|
|
|
Re: get the name of the file storing a model [message #1426232 is a reply to message #1426137] |
Thu, 18 September 2014 12:41 |
|
Hi Anne-Lise
Le 18/09/2014 11:47, anne-Lise Courbis a écrit :
> I am talking about the code in my .odesign file, associated with the
> creation of an instance in a diagram.
If I well understand your need, I think you could create a Java service,
called on the semantic/domain object which will contain the newly
created instance. The service would take an EObject as parameter and it
could make something like eObject.eResource().getUri(). From this uri,
you will remove the file extension and extract the last segment to get
the file name.
> I guess I could associate the code you send to me as an "External Java
> code". However, I do not understand to which window corresponds the
> getActiveWorkbenchWindow in instruction: IWorkbenchWindow win =
> PlatformUI.getWorkbench().getActiveWorkbenchWindow();
This corresponds to the active Eclipse window. By default, when you
launch Eclipse, you see one window (one application in your system), but
if you click on Window > new Window, it opens a new window. Then you
will have two windows (WorkbenchWindow) for the same Eclipse instance
(the Workbench). Only one is active at the same time: the one which has
the focus in your system.
>
> Thanks again for your help.
> Anne-Lise
Regards
--
Maxime - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
Maxime Porhel - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
|
Re: get the name of the file storing a model [message #1426752 is a reply to message #1426273] |
Fri, 19 September 2014 07:03 |
|
Hi Anne-Lise,
Le 18/09/2014 15:53, anne-Lise Courbis a écrit :
> Thanks Maxime for the answer. It is exactly what I want to do BUT
> I have a problem if I test the formula under Acceleo Interpreter. I can
> get the resource with : Object.eResource() and I see the uri label, but
> there is an error (of syntax ?...) with Object.eResource().getUri(). Do
> you know why ?
It seems you try to interprete some Java code in the Accelo Interpreter
which is able to interprete Acceleo code (+ Sirius supported interpreter
if the Sirius interpreted is selected).
Acceleo will be able to interprete [someEObject.eResource()/] as
eResource is a method on EObject. But then by default you hav no need to
get the uri with an Acceleo expression without using a Java service.
>
> Maybe I need a good course about emf. Could you advise to me a good
> support on internet or a book (I am from the old school), waiting next
> year to see you again to have a lesson to become an expert on emf :) ?
You will find some tuto, docs and book references on EMF docs page (see
[1]).
>
> I will try to include this code into a java service. I still fail to
> call a java service. It will be next subject, if my colleague cannot
> help me.
You will find information about Java services in the Sirius
documentation (see [2]).
>
> Regards,
> Anne-Lise
Regards,
--
Maxime - Obeo
Need professional services for Sirius?
http://www.obeodesigner.com/sirius
--
[1] https://www.eclipse.org/modeling/emf/docs/
[2]
https://www.eclipse.org/sirius/doc/specifier/general/Writing_Queries.html#service_methods
Maxime Porhel - Obeo
Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
|
|
|
Powered by
FUDForum. Page generated in 0.03561 seconds