Пример #1
0
  /*
   * Get the "-" separated list of names of the parent elements.
   */
  public static String getContainerList(Model_c model, Ooaofooa modelRoot) {
    int ooaType = model.getOoa_type();
    NonRootModelElement elem =
        (NonRootModelElement) Cl_c.Getinstancefromooa_id(modelRoot, model.getOoa_id(), ooaType);

    return getContainerList(elem, ooaType);
  }
Пример #2
0
 public boolean exists() {
   if (m_input != null) {
     if (m_input.getRepresents() != null) {
       Object represents = m_input.getRepresents();
       if (!((NonRootModelElement) represents).isOrphaned()) {
         return true;
       }
     }
   }
   return false;
 }
Пример #3
0
 public static GraphicalEditorInput createInstance(Object c_input) throws PartInitException {
   ModelSpecification_c[] modelSpecs =
       ModelSpecification_c.ModelSpecificationInstances(Ooaofgraphics.getDefaultInstance());
   for (int i = 0; i < modelSpecs.length; i++) {
     if (modelSpecs[i].getRepresents() == c_input.getClass()) {
       final UUID ooa_id = Cl_c.Getooa_idfrominstance(c_input);
       final int modelType = modelSpecs[i].getModel_type();
       String rootName = Cl_c.getModelRootname(c_input);
       if (rootName != null) {
         Ooaofgraphics modelRoot = Ooaofgraphics.getInstance(rootName);
         Model_c canvas =
             Model_c.ModelInstance(
                 modelRoot,
                 new ClassQueryInterface_c() {
                   public boolean evaluate(Object candidate) {
                     Model_c selected = (Model_c) candidate;
                     return selected.getModel_type() == modelType
                         && selected.getOoa_id().equals(ooa_id);
                   }
                 });
         if (canvas != null) {
           CanvasModelListener.setGraphicalRepresents(canvas);
           return new GraphicalEditorInput(canvas, c_input, modelSpecs[i].getBackground());
         }
       }
     }
   }
   return null;
 }
Пример #4
0
 public boolean equals(Object o) {
   if (o instanceof GraphicalEditorInput) {
     return ((GraphicalEditorInput) o).m_input == m_input;
   } else if (o instanceof IFileEditorInput) {
     return ((IFileEditorInput) o).getFile().equals(m_input.getFile());
   }
   return false;
 }
Пример #5
0
 private static IFile getUnderlyingFile(Model_c canvas) {
   IFile result = ((NonRootModelElement) canvas.getRepresents()).getFile();
   // result can be null during unit tests, when DEFAULT_TEST_MODELSPACE
   // (__default_test_root) is used
   if (result != null) {
     return result;
   }
   return new CanvasDummyIFile(result);
 }
Пример #6
0
  public static PersistableModelComponent getComponentOfElementInResize(
      final NonRootModelElement me) {
    Model_c model = null;
    if (me instanceof ElementInResize_c) {
      final ElementInResize_c elementInResize = (ElementInResize_c) me;
      model =
          Model_c.ModelInstance(
              me.getModelRoot(),
              new ClassQueryInterface_c() {
                public boolean evaluate(Object candidate) {
                  return ((Model_c) candidate)
                      .getDiagramid()
                      .equals(elementInResize.getDiagramidCachedValue());
                }
              },
              false);
    }

    if (model != null) return model.getPersistableComponent();
    else return null;
  }
Пример #7
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());
    }
  }