Specifying application for open image

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
Posts: 69

Specifying application for open image

Wed Aug 23, 2017 12:21 am

In a docbook document, if I have an imagedata element with a fileref attribute that points to an image file, I can double click or use the context menu->Open image to launch the image in an external image editor that is the default editor for the file extension. Is it possible to configure Oxygen to launch different editors based on criteria such as an attribute? For example, if the imagedata also has a role attribute set to "editor1" it would launch draw but if the role is set to "editor2" it would use a snagit.
Posts: 5927

Re: Specifying application for open image

Wed Aug 23, 2017 8:30 am

Hi Steve,

We have API which allows you to add a mouse listener on the Author visual editing page, something like:

Code: Select all

    PluginWorkspaceProvider.getPluginWorkspace().addEditorChangeListener(new WSEditorChangeListener(){
       * @see ro.sync.exml.workspace.api.listeners.WSEditorChangeListener#editorOpened(java.net.URL)
      public void editorOpened(URL editorLocation) {
        WSEditor editor = PluginWorkspaceProvider.getPluginWorkspace().getEditorAccess(editorLocation, PluginWorkspace.MAIN_EDITING_AREA);
        WSEditorPage currentPage = editor.getCurrentPage();
        if(currentPage instanceof WSAuthorEditorPage){
          final WSAuthorEditorPage authorPage = (WSAuthorEditorPage)currentPage;
          authorPage.addAuthorMouseListener(new AuthorMouseAdapter(){
             * @see ro.sync.ecss.extensions.api.AuthorMouseAdapter#mouseClicked(ro.sync.ecss.extensions.api.AuthorMouseEvent)
            public void mouseClicked(AuthorMouseEvent e) {
              if(e.clickCount == 2 && ! e.isPopupTrigger()){
                //Double click...
                AuthorViewToModelInfo vtm = authorPage.viewToModel(e.X, e.Y);
                  System.err.println("CUSTOM OPEN " + ((AuthorElement)vtm.getAuthorNode()).getAttribute("href"));
//                  Runtime.getRuntime().exec(".....");
                  //Consume event...
    }, PluginWorkspace.MAIN_EDITING_AREA);

The same API could be used from a Javascript-based Workspace Access Plugin Extension.
We also have API WSAuthorEditorPage.addPopUpMenuCustomizer(AuthorPopupMenuCustomizer) to customize the contextual menu in the Author visual editing mode.

Radu Coravu
<oXygen/> XML Editor

Return to “Common Problems”

Who is online

Users browsing this forum: No registered users and 1 guest