Search in sources :

Example 6 with Interaction

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

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

Example 7 with Interaction

use of org.obeonetwork.dsl.interaction.Interaction 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 8 with Interaction

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

the class DeleteServices method getMessagesForParticipant.

private List<Message> getMessagesForParticipant(Participant participant) {
    Interaction interaction = (Interaction) participant.eContainer();
    List<Message> result = new ArrayList<Message>();
    for (Message message : interaction.getMessages()) {
        if (message.getStartingEnd() != null && participant.equals(message.getStartingEnd().getContext())) {
            result.add(message);
        } else if (message.getFinishingEnd() != null && participant.equals(message.getFinishingEnd().getContext())) {
            result.add(message);
        }
    }
    return result;
}
Also used : Message(org.obeonetwork.dsl.interaction.Message) Interaction(org.obeonetwork.dsl.interaction.Interaction) ArrayList(java.util.ArrayList)

Example 9 with Interaction

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

the class DeleteServices method getInteractionUsesForParticipant.

private List<InteractionUse> getInteractionUsesForParticipant(Participant participant) {
    Interaction interaction = (Interaction) participant.eContainer();
    List<InteractionUse> result = new ArrayList<InteractionUse>();
    for (InteractionUse interactionUse : interaction.getInteractionUses()) {
        if (interactionUse.getCoveredParticipants().size() == 1 && interactionUse.getCoveredParticipants().contains(participant)) {
            result.add(interactionUse);
        }
    }
    return result;
}
Also used : Interaction(org.obeonetwork.dsl.interaction.Interaction) ArrayList(java.util.ArrayList) InteractionUse(org.obeonetwork.dsl.interaction.InteractionUse)

Example 10 with Interaction

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

the class InteractionServices method isPointedByDestroyMessage.

/**
 * Return true if the context is pointed by a DestroyParticipantMessage.
 * @param context the context on which is applied the service
 * @return boolean, true if the context is pointed by a DestroyParticipantMessage, false otherwise
 */
public boolean isPointedByDestroyMessage(Participant context) {
    boolean isPointedByDestroyMessage = false;
    Interaction interaction = null;
    EObject container = context.eContainer();
    while (container != null) {
        if (container instanceof Interaction) {
            interaction = (Interaction) container;
            // loop output
            container = null;
        } else {
            container = container.eContainer();
        }
    }
    if (interaction != null) {
        List<Message> messages = interaction.getMessages();
        List<DestroyParticipantMessage> destroyParticipantMesssages = new ArrayList<DestroyParticipantMessage>();
        for (Message message : messages) {
            // Retrieve DestroParticipantMessage
            if (message instanceof DestroyParticipantMessage) {
                destroyParticipantMesssages.add((DestroyParticipantMessage) message);
            }
        }
        for (DestroyParticipantMessage destroyParticipantMessage : destroyParticipantMesssages) {
            // Retrieve the finishingEnd that the context is the same as parameter
            if (destroyParticipantMessage.getFinishingEnd().getContext() == context) {
                isPointedByDestroyMessage = true;
            }
        }
    }
    return isPointedByDestroyMessage;
}
Also used : DestroyParticipantMessage(org.obeonetwork.dsl.interaction.DestroyParticipantMessage) Message(org.obeonetwork.dsl.interaction.Message) DestroyParticipantMessage(org.obeonetwork.dsl.interaction.DestroyParticipantMessage) Interaction(org.obeonetwork.dsl.interaction.Interaction) EObject(org.eclipse.emf.ecore.EObject) ArrayList(java.util.ArrayList)

Aggregations

Interaction (org.obeonetwork.dsl.interaction.Interaction)13 ArrayList (java.util.ArrayList)9 EObject (org.eclipse.emf.ecore.EObject)4 Message (org.obeonetwork.dsl.interaction.Message)3 RecordingCommand (org.eclipse.emf.transaction.RecordingCommand)2 TransactionalEditingDomain (org.eclipse.emf.transaction.TransactionalEditingDomain)2 Session (org.eclipse.sirius.business.api.session.Session)2 DestroyParticipantMessage (org.obeonetwork.dsl.interaction.DestroyParticipantMessage)2 End (org.obeonetwork.dsl.interaction.End)2 InteractionUse (org.obeonetwork.dsl.interaction.InteractionUse)2 Collection (java.util.Collection)1 Stack (java.util.Stack)1 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)1 ECrossReferenceAdapter (org.eclipse.emf.ecore.util.ECrossReferenceAdapter)1 EObjectFlatComboSettings (org.eclipse.emf.eef.runtime.ui.widgets.eobjflatcombo.EObjectFlatComboSettings)1 InputDialog (org.eclipse.jface.dialogs.InputDialog)1 Viewer (org.eclipse.jface.viewers.Viewer)1 ViewerFilter (org.eclipse.jface.viewers.ViewerFilter)1 ModelAccessor (org.eclipse.sirius.ecore.extender.business.api.accessor.ModelAccessor)1 IEditingSession (org.eclipse.sirius.ui.business.api.session.IEditingSession)1