Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » eRCP » Remove Menu from other plugin(Remove Menu, defined by org.eclipse.search in plugin)
Remove Menu from other plugin [message #1388258] Thu, 26 June 2014 07:26 Go to next message
Stefan Weiser is currently offline Stefan WeiserFriend
Messages: 55
Registered: February 2012
Member
Hello,

I have the problem that the plugin org.eclipse.search adds menus to the shell of my rcp-application. How can I remove them in my application?

I need this plugin, as it is required by org.drools.eclipse, which I am using. This plugin has a dependency to org.eclipse.search (over org.eclipse.jdt.ui).

Re: Remove Menu from other plugin [message #1389248 is a reply to message #1388258] Fri, 27 June 2014 14:40 Go to previous messageGo to next message
k90v v is currently offline k90v vFriend
Messages: 3
Registered: June 2014
Junior Member
Hi,

Are you trying to hide search menus from your plugin without having to remove org.eclipse.search?
Re: Remove Menu from other plugin [message #1390954 is a reply to message #1389248] Mon, 30 June 2014 08:19 Go to previous messageGo to next message
Stefan Weiser is currently offline Stefan WeiserFriend
Messages: 55
Registered: February 2012
Member
Yes, I don't want the menu to be shown, but cannot remove org.eclipse.search. How can I do that?
Re: Remove Menu from other plugin [message #1390987 is a reply to message #1390954] Mon, 30 June 2014 09:23 Go to previous messageGo to next message
Stefan Weiser is currently offline Stefan WeiserFriend
Messages: 55
Registered: February 2012
Member
OK, I found a solution:

WorkbenchWindow workbenchWindow = (WorkbenchWindow) iWorkbenchWindowConfigurer.getWindow();
IContributionItem[] items = workbenchWindow.getMenuManager().getItems();
for (IContributionItem iContributionItem : items) {
    if (iContributionItem instanceof IActionSetContributionItem
            && "org.eclipse.search.searchActionSet".equals(((IActionSetContributionItem) iContributionItem)
                    .getActionSetId())) {
                iContributionItem.setVisible(false);
    }
}


This solution works fine but I uses internal API, so I'm not happy about this code snippet. Is there any better way?
Re: Remove Menu from other plugin [message #1391117 is a reply to message #1390987] Mon, 30 June 2014 13:19 Go to previous messageGo to next message
Stefan Weiser is currently offline Stefan WeiserFriend
Messages: 55
Registered: February 2012
Member
OK, I think I found an adequate solution:

IWorkbenchWindow workbenchWindow = iWorkbenchWindowConfigurer.getWindow();
workbenchWindow.getActivePage().hideActionSet("org.eclipse.search.searchActionSet");


As this code snippet does not use any internal API, it seems to be a correct solution.
Re: Remove Menu from other plugin [message #1392374 is a reply to message #1391117] Wed, 02 July 2014 08:32 Go to previous message
k90v v is currently offline k90v vFriend
Messages: 3
Registered: June 2014
Junior Member
Hi,

You can add an extension point "org.eclipse.ui.activities" to your rcp's plugin.xml with a list of "hidden activities" like :

< extension point="org.eclipse.ui.activities">
< activity id="appPackage.rcp.activity" name="Hidden activities"/>

    <activityPatternBinding activityId="appPackage.rcp.activity" pattern=".*/org.eclipse.search.TextSearchWorkingSet"/>
    <activityPatternBinding activityId="appPackage.rcp.activity" pattern=".*/org.eclipse.search.TextSearchWorkspace"/>
    <activityPatternBinding activityId="appPackage.rcp.activity" pattern=".*/org.eclipse.search.TextSearchProject"/>
    <activityPatternBinding activityId="appPackage.rcp.activity" pattern=".*/org.eclipse.search.TextSearchWorkingSet"/>
    <activityPatternBinding activityId="appPackage.rcp.activity" pattern=".*/org.eclipse.search.OpenFileSearchPage"/>
    <activityPatternBinding activityId="appPackage.rcp.activity" pattern=".*/org.eclipse.search.TextSearchFile"/>
    <activityPatternBinding activityId="appPackage.rcp.activity" pattern=".*/org.eclipse.search.internal.ui.text.TextSearchPage*"/>

< / extension>


Hope this will help you.
Previous Topic:Override preferences
Next Topic:Programmatic added Commands and Handler throw Exception
Goto Forum:
  


Current Time: Tue Mar 19 04:56:08 GMT 2024

Powered by FUDForum. Page generated in 0.02131 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top