public static InstanceStateMachine_c getOneSM_ISMOnR518(
      ModelRoot modelRoot, ModelClass_c target, ClassQueryInterface_c test, boolean loadComponent) {
    InstanceStateMachine_c result = null;

    result = find_getOneSM_ISMOnR518(modelRoot, target, test);
    if (result == null && (loadComponent)) {
      // Containment Relation
      List comps =
          PersistenceManager.findAllChildComponents(
              target.getPersistableComponent(), modelRoot, InstanceStateMachine_c.class);
      for (int i = 0; i < comps.size(); i++) {
        PersistableModelComponent component = (PersistableModelComponent) comps.get(i);
        if (!component.isLoaded()) {
          try {
            component.load(new NullProgressMonitor());
            result = find_getOneSM_ISMOnR518(modelRoot, target, test);
            if (result != null) return result;
          } catch (Exception e) {
            CorePlugin.logError("Error Loading component", e);
          }
        }
      }
    }

    return result;
  }
  private void COMM_COMM_NewClassParticipant(IStructuredSelection selection) {
    // Assign the context selection variables with the action context
    // Assign the context selection variable with the action context
    Object context = selection.iterator().next();
    Communication_c v_comm = (Communication_c) context;
    PersistableModelComponent.ensureCoreDataTypesAvailable(v_comm.getModelRoot());

    TransactionUtil.TransactionGroup transactionGroup =
        TransactionUtil.startTransactionsOnSelectedModelRoots("New Class Participant");
    try {
      // Ensure that actions take place between Verifier Activity executions
      Ooaofooa.beginSaveOperation();
      if (((v_comm != null))) {

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

      // end critical section
      Ooaofooa.endSaveOperation();
      // catch all exceptions and cancel the transactions
    } catch (Exception e) {
      Ooaofooa.endSaveOperation();
      TransactionUtil.cancelTransactions(transactionGroup, e);
      CorePlugin.logError("Transaction: New Class Participant failed", e); // $NON-NLS-1$
    }
    TransactionUtil.endTransactions(transactionGroup);
  }
 public Object getAdapter(Class adapter) {
   Object superAdapter = super.getAdapter(adapter);
   if (superAdapter != null) {
     return superAdapter;
   }
   if (adapter == org.eclipse.core.resources.IResource.class) {
     PersistableModelComponent comp = getPersistableComponent(false);
     if (comp != null) {
       return comp.getFile().getParent();
     }
   } else if (adapter == org.eclipse.core.resources.IFile.class) {
     PersistableModelComponent comp = getPersistableComponent(false);
     if (comp != null) {
       return comp.getFile();
     }
   }
   return null;
 }
 public static InformalArgument_c InformalArgumentInstance(
     ModelRoot modelRoot, ClassQueryInterface_c test, boolean loadComponent) {
   InformalArgument_c result = findInformalArgumentInstance(modelRoot, test, loadComponent);
   if (result == null && loadComponent) {
     List pmcs = PersistenceManager.findAllComponents(modelRoot, InformalArgument_c.class);
     for (int i = 0; i < pmcs.size(); i++) {
       PersistableModelComponent component = (PersistableModelComponent) pmcs.get(i);
       if (!component.isLoaded()) {
         try {
           component.load(new NullProgressMonitor());
           result = findInformalArgumentInstance(modelRoot, test, loadComponent);
           if (result != null) return result;
         } catch (Exception e) {
           CorePlugin.logError("Error Loading component", e);
         }
       }
     }
   }
   if (result != null && loadComponent) {
     result.loadProxy();
   }
   return result;
 }
  private void CNST_CSP_NewConstant(IStructuredSelection selection) {
    // Assign the context selection variables with the action context
    // Assign the context selection variable with the action context
    Object context = selection.iterator().next();
    ConstantSpecification_c v_csp = (ConstantSpecification_c) context;
    PersistableModelComponent.ensureCoreDataTypesAvailable(v_csp.getModelRoot());

    TransactionUtil.TransactionGroup transactionGroup =
        TransactionUtil.startTransactionsOnSelectedModelRoots("New Constant");
    boolean abortTransaction = false;
    try {
      // Ensure that actions take place between Verifier Activity executions
      Ooaofooa.beginSaveOperation();
      if (v_csp != null) {
        v_csp.Newliteralsymbolicconstant();
      } else {
        Throwable t = new Throwable();
        t.fillInStackTrace();
        CorePlugin.logError("Attempted to call an operation on a null instance.", t);
      }

      NonRootModelElement[] children =
          LiteralSymbolicConstant_c.getManyCNST_LSCsOnR1503(
              LeafSymbolicConstant_c.getManyCNST_LFSCsOnR1502(
                  SymbolicConstant_c.getManyCNST_SYCsOnR1504(v_csp)));

      NonRootModelElement newElement = children[children.length - 1];
      IPreferenceStore store = CorePlugin.getDefault().getPreferenceStore();
      boolean option = store.getBoolean(BridgePointPreferencesStore.USE_DEFAULT_NAME_FOR_CREATION);
      if (!option) {
        String oldName = RenameActionUtil.getElementName(newElement);
        boolean performRename =
            UIUtil.inputDialog(
                null,
                "Element Creation",
                "Enter the name:",
                oldName,
                UIUtil.newRenameValidator(newElement));
        if (performRename) {
          String proposedName = UIUtil.inputDialogResult;
          RenameActionUtil.setElementName(newElement, proposedName);
          newElement.setComponent(null);
        } else {
          abortTransaction = true;
        }
      }
      // end critical section
      Ooaofooa.endSaveOperation();
      // catch all exceptions and cancel the transactions
    } catch (Exception e) {
      Ooaofooa.endSaveOperation();
      TransactionUtil.cancelTransactions(transactionGroup, e);
      CorePlugin.logError("Transaction: New Constant failed", e); // $NON-NLS-1$
    }
    if ((!CorePlugin.getDefault()
            .getPreferenceStore()
            .getBoolean(BridgePointPreferencesStore.USE_DEFAULT_NAME_FOR_CREATION))
        && abortTransaction) {
      TransactionUtil.cancelTransactions(transactionGroup);
    } else {
      TransactionUtil.endTransactions(transactionGroup);
    }
  }
  @Override
  protected void setUp() throws Exception {
    if (!initialized) delayGlobalUpgrade = true;
    super.setUp();

    if (!initialized) {
      CorePlugin.disableParseAllOnResourceChange();

      // set perspective switch dialog on launch
      DebugUIPlugin.getDefault()
          .getPluginPreferences()
          .setValue(IDebugUIConstants.PLUGIN_ID + ".switch_to_perspective", "always");

      CorePlugin.getDefault()
          .getPluginPreferences()
          .setDefault(BridgePointPreferencesStore.ALLOW_IMPLICIT_COMPONENT_ADDRESSING, true);

      CorePlugin.getDefault()
          .getPluginPreferences()
          .setValue(BridgePointPreferencesStore.SHOW_EVENT_PARAMETERS, true);

      // initialize test model
      final IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);

      File sourceProject = new File(m_workspace_path + "../" + projectName);

      TestingUtilities.copyProjectContents(sourceProject, project);

      TestingUtilities.allowJobCompletion();

      TestingUtilities.allowJobCompletion();

      m_sys =
          SystemModel_c.SystemModelInstance(
              Ooaofooa.getDefaultInstance(),
              new ClassQueryInterface_c() {

                public boolean evaluate(Object candidate) {
                  return ((SystemModel_c) candidate).getName().equals(project.getName());
                }
              });

      PersistableModelComponent sys_comp = m_sys.getPersistableComponent();
      sys_comp.loadComponentAndChildren(new NullProgressMonitor());

      CorePlugin.enableParseAllOnResourceChange();

      TestingUtilities.allowJobCompletion();
      while (!ResourcesPlugin.getWorkspace().getRoot().isSynchronized(IProject.DEPTH_INFINITE)) {
        ResourcesPlugin.getWorkspace()
            .getRoot()
            .refreshLocal(IProject.DEPTH_INFINITE, new NullProgressMonitor());
        while (PlatformUI.getWorkbench().getDisplay().readAndDispatch()) ;
      }

      Ooaofooa.setPersistEnabled(true);
      delayGlobalUpgrade = false;

      initialized = true;
    }
  }