Example #1
0
 /**
  * compute the path of a {@link BaseState}
  *
  * @param bs
  * @return the path
  */
 private QualifiedName getStatePath(BaseState bs) {
   EObject parent = bs.eContainer().eContainer();
   if (parent instanceof BaseState) return getStatePath((BaseState) parent).append(bs.getName());
   else if (parent instanceof RefinedState) {
     BaseState base = ((RefinedState) parent).getBase();
     if (base != null) return getStatePath(base).append(bs.getName());
   }
   return QualifiedName.create(bs.getName());
 }
Example #2
0
  private IScope getStateScopes(EObject obj) {
    final List<IEObjectDescription> scopes = new ArrayList<IEObjectDescription>();

    // first state in container hierarchy
    StateGraph parent = getStateGraph(obj);

    // collect states of my parent
    if (parent != null) {
      for (State s : parent.getStates()) {
        BaseState bs = getBaseState(s);
        scopes.add(EObjectDescription.create(bs.getName(), bs));
      }

      // if my parent is a refined state we also add its base state contents
      if (parent.eContainer() instanceof RefinedState) {
        parent = ((RefinedState) parent.eContainer()).getBase().getSubgraph();
        if (parent != null)
          for (State s : parent.getStates()) {
            BaseState bs = getBaseState(s);
            scopes.add(EObjectDescription.create(bs.getName(), bs));
          }
      } else if (parent.eContainer() instanceof ActorClass) {
        ActorClass ac = (ActorClass) parent.eContainer();
        if (ac.getBase() != null) {
          for (State s : ac.getBase().getStateMachine().getStates()) {
            BaseState bs = getBaseState(s);
            scopes.add(EObjectDescription.create(bs.getName(), bs));
          }
        }
      }
    }
    return new SimpleScope(IScope.NULLSCOPE, scopes);
  }