public static ElementInMove_c[] getManyGD_EIMsOnR25(
      GraphicalElement_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {

    if (targets == null || targets.length == 0 || targets[0] == null) return new ElementInMove_c[0];

    ModelRoot modelRoot = targets[0].getModelRoot();

    InstanceList instances = modelRoot.getInstanceList(ElementInMove_c.class);

    Vector matches = new Vector();
    for (int i = 0; i < targets.length; i++) {
      synchronized (targets[i].backPointer_IsMovingInElementInMoveIsMovingIn_R25) {
        for (int j = 0;
            j < targets[i].backPointer_IsMovingInElementInMoveIsMovingIn_R25.size();
            ++j) {
          ElementInMove_c source =
              (ElementInMove_c) targets[i].backPointer_IsMovingInElementInMoveIsMovingIn_R25.get(j);
          if (source != null && (test == null || test.evaluate(source))) {
            matches.add(source);
          }
        }
      }
    }
    if (matches.size() > 0) {
      ElementInMove_c[] ret_set = new ElementInMove_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new ElementInMove_c[0];
    }
  }
Esempio n. 2
0
  public void batchRelate(
      ModelRoot modelRoot, boolean relateProxies, boolean notifyChanges, boolean searchAllRoots) {
    InstanceList instances = null;
    ModelRoot baseRoot = modelRoot;

    // R301
    Graphelement_c relInst21771 =
        (Graphelement_c)
            baseRoot.getInstanceList(Graphelement_c.class).get(new Object[] {m_elementid});
    // if there was no local element, check for any global elements
    // failing that proceed to check other model roots
    if (relInst21771 == null) {
      relInst21771 =
          (Graphelement_c)
              Ooaofooa.getDefaultInstance()
                  .getInstanceList(Graphelement_c.class)
                  .get(new Object[] {m_elementid});
    }
    // synchronized
    if (relInst21771 != null) {
      if (relateProxies || !isProxy() || (inSameComponent(this, relInst21771) && !isProxy())) {
        relInst21771.relateAcrossR301To(this, notifyChanges);
      }
    }
  }
  public static ElementInMove_c resolveInstance(
      ModelRoot modelRoot,
      java.util.UUID p_m_elementid,
      java.util.UUID p_m_diagramid,
      float p_m_startingx,
      float p_m_startingy) {
    InstanceList instances = modelRoot.getInstanceList(ElementInMove_c.class);
    ElementInMove_c source = null;
    synchronized (instances) {
      Object[] key = {p_m_elementid, p_m_diagramid};
      source = (ElementInMove_c) instances.get(key);
      if (source != null && !modelRoot.isCompareRoot()) {
        source.convertFromProxy();
        source.batchUnrelate();
        // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
        source.m_elementid = IdAssigner.preprocessUUID(p_m_elementid);
        // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
        source.m_diagramid = IdAssigner.preprocessUUID(p_m_diagramid);
        source.m_startingx = p_m_startingx;
        source.m_startingy = p_m_startingy;

        return source;
      }
    }
    // there is no instance matching the id
    ElementInMove_c new_inst =
        new ElementInMove_c(modelRoot, p_m_elementid, p_m_diagramid, p_m_startingx, p_m_startingy);
    return new_inst;
  }
 public static ElementInMove_c createProxy(
     ModelRoot modelRoot,
     java.util.UUID p_m_elementid,
     java.util.UUID p_m_diagramid,
     float p_m_startingx,
     float p_m_startingy,
     String p_contentPath,
     IPath p_localPath) {
   ModelRoot resolvedModelRoot = ModelRoot.findModelRoot(modelRoot, p_contentPath, p_localPath);
   // if a model root was not resolved it is most likely
   // due to a missing file of the proxy, defualt back to
   // the original model root
   if (resolvedModelRoot != null) modelRoot = resolvedModelRoot;
   InstanceList instances = modelRoot.getInstanceList(ElementInMove_c.class);
   ElementInMove_c new_inst = null;
   synchronized (instances) {
     Object[] key = {p_m_elementid, p_m_diagramid};
     new_inst = (ElementInMove_c) instances.get(key);
   }
   String contentPath = PersistenceUtil.resolveRelativePath(p_localPath, new Path(p_contentPath));
   if (modelRoot.isNewCompareRoot()) {
     // for comparisons we do not want to change
     // the content path
     contentPath = p_contentPath;
   }
   if (new_inst != null && !modelRoot.isCompareRoot()) {
     PersistableModelComponent pmc = new_inst.getPersistableComponent();
     if (pmc == null) {
       // dangling reference, redo this instance
       new_inst.batchUnrelate();
       // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
       new_inst.m_elementid = IdAssigner.preprocessUUID(p_m_elementid);
       // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
       new_inst.m_diagramid = IdAssigner.preprocessUUID(p_m_diagramid);
       new_inst.m_startingx = p_m_startingx;
       new_inst.m_startingy = p_m_startingy;
     }
   }
   if (new_inst == null) {
     // there is no instance matching the id, create a proxy
     // if the resource doesn't exist then this will be a dangling reference
     new_inst =
         new ElementInMove_c(
             modelRoot, p_m_elementid, p_m_diagramid, p_m_startingx, p_m_startingy);
     new_inst.m_contentPath = contentPath;
   }
   return new_inst;
 }
Esempio n. 5
0
 public static void clearInstances(ModelRoot modelRoot) {
   InstanceList instances = modelRoot.getInstanceList(Graphnode_c.class);
   synchronized (instances) {
     for (int i = instances.size() - 1; i >= 0; i--) {
       ((NonRootModelElement) instances.get(i)).delete_unchecked();
     }
   }
 }
Esempio n. 6
0
 public static void batchRelateAll(
     ModelRoot modelRoot, boolean notifyChanges, boolean searchAllRoots, boolean relateProxies) {
   InstanceList instances = modelRoot.getInstanceList(Graphnode_c.class);
   synchronized (instances) {
     Iterator<NonRootModelElement> cursor = instances.iterator();
     while (cursor.hasNext()) {
       final Graphnode_c inst = (Graphnode_c) cursor.next();
       inst.batchRelate(modelRoot, relateProxies, notifyChanges, searchAllRoots);
     }
   }
 }
Esempio n. 7
0
  public static Graphnode_c resolveInstance(
      ModelRoot modelRoot, float p_m_width, float p_m_height, java.util.UUID p_m_elementid) {
    InstanceList instances = modelRoot.getInstanceList(Graphnode_c.class);
    Graphnode_c source = null;
    synchronized (instances) {
      Object[] key = {p_m_elementid};
      source = (Graphnode_c) instances.get(key);
      if (source != null && !modelRoot.isCompareRoot()) {
        source.convertFromProxy();
        source.batchUnrelate();
        source.m_width = p_m_width;
        source.m_height = p_m_height;
        // pre-process the uuid so that we re-use null uuid instance rather then creating a new one.
        source.m_elementid = IdAssigner.preprocessUUID(p_m_elementid);

        return source;
      }
    }
    // there is no instance matching the id
    Graphnode_c new_inst = new Graphnode_c(modelRoot, p_m_width, p_m_height, p_m_elementid);
    return new_inst;
  }
Esempio n. 8
0
 private static Graphnode_c findGraphnodeInstance(
     ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) {
   InstanceList instances = modelRoot.getInstanceList(Graphnode_c.class);
   synchronized (instances) {
     for (int i = 0; i < instances.size(); ++i) {
       Graphnode_c x = (Graphnode_c) instances.get(i);
       if (test == null || test.evaluate(x)) {
         return x;
       }
     }
   }
   return null;
 }
Esempio n. 9
0
  public static Graphnode_c[] getManyDIM_NDsOnR301(
      Graphelement_c[] targets, ClassQueryInterface_c test, boolean loadComponent) {

    if (targets == null || targets.length == 0 || targets[0] == null) return new Graphnode_c[0];

    ModelRoot modelRoot = targets[0].getModelRoot();

    InstanceList instances = modelRoot.getInstanceList(Graphnode_c.class);

    Vector matches = new Vector();
    for (int i = 0; i < targets.length; i++) {
      Graphnode_c source = (Graphnode_c) targets[i].backPointer_IsSubtypeGraphnodeIsSubtype_R301;
      if (source != null && (test == null || test.evaluate(source))) {
        matches.add(source);
      }
    }
    if (matches.size() > 0) {
      Graphnode_c[] ret_set = new Graphnode_c[matches.size()];
      matches.copyInto(ret_set);
      return ret_set;
    } else {
      return new Graphnode_c[0];
    }
  }
Esempio n. 10
0
 public static Graphnode_c[] GraphnodeInstances(
     ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) {
   InstanceList instances = modelRoot.getInstanceList(Graphnode_c.class);
   Vector matches = new Vector();
   synchronized (instances) {
     for (int i = 0; i < instances.size(); ++i) {
       Graphnode_c x = (Graphnode_c) instances.get(i);
       if (test == null || test.evaluate(x)) {
         matches.add(x);
       }
     }
     if (matches.size() > 0) {
       Graphnode_c[] ret_set = new Graphnode_c[matches.size()];
       matches.copyInto(ret_set);
       return ret_set;
     } else {
       return new Graphnode_c[0];
     }
   }
 }
  public boolean performFinish() {
    TransactionUtil.TransactionGroup transactionGroup = null;
    ModelRoot modelRoot = v_syncMessage.getModelRoot();
    try {
      transactionGroup =
          TransactionUtil.startTransactionsOnSelectedModelRoots(
              "Interface Operation Formalize"); //$NON-NLS-1$
      Message_c v_message = Message_c.getOneMSG_MOnR1018(v_syncMessage);

      InteractionParticipant_c v_participant =
          InteractionParticipant_c.getOneSQ_POnR1007(v_message);

      ComponentParticipant_c v_cop = ComponentParticipant_c.getOneSQ_COPOnR930(v_participant);

      if (((v_cop == null))) {

        v_cop =
            ComponentParticipant_c.getOneSQ_COPOnR930(
                InteractionParticipant_c.getOneSQ_POnR940(
                    Lifespan_c.getOneSQ_LSOnR930(v_participant)));
      }

      Component_c v_component =
          (Component_c)
              modelRoot.getInstanceList(Component_c.class).getGlobal(null, Gd_c.Null_unique_id());

      if (((v_cop != null))) {

        v_component = Component_c.getOneC_COnR955(v_cop);
      }

      if (((v_component != null))) {

        if (((v_Operation != null))) {

          if (v_syncMessage != null) {
            v_syncMessage.Formalizewithinterfaceoperation(v_Operation.getId());
          } else {
            Throwable t = new Throwable();
            t.fillInStackTrace();
            CorePlugin.logError("Attempted to call an operation on a null instance.", t);
          }
        }
      }

      // catch all exceptions and cancel the transaction
    } catch (Exception e) {
      if (transactionGroup != null) TransactionUtil.cancelTransactions(transactionGroup, e);
      CorePlugin.logError("Transaction: Interface Operation Formalize failed", e); // $NON-NLS-1$
      // return true so that the wizard will
      // close
      return true;
    }
    if (transactionGroup != null) TransactionUtil.endTransactions(transactionGroup);
    if (m_viewer != null) {
      if (m_viewer instanceof StructuredViewer) {
        ((StructuredViewer) m_viewer).refresh(v_syncMessage);
      } else {
        m_viewer.refresh();
      }
    }
    return true;
  }
  public boolean performFinish() {
    TransactionUtil.TransactionGroup transactionGroup = null;
    ModelRoot modelRoot = v_asyncMessage.getModelRoot();
    try {
      transactionGroup =
          TransactionUtil.startTransactionsOnSelectedModelRoots(
              "Instance Event Formalize"); //$NON-NLS-1$
      Message_c v_message = Message_c.getOneMSG_MOnR1018(v_asyncMessage);

      InteractionParticipant_c v_participant =
          InteractionParticipant_c.getOneSQ_POnR1007(v_message);

      Lifespan_c v_ls = Lifespan_c.getOneSQ_LSOnR930(v_participant);

      ClassInstanceParticipant_c v_cip =
          ClassInstanceParticipant_c.getOneSQ_CIPOnR930(
              InteractionParticipant_c.getOneSQ_POnR940(v_ls));

      ModelClass_c v_cipclass =
          (ModelClass_c)
              modelRoot.getInstanceList(ModelClass_c.class).getGlobal(null, Gd_c.Null_unique_id());

      if (((v_cip != null))) {

        v_cipclass = ModelClass_c.getOneO_OBJOnR934(v_cip);

      } else {

        v_cip =
            ClassInstanceParticipant_c.getOneSQ_CIPOnR930(
                InteractionParticipant_c.getOneSQ_POnR1007(v_message));

        if (((v_cip != null))) {

          Communication_c v_communication =
              Communication_c.getOneCOMM_COMMOnR1126(
                  ParticipantInCommunication_c.getOneCOMM_PICOnR1126(
                      InteractionParticipant_c.getOneSQ_POnR930(v_cip)));

          if (((v_communication != null))) {

            v_cipclass = ModelClass_c.getOneO_OBJOnR934(v_cip);
          }
        }
      }

      if (((v_cipclass != null))) {

        StateMachineEvent_c v_evt =
            StateMachineEvent_c.getOneSM_EVTOnR1009(
                EventMessage_c.getOneMSG_EOnR1019(v_asyncMessage));

        java.util.UUID v_existingId = Gd_c.Null_unique_id();

        if (((v_evt != null))) {

          v_existingId = v_evt.getSmevt_id();
        }

        StateMachine_c v_stateMachine =
            StateMachine_c.getOneSM_SMOnR517(InstanceStateMachine_c.getOneSM_ISMOnR518(v_cipclass));

        StateMachine_c[] v_machines =
            StateMachine_c.getManySM_SMsOnR517(
                InstanceStateMachine_c.getManySM_ISMsOnR518(
                    ModelClass_c.getManyO_OBJsOnR8001(
                        PackageableElement_c.getManyPE_PEsOnR8000(
                            Package_c.getManyEP_PKGsOnR1405(
                                SystemModel_c.getManyS_SYSsOnR1405(
                                    Package_c.getManyEP_PKGsOnR8000(
                                        PackageableElement_c.getManyPE_PEsOnR8001(
                                            v_cipclass))))))));

        if (((v_machines.length == 0))) {

          v_machines =
              StateMachine_c.getManySM_SMsOnR517(
                  InstanceStateMachine_c.getManySM_ISMsOnR518(
                      ModelClass_c.getManyO_OBJsOnR2(
                          Subsystem_c.getManyS_SSsOnR1(
                              Domain_c.getManyS_DOMsOnR1(
                                  Subsystem_c.getManyS_SSsOnR2(v_cipclass))))));
        }

        if (((v_Message != null))) {

          if (v_asyncMessage != null) {
            v_asyncMessage.Formalizewithevent(v_Message.getSmevt_id());
          } else {
            Throwable t = new Throwable();
            t.fillInStackTrace();
            CorePlugin.logError("Attempted to call an operation on a null instance.", t);
          }
        }
      }

      // catch all exceptions and cancel the transaction
    } catch (Exception e) {
      if (transactionGroup != null) TransactionUtil.cancelTransactions(transactionGroup, e);
      CorePlugin.logError("Transaction: Instance Event Formalize failed", e); // $NON-NLS-1$
      // return true so that the wizard will
      // close
      return true;
    }
    if (transactionGroup != null) TransactionUtil.endTransactions(transactionGroup);
    if (m_viewer != null) {
      if (m_viewer instanceof StructuredViewer) {
        ((StructuredViewer) m_viewer).refresh(v_asyncMessage);
      } else {
        m_viewer.refresh();
      }
    }
    return true;
  }