Remove "Refactoring" entries in context menu

<oXygen/> general issues.
SNO
Posts: 42
Joined: Mon Oct 01, 2012 3:05 pm

Remove "Refactoring" entries in context menu

Post by SNO » Wed Sep 30, 2020 2:38 pm

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
Stefan Nöbauer
Senior Solution Architect
KGU-Consulting GmbH

Radu
Posts: 7428
Joined: Fri Jul 09, 2004 5:18 pm

Re: Remove "Refactoring" entries in context menu

Post by Radu » Wed Sep 30, 2020 2:54 pm

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

SNO
Posts: 42
Joined: Mon Oct 01, 2012 3:05 pm

Re: Remove "Refactoring" entries in context menu

Post by SNO » Wed Sep 30, 2020 5:05 pm

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
Stefan Nöbauer
Senior Solution Architect
KGU-Consulting GmbH

Radu
Posts: 7428
Joined: Fri Jul 09, 2004 5:18 pm

Re: Remove "Refactoring" entries in context menu

Post by Radu » Thu Oct 01, 2020 6:49 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

SNO
Posts: 42
Joined: Mon Oct 01, 2012 3:05 pm

Re: Remove "Refactoring" entries in context menu

Post by SNO » Thu Oct 01, 2020 10:18 am

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
Stefan Nöbauer
Senior Solution Architect
KGU-Consulting GmbH

Radu
Posts: 7428
Joined: Fri Jul 09, 2004 5:18 pm

Re: Remove "Refactoring" entries in context menu

Post by Radu » Thu Oct 01, 2020 10:39 am

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
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Radu
Posts: 7428
Joined: Fri Jul 09, 2004 5:18 pm

Re: Remove "Refactoring" entries in context menu

Post by Radu » Fri Nov 20, 2020 2:25 pm

Hi Stefan,

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

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com

Post Reply