Search in sources :

Example 1 with Execution

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

the class InteractionServices method computePredecessorForExecution.

public Execution computePredecessorForExecution(Execution execution) {
    // Get the preceding end
    List<End> precedingEnds = getPrecedingEnds(execution.getStartingEnd());
    // The predecessor is the last Execution found amongst the preceding executions
    Execution predecessor = null;
    for (End end : precedingEnds) {
        if (end.isExecutionEnd() && end.isStartingEnd()) {
            predecessor = end.getExecution();
        }
    }
    return predecessor;
}
Also used : Execution(org.obeonetwork.dsl.interaction.Execution) End(org.obeonetwork.dsl.interaction.End)

Example 2 with Execution

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

the class ExecutionExecutionPropertiesEditionComponent 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 Execution execution = (Execution) elt;
        final ExecutionPropertiesEditionPart executionPart = (ExecutionPropertiesEditionPart) editingPart;
        // init values
        if (isAccessible(InteractionViewsRepository.Execution.Properties.name))
            executionPart.setName(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, execution.getName()));
        if (isAccessible(InteractionViewsRepository.Execution.Properties.description))
            executionPart.setDescription(EEFConverterUtil.convertToString(EcorePackage.Literals.ESTRING, execution.getDescription()));
    // init filters
    // init values for referenced views
    // init filters for referenced views
    }
    setInitializing(false);
}
Also used : ExecutionPropertiesEditionPart(org.obeonetwork.dsl.interaction.parts.ExecutionPropertiesEditionPart) Execution(org.obeonetwork.dsl.interaction.Execution)

Example 3 with Execution

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

the class DeleteServices method getExecutionsForParticipant.

private List<Execution> getExecutionsForParticipant(Participant participant) {
    Interaction interaction = (Interaction) participant.eContainer();
    List<Execution> result = new ArrayList<Execution>();
    for (Execution execution : interaction.getExecutions()) {
        if (participant.equals(execution.getOwner())) {
            result.add(execution);
        }
    }
    return result;
}
Also used : Execution(org.obeonetwork.dsl.interaction.Execution) Interaction(org.obeonetwork.dsl.interaction.Interaction) ArrayList(java.util.ArrayList)

Example 4 with Execution

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

the class InteractionServices method computeExecutionDepth.

/**
 * Computes the depth of an Execution. If the EObject is not an Execution,
 * this method returns 0.
 *
 * @param eobject the EObject to find the depth if it is an Execution
 * @param nbOfColors Total number of colors
 * @return the depth if it is an Execution.
 */
public int computeExecutionDepth(EObject eobject, int nbOfColors) {
    int executionDepth = 0;
    if (eobject instanceof Execution) {
        Execution currentExecution = (Execution) eobject;
        Participant currentLifeline = currentExecution.getOwner();
        End start = currentExecution.getStartingEnd();
        EObject eContainer = start.eContainer();
        EList<EObject> eContents = eContainer.eContents();
        int startIndex = eContents.lastIndexOf(start);
        List<EObject> contents = eContents.subList(0, startIndex);
        for (EObject obj : contents) {
            if (obj instanceof End) {
                End end = (End) obj;
                if (end.isExecutionEnd()) {
                    Execution execution = end.getExecution();
                    if (currentLifeline != null && execution != null && currentLifeline.equals(execution.getOwner())) {
                        if (execution.getStartingEnd().equals(end)) {
                            executionDepth++;
                        } else if (execution.getFinishingEnd().equals(end)) {
                            executionDepth--;
                        }
                    }
                }
            }
        }
    }
    return getColorDepth(executionDepth, nbOfColors);
}
Also used : Execution(org.obeonetwork.dsl.interaction.Execution) Participant(org.obeonetwork.dsl.interaction.Participant) EObject(org.eclipse.emf.ecore.EObject) End(org.obeonetwork.dsl.interaction.End)

Aggregations

Execution (org.obeonetwork.dsl.interaction.Execution)4 End (org.obeonetwork.dsl.interaction.End)2 ArrayList (java.util.ArrayList)1 EObject (org.eclipse.emf.ecore.EObject)1 Interaction (org.obeonetwork.dsl.interaction.Interaction)1 Participant (org.obeonetwork.dsl.interaction.Participant)1 ExecutionPropertiesEditionPart (org.obeonetwork.dsl.interaction.parts.ExecutionPropertiesEditionPart)1