Hiding/Preventing editor popup menu items [message #289117] |
Fri, 29 July 2005 11:12  |
Eclipse User |
|
|
|
Originally posted by: sunil_kamath.nohotspammail.com
I have implemented a couple of editors by extending the eclipse TextEditor.
My problem is that since Eclipse 3.1, the editor popup menu (right-click
within editor part) shows a couple of new menu items: "Run as..." and "Debug
as...".
However, these items are not really appropriate for my editor since there is
nothing to run or debug.
Investigating further reveals that these are object contributions from the
debug UI plugin and have been registered for the Object class (how
helpful!)- i.e., there's no escaping them.
Is there any way to prevent these popup menu items from being displayed?
Would IContributorResourceAdapter be of any use?
---
TIA,
Sunil
|
|
|
Re: Hiding/Preventing editor popup menu items [message #289243 is a reply to message #289117] |
Tue, 02 August 2005 14:32   |
Eclipse User |
|
|
|
Originally posted by: douglas.pollock.magma.ca
Sunil Kamath wrote:
> I have implemented a couple of editors by extending the eclipse
> TextEditor. My problem is that since Eclipse 3.1, the editor popup menu
> (right-click within editor part) shows a couple of new menu items: "Run
> as..." and "Debug as...".
> However, these items are not really appropriate for my editor since there
> is nothing to run or debug.
> Investigating further reveals that these are object contributions from the
> debug UI plugin and have been registered for the Object class (how
> helpful!)- i.e., there's no escaping them.
> Is there any way to prevent these popup menu items from being displayed?
There are two options of which I am aware.
In your particular case, you can register the context menu using
EditorSite.registerContextMenu(MenuManager,ISelectionProvide r,boolean) or
EditorSite.registerContextMenu(String,MenuManager,ISelection Provider,boolean).
If you pass "false" as the "includeEditorInput" parameter, then the "Run
as..." and "Debug as..." items should disappear. However, I'm not sure how
you would control this is you were subclassing TextEditor. You'd have to
ask the Platform/Text guys (possibly by filing a bug)....
The other way is to use Capabilities (née Activites). These can be used to
filter out menu items based on their ID. The only problem is that this
would also filter out these menu items from other editors. If it still
interests you, I'd recommend looking at the "org.eclipse.ui.activities"
extension point.
cheers,
d.
|
|
|
Re: Hiding/Preventing editor popup menu items [message #289255 is a reply to message #289243] |
Tue, 02 August 2005 17:13   |
Eclipse User |
|
|
|
Originally posted by: sunil_kamath.nohotspammail.com
"Douglas Pollock" <douglas.pollock@magma.ca> wrote in message
news:dcoe8f$ej7$1@news.eclipse.org...
> Sunil Kamath wrote:
>
>> I have implemented a couple of editors by extending the eclipse
>> TextEditor. My problem is that since Eclipse 3.1, the editor popup menu
>> (right-click within editor part) shows a couple of new menu items: "Run
>> as..." and "Debug as...".
>> However, these items are not really appropriate for my editor since there
>> is nothing to run or debug.
>> Investigating further reveals that these are object contributions from
>> the
>> debug UI plugin and have been registered for the Object class (how
>> helpful!)- i.e., there's no escaping them.
>> Is there any way to prevent these popup menu items from being displayed?
>
> There are two options of which I am aware.
>
> In your particular case, you can register the context menu using
> EditorSite.registerContextMenu(MenuManager,ISelectionProvide r,boolean) or
> EditorSite.registerContextMenu(String,MenuManager,ISelection Provider,boolean).
> If you pass "false" as the "includeEditorInput" parameter, then the "Run
> as..." and "Debug as..." items should disappear. However, I'm not sure
> how
> you would control this is you were subclassing TextEditor. You'd have to
> ask the Platform/Text guys (possibly by filing a bug)....
>
This cannot be done for a text editor since the context menu is registered
in the AbstractTextEditor.createPartControl().
I tried it for a non-text editor (I also have a GEF editor which has the
same problem) and setting includeEditorInput to false had no effect.
The Run as.. and Debug as.. still show up.
> The other way is to use Capabilities (n
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.10034 seconds