Exemplo n.º 1
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;
 }
Exemplo n.º 2
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;
  }