Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » How to get rid of "Run as...,Debug As" in my context menu
How to get rid of "Run as...,Debug As" in my context menu [message #330527] Thu, 31 July 2008 13:50 Go to next message
Eclipse UserFriend
Originally posted by: rudolf.hornig.omnest.com

We have a graphical editor where we registered a context menu. When we open the
context menu on we have several unwanted menu items like Run as...,Debug As...,
Team etc. How can we get rid of them? We would like to keep the
context menu registered.

It seems that org.eclipse.debug.ui registers these contributions to
"java.lang.Object" is there a way to neutralize that?

Thanks, Rudolf
Re: How to get rid of "Run as...,Debug As" in my context menu [message #330533 is a reply to message #330527] Thu, 31 July 2008 14:43 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Hornig Rudolf wrote:
> We have a graphical editor where we registered a context menu. When we open the
> context menu on we have several unwanted menu items like Run as...,Debug As...,
> Team etc. How can we get rid of them? We would like to keep the
> context menu registered.
>
> It seems that org.eclipse.debug.ui registers these contributions to
> "java.lang.Object" is there a way to neutralize that?

In a product/RCP, you can use product transforms to remove the unwanted
XML http://wiki.eclipse.org/Product_Customization .

The other option is to use org.eclipse.ui.activities. You can bind an
activity to the contributions you don't want, and have the activity
default be false (although that will remove them from all context menus).

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: How to get rid of "Run as...,Debug As" in my context menu [message #330534 is a reply to message #330533] Thu, 31 July 2008 15:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rudolf.hornig.omnest.com

Thanks for the pointers, I have checked them. We want to get rid of these
menus ONLY in our editor window (just not to pollute the context menu),
but still want to register the menu, so some of OUR own other plugins
could be able to contribute to it.

Is there a way to register a menu privately for example?
i.e. contributions going to "org.eclipse.ui.popup.any" would not be added
to this menu, only those that specify the menu/part id explicitly...

Thanks

> Hornig Rudolf wrote:
>> We have a graphical editor where we registered a context menu. When we
>> open the context menu on we have several unwanted menu items like Run
>> as...,Debug As...,
>> Team etc. How can we get rid of them? We would like to keep the
>> context menu registered.
>>
>> It seems that org.eclipse.debug.ui registers these contributions to
>> "java.lang.Object" is there a way to neutralize that?
>
> In a product/RCP, you can use product transforms to remove the unwanted
> XML http://wiki.eclipse.org/Product_Customization .
>
> The other option is to use org.eclipse.ui.activities. You can bind an
> activity to the contributions you don't want, and have the activity
> default be false (although that will remove them from all context
> menus).
>
> PW
Re: How to get rid of "Run as...,Debug As" in my context menu [message #330536 is a reply to message #330534] Thu, 31 July 2008 16:33 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Hornig Rudolf wrote:
> Thanks for the pointers, I have checked them. We want to get rid of these
> menus ONLY in our editor window (just not to pollute the context menu),
> but still want to register the menu, so some of OUR own other plugins
> could be able to contribute to it.
>
> Is there a way to register a menu privately for example?
> i.e. contributions going to "org.eclipse.ui.popup.any" would not be added
> to this menu, only those that specify the menu/part id explicitly...

There used to be ... in the old world, if you didn't add an "additions"
group marker to your registered context menu there was no way of adding
to it (except programmatically). But even that was "accept contribution
v.s. no contributions"

The new system doesn't even have that restriction, since it auto-creates
an additions group if necessary.

I can't think of a workaround. Do the menus still appear after the
org.eclipse.ui.debug plugin has been activated? They usually only
appear if some facet of the editor/selection is launchable.

Perhaps we need an enhancement request to allow a context menu to
"opt-out" of popup:org.eclipse.ui.popup.any

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: How to get rid of "Run as...,Debug As" in my context menu [message #330706 is a reply to message #330536] Mon, 11 August 2008 09:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rudolf.hornig.omnest.com

On Thu, 31 Jul 2008 12:33:14 -0400, Paul Webster wrote:

> Hornig Rudolf wrote:
>> Thanks for the pointers, I have checked them. We want to get rid of
>> these menus ONLY in our editor window (just not to pollute the context
>> menu), but still want to register the menu, so some of OUR own other
>> plugins could be able to contribute to it.
>>
>> Is there a way to register a menu privately for example? i.e.
>> contributions going to "org.eclipse.ui.popup.any" would not be added to
>> this menu, only those that specify the menu/part id explicitly...
>
> There used to be ... in the old world, if you didn't add an "additions"
> group marker to your registered context menu there was no way of adding
> to it (except programmatically). But even that was "accept contribution
> v.s. no contributions"
>
> The new system doesn't even have that restriction, since it auto-creates
> an additions group if necessary.
>
> I can't think of a workaround. Do the menus still appear after the
> org.eclipse.ui.debug plugin has been activated? They usually only
> appear if some facet of the editor/selection is launchable.
It seems that the Debug As menu (and some other) are registered to show
if an Object is selected (ie. practically anything can be launchable)
I would expect to have some marker interface like ILaunchable/IDebuggable
and these menus should be visible only if an object is selected and Adopts
/ Implements these marker interfaces. But unfortunately it is not
implemented this way...
>
> Perhaps we need an enhancement request to allow a context menu to
> "opt-out" of popup:org.eclipse.ui.popup.any

Would love to see this enhancement to...

Thanks, Rudolf
Re: How to get rid of "Run as...,Debug As" in my context menu [message #330768 is a reply to message #330527] Tue, 12 August 2008 17:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: felix.mayer.erdas.com

Did you try to override method
org.eclipse.jface.action.ContributionManager.allowItem(ICont ributionItem)?

"Hornig Rudolf" <rudolf.hornig@omnest.com> wrote in message
news:g6sfve$c2m$1@build.eclipse.org...
> We have a graphical editor where we registered a context menu. When we
> open the
> context menu on we have several unwanted menu items like Run as...,Debug
> As...,
> Team etc. How can we get rid of them? We would like to keep the
> context menu registered.
>
> It seems that org.eclipse.debug.ui registers these contributions to
> "java.lang.Object" is there a way to neutralize that?
>
> Thanks, Rudolf
Re: How to get rid of "Run as...,Debug As" in my context menu [message #330849 is a reply to message #330706] Thu, 14 August 2008 16:39 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Hornig Rudolf wrote:
> It seems that the Debug As menu (and some other) are registered to show
> if an Object is selected (ie. practically anything can be launchable)
> I would expect to have some marker interface like ILaunchable/IDebuggable
> and these menus should be visible only if an object is selected and Adopts
> / Implements these marker interfaces. But unfortunately it is not
> implemented this way...

It should be ... these menus should show up on any object that adapts
(via adapter factory) to org.eclipse.debug.ui.actions.ILaunchable. That
would include many java elements and IResource elements.

Later,
PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: How to get rid of &quot;Run as...,Debug As&quot; in my context menu [message #331569 is a reply to message #330849] Thu, 11 September 2008 19:11 Go to previous message
Eclipse UserFriend
Originally posted by: ralffrotscher.web.de

I override the addListener-method in the ContextMenuProvider in the following way:

public void addMenuListener(IMenuListener listener) {
if (listener instanceof PopupMenuExtender) {
return;
}
super.addMenuListener(listener);
}

The PopupMenuExtender would add these contributions to the context menu. It would be better to avoid this by deactivating the PopupMenuExtender but for the moment the solution above works.

Ralf
Previous Topic:Obtaining *all* referenced projects (including plugins and external folders)
Next Topic:how to check in derived resources?
Goto Forum:
  


Current Time: Fri Oct 18 13:25:25 GMT 2024

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

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

Back to the top