/**
  * This method may be overridden by subclasses as restore tests are doing.
  *
  * @throws CoreException
  */
 protected void setupProjectAndTestModel() throws CoreException {
   m_sys = getSystemModel(projectName);
   if (firstTime) {
     // ensureAvailableAndLoaded(domainName, false,false);
     loadProject(projectName);
     firstTime = false;
   }
   project = getProjectHandle(projectName);
   modelRoot =
       Ooaofooa.getInstance(
           Ooaofooa.createModelRootId(getProjectHandle(projectName), "MultiLevelModel", true),
           true);
   graphicsModelRoot = Ooaofgraphics.getInstance(modelRoot.getId());
   Ooaofooa.setPersistEnabled(true);
 }
  //  System
  @Test
  public void testRenameSystem_ThruME_NoEditor() throws Exception {
    performRenameComponentThruMEGenerics(
        "SystemModel", projectName, EditorTestUtilities.EDITOR_TYPE_NONE, false, 0);
    if (toRunTests()) // avoid to rename in setup pass
    projectName += "_n"; // projectName changed for coming tests
    //   super.setupProject(projectName);
    // ((BaseTest)this).get// = getProjectHandle(projectName).getProject();
    super.setupProject(projectName);
    m_sys = getSystemModel(projectName);
    modelRoot =
        Ooaofooa.getInstance(
            Ooaofooa.createModelRootId(getProjectHandle(projectName), projectName, true), true);

    //    graphicsModelRoot = Ooaofgraphics.getInstance(modelRoot.getId());
    getProject().delete(true, null);
  }
  /* (non-Javadoc)
   * @see junit.framework.TestCase#setUp()
   */
  protected void setUp() throws Exception {
    super.setUp();

    if (!firstSetup) {

      String modelName = "testOAL1";

      TestingUtilities.importTestingProjectIntoWorkspace("testOAL1");

      project = ResourcesPlugin.getWorkspace().getRoot().getProject("testOAL1");
      m_sys = getSystemModel(project.getName());

      String modelRootId = Ooaofooa.createModelRootId(project, modelName, true);
      modelRoot = Ooaofooa.getInstance(modelRootId, true);
    }

    firstSetup = true;

    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 diskObj =
        ModelClass_c.ModelClassInstance(modelRoot, new Object_test1_c("D_D")); // $NON-NLS-1$
    ModelClass_c libObj =
        ModelClass_c.ModelClassInstance(modelRoot, new Object_test1_c("D_H")); // $NON-NLS-1$
    populateTransformerInstances(diskObj, false);
    populateTransformerInstances(libObj, true);
    populateStateActionInstances();
    populateMDAInstances();
  }
Exemplo n.º 4
0
  /* (non-Javadoc)
   * @see org.eclipse.ui.IPersistableElement#saveState(org.eclipse.ui.IMemento)
   */
  public void saveState(IMemento memento) {
    String root_id = m_input.getModelRoot().getId();
    Ooaofooa modelRoot = Ooaofooa.getInstance(root_id, false);

    memento.putString(GraphicalEditorFactory.TAG_MODELROOTID, m_input.getModelRoot().getId());
    memento.putString(GraphicalEditorFactory.TAG_OOAID, m_input.getOoa_id().toString());
    memento.putInteger(GraphicalEditorFactory.TAG_OOATYPE, m_input.getOoa_type());
    memento.putInteger(GraphicalEditorFactory.TAG_MODELTYPE, m_input.getModel_type());
    NonRootModelElement nrme = (NonRootModelElement) m_input.getRepresents();
    if (nrme == null) {
      nrme =
          (NonRootModelElement)
              Cl_c.Getinstancefromooa_id(modelRoot, m_input.getOoa_id(), m_input.getOoa_type());
    }

    // if there's no way to get a component path, then don't save the tag
    // CanvasFactory.createElement() will check for the tag's existence
    // before doing anything
    if (nrme != null) {
      memento.putString(GraphicalEditorFactory.TAG_COMPONENTPATH, nrme.getContent());
    }
  }