Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Use External Java Action in Create Instance(Use External Java Action in Create Instance)
Use External Java Action in Create Instance [message #1775788] Mon, 06 November 2017 12:29 Go to next message
Bo Liu is currently offline Bo LiuFriend
Messages: 32
Registered: July 2016
Member
Hello Community,

Is it possible to call an external Java Action unter Create Instance.
I want to set some value to the newly created Instance programmatically using an external java action.

How can I access the created instance in the java action?

Thanks in advance.

[Updated on: Mon, 06 November 2017 12:30]

Report message to a moderator

Re: Use External Java Action in Create Instance [message #1775858 is a reply to message #1775788] Tue, 07 November 2017 10:34 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 703
Registered: July 2009
Senior Member
Hi,

If you mean External Java Actions as described in https://www.eclipse.org/sirius/doc/specifier/general/Model_Operations.html#external_java_action, the current element ("self") on which the action is invoked is available in the first argument of your Java class's execute() method. If you defined your action as a child of the "Create Instance" operation, the current element for the operation will be the newly created instance.

Note that External Java Actions are an older mechanism which should probably be deprecated at some point. Plain Java services are much more flexible. In your case, you could simply use a "Set" operation, with the "Value Expression" returning the value you want for the element's feature. The value expression can be as simple as a plain AQL expression, and can also invoke Java code if needed (see https://www.eclipse.org/sirius/doc/specifier/general/Writing_Queries.html#service_methods).

Regards,


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Use External Java Action in Create Instance [message #1775860 is a reply to message #1775858] Tue, 07 November 2017 10:40 Go to previous message
Bo Liu is currently offline Bo LiuFriend
Messages: 32
Registered: July 2016
Member
thanks for the reply.

the AQL Expression seems to be a good option. I'll look into it.
Previous Topic:Depth-first traversal problem in large-scale model
Next Topic:Relation-Based Edges Path Format
Goto Forum:
  


Current Time: Wed Apr 24 15:15:48 GMT 2024

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

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

Back to the top