use of org.eclipse.sirius.diagram.DDiagramElement in project InformationSystem by ObeoNetwork.
the class DatabaseServices method getForeignKeys.
/**
* Return ForeignKeys from tables.
* @param tableContainer
* @return foreignKeys
*/
public List<ForeignKey> getForeignKeys(TableContainer tableContainer, DSemanticDiagram diagram) {
List<ForeignKey> foreignKeys = new ArrayList<ForeignKey>();
List<AbstractTable> tables = tableContainer.getTables();
for (AbstractTable abstractTable : tables) {
if (abstractTable instanceof Table) {
foreignKeys.addAll(((Table) abstractTable).getForeignKeys());
}
}
// Foreign keys from external tables on diagram
for (DDiagramElement diagramElement : diagram.getDiagramElements()) {
EObject semanticElt = diagramElement.getTarget();
if (semanticElt instanceof Table) {
foreignKeys.addAll(((Table) semanticElt).getForeignKeys());
}
}
return foreignKeys;
}
use of org.eclipse.sirius.diagram.DDiagramElement in project InformationSystem by ObeoNetwork.
the class TaskUtils method candidatesExpressionForExistingActors.
/**
* Calculate the candidateExpression defines in creation tool Existing
* Actors in Task Graph.
*
* @param context
* the context of call
* @param diagram
* the representation
* @return list of existing Actors
*/
public List<Actor> candidatesExpressionForExistingActors(EObject context, DSemanticDiagram diagram) {
List<Actor> actors = new ArrayList<Actor>(getSystem(context).getActors());
List<Actor> actorsInDiagam = new ArrayList<Actor>();
List<DDiagramElement> ownedDiagramElements = diagram.getOwnedDiagramElements();
for (DDiagramElement diagramElement : ownedDiagramElements) {
if (diagramElement.getTarget() instanceof Actor) {
actorsInDiagam.add((Actor) diagramElement.getTarget());
}
}
actors.removeAll(actorsInDiagam);
return actors;
}
use of org.eclipse.sirius.diagram.DDiagramElement 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);
}
});
}
}
}
use of org.eclipse.sirius.diagram.DDiagramElement in project Palladio-Editors-Sirius by PalladioSimulator.
the class RemoveConnectorAction method execute.
@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
DEdge edge = (DEdge) parameters.get("elementView");
LinkingResource linkingResource = (LinkingResource) edge.getTarget();
EdgeTarget targetNode = edge.getTargetNode();
ResourceContainer resourceContainer = (ResourceContainer) (((DDiagramElement) targetNode).getTarget());
linkingResource.getConnectedResourceContainers_LinkingResource().remove(resourceContainer);
}
use of org.eclipse.sirius.diagram.DDiagramElement in project Palladio-Editors-Sirius by PalladioSimulator.
the class ReconnectTargetOfRecoveryFlow method execute.
@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
// RecoveryActionBehaviour source = (RecoveryActionBehaviour) parameters.get("source");
RecoveryActionBehaviour newTarget = (RecoveryActionBehaviour) parameters.get("target");
RecoveryActionBehaviour element = (RecoveryActionBehaviour) parameters.get("element");
// Removing the original edge
DEdge edge = (DEdge) parameters.get("edgeView");
RecoveryActionBehaviour source = (RecoveryActionBehaviour) edge.getTarget();
EdgeTarget targetNode = edge.getTargetNode();
RecoveryActionBehaviour target = (RecoveryActionBehaviour) (((DDiagramElement) targetNode).getTarget());
// prevent self looping
if (!element.equals(newTarget)) {
source.getFailureHandlingAlternatives__RecoveryActionBehaviour().remove(target);
// Adding it as new connection
element.getFailureHandlingAlternatives__RecoveryActionBehaviour().add(newTarget);
}
}
Aggregations