Menu popup on EditPart [message #13968] |
Thu, 18 July 2002 13:18 |
Eclipse User |
|
|
|
Originally posted by: jol.linuxgames.com
Hello !
I want to know, how show a different menupopup on different EditPart
Example:
I've a CircleEditPart and i want a special popup for this editpart
and I've a RectangleEditPart and i want another special popup for this
EditPart.
How can i do ?
Thanks a lot
|
|
|
|
Re: Menu popup on EditPart [message #14404 is a reply to message #13994] |
Sun, 21 July 2002 16:51 |
Eclipse User |
|
|
|
Originally posted by: none.ibm.com
"Guy Slade" <gslade@us.ibm.com> wrote in message
news:ah95h7$4v8$1@rogue.oti.com...
> 1. Create your context menu provider by subclassing ContextMenuProvider (
> this is in the Logic sample)
> 2. Register the context menu provider with your viewer(s) ( this is in the
> Logic sample)
> 3. Create Actions for each of your context menu option and register then
in
> the ActionsRegistery ( this is in the Logic sample )
> Note: What I did was have superclass action that implements
> ISelectionListener, registers itself with the Workbench selection service
> and so it gets notified when there has been a selection change, and what
the
GEF has an abstract action which does this already.
> new selection(s) is(are) ( this is what the SelectionAction in the Logic
> example does ). This superclass Then all of my other context menu actions
> subclass this. Each of my actions implemented the following....
>
> protected void handleSelectionChanged() {
> setEnabled(canPerformAction());
> }
>
> In the canPerformAction() method I check what the current selection is (
i.e
> what EditParts are selected ). And based on that decides whether it should
> be enabled or disabled.
> Hope this is helpful.
>
>
> Guy
>
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.24319 seconds