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);
}
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;
}
Aggregations