Page 1 of 1

submenu under the [b]Contextual Menu of the DITA Maps Manager[/b]

Posted: Fri Nov 11, 2022 6:25 pm
by vishwavaranasi
Hello Team , we wanted to have our own submenu under the Contextual Menu of the DITA Maps Manager
image.png
image.png (20.97 KiB) Viewed 1216 times
We have tried editing the as below

but it is not adding to the Contextual Menu of the DITA Maps Manager
image.png
image.png (63.21 KiB) Viewed 1216 times

Re: submenu under the [b]Contextual Menu of the DITA Maps Manager[/b]

Posted: Sat Nov 12, 2022 12:18 am
by Radu
Hi,

When you edit a framework configuration in the Preferences->"Document Type Associations" page and edit actions in the "Author" tab you only influence XML documents opened in the main editor in the Author visual editing mode. So you influence a DITA Map only if opened in a DITA Map.
For DITA Maps opened in the DITA Maps Manager you cannot use the framework configuration to customize the popup menu.
You do have API to customize the popup menu in the DITA Maps Manager view but only from a Workspace Access Oxygen Java plugin:
https://github.com/oxygenxml/sample-plu ... ace-access

Something like:

Code: Select all

    @Override
    public void applicationStarted(StandalonePluginWorkspace pluginWorkspaceAccess) {
      pluginWorkspaceAccess.addEditorChangeListener(new WSEditorChangeListener() {
        @Override
        public void editorOpened(URL editorLocation) {
          WSDITAMapEditorPage ditaMapEditorPage = (WSDITAMapEditorPage) pluginWorkspaceAccess.getEditorAccess(editorLocation, PluginWorkspace.DITA_MAPS_EDITING_AREA);
          ditaMapEditorPage.setPopUpMenuCustomizer(new DITAMapPopupMenuCustomizer() {
            
            @Override
            public void customizePopUpMenu(Object popUp, AuthorDocumentController ditaMapDocumentController) {
              JPopupMenu menu = (JPopupMenu) popUp;
              AuthorNode[] selectedNodes = ditaMapEditorPage.getSelectedNodes(true);
              ditaMapDocumentController.insertXMLFragment("", selectedNodes[0].getStartOffset());
            }
          });
        };
      }, PluginWorkspace.DITA_MAPS_EDITING_AREA);
    }
Regards,
Radu

Re: submenu under the [b]Contextual Menu of the DITA Maps Manager[/b]

Posted: Thu Nov 24, 2022 5:37 am
by KevinGarcia99
Hi Radu, when I tried what you suggest I'm getting the following error when I open Oxygen:
image.png
image.png (22.72 KiB) Viewed 927 times
Am I importing the wrong editor or something like that?