rich client 2.0

Getting rid of “Convert Line Delimiters to”


20. March 2006
Tom Seidel @ 09:42

If you're having dependencies to org.eclipse.ui.ide and you launch your RCP you'll automatically get an entry in the menu-bar that is called "Convert Line Delimiters to" and also "Last Edit Location", although you don't need it. To remove this entries place the following lines in your ApplicationActionBarAdvisor

JAVA:
  1. ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry();
  2. IActionSetDescriptor[] actionSets = reg.getActionSets();
  3. // removing annoying gotoLastPosition Message.
  4. String actionSetId = "org.eclipse.ui.edit.text.actionSet.navigation"; //$NON-NLS-1$
  5. for (int i = 0; i <actionSets.length; i++)
  6. {
  7.     if (!actionSets[i].getId().equals(actionSetId))
  8.         continue;
  9.         IExtension ext = actionSets[i].getConfigurationElement()
  10.             .getDeclaringExtension();
  11.         reg.removeExtension(ext, new Object[] { actionSets[i] });
  12. }
  13. // Removing convert line delimiters menu.
  14. actionSetId = "org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo"; //$NON-NLS-1$
  15. for (int i = 0; i <actionSets.length; i++)
  16. {
  17.     if (!actionSets[i].getId().equals(actionSetId))
  18.         continue;
  19.     IExtension ext = actionSets[i].getConfigurationElement()
  20.             .getDeclaringExtension();
  21.    reg.removeExtension(ext, new Object[] { actionSets[i] });
  22. }

16 Comments »

  1. thanks Tom Seidel

    we tried it and , its working fine..great job

    thanks again

    Comment by biju — 29. September 2006 @ 09:09

  2. Hi,

    thanks for this one - worked great. I enhanced it to get rid of “open file” as well and changed it so that walked only once through the loop. Takes about 15 millisec for three ids - so I think its quite fast :)

    And it seems to work in Eclipse 3.2 as well.

    Cheers,
    Christoph

    Comment by Christoph — 29. September 2006 @ 15:38

  3. thanks.
    your tips really help me!
    finally I could remove “org.eclipse.ui.WorkingSetActionSet”

    Comment by aki — 9. April 2007 @ 16:12

  4. This was very helpful thanks.

    I refactored it to avoid the duplication (DRY) as follows:

    private void removeExtraneousActions() {

    ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry();

    // removing gotoLastPosition message
    removeStandardAction(reg, “org.eclipse.ui.edit.text.actionSet.navigation”);

    // Removing “Convert Line Delimiters To” menu
    removeStandardAction(reg, “org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo”);
    }

    private void removeStandardAction(ActionSetRegistry reg, String actionSetId) {

    IActionSetDescriptor[] actionSets = reg.getActionSets();

    for (int i = 0; i

    Comment by Edward Garson — 23. April 2007 @ 15:37

  5. Ah, there is some filtering going on.

    The implementationof “removeStandardAction” is like the original for loop.

    Have fun

    Comment by Edward Garson — 23. April 2007 @ 15:38

  6. Great Job Thanks!!!

    Comment by GC — 9. July 2007 @ 17:18

  7. Thanks a lot.

    Comment by Thanker — 28. December 2007 @ 21:08

  8. Hi, i try to get rid of the”Open File” menu in the menubar which appeared with the “Convert Line Delimiters to”, how can i do this??
    I can’t fing the “actionSetId”

    Comment by cansen — 5. March 2008 @ 08:49

  9. cool site man

    Comment by ben — 6. March 2008 @ 20:44

  10. The actionsetid can be found in the plugin “org.eclipse.ui.ide” as extension at the “org.eclipse.ui.actionSets” extensionpoint. Its id is “org.eclipse.ui.actionSet.openFiles”

    Greets, Mike

    Comment by mike — 11. June 2008 @ 17:23

  11. Hi!

    I want to make better my SQL experience.
    I red that many SQL books and would like to
    read more about SQL for my work as oracle database manager.

    What can you recommend?

    Thanks,
    Werutz

    Comment by werutzb — 8. October 2008 @ 03:40

  12. Improved to make single pass through actions and process list of unwanted actions:
    In ApplicationActionBarAdvisor.makeActions add

    ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry();
    IActionSetDescriptor[] actionSets = reg.getActionSets();
    ArrayList unwantedIDs = new ArrayList();
    unwantedIDs.add(”org.eclipse.ui.edit.text.actionSet.navigation”);
    unwantedIDs.add(”org.eclipse.ui.edit.text.actionSet.convertLineDelimitersTo”);
    unwantedIDs.add(”org.eclipse.ui.actionSet.openFiles”);

    removeUnwantedAction(reg, actionSets, unwantedIDs);

    @SuppressWarnings(”restriction”)
    private void removeUnwantedAction(ActionSetRegistry reg, IActionSetDescriptor[] actionSets, List unwantedIDs)
    {
    for (int i = 0; i

    Comment by bgilbert — 13. July 2009 @ 17:31

  13. For some reason my post did not get the method:

    private void removeUnwantedAction(ActionSetRegistry reg, IActionSetDescriptor[] actionSets, List unwantedIDs)
    {
    for (int i = 0; i

    Comment by bgilbert — 13. July 2009 @ 17:31

  14. Darn, the post needs to HTML encode the less than char.

    private void removeUnwantedAction(ActionSetRegistry reg, IActionSetDescriptor[] actionSets, List unwantedIDs)
    {
    for (int i = 0; i < actionSets.length; i++)
    {
    String actionID = actionSets[i].getId();
    if (unwantedIDs.contains(actionID))
    {
    //System.out.println(”ApplicationActionBarAdvisor removeUnwantedAction removing: ” + actionID);
    IExtension ext = actionSets[i].getConfigurationElement().getDeclaringExtension();
    reg.removeExtension(ext, new Object[] {actionSets[i]});
    }
    }
    }

    Comment by bgilbert — 13. July 2009 @ 17:33

  15. You only need to add this to plugin.xml :

    Comment by Pablo — 6. November 2009 @ 14:25

  16. Finally :)

    [extension
    point=”org.eclipse.ui.activities”\]
    [activity
    description=”Disable plug-in contributions”
    id=”myRcp.app.ID.disableEclipseIDEContribs”
    name=”DisableIDEContribs”\]
    [/activity]
    [activityPatternBinding
    activityId=”myRcp.app.ID.disableEclipseIDEContribs”
    pattern=”org\.eclipse\.ui\.editors/org\.eclipse\.ui\.edit\.text\.delimiter.*”]
    [/activityPatternBinding]

    [/extension]

    Comment by Pablo — 6. November 2009 @ 14:33

RSS feed for comments on this post. TrackBack URI

Leave a comment

Powered by WordPress