@Override
 public void setUp() throws Exception {
   super.setUp();
   CorePlugin.getDefault()
       .getPreferenceStore()
       .setValue(BridgePointPreferencesStore.USE_DEFAULT_NAME_FOR_CREATION, false);
   Ooaofooa.setPersistEnabled(true);
 }
  @Test
  public void setUpGlobalSetting() throws CoreException {

    // turn off autobuild to stop MC-3020 builders from running
    WorkspaceUtil.setAutobuilding(false); // throws CoreException
    CorePlugin.getDefault()
        .getPreferenceStore()
        .setValue(BridgePointPreferencesStore.USE_DEFAULT_NAME_FOR_CREATION, true);
  }
 @Override
 public void tearDown() {
   errorTxt = "";
   while (PlatformUI.getWorkbench().getDisplay().readAndDispatch()) ;
   UITestingUtilities.clearGraphicalSelection();
   CorePlugin.getDefault()
       .getPreferenceStore()
       .setValue(BridgePointPreferencesStore.USE_DEFAULT_NAME_FOR_CREATION, true);
   Ooaofooa.setPersistEnabled(false);
 }
  private IMarker[] parseModel(NonRootModelElement testElement) throws CoreException {
    BaseTest.dispatchEvents(0);
    try {
      Bundle ui_text = Platform.getBundle("org.xtuml.bp.ui.text"); // $NON-NLS-1$
      Class<?> factoryClass =
          ui_text.loadClass("org.xtuml.bp.ui.text.activity.AllActivityModifier"); // $NON-NLS-1$

      // find the constructor that takes package and monitor as parameters
      Class<?>[] arg_types = new Class[] {testElement.getClass(), IProgressMonitor.class};
      Constructor<?> ctor = factoryClass.getDeclaredConstructor(arg_types);

      // invoke the constructor to create an instance
      Object[] args = new Object[] {testElement, new NullProgressMonitor()};
      IAllActivityModifier aam = (IAllActivityModifier) ctor.newInstance(args);

      aam.processAllActivities(IAllActivityModifier.PARSE);
    } catch (ClassNotFoundException cnf) {
      CorePlugin.logError("Problem loading activity parser ", cnf);
    } catch (IllegalAccessException i) {
      CorePlugin.logError("Problem loading activity parser ", i);
    } catch (InstantiationException i) {
      CorePlugin.logError("Problem loading activity parser ", i);
    } catch (InvocationTargetException e) {
      CorePlugin.logError("Problem running activity parser ", e);
    } catch (SecurityException e) {
      CorePlugin.logError("Problem running activity parser ", e);
    } catch (NoSuchMethodException e) {
      CorePlugin.logError("Problem running activity parser ", e);
    }
    return collectParseErrors(testElement);
  }
  @Before
  public void setUp() throws Exception {
    super.setUp();
    if (!initialized) {
      CorePlugin.disableParseAllOnResourceChange();
      TestVerifierRunTimeErrorMsgs.projectName = projectName;

      // 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);

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

      loadProject(projectName);

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

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

      Ooaofooa.setPersistEnabled(true);
      delayGlobalUpgrade = false;
      modelRoot = (Ooaofooa) m_sys.getModelRoot();
      initialized = true;
    }
  }
 protected void setupProjectAndTestModel() throws CoreException {
   String path = getProperty("mdlClassPath");
   if (path != null) mdlClassPath = new Path(path);
   reCopy = getProperty("reCopy", reCopy);
   if (!toRunTests()) {
     if (reCopy) {
       setupProject(projectName);
       CorePlugin.disableParseAllOnResourceChange();
       while (Display.getCurrent().readAndDispatch()) ;
       ensureAvailableAndLoaded(domainName, false, true);
       reCopy = false;
     } else {
       setupProject(projectName);
     }
   }
 }
  protected void setUp() throws Exception {
    super.setUp();
    String componentPackageName = "Arrays";
    PersistableModelComponent domainComponentPackage =
        ensureAvailableAndLoaded(
            projectName, componentPackageName, false, false, "Component Package");
    arrayModelRoot = (Ooaofooa) domainComponentPackage.getRootModelElement().getModelRoot();

    IPreferenceStore store = CorePlugin.getDefault().getPreferenceStore();
    store.setValue(BridgePointPreferencesStore.ALLOW_IMPLICIT_COMPONENT_ADDRESSING, true);

    class ComponentNameTest implements ClassQueryInterface_c {
      public boolean evaluate(Object candidate) {
        Component_c selected = (Component_c) candidate;
        return selected.getName().equals("SingleDimensionFixedArrays");
      }
    }
    Component_c comp = Component_c.ComponentInstance(arrayModelRoot, new ComponentNameTest());

    populateFunctionInstances();
    populateBridgeInstances();
    class Object_test1_c implements ClassQueryInterface_c {
      Object_test1_c(String id) {
        m_id = id;
      }

      private String m_id;

      public boolean evaluate(Object inst) {
        ModelClass_c selected = (ModelClass_c) inst;
        return selected.getKey_lett().equals(m_id);
      }
    }
    ModelClass_c testObj =
        ModelClass_c.ModelClassInstance(arrayModelRoot, new Object_test1_c("A_T")); // $NON-NLS-1$

    populateTransformerInstances(testObj, false);

    populateInterfaceOperationInstances(comp, "Port1", true);
    populateInterfaceOperationInstances(comp, "Port2", false);
    populateArrayStateActionInstances();
  }
