Skip to main content



      Home
Home » Eclipse Projects » GEF » Menu popup on EditPart
Menu popup on EditPart [message #13968] Thu, 18 July 2002 09:18 Go to next message
Eclipse UserFriend
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 #13994 is a reply to message #13968] Fri, 19 July 2002 10:22 Go to previous messageGo to next message
Eclipse UserFriend
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
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
Re: Menu popup on EditPart [message #14404 is a reply to message #13994] Sun, 21 July 2002 12:51 Go to previous messageGo to next message
Eclipse UserFriend
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
>
>
Re: Menu popup on EditPart [message #14670 is a reply to message #14404] Mon, 22 July 2002 09:57 Go to previous message
Eclipse UserFriend
Originally posted by: jol.linuxgames.com

ThankQ

"Randy Hudson" <none@ibm.com> a
Previous Topic:BendPoints Refresh problem
Next Topic:HowTo get undoing of property changes working?
Goto Forum:
  


Current Time: Wed Jul 09 04:12:58 EDT 2025

Powered by FUDForum. Page generated in 1.34761 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top