Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Change context programmatically
Change context programmatically [message #1765569] Mon, 12 June 2017 13:59 Go to next message
Martin Jedlicka is currently offline Martin JedlickaFriend
Messages: 122
Registered: January 2016
Senior Member
Hi,

I would like to know whether it is possible to modify the context (Change Context) programmatically.

If so, how?

Thanks.

Martin
Re: Change context programmatically [message #1765579 is a reply to message #1765569] Mon, 12 June 2017 14:50 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 703
Registered: July 2009
Senior Member
Hi,

The simple answer it no, not really.

The longer answer is that the "context" in the Change Context model operation is simply the default value of "self" to use for sub-operations. It's internal state managed by Sirius during a tool's execution and is only meaningful during the execution of the sub-elements of the "Change Context" operation.

What are your trying to accomplish? This may not be the tool you want/need.

Regards,
Pierre-Charles David


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Change context programmatically [message #1765585 is a reply to message #1765579] Mon, 12 June 2017 15:05 Go to previous messageGo to next message
Martin Jedlicka is currently offline Martin JedlickaFriend
Messages: 122
Registered: January 2016
Senior Member
Thanks for the reply.

My problem is this:

I have a text editor xText and a graphical Sirius editor. If I put a node from a graphical editor, the changes will also be transferred to xText. However, if I put a node (even with an edge!) into xText, the changes will not be transferred to the graphic until a change context is introduced (eg. inserts another node).

I do not know why the xText -> Sirius changes will not be done, but somehow they have to be refreshed. In the model, those changes are (target), but they are not transferred to the graphical representation (DRepresentation).

Thanks.

Martin
Re: Change context programmatically [message #1765653 is a reply to message #1765585] Tue, 13 June 2017 07:36 Go to previous message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 703
Registered: July 2009
Senior Member
Martin Jedlicka wrote on Mon, 12 June 2017 17:05

I have a text editor xText and a graphical Sirius editor. If I put a node from a graphical editor, the changes will also be transferred to xText. However, if I put a node (even with an edge!) into xText, the changes will not be transferred to the graphic until a change context is introduced (eg. inserts another node).

I do not know why the xText -> Sirius changes will not be done, but somehow they have to be refreshed. In the model, those changes are (target), but they are not transferred to the graphical representation (DRepresentation).


i do not know how your two editors are connected together, but the effects you see have probably nothing to do with "Change Context" by itself. Executing a "Change Context $SOME_EXPRESSION" really only does two things: 1) evaluate the expression, 2) set a internal Sirius variable to the result. "Change Context" is really only one of many operations that can be executed as part of a tool, and by itself has nothing to do with "inserting another node".

Now, what you see is probably that executing some tool (which may or may not have a Change Context operation, that by itself is not relevant) forces Sirius to re-synchronize its graphical views with the current state of the underlying model. Sirius normally does it automatically when it detects the underlying model has changed, but this may be disabled if you have unchecked the "Automatic Refresh" preference (in Window > Preferences > Sirius), or if your diagram and/or mappings are unsynchonized.

This can be tested simply: after you "put a node (even with an edge!) into xText", invoke the Sirius refresh explicitly (F5 or the "Refresh" icon in the diagram's tabbar). Do the new elements appear then ? Note that depending on how your two editors are connected, you probably need to save the Xtext file; as long as the change only exists in the Xtext editor's in-memory version of the model, Sirius has now way to know about it.



Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Previous Topic:How to use embedded OCL constraints from ecore in Sirius?
Next Topic:A node instance doesnt appear on the canvas of a second representation
Goto Forum:
  


Current Time: Fri Apr 26 23:03:52 GMT 2024

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

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

Back to the top