Search in sources :

Example 1 with DestroyParticipantMessage

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

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

Example 2 with DestroyParticipantMessage

use of org.obeonetwork.dsl.interaction.DestroyParticipantMessage 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

DestroyParticipantMessage (org.obeonetwork.dsl.interaction.DestroyParticipantMessage)2 ArrayList (java.util.ArrayList)1 EObject (org.eclipse.emf.ecore.EObject)1 Interaction (org.obeonetwork.dsl.interaction.Interaction)1 Message (org.obeonetwork.dsl.interaction.Message)1 DestroyParticipantMessagePropertiesEditionPart (org.obeonetwork.dsl.interaction.parts.DestroyParticipantMessagePropertiesEditionPart)1