Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » (no subject)
(no subject) [message #718843] Thu, 25 August 2011 13:22 Go to next message
techteam is currently offline techteamFriend
Messages: 55
Registered: September 2010
Member
Hi,
I try to add a new submenu with some commands to the default Ecore
editor, for working on the model elements.

I tried it with the jface command framework and it works well, and also
the editor shows me, what I have done inside the command.

But
1. the editor was not changed to dirty, thru my model modifications
2. undo and redo doesnt work.

I know, the right way would be using the EMF.edit command framework and
also I have read the chapters of EMF Book about the CompundCommand and
so on.

But how can I add the menu and this commands to the contextmenu of the
Ecore editor?

Knows sombody a simple example for this?

Greetings
Heiko
(no subject) [message #718914 is a reply to message #718843] Thu, 25 August 2011 15:33 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33216
Registered: July 2009
Senior Member
Heiko,

Comments below.

On 25/08/2011 6:22 AM, Heiko wrote:
> Hi,
> I try to add a new submenu with some commands to the default Ecore
> editor, for working on the model elements.
>
> I tried it with the jface command framework and it works well, and
> also the editor shows me, what I have done inside the command.
You need to use EMF's commands.
>
> But
> 1. the editor was not changed to dirty, thru my model modifications
> 2. undo and redo doesnt work.
So clearly you're not executing EMF commands on the command stack.
>
> I know, the right way would be using the EMF.edit command framework
> and also I have read the chapters of EMF Book about the CompundCommand
> and so on.
>
> But how can I add the menu and this commands to the contextmenu of the
> Ecore editor?
You've looked at how all the other menu items that appear in your
generated editor are supported?
>
> Knows sombody a simple example for this?
Look at your generated XyzDomainActionBarContributor and the base class
EditingDomainActionBarContributor to see how all the other menu stuff is
done. Depending on what you're doing, object menu contributions might
work very well; you could look at CreateDynamicInstanceAction to see how
that's done for an action that's applicable to EClasses (and that you
can see in action on the context menu for an EClass in the Sample Ecore
Editor).
>
> Greetings
> Heiko
>


Ed Merks
Professional Support: https://www.macromodeling.com/
(no subject) [message #718939 is a reply to message #718914] Thu, 25 August 2011 16:10 Go to previous message
techteam is currently offline techteamFriend
Messages: 55
Registered: September 2010
Member
Hi Ed,
thanks for your fast answer.

Comments and clarifiacation below.

Am 25.08.2011 17:33, schrieb Ed Merks:
> Heiko,
>
> Comments below.
>
> On 25/08/2011 6:22 AM, Heiko wrote:
>> Hi,
>> I try to add a new submenu with some commands to the default Ecore
>> editor, for working on the model elements.
>>
>> I tried it with the jface command framework and it works well, and
>> also the editor shows me, what I have done inside the command.
> You need to use EMF's commands.
>>
>> But
>> 1. the editor was not changed to dirty, thru my model modifications
>> 2. undo and redo doesnt work.
> So clearly you're not executing EMF commands on the command stack.
Yes, for my first try I don't use EMF commands and don't use the command
stack.
>>
>> I know, the right way would be using the EMF.edit command framework
>> and also I have read the chapters of EMF Book about the CompundCommand
>> and so on.
>>
>> But how can I add the menu and this commands to the contextmenu of the
>> Ecore editor?
> You've looked at how all the other menu items that appear in your
> generated editor are supported?
I don't have an own generated editor.
>>
>> Knows sombody a simple example for this?
> Look at your generated XyzDomainActionBarContributor and the base class
> EditingDomainActionBarContributor to see how all the other menu stuff is
> done. Depending on what you're doing, object menu contributions might
> work very well; you could look at CreateDynamicInstanceAction to see how
> that's done for an action that's applicable to EClasses (and that you
> can see in action on the context menu for an EClass in the Sample Ecore
> Editor).
Both , XyzDomainActionBarContributor and
EditingDomainActionBarContributor I'dont have it just in this point,
what I want to do - I think so. :|

For more clarification:
For building models using with the CDO framework, I build these model
with your standard ecore editor
(org.eclipse.emf.ecore.presentation.EcoreEditor ; EditorID:
org.eclipse.emf.ecore.presentation.ReflectiveEditorID)
For the modeled elements inside this editor I want to define some simple
commands to add CDO annotations to the elements, so I don't need to use
the long way with
-> Add Anotation
-> Define source
-> Add key and value.
So I want to add a sub menu and commands to your editor,
But how do I extend your contextmenus in a declarative way?

CreateDynamicInstanceAction are added declarativ but there are not used
any EMF command inside.
I think I need both declartiv, because I can't and wan't hack your
editor and using EMF command stack.
>>
>> Greetings
>> Heiko
>>
Previous Topic:issues using headless invocation
Next Topic:[Teneo] Is it ready for GWT?
Goto Forum:
  


Current Time: Fri Sep 20 06:31:49 GMT 2024

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

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

Back to the top