Modify dialog warning message
Post here questions and problems related to oXygen frameworks/document types.
Modify dialog warning message
Hello,
I'm modifying the filteredElements to delete a task child element when trying to insert into a task topic context (as well for a reference and a concept) as follow:
It is working fine, it doesn't allow me to introduce an invalid child for the topic in the Author mode and I'm getting the following message when attempt to do it:
I need to edit that dialog to send a custom message, how can I do it?
I'm modifying the filteredElements to delete a task child element when trying to insert into a task topic context (as well for a reference and a concept) as follow:
Code: Select all
public List<CIElement> filterElements(final List<CIElement> elements,
final WhatElementsCanGoHereContext context) {
List<CIElement> filteredElements = super.filterElements(elements, context);
if ((context != null) && (filteredElements != null)) {
Stack<ContextElement> elementStack = context.getElementStack();
if(elementStack != null) {
ContextElement contextElement = context.getElementStack().peek();
String contextName = contextElement.getQName();
//compare with the topic element
if(TOPIC_ELEMENTS.contains(contextName)) {
for(Iterator<CIElement> iterator = filteredElements.iterator(); iterator.hasNext();) {
CIElement element = iterator.next();
//remove invalid element
if(contextName.equals(element.getQName()))
{
filteredElements.remove(element);
break;
}
}
}
}
}
return filteredElements;
}
I need to edit that dialog to send a custom message, how can I do it?
Re: Modify dialog warning message
Hi,
We do not have API to allow the interception of any error message issued by the application.
How exactly do you attempt to insert the task node when the dialog pops up? Copy paste?
Regards,
Radu
We do not have API to allow the interception of any error message issued by the application.
How exactly do you attempt to insert the task node when the dialog pops up? Copy paste?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Re: Modify dialog warning message
Hi,
I would like to know how the end user tries to insert that task. They cannot use the content completion window because you've already removed that choice for them. So are they using a toolbar action? If so, maybe you can remove that particular toolbar button.
Regards,
Radu
I would like to know how the end user tries to insert that task. They cannot use the content completion window because you've already removed that choice for them. So are they using a toolbar action? If so, maybe you can remove that particular toolbar button.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Re: Modify dialog warning message
Hi,
They will try to insert a task as follows:
1. In a task topic context:
2. They will type or search for the task element:
If they try to insert the task, the error dialog message will be prompt.
If its not possible to change the message of the UI, is it a way to show a ISO Schematron message when the error is catch?
They will try to insert a task as follows:
1. In a task topic context:
2. They will type or search for the task element:
If they try to insert the task, the error dialog message will be prompt.
If its not possible to change the message of the UI, is it a way to show a ISO Schematron message when the error is catch?
Re: Modify dialog warning message
Hi,
Thanks for the extra details.
Here are two possibilities to work around this:
1) In the Oxygen Preferences->"Editor / Edit Modes / Author / Schema-Aware" page there is a checkbox called "Show all possible elements in the content completion window". Unchecking it should no longer display the "task" element in the content completion list.
There are some possibilities to share application settings with others:
https://www.oxygenxml.com/doc/versions/ ... sibilities
2) Using Java API: f you edit your custom document type configuration in the Oxygen Preferences->"Document Type Associations" page, in the Extensions tab one of those extensions is a "Author Extension state listener":
https://www.oxygenxml.com/doc/versions/ ... tener.html
You can implement the interface something like:
That "insertFragment" callback should arrive in your code before Oxygen does the default behavior. The AuthorDocumentFragment has enough information inside it to know what will be inserted so sometimes you may reject the insertion (no longer calling the super implementation) and instead show your own dialog.
About this remark you had:
But in general having Schematron rules (and quick fixes) for various project related checks are a very good idea. Some blog post links to show you what can be done and how you can share the rules in your framework configuration:
http://blog.oxygenxml.com/2015/05/schem ... nical.html
http://blog.oxygenxml.com/2017/02/shari ... rules.html
Regards,
Radu
Thanks for the extra details.
Here are two possibilities to work around this:
1) In the Oxygen Preferences->"Editor / Edit Modes / Author / Schema-Aware" page there is a checkbox called "Show all possible elements in the content completion window". Unchecking it should no longer display the "task" element in the content completion list.
There are some possibilities to share application settings with others:
https://www.oxygenxml.com/doc/versions/ ... sibilities
2) Using Java API: f you edit your custom document type configuration in the Oxygen Preferences->"Document Type Associations" page, in the Extensions tab one of those extensions is a "Author Extension state listener":
https://www.oxygenxml.com/doc/versions/ ... tener.html
You can implement the interface something like:
Code: Select all
/**
* @see ro.sync.ecss.extensions.api.AuthorExtensionStateListener#activated(ro.sync.ecss.extensions.api.AuthorAccess)
*/
@Override
public void activated(final AuthorAccess authorAccess) {
authorAccess.getDocumentController().setDocumentFilter(new AuthorDocumentFilter() {
/**
* @see ro.sync.ecss.extensions.api.AuthorDocumentFilter#insertFragment(ro.sync.ecss.extensions.api.AuthorDocumentFilterBypass, int, ro.sync.ecss.extensions.api.node.AuthorDocumentFragment)
*/
@Override
public void insertFragment(AuthorDocumentFilterBypass filterBypass, int offset,
AuthorDocumentFragment frag) {
//Here you can look at the nodes inside the fragment and you have a chance to show your dialog and avoid calling the super implementation.
super.insertFragment(filterBypass, offset, frag);
}
});
}
About this remark you had:
Indeed you can also create a Schematron schema which will present a validation error when tasks are embedded inside each other. But all validation errors are signaled after the content has been changed and they are not shown in a modal dialog, they are shown as red highlights in the editor area.If its not possible to change the message of the UI, is it a way to show a ISO Schematron message when the error is catch?
But in general having Schematron rules (and quick fixes) for various project related checks are a very good idea. Some blog post links to show you what can be done and how you can share the rules in your framework configuration:
http://blog.oxygenxml.com/2015/05/schem ... nical.html
http://blog.oxygenxml.com/2017/02/shari ... rules.html
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service