Search in sources :

Example 6 with DDiagramElement

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);
    }
}
Also used : DDiagramElement(org.eclipse.sirius.diagram.DDiagramElement) RecoveryActionBehaviour(org.palladiosimulator.pcm.seff.seff_reliability.RecoveryActionBehaviour) DEdge(org.eclipse.sirius.diagram.DEdge)

Example 7 with DDiagramElement

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);
    }
}
Also used : DDiagramElement(org.eclipse.sirius.diagram.DDiagramElement) AbstractAction(org.palladiosimulator.pcm.seff.AbstractAction)

Example 8 with DDiagramElement

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;
}
Also used : Node(org.eclipse.gmf.runtime.notation.Node) EObject(org.eclipse.emf.ecore.EObject) CreateEditPoliciesOperation(org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation) EditPart(org.eclipse.gef.EditPart) EObject(org.eclipse.emf.ecore.EObject) DDiagramElement(org.eclipse.sirius.diagram.DDiagramElement)

Aggregations

DDiagramElement (org.eclipse.sirius.diagram.DDiagramElement)8 DEdge (org.eclipse.sirius.diagram.DEdge)3 ArrayList (java.util.ArrayList)2 EObject (org.eclipse.emf.ecore.EObject)2 EdgeTarget (org.eclipse.sirius.diagram.EdgeTarget)2 RecoveryActionBehaviour (org.palladiosimulator.pcm.seff.seff_reliability.RecoveryActionBehaviour)2 Iterator (java.util.Iterator)1 List (java.util.List)1 EList (org.eclipse.emf.common.util.EList)1 RecordingCommand (org.eclipse.emf.transaction.RecordingCommand)1 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)1 EditPart (org.eclipse.gef.EditPart)1 CreateEditPoliciesOperation (org.eclipse.gmf.runtime.diagram.ui.services.editpolicy.CreateEditPoliciesOperation)1 Node (org.eclipse.gmf.runtime.notation.Node)1 DecorationHelper (org.eclipse.sirius.diagram.business.api.helper.decoration.DecorationHelper)1 AdditionalLayer (org.eclipse.sirius.diagram.description.AdditionalLayer)1 Layer (org.eclipse.sirius.diagram.description.Layer)1 Decoration (org.eclipse.sirius.viewpoint.Decoration)1 AbstractTable (org.obeonetwork.dsl.database.AbstractTable)1 ForeignKey (org.obeonetwork.dsl.database.ForeignKey)1