Page 1 of 1

Remove "Refactoring" entries in context menu

Posted: Wed Sep 30, 2020 2:38 pm
by SNO
Hallo,

We are using Oxygen 22.1 Eclipse-version in an CMS Context and have troubles with some ootb DITA functions within the "Refactoring" context menu.

Is there a way to disable some entries of the refactoring menu?

Best
Stefan

Re: Remove "Refactoring" entries in context menu

Posted: Wed Sep 30, 2020 2:54 pm
by Radu
Hi Stefan,

In the Oxygen plugin's plugin.xml there is an extension point defined like:

Code: Select all

  <!--The usage in the other plugin.xml is something like:
     <extension point="com.oxygenxml.editor.actionBarContributorCustomizer">
      <implementation class="my.package.CustomActionBarContributorCustomizer"/>;
     </extension>
   
      where CustomActionBarContributorCustomizer extends "com.oxygenxml.editor.editors.ActionBarContributorCustomizer" 
  -->
  <extension-point id="actionBarContributorCustomizer" name="Action Bar Contributor Customizer"
    schema="exsd-schema/actionBarContributorCustomizer.exsd"/>
You can implement it from your own Eclipse plugin and the implemented base class will allow you to override various methods like:

http://archives.oxygenxml.com/Oxygen/Ed ... horAccess-

Regards,
Radu

Re: Remove "Refactoring" entries in context menu

Posted: Wed Sep 30, 2020 5:05 pm
by SNO
Hi Radu,

I implemented a filter to remove some entries in the "Refactoring" menu but as I see in the debugger the ActionContributions have localized IDs
Is there a way to identify specific actions safely?

Regards,
Stefan

Re: Remove "Refactoring" entries in context menu

Posted: Thu Oct 01, 2020 6:49 am
by Radu
Hi Stefan,

Usually calling this API "authorAccess.getEditorAccess().getActionsProvider().getActionID(action)" should give you an ID for the action, ID which does not depend on the language.
From what I tested it might not work well for all actions in the "Refactoring" contextual menu. Does it work for the actions you want to remove? If not, what are those particular actions?
I added an internal issue on our side to look into all actions in the menu and see if each has an ID set on it.

Regards,
Radu

Re: Remove "Refactoring" entries in context menu

Posted: Thu Oct 01, 2020 10:18 am
by SNO
Good Morning Radu,

calling this

Code: Select all

 IContributionItem[] items = ((IMenuManager) contribItem).getItems();
            AuthorActionsProvider actionsProvider = authorAccess.getEditorAccess().getActionsProvider();
            Stream.of(items).filter(ActionContributionItem.class::isInstance).map(ActionContributionItem.class::cast)
                    .map(ActionContributionItem::getAction).map(actionsProvider::getActionID)
                    .forEach(System.out::println);
leads to the same result:

Author/Toggle_comment
Author/Move_up
Author/Move_down
Author/Split_element
Author/Rename_element
Author/Delete_tags
XML_Document/CALS-Tabellen in einfache Tabellen umwandeln
XML_Document/Dateinamen als Topic-ID verwenden
XML_Document/Konvertiere Inhaltsreferenzen zu Inhaltsschlüsselreferenzen
XML_Document/Konvertiere einfache Tabellen in CALS Tabellen
XML_Document/Konvertiere zu Concept
XML_Document/Konvertiere zu General-Task
XML_Document/Konvertiere zu Reference
XML_Document/Konvertiere zu Task
XML_Document/Konvertiere zu Topic
XML_Document/Konvertiere zu Troubleshooting

the XML_Document menues are the one I need to remove.

Regards
Stefan

Re: Remove "Refactoring" entries in context menu

Posted: Thu Oct 01, 2020 10:39 am
by Radu
Hi Stefan,

Right, I will make changes on our side, hopefully for Oxygen 23 (November this year) to assign some meaningful IDs to the actions which right now display their translated name. The actions are based on refactoring operations and each operation has an ID, so this should work.
Maybe in the meantime you can remove all actions whose IDs start with "XML_Document/". In a way I do not quite like that category either, for Oxygen 23 I would change it to "XML_Refactoring/", so something like "XML_Refactoring/changeTopicID2FileName".
By the way, these refactoring actions come from the DITA framework configuration, from the folder "OXYGEN_PLUGIN_DIR/frameworks/dita/refactoring". An extension of the DITA framework can change the "Classpath" list so that the "refactoring" folder is no longer added there, causing Oxygen to no longer load the refactoring actions when right clicking inside DITA topics.

Regards,
Radu

Re: Remove "Refactoring" entries in context menu

Posted: Fri Nov 20, 2020 2:25 pm
by Radu
Hi Stefan,

We released Oxygen 23 yesterday and it should have IDs for all refactoring actions in the contextual menu.

Regards,
Radu