Skip to main content



      Home
Home » Eclipse Projects » Sirius » performSetCommand not using own model ItemProviderAdapter
performSetCommand not using own model ItemProviderAdapter [message #1737678] Mon, 11 July 2016 19:18 Go to next message
Eclipse UserFriend
Hi all,
I am trying the new command-related services in Sirius 4.0, especially the performSetCommand(). In the documentation you can read:
Quote:
The implementation of these services delegate to the ItemProviderAdapter.createCommand() method, so any customization made in the ItemProviderAdapter 's implementation will be taken into account.

In the corresponding ItemProviderAdapters of my model I have made several customizations, but they are not used when I call for example performSetCommand(). Debugging the Sirius code shows that performSetCommand() indeed is called as expected and a standard SetCommand is performed. But my customizations are not used, since the Sirius EditingDomain (TransActionionalEditingDomainImpl) is not aware of the ItemProviders of my model, since
      IEditingDomainItemProvider editingDomainItemProvider = 
        (IEditingDomainItemProvider)
          adapterFactory.adapt(owner, IEditingDomainItemProvider.class);
results in editingDomainItemProvider == null (owner is an object of my model).

Did I miss something? Do I have to add my models AdapterFactories to the EditingDomain of Sirius myself? And if so, how can I do it?

Any help would be greatly appreciated.
Re: performSetCommand not using own model ItemProviderAdapter [message #1737703 is a reply to message #1737678] Tue, 12 July 2016 03:29 Go to previous messageGo to next message
Eclipse UserFriend
Hi Joachim,

Le 12/07/2016 à 01:18, Joachim Anlauf a écrit :
> Hi all,
> I am trying the new command-related services in Sirius 4.0, especially
> the performSetCommand(). In the documentation you can read:
> Quote:
>> The implementation of these services delegate to the
>> ItemProviderAdapter.createCommand() method, so any customization made
>> in the ItemProviderAdapter 's implementation will be taken into account.
>
> In the corresponding ItemProviderAdapters of my model I have made
> several customizations, but they are not used when I call for example
> performSetCommand(). Debugging the Sirius code shows that
> performSetCommand() indeed is called as expected and a standard
> SetCommand is performed. But my customizations are not used, since the
> Sirius EditingDomain (TransActionionalEditingDomainImpl) is not aware of
> the ItemProviders of my model, since
> IEditingDomainItemProvider editingDomainItemProvider =
> (IEditingDomainItemProvider)
> adapterFactory.adapt(owner,
> IEditingDomainItemProvider.class);results in editingDomainItemProvider
> == null (owner is an object of my model).

In which context do you try this performSetCommand() ? In a model
operation of a tool ? Is your object alreayd attached to its
parent/resource ?

>
> Did I miss something? Do I have to add my models AdapterFactories to the
> EditingDomain of Sirius myself? And if so, how can I do it?

You should not have to do so: the editing domain is initialized with a
ComposedAdapterFactory aware of the
ComposedAdatperFactory.Descriptor.Registry.INSTANCE, so if you have
properly declared your EMF.edit plugin, it should work.

org.eclipse.sirius.ext.emf.edit.EditingDomainServices.getEditingDomain(EObject)
calls
org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain.getEditingDomainFor(EObject)
which will return true if the object's resoure is null.

But the fact that you have a command shows that the domain is found.
It looks like the ReflectiveItemProviderAdapterFactory has been found
instead of yours.

Could you check your extension to <extension
point="org.eclipse.emf.edit.itemProviderAdapterFactories">, its
supported type, the uri and the class ?


>
> Any help would be greatly appreciated.

Regards

--
Maxime - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: performSetCommand not using own model ItemProviderAdapter [message #1737763 is a reply to message #1737703] Tue, 12 July 2016 11:37 Go to previous messageGo to next message
Eclipse UserFriend
Hi Maxime,
many thanks for your quick reply.

Your last sentence was the key:

> Could you check your extension to <extension
> point="org.eclipse.emf.edit.itemProviderAdapterFactories">, its
> supported type, the uri and the class ?

I was not aware of the fact that I have to use this extension point in order to register my ItemProviderAdapterFactory. I added it and now my performSetCommand() is working as expected. Thanks a lot again.

One additional question:

> In which context do you try this performSetCommand() ? In a model
> operation of a tool ? Is your object alreayd attached to its
> parent/resource ?

My object is attached to its container already, therefore it belongs to a Resource, before I call performSetCommand(). I call it inside an edge creation tool in the Browse Expression of a Change Context node:
.
.
> Begin
\-> Change Context aql:source.performSetCommand('implementedEntity', target)

I did not find another place to do it. I do not need any other operation, since everything should be done in my customizations of the SetCommand. Is this the intended way of using it? Is there another operation that should be used instead?

Regards,
Joachim
Re: performSetCommand not using own model ItemProviderAdapter [message #1737767 is a reply to message #1737763] Tue, 12 July 2016 12:22 Go to previous message
Eclipse UserFriend
Le 12/07/2016 à 17:37, Joachim Anlauf a écrit :
> Hi Maxime,
> many thanks for your quick reply.
>
> Your last sentence was the key:
>
>> Could you check your extension to <extension
>> point="org.eclipse.emf.edit.itemProviderAdapterFactories">, its
>> supported type, the uri and the class ?
>
> I was not aware of the fact that I have to use this extension point in
> order to register my ItemProviderAdapterFactory. I added it and now my
> performSetCommand() is working as expected. Thanks a lot again.
>
> One additional question:
>
>> In which context do you try this performSetCommand() ? In a model
>> operation of a tool ? Is your object alreayd attached to its
>> parent/resource ?
>
> My object is attached to its container already, therefore it belongs to
> a Resource, before I call performSetCommand(). I call it inside an edge
> creation tool in the Browse Expression of a Change Context node:

My question was in case your extension point had been ok, to identify
where to check the initalization of the tool execution context.


Regards.

--
Maxime - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:Expression to call the java methods
Next Topic:Auto update diagram
Goto Forum:
  


Current Time: Sat Mar 15 04:57:42 EDT 2025

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

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

Back to the top