use of org.eclipse.sirius.diagram.DDiagramElement in project Palladio-Editors-Sirius by PalladioSimulator.
the class ReconnectSourceOfRecoveryFlow method execute.
@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
RecoveryActionBehaviour oldSource = (RecoveryActionBehaviour) parameters.get("source");
RecoveryActionBehaviour newSource = (RecoveryActionBehaviour) parameters.get("target");
// Finding the target that the edge is going to
DEdge edge = (DEdge) parameters.get("edgeView");
RecoveryActionBehaviour target = (RecoveryActionBehaviour) (((DDiagramElement) edge.getTargetNode()).getTarget());
// disallow self looping
if (!newSource.equals(target)) {
oldSource.getFailureHandlingAlternatives__RecoveryActionBehaviour().remove(target);
newSource.getFailureHandlingAlternatives__RecoveryActionBehaviour().add(target);
}
}
use of org.eclipse.sirius.diagram.DDiagramElement in project Palladio-Editors-Sirius by PalladioSimulator.
the class ReconnectSourceOfControlFlow method execute.
@Override
public void execute(Collection<? extends EObject> selections, Map<String, Object> parameters) {
AbstractAction oldSource = (AbstractAction) parameters.get("source");
AbstractAction newSource = (AbstractAction) parameters.get("target");
DDiagramElement otherEnd = (DDiagramElement) parameters.get("otherEnd");
// Prevent self connecting os edges
if (!otherEnd.getTarget().equals(newSource)) {
newSource.setSuccessor_AbstractAction((AbstractAction) otherEnd.getTarget());
oldSource.setSuccessor_AbstractAction(null);
}
}
use of org.eclipse.sirius.diagram.DDiagramElement in project InformationSystem by ObeoNetwork.
the class EditPolicyProvider method provides.
public boolean provides(IOperation operation) {
if (operation instanceof CreateEditPoliciesOperation) {
EditPart editPart = ((CreateEditPoliciesOperation) operation).getEditPart();
Object model = editPart.getModel();
if (model instanceof Node) {
Node node = (Node) model;
// check DNode, DNodeContainer
if (node.getElement() instanceof DDiagramElement) {
DDiagramElement dElement = (DDiagramElement) node.getElement();
EObject target = dElement.getTarget();
// if(target instanceof NamedElement){
if (target instanceof EObject) {
return true;
}
}
}
;
}
return false;
}
Aggregations