예제 #1
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;
 }
예제 #2
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);
 }
예제 #3
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());
    }
  }