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;
  }
 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;
 }
Esempio n. 3
0
 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;
 }