Context Menu Customization

Post here questions and problems related to editing and publishing DITA content.
nagang
Posts: 37
Joined: Mon Jul 14, 2014 9:48 am

Context Menu Customization

Post by nagang »

Hi Team,

We are trying to customize some context menu items in oxygen 20.1 version.

Example: Inspect, Options, Insert -> Insert Entity

We tried creating an external jar plug in but couldn't edit the context menu.

We also checked plugin.xml file from oxygen 20.1 package. But we could not edit the context menu.

Could you please suggest a way to customize the context menu items.

Thanks in advance!

Regards,
SaiTeja
Radu
Posts: 9051
Joined: Fri Jul 09, 2004 5:18 pm

Re: Context Menu Customization

Post by Radu »

Hi,

I'm pasting below the same answer I gave to the email you sent to the forum admin email address:
I need more details in order to help. Can you maybe attach the plugin you worked on? Or at least tell me about what API you tried to use in order to control the contextual menu.
Does your plugin use a Workspace Access plugin extension?
There is a "addMenusAndToolbarsContributorCustomizer" API which allows you to customize the popup menu both for the Text and Author editing modes:

https://github.com/oxygenxml/sample-plu ... nsion.java

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
nagang
Posts: 37
Joined: Mon Jul 14, 2014 9:48 am

Re: Context Menu Customization

Post by nagang »

Hi,

We are doing our customization using maven and creating plugin using maven install.

After creating the maven project we edited the oxygen-sample-eclipse-plugin.

We are using the following APIs in our code

Code: Select all

AuthorPopupMenuCustomizer popUpCustomizer = new AuthorPopupMenuCustomizer()
WSEditorPage currentPage = editorAccess.getCurrentPage();
PluginWorkspace pluginWorkspace = PluginWorkspaceProvider.getPluginWorkspace();
URL[] allEditorLocations = pluginWorkspace.getAllEditorLocations(PluginWorkspace.MAIN_EDITING_AREA);
WSEditor editorAccess = pluginWorkspace.getEditorAccess(allEditorLocations[i], PluginWorkspace.MAIN_EDITING_AREA);
With using the above APIs we are able to create the plugin.

But now the changes are not reflecting.

Please help. Thanks in advance.

Regards,
SaiTeja
Radu
Posts: 9051
Joined: Fri Jul 09, 2004 5:18 pm

Re: Context Menu Customization

Post by Radu »

Dear SaiTeja,

I need some actual code samples to reflect what you are doing on your side.
What are you doing with the popup menu customizer? Do you add it to the Author page using this API ro.sync.exml.workspace.api.editor.page.author.WSAuthorEditorPageBase.addPopUpMenuCustomizer(AuthorPopupMenuCustomizer)?

Maybe it would be easier for you to use this API:

Code: Select all

ro.sync.exml.workspace.api.standalone.StandalonePluginWorkspace.addMenusAndToolbarsContributorCustomizer(MenusAndToolbarsContributorCustomizer)
Something like:

Code: Select all

      public void applicationStarted(StandalonePluginWorkspace pluginWorkspaceAccess) {
        pluginWorkspaceAccess.addMenusAndToolbarsContributorCustomizer(new MenusAndToolbarsContributorCustomizer() {
          @Override
          public void customizeAuthorPageExtensionMenu(JMenu extensionMenu,
              AuthorAccess authorAccess) {
           //
          }
          /**
           * @see ro.sync.exml.workspace.api.standalone.actions.MenusAndToolbarsContributorCustomizer#customizeAuthorPopUpMenu(javax.swing.JPopupMenu, ro.sync.ecss.extensions.api.AuthorAccess)
           */
          @Override
          public void customizeAuthorPopUpMenu(JPopupMenu popUp, AuthorAccess authorAccess) {
           //TODO customize the Author popup menu here
          }
          /**
           * @see ro.sync.exml.workspace.api.standalone.actions.MenusAndToolbarsContributorCustomizer#customizeAuthorBreadcrumbPopUpMenu(javax.swing.JPopupMenu, ro.sync.ecss.extensions.api.AuthorAccess, ro.sync.ecss.extensions.api.node.AuthorNode)
           */
          @Override
          public void customizeAuthorBreadcrumbPopUpMenu(JPopupMenu popUp,
              AuthorAccess authorAccess, AuthorNode currentNode) {
           //
          }
          /**
           * @see ro.sync.exml.workspace.api.standalone.actions.MenusAndToolbarsContributorCustomizer#customizeAuthorOutlinePopUpMenu(javax.swing.JPopupMenu, ro.sync.ecss.extensions.api.AuthorAccess)
           */
          @Override
          public void customizeAuthorOutlinePopUpMenu(JPopupMenu popUp, AuthorAccess authorAccess) {
           //
          }
          @Override
          public void customizeAuthorPageExtensionToolbar(ToolbarInfo toolbarInfo,
              AuthorAccess authorAccess) {
            //
             }
        });
      }
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply