Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Created Diagram programmatically - changes lost after closing diagram (redisplayed after restart)(Created Diagram programmatically - changes lost after closing diagram (redisplayed after restart))
Created Diagram programmatically - changes lost after closing diagram (redisplayed after restart) [message #1811185] Wed, 28 August 2019 10:17 Go to next message
Miriam H. is currently offline Miriam H.Friend
Messages: 6
Registered: May 2018
Junior Member
Hello,
I work on a solution for simplifying the creation of our project (based on a Sirius diagram and a Xtext textual representation). The idea is that the user is able to perform multiple tasks shown below within one step:

- creating a modeling project
- adding several natures
- adding libraries and JARs to the buildpath
- create semantic resource (textual representation)
- select the vievpoint and create a representation
- and finally: creating and open the diagram

I followed the helpful hints given in this posting https://www.eclipse.org/forums/index.php/t/633830/
(in deviation to this I create a new RecordingCommand when calling DialectManger.INSTANCE.createRepresentation(...);

Now everything works fine except the last step: I can open the diagram programmtically and also add / delete elements the textual representation is also kept in sync (on diagram save). But if I close the diagram and open it again, it is empty and I am not able to edit it (while the textual representation shows everything).
The console output displays that the services are not found, eg:

!ENTRY org.eclipse.sirius 2 0 2019-08-28 10:15:09.898
!MESSAGE the following mapping semantic candidates expression could not be correctly evaluated : service:semCandiClassContainer()
!STACK 0
org.eclipse.sirius.common.tools.api.interpreter.EvaluationException: Unknown service "semCandiClassContainer"
    at org.eclipse.sirius.common.tools.internal.interpreter.ServiceInterpreter.callService(ServiceInterpreter.java:165)
    at org.eclipse.sirius.common.tools.internal.interpreter.ServiceInterpreter.evaluate(ServiceInterpreter.java:155)
    at org.eclipse.sirius.common.tools.internal.interpreter.AbstractInterpreter.evaluateCollection(AbstractInterpreter.java:54)
    at org.eclipse.sirius.tools.internal.interpreter.SessionInterpreter.evaluateCollection(SessionInterpreter.java:245)
...
I could also figure out that ServiceInterpreter.registerServices(...) is never called.
But after restarting  eclipse runtime the services are found so the diagram contains all created elements and also behaves as it should...!
I don't have any clue what I could try at this point. Do I have to register the services programmatically? I would be very glad if someone could give me a hint.
Thanks,
Miriam
Re: Created Diagram programmatically - changes lost after closing diagram (redisplayed after restar [message #1811334 is a reply to message #1811185] Sat, 31 August 2019 12:37 Go to previous message
Miriam H. is currently offline Miriam H.Friend
Messages: 6
Registered: May 2018
Junior Member
Hi,

is nobody there who could give me any suggestions?

For now I figured out a not really pleasent workaround:
DialectEditor editor = (DialectEditor) DialectUIManager.INSTANCE.openEditor(session, repr, monitor);
DialectUIManager.INSTANCE.closeEditor(editor, true);
if (project.isOpen())
{
project.close(monitor);
project.open(monitor);
}					

Now, by opening the diagram editor manually, everything works: one can edit the diagram and changes are persisted after closing and opening diagram again. Also after editing in the Xtext editor the modifications are now taken over in the Sirius diagram.

Nevertheless it would be nice to learn about the right way to solve my problem and any help would be very appreciated :)

Miriam
Previous Topic:the value of radio and select widgets did'nt save after user choosing
Next Topic:Customizing markers location with EMF Validation
Goto Forum:
  


Current Time: Mon Oct 21 14:26:11 GMT 2019

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

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

Back to the top