Beispiel #8
0
 protected static int getDebugTimeout() {
   IPreferenceStore store = CorePlugin.getDefault().getPreferenceStore();
   // convert setting to milliseconds
   return store.getInt("bridgepoint_prefs_start_up_time") * 1000;
 }
 public static boolean getEmitRTODataWorkspaceSetting() {
   IPreferenceStore wkspPrefs = CorePlugin.getDefault().getPreferenceStore();
   boolean rVal = wkspPrefs.getBoolean(BridgePointPreferencesStore.EMIT_RTO_DATA);
   return rVal;
 }
 @Before
 public void setUp() throws Exception {
   super.setUp();
   CorePlugin.disableParseAllOnResourceChange();
   setupProjectAndTestModel();
 }
public class SynchronizationDecorator implements ILightweightLabelDecorator {

  private static final ImageDescriptor SYNC_OVERLAY =
      CorePlugin.getImageDescriptor("warning_co.gif");
  public static final String ID =
      "org.xtuml.bp.ui.explorer.synchronizationDecorator"; //$NON-NLS-1$

  @Override
  public void decorate(Object element, IDecoration decoration) {
    // rather than check the class for the isSynchronizedMethod through
    // reflection, only consider the known classes
    if (!isSynchronized(element)) {
      decoration.addOverlay(SYNC_OVERLAY, IDecoration.BOTTOM_LEFT);
    }
  }

  private boolean isSynchronized(Object element) {
    if (element instanceof NonRootModelElement) {
      NonRootModelElement nrme = (NonRootModelElement) element;
      if (nrme.Issynchronized()) {
        // check children as well
        return childrenAreSynchronized(nrme);
      } else {
        return false;
      }
    }
    return true;
  }

  private boolean childrenAreSynchronized(NonRootModelElement element) {
    boolean result = true;
    result = element.Issynchronized();
    if (result) {
      List<?> children = new ArrayList<Object>();
      element.Collectreferencesforsynchronization(children, Synchronizationtype_c.Pull);
      for (Object child : children) {
        if (((NonRootModelElement) child).getModelRoot() instanceof Ooaofooa) {
          result = childrenAreSynchronized((NonRootModelElement) child);
          if (!result) {
            return result;
          }
        }
      }
    }
    return result;
  }

  @Override
  public void addListener(ILabelProviderListener listener) {
    // not required
  }

  @Override
  public void dispose() {
    // not required
  }

  @Override
  public boolean isLabelProperty(Object element, String property) {
    // not required
    return false;
  }

  @Override
  public void removeListener(ILabelProviderListener listener) {
    // not required
  }
}