use of org.eclipse.sirius.diagram.description.AdditionalLayer in project InformationSystem by ObeoNetwork.
the class Activator method refreshDecorationsOnDiagram.
private void refreshDecorationsOnDiagram(final DSemanticDiagram diagram, final Session session) {
EList<AdditionalLayer> activatedTransientLayers = diagram.getActivatedTransientLayers();
for (final AdditionalLayer additionalLayer : activatedTransientLayers) {
// We want the "EObjectWithRequirement" layer
if (REQUIREMENTS_DECORATION_LAYER_NAME.equals(additionalLayer.getName())) {
TransactionalEditingDomain ted = session.getTransactionalEditingDomain();
ted.getCommandStack().execute(new RecordingCommand(ted) {
@Override
protected void doExecute() {
// Due to a bug in Sirius we have to remove the existing decorations before calling the update method
for (DDiagramElement diagElement : diagram.getDiagramElements()) {
Iterator<Decoration> it = diagElement.getTransientDecorations().iterator();
while (it.hasNext()) {
Decoration decoration = it.next();
if (REQUIREMENTS_DECORATION_NAME.equals(decoration.getDescription().getName())) {
it.remove();
}
}
}
List<Layer> layersToRefresh = Arrays.asList((Layer) additionalLayer);
new DecorationHelper(diagram).updateDecorations(layersToRefresh);
}
});
}
}
}
Aggregations