Duplicate popup actions from Java classes [message #164127] |
Fri, 11 June 2004 19:09  |
Eclipse User |
|
|
|
Originally posted by: kariem_h.hotmail.com
Hi,
I thought it would be fairly easy to implement that, but it seems like I
don't know how to do it.
I have a view which displays one or more Java classes and their
associations. I wanted to implement a context menu that displays the
standard operations which can usually be executed from the class'
context menu (menus "Source" and "Refactor" are of special interest, but
the search operations would be nice too).
Simple refactor operations would be most important. Could you please
give me a starting point?
I had already had a look at the org.eclipse.jdt.ui module in CVS, but I
don't think it is reasonable to directly indicate the ids. Is there a
possibility to retrieve several action sets (by category) and to display
them in a context menu within this view? The optimal solution would be
to display all actions that are available from a class' context menu
(either in the Package Explorer, or the Java Editor).
I hope you could understand that question. It's already late, so please
pardon my English.
Thank you,
Kariem
|
|
|
Re: Duplicate popup actions from Java classes [message #164151 is a reply to message #164127] |
Sat, 12 June 2004 09:01  |
Eclipse User |
|
|
|
Originally posted by: kariem_h.hotmail.com
The things I have found out so far:
- According to [1] I should use the RetargetAction
(org.eclipse.ui.actions)
- The action ids are defined in JdtActionConstants
(org.eclipse.jdt.ui.actions)
That means I can build the actions I'm looking for by creating a new
RetargetAction for each constant I intend to show.
For example, if I want to provide renaming:
action = new RetargetAction(JdtActionConstants.RENAME, "rename");
If I want to add all actions, I use introspection on JdtActionConstants
and iterate over all public constants.
There are some problems:
1. It sounds too easy :)
2. How do I dynamically access the "original" text for the action?
Hope someone can help me here,
Kariem
[1] Retargetable Actions
Platform Plug-in Dev Guide > Programmer's Guide > Plugging into the
workbench > Retargetable actions
Kariem Hussein wrote:
> Hi,
>
>
> I thought it would be fairly easy to implement that, but it seems like I
> don't know how to do it.
>
> I have a view which displays one or more Java classes and their
> associations. I wanted to implement a context menu that displays the
> standard operations which can usually be executed from the class'
> context menu (menus "Source" and "Refactor" are of special interest, but
> the search operations would be nice too).
>
> Simple refactor operations would be most important. Could you please
> give me a starting point?
>
> I had already had a look at the org.eclipse.jdt.ui module in CVS, but I
> don't think it is reasonable to directly indicate the ids. Is there a
> possibility to retrieve several action sets (by category) and to display
> them in a context menu within this view? The optimal solution would be
> to display all actions that are available from a class' context menu
> (either in the Package Explorer, or the Java Editor).
>
>
> I hope you could understand that question. It's already late, so please
> pardon my English.
>
>
> Thank you,
> Kariem
>
|
|
|
Powered by
FUDForum. Page generated in 0.02606 seconds