Re: [oXygen-sdk] Problem with the "insert.cross.reference" action in Oxygen Author 15.2

Thanks Alex, I think we are good with the format attribute. With respect to my second part of the mail, is there any way to add defaulted "scope" and "type" attribute values to the xref when they are dragged-and-dropped from the project/ditamaps manager pane? Can this be done using the Author SDK? Regards, Nathan

Hello Nathan, What you can do using the SDK is to intercept ALL the insertion events by using an AuthorDocumentFilter [1]. Whenever a node (insertNode()) or a fragment (insertFragment()) is inserted you can check and see if it's an "xref" and add values for the "scope" and "type" attributes. Again, you wont know if the "xref" was inserted using DnD or another action in Oxygen (if that's relevant for you). Just to be sure I understood the scenario: when these attributes are missing you want to explicitly specify these attributes with their default as the value? In which scenario is this needed? perhaps this scenarios is something that we too should take into account... [1] http://www.oxygenxml.com/doc/ug-editor/#topics/api_faq_use_typograhic_quotat... Best regards, Alex -- Alex Jitianu <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com On 01-May-14 5:56 PM, Nathan wrote:
Thanks Alex, I think we are good with the format attribute. With respect to my second part of the mail, is there any way to add defaulted "scope" and "type" attribute values to the xref when they are dragged-and-dropped from the project/ditamaps manager pane? Can this be done using the Author SDK?
Regards, Nathan
_______________________________________________ oXygen-sdk mailing list oXygen-sdk@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-sdk

Thanks a bunch Alex. With regards to the scenario, in our case, our writers are used to see these attributes pre-populated since it is valid for 90% of all our content. Only for the smaller percentage of the content do our writers actually go ahead and change these values, which saves them quite a few clicks. With regards to your suggestion of using the "AuthorDocumentFilter" as shown in " http://www.oxygenxml.com/doc/ug-editor/#topics/api_faq_use_typograhic_quotat...", do let me know if the following steps are what I should undertake based on the fact that I am using the DITA extension: 1) Create a class which extends the dita extension bundle. 2) Create a new document filter to filter out xrefs and set the attributes. 3) Set the document filter created in (2) within the class created in (1). Do let me know if there is any alternative to the above steps. Thanks, Nathan On Thu, May 1, 2014 at 7:56 AM, Nathan <vrveerar@gmail.com> wrote:
Thanks Alex, I think we are good with the format attribute. With respect to my second part of the mail, is there any way to add defaulted "scope" and "type" attribute values to the xref when they are dragged-and-dropped from the project/ditamaps manager pane? Can this be done using the Author SDK?
Regards, Nathan

Hi Nathan, I'm sorry I didn't give more details. I kind of expected our documentation to also mention more on how to install the filter, but at a closer look I see that it doesn't... I'll add an issue to add more details. There are two places where you can add the filter: 1. AuthorExtensionStateListener.activated(), if you are working with framework level API. Like you've said, you can create a class which extends the DITAExtensionBundle and override createAuthorExtensionStateListener(). I recommend also delegating to the super listener (the default bundle needs this listener too), like so: public class CustomDITAExtensionBundle extends DITAExtensionsBundle { /** * @see ro.sync.ecss.extensions.dita.DITAExtensionsBundle#createAuthorExtensionStateListener() */ @Override public AuthorExtensionStateListener createAuthorExtensionStateListener() { final AuthorExtensionStateListener superListener = super.createAuthorExtensionStateListener(); return new AuthorExtensionStateListenerDelegator() { @Override public String getDescription() { return ""; } @Override public void deactivated(AuthorAccess authorAccess) { superListener.deactivated(authorAccess); } @Override public void activated(AuthorAccess authorAccess) { // TODO INSTALL FILTER authorAccess.getDocumentController().setDocumentFilter(authorDocumentFilter); superListener.activated(authorAccess); } }; } } 2. An Workspace Access plugin [2], if you are working with plugin API. Like so: public void applicationStarted(final StandalonePluginWorkspace pluginWorkspaceAccess) { pluginWorkspaceAccess.addEditorChangeListener( new WSEditorChangeListener() { @Override public void editorOpened(URL editorLocation) { WSEditor editorAccess = pluginWorkspaceAccess.getEditorAccess(editorLocation, PluginWorkspace.MAIN_EDITING_AREA); WSEditorPage currentPage = editorAccess.getCurrentPage(); if (currentPage instanceof WSAuthorEditorPage) { WSAuthorEditorPage authorEditorPage = (WSAuthorEditorPage) currentPage; authorEditorPage.getAuthorAccess().getDocumentController().setDocumentFilter(authorDocumentFilter); } // TODO It's also a good idea to listener for page changes on the editor. // Perhaps the editor opens in the text page and the user switches later on to author. editorAccess.addPageChangedListener(new WSEditorPageChangedListener() { @Override public void editorPageChanged() { // TODO Same code here to add the filter. } }); } }, PluginWorkspace.MAIN_EDITING_AREA); [1] http://www.oxygenxml.com/InstData/Editor/SDK/javadoc/ro/sync/ecss/extensions... [2] http://www.oxygenxml.com/doc/ug-editor/#concepts/workspace-access-plugin.htm... Best regards, Alex -- Alex Jitianu <oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger http://www.oxygenxml.com On 06-May-14 8:50 AM, Nathan wrote:
Thanks a bunch Alex. With regards to the scenario, in our case, our writers are used to see these attributes pre-populated since it is valid for 90% of all our content. Only for the smaller percentage of the content do our writers actually go ahead and change these values, which saves them quite a few clicks. With regards to your suggestion of using the "AuthorDocumentFilter" as shown in "http://www.oxygenxml.com/doc/ug-editor/#topics/api_faq_use_typograhic_quotat...", do let me know if the following steps are what I should undertake based on the fact that I am using the DITA extension: 1) Create a class which extends the dita extension bundle. 2) Create a new document filter to filter out xrefs and set the attributes. 3) Set the document filter created in (2) within the class created in (1).
Do let me know if there is any alternative to the above steps.
Thanks, Nathan
On Thu, May 1, 2014 at 7:56 AM, Nathan <vrveerar@gmail.com <mailto:vrveerar@gmail.com>> wrote:
Thanks Alex, I think we are good with the format attribute. With respect to my second part of the mail, is there any way to add defaulted "scope" and "type" attribute values to the xref when they are dragged-and-dropped from the project/ditamaps manager pane? Can this be done using the Author SDK?
Regards, Nathan
_______________________________________________ oXygen-sdk mailing list oXygen-sdk@oxygenxml.com http://www.oxygenxml.com/mailman/listinfo/oxygen-sdk
participants (2)
-
Alex Jitianu
-
Nathan