Esempio n. 1
0
  public static ArrayList<TransitionDetails> readVertices(Vertex vertex, SM smDetails) {
    State state = (State) vertex;
    ArrayList<TransitionDetails> transition = new ArrayList<>();
    EList<Transition> outgoingTransitions = state.getOutgoings();
    for (Transition trans : outgoingTransitions) {

      if (state.eClass() != UMLPackage.Literals.PSEUDOSTATE) {
        // System.out.println("Source : "+trans.getSource().getLabel());
        // System.out.println("Dest : "+trans.getTarget().getLabel());
        TransitionDetails temp = transitionDetails(trans);
        temp.setName(trans.getLabel());
        temp.setDest(trans.getTarget().getLabel());
        transition.add(temp);
      }
    }
    return transition;
  }
Esempio n. 2
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.papyrus.uml.diagram.sequence.parsers.MessageFormatParser#
  * getPrintString(org.eclipse .core.runtime.IAdaptable, int)
  */
 public String getPrintString(IAdaptable element, int flags) {
   StringBuffer label = new StringBuffer();
   Object obj = element.getAdapter(EObject.class);
   if (obj instanceof Pin) {
     Pin pin = (Pin) obj;
     String name = pin.getName();
     if (name == null) {
       name = "";
     }
     label.append(name);
     if (pin.getInStates() != null) {
       // manage states
       StringBuffer stateLabel = new StringBuffer();
       for (State state : pin.getInStates()) {
         if (state != null) {
           String stateName = state.getName();
           if (stateName == null) {
             stateName = "";
           }
           if (!"".equals(stateName)) {
             if (stateLabel.length() > 0) {
               stateLabel.append(STATE_SEPARATOR);
             }
             stateLabel.append(stateName);
           }
         }
       }
       if (stateLabel.length() > 0) {
         label.append(String.format(STATE_DISPLAY, stateLabel.toString()));
       }
     }
   }
   if (label.length() == 0) {
     label.append(" ");
   }
   return label.toString();
 }