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

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


        IEOModelGroupFactory.Utility.loadModelGroup(indexURL, modelGroup, myLoadFailures, true, indexURL.toURL(), progressMonitor);
      } finally {
        modelGroup.removePropertyChangeListener(EOModelGroup.MODELS, getContentOutlinePage());
      }

      EOModel model = modelGroup.getEditingModel();
      boolean showModelGroup = true;
      if (model == null) {
        handleModelErrors(myLoadFailures, true, null);
        Set<EOModel> models = modelGroup.getModels();
        if (models.size() > 0) {
          model = models.iterator().next();
          showModelGroup = true;
        }
      }
      if (model == null) {
        // DO NOTHING
      } else {
        //EclipseFileUtils.getEditorInput(model);
        if (openingEntityName != null) {
          myOpeningEntity = model.getEntityNamed(openingEntityName);
        }
        handleModelErrors(myLoadFailures, false, null);

        if (model.getModelGroup() != null) {
          model.getModelGroup().addPropertyChangeListener(EOModel.DIRTY, myDirtyModelListener);
        }
        model.addPropertyChangeListener(EOModel.DIRTY, myDirtyModelListener);
        myEntitiesChangeListener.start();
        model.addPropertyChangeListener(EOModel.ENTITIES, myEntitiesChangeListener);
        myStoredProceduresChangeListener.start();
        model.addPropertyChangeListener(EOModel.STORED_PROCEDURES, myStoredProceduresChangeListener);
        myDatabaseConfigsChangeListener.start();
        model.addPropertyChangeListener(EOModel.DATABASE_CONFIGS, myDatabaseConfigsChangeListener);
        myFetchSpecsChangeListener.start();
        model.addPropertyChangeListener(EOModel.ENTITY + "." + EOEntity.FETCH_SPECIFICATIONS, myFetchSpecsChangeListener);
        myEntityIndexesChangeListener.start();
        model.addPropertyChangeListener(EOModel.ENTITY + "." + EOEntity.ENTITY_INDEXES, myEntityIndexesChangeListener);
        // setInput(new EOModelEditorInput(fileEditorInput));
        // init(getEditorSite(), new
        // EOModelEditorInput(fileEditorInput));
        updatePartName();
        getEditorSite().setSelectionProvider(this);
View Full Code Here


      else {
        children = new Object[] { "Loading " + loading.getModel().getName() + " ..." };
      }
    } else if (_parentElement instanceof EOModelContainer) {
      EOModelContainer modelContainer = (EOModelContainer) _parentElement;
      EOModel model = modelContainer.getModel();
      if (model == null) {
        children = new Object[] { "No Model Loaded" };
      } else {
        children = new Object[] { model };
      }
    } else if (_parentElement instanceof EOModelGroup) {
      EOModelGroup modelGroup = (EOModelGroup) _parentElement;
      Set<EOModel> modelGroupChildren = new TreeSet<EOModel>(new EOSortableEOModelObjectComparator());
      modelGroupChildren.addAll(modelGroup.getModels());
      children = modelGroupChildren.toArray();
    } else if (_parentElement instanceof EOModel) {
      EOModel model = (EOModel) _parentElement;
      Set<EOModelObject> modelChildren = new TreeSet<EOModelObject>(new EOSortableEOModelObjectComparator());
      if (_showEntities) {
        modelChildren.addAll(model.getEntities());
      }
      if (_showStoredProcedures) {
        modelChildren.addAll(model.getStoredProcedures());
      }
      if (_showDatabaseConfigs) {
        modelChildren.addAll(model.getDatabaseConfigs());
      }
      children = modelChildren.toArray();
    } else if (_parentElement instanceof EOEntity) {
      EOEntity entity = (EOEntity) _parentElement;
      Set<EOModelObject> entityChildren = new TreeSet<EOModelObject>(new EOSortableEOModelObjectComparator());
View Full Code Here

  protected void handleModelErrors(final Set<EOModelVerificationFailure> failures, final boolean forceOpen, final Runnable executeWhenApproved) {
    if (myModel != null) {
      try {
        if (Activator.getDefault().getPreferenceStore().getBoolean(PreferenceConstants.SHOW_ERRORS_IN_PROBLEMS_VIEW_KEY)) {
          final EOModel editingModel = myModel;
          IWorkspaceRunnable body = new IWorkspaceRunnable() {
            public void run(final IProgressMonitor monitor) throws CoreException {
              for (EOModel model : editingModel.getModelGroup().getModels()) {
                try {
                  IFile indexFile = EclipseFileUtils.getEclipseIndexFile(model);
                  if (indexFile != null) {
                    IMarker[] oldMarkers = indexFile.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
                    for (int markerNum = 0; markerNum < oldMarkers.length; markerNum++) {
                      // System.out.println("EOModelEditor.handleModelErrors:
                      // deleting " + markers[markerNum]);
                      oldMarkers[markerNum].delete();
                    }
                    IMarker[] newMarkers = indexFile.findMarkers(org.objectstyle.wolips.eomodeler.core.Activator.EOMODEL_PROBLEM_MARKER, true, IResource.DEPTH_INFINITE);
                    for (int markerNum = 0; markerNum < newMarkers.length; markerNum++) {
                      // System.out.println("EOModelEditor.handleModelErrors:
                      // deleting " + markers[markerNum]);
                      newMarkers[markerNum].delete();
                    }
                  }
                } catch (Exception e) {
                  Activator.getDefault().log(e);
                }
              }

              for (EOModelVerificationFailure failure : failures) {
                EOModel model = failure.getModel();
                IFile indexFile;
                try {
                  indexFile = EclipseFileUtils.getEclipseIndexFile(model);
                  if (indexFile != null) {
                    IMarker marker = indexFile.createMarker(org.objectstyle.wolips.eomodeler.core.Activator.EOMODEL_PROBLEM_MARKER);
View Full Code Here

import org.objectstyle.wolips.eomodeler.core.utils.EOModelUtils;
import org.objectstyle.wolips.eomodeler.editors.EOModelErrorDialog;

public class VerifyAction extends EMAction {
  public void run(IAction action) {
    EOModel model = null;
    Object selectedObject = getSelectedObject();
    if (selectedObject != null) {
      model = EOModelUtils.getRelatedModel(selectedObject);
    }
    if (model != null) {
      Set<EOModelVerificationFailure> verifyFailures = new HashSet<EOModelVerificationFailure>();
      model.verify(verifyFailures);
      EOModelErrorDialog dialog = new EOModelErrorDialog(getWindow().getShell(), verifyFailures);
      dialog.open();
    }
  }
View Full Code Here

    myCellEditors = _cellEditors;
  }

  protected boolean _canModify(Object _element, String _property) {
    if (EOEntity.PARENT.equals(_property)) {
      EOModel model = (EOModel) getTableViewer().getInput();
      myEntityNames = new LinkedList(model.getModelGroup().getEntityNames());
      myEntityNames.add(0, EOEntitiesCellModifier.NO_PARENT_VALUE);
      String[] entityNames = (String[]) myEntityNames.toArray(new String[myEntityNames.size()]);
      int columnNumber = TableUtils.getColumnNumberForTablePropertyNamed(EOEntity.class.getName(), _property);
      if (columnNumber != -1) {
        KeyComboBoxCellEditor cellEditor = (KeyComboBoxCellEditor) myCellEditors[columnNumber];
View Full Code Here

  public String getText(Object _element) {
    String text;
    if (_element instanceof String) {
      text = (String) _element;
    } else if (_element instanceof EOModel) {
      EOModel model = (EOModel) _element;
      text = model.getName();
      if (model.isDirty()) {
        text = text + "*";
      }
    } else if (_element instanceof EOEntity) {
      EOEntity entity = (EOEntity) _element;
      text = entity.getName();
View Full Code Here

          IContainer possibleEOModelFolder = possibleEditorFile.getParent();
          matches = existingEOModelFolder.equals(possibleEOModelFolder);
          if ("plist".equals(possibleEditorFile.getFileExtension())) {
            String entityName = possibleEditorFile.getName();
            entityName = entityName.substring(0, entityName.indexOf('.'));
            EOModel eoModel = eomodelEditorPart.getModel();
            if (eoModel != null) {
              EOEntity entity = eoModel.getEntityNamed(entityName);
              eomodelEditorPart.setSelectedEntity(entity);
            }
          }
        }
      }
View Full Code Here

  public Image getImage(Object _element) {
    return null;
  }

  public String getText(Object _element) {
    EOModel model = (EOModel) _element;
    return model.getName();
  }
View Full Code Here

    return referenceFailures;
  }

  public static IUndoContext getUndoContext(Object obj) {
    EOModel model = EOModelUtils.getRelatedModel(obj);
    String label = model == null ? "No Model" : model.getName();
    return new ObjectUndoContext(model, label);
  }
View Full Code Here

    }
    return relatedObj;
  }

  public static EOModel getRelatedModel(Object obj) {
    EOModel model = null;
    if (obj instanceof EOModel) {
      model = (EOModel) obj;
    } else if (obj instanceof IEOEntityRelative) {
      model = ((IEOEntityRelative) obj).getEntity().getModel();
    } else if (obj instanceof EOStoredProcedure) {
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.