[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.modeling.mdt.uml2.uml] Re: UML Interactions via the API

Ken,

you were right, it has been discussed earlier but no code example. Just in case anyone else needs to know how, the following code snippet is how you do it off the version 1.03 API (Using IBM RSA6 hence the old API)

Object collaborationElement = iterator.next();
if(collaborationElement instanceof Interaction) {
Interaction interaction = (Interaction) collaborationElement;
EList fragments = interaction.getFragments();
for (Iterator fragmentIterator = fragments.iterator(); fragmentIterator.hasNext();) {
Object fragment = fragmentIterator.next();
if(fragment instanceof ExecutionOccurrence) {
ExecutionOccurrence eo = (ExecutionOccurrence) fragment;
} else if(fragment instanceof EventOccurrence) {
EventOccurrence eo = (EventOccurrence) fragment;
if(eo.getSendMessage() != null) {
logger.trace("Message " + eo.getSendMessage().getName());
}
}
}