Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » add a menu entry
add a menu entry [message #172763] Mon, 21 March 2005 17:54 Go to next message
Eclipse UserFriend
Originally posted by: J_ML.netcabo.pt

Hi all.

Here's my question: I want to add a menu entry to delete selected figures
on my editor. I've seen it on GEF's examples but i need to understand the
concept also. So... i need to register the delete action on my menu
provider over the viewer, done that (just like i did with undo and redo
and it's working fine). I need to create a delete command (didn't yet, but
no prob doing it), but how do i put it all together? i mean, what do i
need to do to "connect" the menu entry with my delete command?

Cause as far as i understood the redo and undo methods are called by "GEF"
over the command stack, but that's not the point of the delete option...
it's not supposed to mess with the command stack.... (i think)

any help? thanks

By the way... is there a way to hide the default menu options that appear
at the bottom of the popup menu?
Re: add a menu entry [message #172770 is a reply to message #172763] Mon, 21 March 2005 16:38 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

I think our approach to building context menus is that disabled actions
don't appear. So, if you don't implement the delete command, the action may
be left off the menu.

The action itself is pretty straightforward. It asks for a command, and
executes it on the stack.

""jos
Re: add a menu entry [message #172775 is a reply to message #172763] Mon, 21 March 2005 18:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: J_ML.netcabo.pt

ok, so far i understood a few things:

If i need to add a new menu entry (like changing the color of some
figure), i have to implement the Action and add it like redo, undo and
delete.

But the question remains, how do i "fuse" my implemented action (or the
delete action) represented with the menu entry with the command i want to
implement?

Thanks! =)
Re: add a menu entry [message #172837 is a reply to message #172775] Mon, 21 March 2005 19:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: none.us.ibm.com

For an example of this, look at the IncrementDecrementAction in the Logic
example.

""jos
Re: add a menu entry [message #172844 is a reply to message #172775] Mon, 21 March 2005 19:39 Go to previous message
Eclipse UserFriend
Originally posted by: huangjun.cs.umb.edu

Delete action is created in GraphicalEditor#createActions by default.
If your editpart creates a command when receiving a REQ_DELETE request, the
action will be enabled if ur delete command can execute. It is quite
convenient to use, isn't it?

Have a look at DeleteAction source will help u to understand. In your own
action you can get current selection in the editor(if it is a selection
action) and then determine which command to use for the selected
editpart(s).

Best,
Jun

"jos
Previous Topic:Finally! 0 Unread messages
Next Topic:outiline view
Goto Forum:
  


Current Time: Thu Apr 25 03:47:39 GMT 2024

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

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

Back to the top