how to add notes when creating diagram programmatically [message #1742575] |
Mon, 05 September 2016 07:39 |
Eclipse User |
|
|
|
Hello
I currently develop a plugin to Capella in order to import programmatically scenarios and create related sequence diagrams exported from an other modeling tool.
I managed to create the sequence diagrams and the related semantic elements under Capella:
//creation of the sequence diagram
DDiagram diagram = (DDiagram) DialectManager.INSTANCE.createRepresentation(DiagramDescriptionConstants.INTERFACE_SCENARIO, scenario, des, InfrastructureUtil.getSession(), new NullProgressMonitor());
However I don't know how use the Sirius/GMF APIs to add programmatically notes on these created diagrams (notes are not related to any semantic elements). I tried the following code:
Shape note = NotationFactory.eINSTANCE.createShape();
note.setType("Note");
note.setDescription("note");
for (AnnotationEntry entry : diagram.getOwnedAnnotationEntries()){
if (entry.getSource().equals("GMF_DIAGRAMS")){
Diagram data = (Diagram) entry.getData();
data.getChildren().add(note);
}
But I have the following error on the last instruction:
java.lang.UnsupportedOperationException
at org.eclipse.emf.ecore.util.EContentsEList$FeatureIteratorImpl.add(EContentsEList.java:773)
at java.util.AbstractSequentialList.add(Unknown Source)
at java.util.AbstractList.add(Unknown Source)
Thank you in advance for your precious help
Marjolaine
|
|
|
Powered by
FUDForum. Page generated in 0.02750 seconds