Examples of EOModel


Examples of org.objectstyle.wolips.eomodeler.core.model.EOModel

    _comparator = new KVCComparator<EOEntity>(EOEntity.class, EOEntity.NAME);
  }

  public Object[] getElements(Object inputElement) {
    Set entitiesList;
    EOModel model = EOModelUtils.getRelatedModel(inputElement);
    if (model != null) {
      if (_restrictToSingleModel) {
        if (_includePrototypes) {
          entitiesList = model.getEntities();
        } else {
          entitiesList = model.getNonPrototypeEntities();
        }
      } else if (_includePrototypes) {
        entitiesList = model.getModelGroup().getEntities();
      } else {
        entitiesList = model.getModelGroup().getNonPrototypeEntities();
      }
    } else {
      throw new IllegalArgumentException("Unknown input element: " + inputElement);
    }
View Full Code Here

Examples of org.objectstyle.wolips.eomodeler.core.model.EOModel

      createModelGroup = true;
      EOModelErrorDialog errors = new EOModelErrorDialog(Display.getDefault().getActiveShell(), failures);
      errors.open();
    }

    EOModel model = new EOModel(_modelName);
    EODatabaseConfig databaseConfig = new EODatabaseConfig("Default");
    databaseConfig.setAdaptorName(_adaptorName);
    model.addDatabaseConfig(databaseConfig);
    modelGroup.addModel(model);
    modelGroup.setEditingModelName(_modelName);

    ProjectFrameworkAdapter frameworkAdapter = (ProjectFrameworkAdapter)_parentResource.getProject().getAdapter(ProjectFrameworkAdapter.class);
    // add adaptor framework
    if (!"None".equals(_adaptorName) && !"".equals(_adaptorName)) {
      frameworkAdapter.addFrameworks(frameworkAdapter.getAdaptorFrameworks().get(_adaptorName));
    }
    if (!"None".equals(_pluginName) && !"".equals(_pluginName)) {
      IEclipseFramework pluginFramework = frameworkAdapter.getPluginFrameworks().get(_pluginName);
      frameworkAdapter.addFrameworks(pluginFramework);
      String selectedPrototypeEntityName = "EO" + _adaptorName + _pluginName + "Prototypes";
      EOEntity selectedPrototypeEntity = modelGroup.getEntityNamed(selectedPrototypeEntityName);
      if (selectedPrototypeEntity != null) {
        EODatabaseConfig activeConfig = model.getActiveDatabaseConfig();
        if (activeConfig != null) {
          activeConfig.setPrototype(selectedPrototypeEntity);
        }
      }
    }

    File modelFolderFile = model.saveToFolder(parentContainer.getLocation().toFile());
    IFolder modelFolder = parentContainer.getFolder(new Path(modelFolderFile.getName()));
    String baseName = model.getName();

    if (_createEOGeneratorFile) {
      EOGeneratorModel eogenModel = EOGeneratorWizard.createEOGeneratorModel(parentContainer, model, false);
      IFile eogenFile = parentContainer.getFile(new Path(baseName + ".eogen"));
      if (eogenFile.exists()) {
View Full Code Here

Examples of org.objectstyle.wolips.eomodeler.core.model.EOModel

    List<URL> modelURLs = new LinkedList();
    // AK: I hope this does the right thing... we add all other models
    // before the one in question
    Iterator modelsIter = model.getModelGroup().getModels().iterator();
    while (modelsIter.hasNext()) {
      EOModel otherModel = (EOModel) modelsIter.next();
      if (otherModel != model) {
        URL otherModelURL = otherModel.getModelURL();
        modelURLs.add(WOUtils.trimModelURLs(otherModelURL));
      }
    }
    modelURLs.add(WOUtils.trimModelURLs(model.getModelURL()));
View Full Code Here

Examples of org.objectstyle.wolips.eomodeler.core.model.EOModel

   */
  public static List<EOModelReference> createModelReferencesForModelGroup(EOModelGroup modelGroup, List<EOModel> exceptModels) {
    LinkedList<EOModelReference> modelReferences = new LinkedList<EOModelReference>();
    Iterator<EOModel> modelsIter = modelGroup.getModels().iterator();
    while (modelsIter.hasNext()) {
      EOModel modelGroupModel = modelsIter.next();
      if (modelGroupModel.getModelURL() != null) {
        Path modelPath = new Path(modelGroupModel.getModelURL().toString());
        EOModelReference modelReference = new EOModelReference(modelPath);
        if (!exceptModels.contains(modelGroupModel)) {
          modelReferences.add(modelReference);
        }
      }
View Full Code Here

Examples of org.objectstyle.wolips.eomodeler.core.model.EOModel

    _definitionText.setEnabled(!hasJoins);
  }

  protected void updateEntityCombo() {
    IStructuredSelection selection = (IStructuredSelection) _modelComboViewer.getSelection();
    EOModel selectedModel = (EOModel) selection.getFirstElement();
    _entityComboViewer.setInput(selectedModel);
  }
View Full Code Here

Examples of org.objectstyle.wolips.eomodeler.core.model.EOModel

            OpenEntityModelerAction.openResourceIfPossible(null, file);
          }
        }
        else if (resource instanceof IContainer) {
          if (modelEditor != null) {
            EOModel model = modelEditor.getModel().getModelGroup().getModelNamed(ResourceUtilities.getFileNameWithoutExtension(resource.getName()));
            if (model != null) {
              modelEditor.setSelection(new StructuredSelection(model));
            }
          }
          else {
View Full Code Here

Examples of org.objectstyle.wolips.eomodeler.core.model.EOModel

      IPerspectiveDescriptor perspective = window.getActivePage().getPerspective();
      if (perspective != null && EOModelerPerspectiveFactory.EOMODELER_PERSPECTIVE_ID.equals(perspective.getId())) {
        IEditorPart editorPart = activePage.getActiveEditor();
        if (editorPart instanceof EOModelEditor) {
          modelEditor = (EOModelEditor)editorPart;
          EOModel editingModel = modelEditor.getModel();
          if (editingModel != null) {
            List<File> modelFolders = new LinkedList<File>();
            EOModelGroup modelGroup = editingModel.getModelGroup();
            for (EOModel model : modelGroup.getModels()) {
              File modelFolder = URLUtils.cheatAndTurnIntoFile(model.getModelURL()).getParentFile();
              modelFolders.add(modelFolder);
            }
            if (modelFolders.size() > 0) {
View Full Code Here

Examples of org.objectstyle.wolips.eomodeler.core.model.EOModel

            URL modelURL = getModelURL(eogeneratorModel, eomodelReference);
            IEOModelGroupFactory.Utility.loadModelGroup(modelURL, generatingModelGroup, failures, true, modelURL, monitor);
            if (monitor.isCanceled()) {
              throw new OperationCanceledException("EOGenerator canceled.");
            }
            EOModel generatingModel = generatingModelGroup.getEditingModel();
            models.add(generatingModel);

            for (EOModel model : generatingModelGroup.getModels()) {
              if (!modelGroup.containsModelNamed(model.getName())) {
                modelGroup.addModel(model);
              }
            }
          }
        } else {
          loadModels(eogeneratorModel, modelGroup, eogeneratorModel.getModels(), models, monitor);
          loadModels(eogeneratorModel, modelGroup, eogeneratorModel.getRefModels(), new LinkedList<EOModel>(), monitor);

          modelGroup.resolve(failures);
          modelGroup.verify(failures);
        }

        for (EOModelVerificationFailure failure : failures) {
          if (!failure.isWarning()) {
            results.append("Error: " + failure.getMessage() + "\n");
            showResults = true;
          }
        }
      } else {
        modelGroup = preloadedModelGroup;
        for (EOModelReference modelRef : eogeneratorModel.getModels()) {
          String modelName = modelRef.getName();
          EOModel model = modelGroup.getModelNamed(modelName);
          if (model == null) {
            throw new RuntimeException("There was no model named '" + modelName + "' in this model group.");
          }
          models.add(model);
        }
      }

      File superclassDestination = new File(eogeneratorModel.getDestination());
      if (!superclassDestination.isAbsolute()) {
        IPath projectPath = eogeneratorModel.getProjectPath();
        if (projectPath != null) {
          superclassDestination = new File(projectPath.toFile(), eogeneratorModel.getDestination());
        }
      }
      if (!superclassDestination.exists()) {
        if (!superclassDestination.mkdirs()) {
          throw new IOException("Failed to create destination '" + superclassDestination + "'.");
        }
      }

      File subclassDestination = new File(eogeneratorModel.getSubclassDestination());
      if (!subclassDestination.isAbsolute()) {
        IPath projectPath = eogeneratorModel.getProjectPath();
        if (projectPath != null) {
          subclassDestination = new File(projectPath.toFile(), eogeneratorModel.getSubclassDestination());
        }
      }
      if (!subclassDestination.exists()) {
        if (!subclassDestination.mkdirs()) {
          throw new IOException("Failed to create subclass destination '" + subclassDestination + "'.");
        }
      }

      // String filePathTemplate = eogeneratorModel.getFilenameTemplate();
      // if (filePathTemplate == null || filePathTemplate.trim().length()
      // == 0) {
      // }

      String extension = eogeneratorModel.getExtension();
      Set<String> entitySet = new HashSet<String>();
      if (entityList != null) {
        entitySet.addAll(entityList);
      }
      Date date = new Date();
     
      for (EOModel model : models) {
        if (monitor.isCanceled()) {
          throw new OperationCanceledException("EOGenerator canceled.");
        }
        // System.out.println("Generating " + model.getName() + " ...");
        for (EOEntity entity : model.getEntities()) {
          VelocityContext context = new VelocityContext();
          context.put("eogeneratorModel", eogeneratorModel);
          context.put("date", date);
          context.put("calendar", Calendar.getInstance());
          for (Define define : eogeneratorModel.getDefines()) {
View Full Code Here

Examples of org.objectstyle.wolips.eomodeler.core.model.EOModel

    for (EOModelReference modelRef : modelReferences) {
      if (monitor.isCanceled()) {
        throw new OperationCanceledException("EOGenerator canceled.");
      }
      URL modelURL = getModelURL(eogeneratorModel, modelRef);
      EOModel model = modelGroup.loadModelFromURL(modelURL);
      loadedModels.add(model);
    }
  }
View Full Code Here

Examples of org.objectstyle.wolips.eomodeler.core.model.EOModel

      }
    }
  }

  protected void addModelsFromEOModelGroupFile(IFile eoModelGroupFile, EOModelGroup modelGroup, Set<EOModelVerificationFailure> failures, boolean skipOnDuplicates, IProgressMonitor progressMonitor) throws ParseException, CoreException, IOException, EOModelException {
    EOModel model = null;
    IProject project = eoModelGroupFile.getProject();
    EOGeneratorModel eogeneratorModel = EOGeneratorModel.createModelFromFile(eoModelGroupFile);
    List<EOModelReference> modelRefList = new LinkedList<EOModelReference>();
    modelRefList.addAll(eogeneratorModel.getModels());
    modelRefList.addAll(eogeneratorModel.getRefModels());
    for (EOModelReference modelRef : modelRefList) {
      String modelPath = modelRef.getPath(project);
      File modelFolder = new File(modelPath);
      if (!modelFolder.isAbsolute()) {
        modelFolder = new File(project.getLocation().toFile(), modelPath);
      }
      if (model == null) {
        modelGroup.setEditingModelURL(modelFolder.toURL());
      }
      EOModel modelGroupModel = modelGroup.loadModelFromURL(modelFolder.toURL(), failures, skipOnDuplicates, progressMonitor);
      if (model == null) {
        model = modelGroupModel;
      }
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.