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

Alex Jitianu alex_jitianu at sync.ro
Tue May 6 04:30:13 CDT 2014


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/api/AuthorExtensionStateListener.html
[2] 
http://www.oxygenxml.com/doc/ug-editor/#concepts/workspace-access-plugin.html

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_quotation_marks.html", 
> 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 at gmail.com 
> <mailto:vrveerar at 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 at oxygenxml.com
> http://www.oxygenxml.com/mailman/listinfo/oxygen-sdk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.oxygenxml.com/pipermail/oxygen-sdk/attachments/20140506/b3a280cd/attachment.html>


More information about the oXygen-sdk mailing list