Hiding/Preventing editor popup menu items [message #289117] |
Fri, 29 July 2005 15: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 18: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 21: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
|
|
|
Re: Hiding/Preventing editor popup menu items [message #289266 is a reply to message #289255] |
Wed, 03 August 2005 02:19 |
Eclipse User |
|
|
|
Originally posted by: sunil_kamath.nohotspammail.com
"Sunil Kamath" <sunil_kamath@nohotspammail.com> wrote in message
news:dconl4$plq$1@news.eclipse.org...
>
> "Douglas Pollock" <douglas.pollock@magma.ca> wrote in message
> news:dcoe8f$ej7$1@news.eclipse.org...
>> Sunil Kamath wrote:
>>
>>
>> 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.
>
I misspoke. The Run as... and Debug as... did indeed disappear- as did other
context menu items which I wanted to appear.
So this is an all-or-nothing solution.
I don't understand why the Debug plugin has a context menu contribution to
the Object class- it is just too sweeping a generalization.
---
Sunil
|
|
|
Re: Hiding/Preventing editor popup menu items [message #289289 is a reply to message #289266] |
Wed, 03 August 2005 13:59 |
Eclipse User |
|
|
|
Originally posted by: douglas.pollock.magma.ca
Sunil Kamath wrote:
> I don't understand why the Debug plugin has a context menu contribution to
> the Object class- it is just too sweeping a generalization.
Then I would suggest filing a bug with Platform/Debug.
d.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04765 seconds