|
|
Re: Using a Java Service in a TreeItemStyleDescription [message #1551417 is a reply to message #1550783] |
Wed, 07 January 2015 16:10 |
Frédéric Botron Messages: 9 Registered: December 2014 |
Junior Member |
|
|
Hi and thank you for your support,
I am not able to make the 3-instance solution work. To sum up, I have :
One main Eclipse instance with the 3 plugins generated by EMF:
com.mycompany.siriustest.model
com.mycompany.siriustest.model.edit
com.mycompany.siriustest.model.editor
One second Eclipse instance (launched by the first one) with the following plugin:
com.mycompany.siriustest.design containing my .odesign file and the Java Service
One third Eclipse instance (launched by the second one) with the following plugin:
com.mycompany.siriustest.sample
I referenced the meta-model in my Viewpoint, as you told me. But:
- when I edit the .odesign file, the methods of the Java Service never appear when I try to use completion in an expression (using the service:method syntax or the [ method() /] syntax)
- when I test my .odesign with an EMF model, no label appears. With the second syntax, I get the following error message in the console:
Cannot find operation (method()) for the type (ConfigurationDataFile)
With the first syntax, no error message is displayed.
BUT
If I keep my 2-instance initial setup with:
The main Eclipse instance
com.mycompany.siriustest.model
com.mycompany.siriustest.model.edit
com.mycompany.siriustest.model.editor
com.mycompany.siriustest.design.service: contains a Java Service
A second Eclipse instance launched from the first one
com.mycompany.siriustest.design: contains an empty Java Service extending the one in com.mycompany.siriustest.design.service
com.mycompany.siriustest.sample
THEN I can use Java Service in labels, with syntax service: (the second one does not work). And the completion works fine too. I just have to restart the second instance once I modify the implementation of my Java Service, which seems normal.
The only remaining problem with this setup is the following: Java Services do not seem to work in pre-conditions, for example in a <TreeItemCreationTool>. My method (whose return type is a boolean), is never invoked and the corresponding creation tool appears in the context menu whatever the case. Nevertheless the method, with the right signature, appears as a suggestion completion in the "precondition" field of the Sirius editor.
Is there a limitation with preconditions, or did I do something wrong with my precondition method ?
Its signature is:
public boolean canCreateSiblingInContainer(EObject self, EClass container);
and the syntax of my precondition is:
service:canCreateSiblingInContainer(container)
|
|
|
Re: Using a Java Service in a TreeItemStyleDescription [message #1552996 is a reply to message #1551417] |
Thu, 08 January 2015 12:43 |
Esteban Dugueperoux Messages: 472 Registered: July 2009 |
Senior Member |
|
|
Hi Frédéric,
I think that your second solution with only 2 Eclipse instances work
because you have your java service in the first one while it was not the
case with the first proposed solution.
After about your issue on precondition evaluation with java service
call, I'm not aware of this kind of issue and this should works. Could
you raise a bugzilla about this issue with a test case and a scenario?
Best Regards.
Le 07/01/2015 17:10, Frédéric Botron a écrit :
> Hi and thank you for your support,
>
> I am not able to make the 3-instance solution work. To sum up, I have :
>
>
> One main Eclipse instance with the 3 plugins generated by EMF:
>
> com.mycompany.siriustest.model
> com.mycompany.siriustest.model.edit
> com.mycompany.siriustest.model.editor
>
> One second Eclipse instance (launched by the first one) with the
> following plugin:
>
> com.mycompany.siriustest.design containing my .odesign file and the Java
> Service
>
> One third Eclipse instance (launched by the second one) with the
> following plugin:
>
> com.mycompany.siriustest.sample
>
>
>
> I referenced the meta-model in my Viewpoint, as you told me. But:
> - when I edit the .odesign file, the methods of the Java Service never
> appear when I try to use completion in an expression (using the
> service:method syntax or the [ method() /] syntax)
> - when I test my .odesign with an EMF model, no label appears. With the
> second syntax, I get the following error message in the console:
> Cannot find operation (method()) for the type (ConfigurationDataFile)
> With the first syntax, no error message is displayed.
>
> BUT
>
> If I keep my 2-instance initial setup with:
>
> The main Eclipse instance
>
> com.mycompany.siriustest.model
> com.mycompany.siriustest.model.edit
> com.mycompany.siriustest.model.editor
> com.mycompany.siriustest.design.service: contains a Java Service
>
> A second Eclipse instance launched from the first one
>
> com.mycompany.siriustest.design: contains an empty Java Service
> extending the one in com.mycompany.siriustest.design.service
> com.mycompany.siriustest.sample
>
>
>
> THEN I can use Java Service in labels, with syntax service: (the second
> one does not work). And the completion works fine too. I just have to
> restart the second instance once I modify the implementation of my Java
> Service, which seems normal.
>
> The only remaining problem with this setup is the following: Java
> Services do not seem to work in pre-conditions, for example in a
> <TreeItemCreationTool>. My method (whose return type is a boolean), is
> never invoked and the corresponding creation tool appears in the context
> menu whatever the case. Nevertheless the method, with the right
> signature, appears as a suggestion completion in the "precondition"
> field of the Sirius editor.
>
> Is there a limitation with preconditions, or did I do something wrong
> with my precondition method ?
>
> Its signature is:
>
> public boolean canCreateSiblingInContainer(EObject self, EClass container);
>
> and the syntax of my precondition is:
> service:canCreateSiblingInContainer(container)
>
--
Esteban Dugueperoux - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05362 seconds