Search in sources :

Example 1 with Operand

use of org.obeonetwork.dsl.interaction.Operand in project InformationSystem by ObeoNetwork.

the class DeleteServices method deleteOperand.

public void deleteOperand(Operand operand) {
    EObject result = operand.eContainer();
    if (result instanceof CombinedFragment) {
        CombinedFragment combinedFragment = (CombinedFragment) result;
        End startingEnd = operand.getStartingEnd();
        End finishingEnd = null;
        EList<Operand> siblings = combinedFragment.getOwnedOperands();
        if (siblings.size() == 1) {
            deleteCombinedFragment(combinedFragment);
            return;
        }
        int index = siblings.indexOf(operand);
        if (index == siblings.size() - 1) {
            // The last operand ends with the CF
            finishingEnd = combinedFragment.getFinishingEnd();
        } else {
            // Other operands ends when their successor starts
            finishingEnd = siblings.get(index + 1).getStartingEnd();
        }
        delete((Interaction) combinedFragment.eContainer(), startingEnd, finishingEnd, false, combinedFragment.getCoveredParticipants());
    }
    return;
}
Also used : Operand(org.obeonetwork.dsl.interaction.Operand) EObject(org.eclipse.emf.ecore.EObject) End(org.obeonetwork.dsl.interaction.End) CompoundEnd(org.obeonetwork.dsl.interaction.CompoundEnd) CombinedFragment(org.obeonetwork.dsl.interaction.CombinedFragment)

Example 2 with Operand

use of org.obeonetwork.dsl.interaction.Operand in project InformationSystem by ObeoNetwork.

the class InteractionServices method computePredecessorForOperand.

public Operand computePredecessorForOperand(Operand operand) {
    // Get the preceding end
    List<End> precedingEnds = getPrecedingEnds(operand.getStartingEnd());
    // The predecessor is the last Operand found amongst the preceding operands for the same combined fragment
    Operand predecessor = null;
    for (End end : precedingEnds) {
        if (end.isOperandEnd() && end.isStartingEnd() && operand.eContainer().equals(end.getOperand().eContainer())) {
            predecessor = end.getOperand();
        }
    }
    return predecessor;
}
Also used : Operand(org.obeonetwork.dsl.interaction.Operand) End(org.obeonetwork.dsl.interaction.End)

Example 3 with Operand

use of org.obeonetwork.dsl.interaction.Operand in project InformationSystem by ObeoNetwork.

the class OperandOperandPropertiesEditionComponent method initPart.

/**
 * {@inheritDoc}
 *
 * @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#initPart(java.lang.Object, int, org.eclipse.emf.ecore.EObject,
 *      org.eclipse.emf.ecore.resource.ResourceSet)
 */
public void initPart(Object key, int kind, EObject elt, ResourceSet allResource) {
    setInitializing(true);
    if (editingPart != null && key == partKey) {
        editingPart.setContext(elt, allResource);
        final Operand operand = (Operand) elt;
        final OperandPropertiesEditionPart operandPart = (OperandPropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(InteractionViewsRepository.Operand.Properties.name))
            operandPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, operand.getName()));
        if (isAccessible(InteractionViewsRepository.Operand.Properties.description))
            operandPart.setDescription(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, operand.getDescription()));
    // init filters
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : OperandPropertiesEditionPart(org.obeonetwork.dsl.interaction.parts.OperandPropertiesEditionPart) Operand(org.obeonetwork.dsl.interaction.Operand)

Example 4 with Operand

use of org.obeonetwork.dsl.interaction.Operand in project InformationSystem by ObeoNetwork.

the class OperandImpl method getFinishingEnd.

/**
 * @generated NOT
 */
@Override
public End getFinishingEnd() {
    End result = null;
    EObject eContainer = eContainer();
    if (eContainer instanceof CombinedFragment) {
        CombinedFragment cf = (CombinedFragment) eContainer;
        result = cf.getFinishingEnd();
        Operand prev = null;
        for (Operand op : cf.getOwnedOperands()) {
            if (this.equals(prev)) {
                result = op.getStartingEnd();
                break;
            } else {
                prev = op;
            }
        }
    }
    return result;
}
Also used : Operand(org.obeonetwork.dsl.interaction.Operand) EObject(org.eclipse.emf.ecore.EObject) End(org.obeonetwork.dsl.interaction.End) CombinedFragment(org.obeonetwork.dsl.interaction.CombinedFragment)

Aggregations

Operand (org.obeonetwork.dsl.interaction.Operand)4 End (org.obeonetwork.dsl.interaction.End)3 EObject (org.eclipse.emf.ecore.EObject)2 CombinedFragment (org.obeonetwork.dsl.interaction.CombinedFragment)2 CompoundEnd (org.obeonetwork.dsl.interaction.CompoundEnd)1 OperandPropertiesEditionPart (org.obeonetwork.dsl.interaction.parts.OperandPropertiesEditionPart)1