Package org.objectstyle.wolips.eomodeler.core.model

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


    try {
      String extension = (_createEOModelGroup) ? ".eomodelgroup" : ".eogen";
      EOModelGroup modelGroup = new EOModelGroup();
      final Set<EOModelVerificationFailure> failures = new HashSet<EOModelVerificationFailure>();
      IEOModelGroupFactory.Utility.loadModelGroup(_modelFile, modelGroup, failures, true, _modelFile.getLocationURI().toURL(), new NullProgressMonitor());
      EOModel model = modelGroup.getEditingModel();
      if (model != null) {
        EOGeneratorModel eogenModel = EOGeneratorWizard.createEOGeneratorModel(_modelFile.getParent(), model, false);
        String eogenBasePath = URLUtils.cheatAndTurnIntoFile(model.getModelURL()).getAbsolutePath();
        int dotIndex = eogenBasePath.lastIndexOf('.');
        eogenBasePath = eogenBasePath.substring(0, dotIndex);
        String eogenPath = eogenBasePath + extension;
        IFile eogenFile = _modelFile.getWorkspace().getRoot().getFileForLocation(new Path(eogenPath));
        for (int dupeNum = 0; eogenFile.exists(); dupeNum++) {
View Full Code Here


    // GridData(GridData.FILL_HORIZONTAL);
    // modelCombo.setLayoutData(modelComboLayoutData);
    _modelComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
      public void selectionChanged(SelectionChangedEvent event) {
        IStructuredSelection selection = (IStructuredSelection) event.getSelection();
        EOModel selectedModel = (EOModel) selection.getFirstElement();
        _entityComboViewer.setInput(selectedModel);
        if (_entityComboViewer.getCombo().getItemCount() > 0) {
          _entityComboViewer.setSelection(new StructuredSelection(_entityComboViewer.getElementAt(0)));
        }
      }
View Full Code Here

    myComparator = new KVCComparator(EOEntity.class, EOEntity.NAME);
  }

  public Object[] getElements(Object _inputElement) {
    Set entitiesList;
    EOModel model = EOModelUtils.getRelatedModel(_inputElement);
    if (model != null) {
      entitiesList = model.getModelGroup().getPrototypeEntities();
    } else {
      throw new IllegalArgumentException("Unknown input element: " + _inputElement);
    }

    List entitiesListCopy = new LinkedList();
View Full Code Here

    _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

      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

    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

   */
  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

    _definitionText.setEnabled(!hasJoins);
  }

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

            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

      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

TOP

Related Classes of org.objectstyle.wolips.eomodeler.core.model.EOModel

Copyright © 2018 www.massapicom. 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.