0

I have the .uml file which contains the UML state machine, transitions and states. I managed to put a marker on the objects in this .uml file, but cannot put a marker on their graphical representation located in a .aird file. This is the code I use to put markers :

public static void addMarker(EObject eObj, String message, String location, int severity) throws CoreException{
  Resource resource = eObj.eResource();
  String uri = EcoreUtil.getURI(eObj).toString();
  String platformString = resource.getURI().toPlatformString(true);
  IResource iresource = ResourcesPlugin.getWorkspace().getRoot().findMember(platformString);
  IMarker imarker = iresource.createMarker(EValidator.MARKER);
  imarker.setAttribute(IMarker.SEVERITY, severity);
  imarker.setAttribute(IMarker.LOCATION, location);
  imarker.setAttribute(EValidator.URI_ATTRIBUTE, uri);
  imarker.setAttribute(IMarker.MESSAGE, message);
}

This is the code I use to find the graphical representation :

for(DView dview : SessionManager.INSTANCE.getSession(eObj).getOwnedViews()){
  if(dview.getViewpoint().getName().equals("Design")){
    for(DRepresentation drep : dview.getOwnedRepresentations()){
      for(DRepresentationElement drepElem : drep.getOwnedRepresentationElements()){
        if(drepElem.getTarget() == st.getSrcTransition().getTransition()){
          MarkerUtil.addMarker(drepElem, message, location, severity);
        }
      }
    }
  } 
}

When I try to go to the marker of the graphical representation of a transition, it highlights the state machine. Below are the URIs of a transition :

platform:/resource/TestSuite/default.uml#_igwUwDFJEealS5qn_7gKFw platform:/resource/TestSuite/representations.aird#_igwUwTFJEealS5qn_7gKFw

1 Answers1

0

I am not used to work with markers but I think that the marker should appear at the left corner of the box containing your edge. Consequently your marker might be out of your diagram. If you want o explicitly add it on the transition you should check at least the type is a DEdge.

If you need more details you can ask questions about Sirius on the Eclipse forum.

Mélanie Bats
  • 249
  • 2
  • 4