| Control over the editor's Popup Menu [message #172887] |
Thu, 13 July 2006 17:23  |
Eclipse User |
|
|
|
Hi,
I'm wanting to nest the CEditor into an Eclipse View. I have a couple of
questions dealing with the use of the CEditor. Any help would be greatly
appreciated.
1) I see that the CEditor is internal. Is there a public way to get an
instance of this class (just an instance, not opening an editor within a
workbench).
2) I would like to have control over the the popup menu (when right clicking
on the editor surface) to be able to add other menu items. I was looking
through the different plugin.xml files to see if I could identify an
extension point that I could plug into, but I am not seeing it. The closest
I have come is to find the CEditorActionContributor class which adds some
elements to the popup menu, but not all of them (i.e. toggling Comments).
Is there somewhere else I can/should look? Ideally I'd like to have control
to remove or add the menu items.
-- I would rather not have to subclass any internal classes to achieve
this, but if that will be the only approach, I would still be interested in
hearing about it.
Thanks in advance,
Adam
|
|
|
| Re: Control over the editor's Popup Menu [message #172900 is a reply to message #172887] |
Fri, 14 July 2006 04:47  |
Eclipse User |
|
|
|
Adam wrote:
> Hi,
>
> I'm wanting to nest the CEditor into an Eclipse View. I have a couple of
> questions dealing with the use of the CEditor. Any help would be greatly
> appreciated.
I am not sure how you are aproaching this, but this is certainly not
supported by Eclipse. You should be aware that you are getting onto
slippy grounds.
See also https://bugs.eclipse.org/bugs/show_bug.cgi?id=51797
>
> 1) I see that the CEditor is internal. Is there a public way to get an
> instance of this class (just an instance, not opening an editor within a
> workbench).
No, but what you intend is quite non-standard anyway, therefore I would
not be too shy and avoid the use of internal classes.
> 2) I would like to have control over the the popup menu (when right clicking
> on the editor surface) to be able to add other menu items. I was looking
> through the different plugin.xml files to see if I could identify an
> extension point that I could plug into, but I am not seeing it. The closest
> I have come is to find the CEditorActionContributor class which adds some
> elements to the popup menu, but not all of them (i.e. toggling Comments).
> Is there somewhere else I can/should look? Ideally I'd like to have control
> to remove or add the menu items.
You can add menu items to the editor using the "poupMenus" extension
point, targeting to "#CEditorContextMenu".
But you won't find a recommended or supported way of removing menu items
and get full control over a menu.
> -- I would rather not have to subclass any internal classes to achieve
> this, but if that will be the only approach, I would still be interested in
> hearing about it.
To me it seems that subclassing (or maybe cloning) is inevitable.
> Thanks in advance,
>
> Adam
>
>
Toni
--
Anton Leherbauer
Wind River CDT Team, Austria
|
|
|
Powered by
FUDForum. Page generated in 0.02860 seconds