Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » SetCommand and actionbar questions
SetCommand and actionbar questions [message #429417] Wed, 22 April 2009 17:40 Go to next message
Richard Memory is currently offline Richard MemoryFriend
Messages: 21
Registered: July 2009
Junior Member
Hi,

I have a couple newbie EMF.Edit questions.

For my EMF.Edit plugins, I'm trying to simplify the popup context menu so
that it has grand total of 4 entries, Undo, Redo, SetMyFeatureToValue1,
and SetMyFeatureToValue2.

I'd like to completely eliminate the rest of the menu entries such as
CreateSibling, CreateChild, copy, paste, cut, etc. (actually, I'd like to
enable the rest of these actions conditionally depending on who is using
the plugin, but that is a completely different question and is not part of
this post).

So, this brings up a few questions, most of which are due to my ignorance
of EditingDomains and EMF commands.

1) What is the best way to eliminate the default set of actions?

At the moment, for testing purposes, I'm simply commenting out all of the
existing code inside of MyPackageActionBarContributor.menuAboutToShow()
and then adding my own actions via the menuManager.add() method.

2) How do I properly create and associate an Action based upon the
existing SetCommand?

This is actually several questions in one and refers to the
SetMyFeatureToValue1 and SetMyFeatureToValue2 popup menu entries that I
mentioned in the opening paragraph.

* These menu's should only be enabled when the user has selected the
appropriate object in the viewer tree.

* They should only be enabled if the value hasn't already been set.

* Full undo and redo support is needed.

I've tried creating my own class SetMyFeatureToValue1Action (extending
CommandActionHandler), and overriding the createCommand() method to create
a CompoundCommand for each object in the collection. But so far this has
been a dud. The domain isn't getting set (not sure why).

Wondering if someone can give me a few pointers.

Thanks,

Richard
Re: SetCommand and actionbar questions [message #429418 is a reply to message #429417] Wed, 22 April 2009 18:18 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Richard,

Comments below.

Richard Memory wrote:
> Hi,
>
> I have a couple newbie EMF.Edit questions.
>
> For my EMF.Edit plugins, I'm trying to simplify the popup context menu
> so that it has grand total of 4 entries, Undo, Redo,
> SetMyFeatureToValue1, and SetMyFeatureToValue2.
> I'd like to completely eliminate the rest of the menu entries such as
> CreateSibling, CreateChild, copy, paste, cut, etc. (actually, I'd like
> to enable the rest of these actions conditionally depending on who is
> using the plugin, but that is a completely different question and is
> not part of this post).
Hmmm.
>
> So, this brings up a few questions, most of which are due to my
> ignorance of EditingDomains and EMF commands.
>
> 1) What is the best way to eliminate the default set of actions?
Negative shopping can be hard. You'd have to look at what
EditingDomainActionBarContributor is giving you for free that eliminate
what you don't want via derivation.
>
> At the moment, for testing purposes, I'm simply commenting out all of
> the existing code inside of
> MyPackageActionBarContributor.menuAboutToShow() and then adding my own
> actions via the menuManager.add() method.
>
> 2) How do I properly create and associate an Action based upon the
> existing SetCommand?
All the existing actions delegate to commands, so you could look at any
one of them as an example.
>
> This is actually several questions in one and refers to the
> SetMyFeatureToValue1 and SetMyFeatureToValue2 popup menu entries that
> I mentioned in the opening paragraph.
>
> * These menu's should only be enabled when the user has selected the
> appropriate object in the viewer tree.
Most of the existing actions operate on the selection.
> * They should only be enabled if the value hasn't already been set.
The action will be enabled if the command to which it delegates is enabled.
>
> * Full undo and redo support is needed.
The command already support that.
>
> I've tried creating my own class SetMyFeatureToValue1Action (extending
> CommandActionHandler), and overriding the createCommand() method to
> create a CompoundCommand for each object in the collection. But so far
> this has been a dud. The domain isn't getting set (not sure why).
Look at how copy works...
>
> Wondering if someone can give me a few pointers.
>
> Thanks,
>
> Richard
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Fastest way to deal with read-only XMLResources.
Next Topic:EMF thread safe databindings?
Goto Forum:
  


Current Time: Thu Mar 28 15:29:14 GMT 2024

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

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

Back to the top