Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Papyrus » Missing state machine diagram(Programmatic copy of active class with state machine looses state machine diagram)
Missing state machine diagram [message #1810729] Sun, 18 August 2019 07:01 Go to next message
Milan Ignjatovic is currently offline Milan IgnjatovicFriend
Messages: 2
Registered: September 2010
Junior Member
Hello,
I have an application which programmatically composes several part Papyrus models. After composition, all models are correct and the application compiles and executes properly. However, the state machine diagrams are missing in the composed model.
The new notation file does not contain the original state machine diagrams.
I can manually copy a diagram from the original part Papyrus uml file and paste it into the composed model. This works fine but does not realise my use case.
The feature used to work well with the previous Topcased environment.
Why is the state machine diagram not copied (notation file is not being updated) with the class defining the state machine?
Thanks and regards
Milan
p.s. I prefer a fully automated solution to the problem without manual workarounds.
Re: Missing state machine diagram [message #1811068 is a reply to message #1810729] Mon, 26 August 2019 12:22 Go to previous messageGo to next message
Pauline Deville is currently offline Pauline DevilleFriend
Messages: 42
Registered: November 2016
Location: Paris Saclay, France
Member
Hello,

Can you show use an example of the code you made ? Does it works for other diagrams than state machine ?

May be you can find some examples of copy paste used in tests [1] [2]

Best regards,
Pauline

1: https://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/tree/tests/junit/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.common.tests/src/org/eclipse/papyrus/infra/gmfdiag/common/commands/tests/DefaultDiagramPasteCommandTest.java

2: https://git.eclipse.org/c/papyrus/org.eclipse.papyrus.git/tree/tests/junit/plugins/uml/modelexplorer/org.eclipse.papyrus.uml.modelexplorer.tests/src/org/eclipse/papyrus/uml/modelexplorer/tests/paste/DiagramCopyPasteModelExplorerTest.java
Re: Missing state machine diagram [message #1811111 is a reply to message #1811068] Tue, 27 August 2019 06:12 Go to previous message
Milan Ignjatovic is currently offline Milan IgnjatovicFriend
Messages: 2
Registered: September 2010
Junior Member
Hello Pauline,

Here is a code excerpt in Mofscript to identify to process classes. You will notice I am not processing any diagram types as they used to get copied with the classes they were created in. My comment says it all. Is there a way of identifying a diagram type using this notation?
Thanks and regards
Milan

//Process Classes
umlext.objectsOfType (umlext.Class)->forEach (cext)
{
//mig: 15.08.2019 trying to copy SM diagrams into the NanoTechnology.notation file
if (cext._getFeature("name").startsWith("StateMachine")) { //nop - using naming convention to see if there are any SM Diagrams
//stdout.println(" Skipping merging for StateMachine with Qualified Name: " + cext._getFeature("qualifiedName"));
//stdout.println(" Skipping merging for StateMachine with Name: " + cext._getFeature("name"));
//stdout.println(" -> since this is automatically added with the corresponding class");
//stdout.println(" -> TODO: however, the State Machine Diagram is not added automatically");
//stdout.println(" -> TODO: the problem is in Papyrus .Notation file -> workaround is to use the CSS file in Core");
//mergedClassList.add(cext._getFeature("name"));
//self.packagedElement.add(cext.clone());
}
else if (cext.getAppliedStereotype("Activity") != null) { //nop - just a test if there are any Activities
//stdout.println(" Skipping merging for StateMachine Transition effects with Qualified Name: " + cext._getFeature("qualifiedName"));
//stdout.println(" -> since this is a special case of Transition effects!!!");
}
else if ( (cext._getFeature("name").startsWith("EntryAction")) ||
(cext._getFeature("name").startsWith("ExitAction")) ) { //this is the only additional processing that needs to be done
//stdout.println(" adding to mergedActionList [Entry State Action, Exit State Action]: " + cext._getFeature("qualifiedName"));
mergedActionList.add(cext._getFeature("qualifiedName"));
}
else {
//stdout.println(" adding to mergedClassList [umlext.Class]: " + cext._getFeature("name"));
mergedClassList.add(cext._getFeature("name"));
//stdout.println(" cloning [umlext.Class]: " + cext._getFeature("qualifiedName"));
self.packagedElement.add(cext.clone());
}
}


Previous Topic:Papyrus SysML Tutorial (version 0.1.3)
Next Topic:About modeling with MARTE
Goto Forum:
  


Current Time: Mon Dec 16 02:28:35 GMT 2019

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

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

Back to the top