Examples of EOModel


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

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

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

    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

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

  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

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

          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

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

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

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

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

    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

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

    }
    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

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

public class GenerateMigrationAction extends EMAction {
  public void run(IAction action) {
    try {
      IStructuredSelection selection = getSelection();
      if (selection != null) {
        EOModel model = null;
        boolean modelSelected = false;
        List<EOEntity> entities = new LinkedList<EOEntity>();
        Iterator selectionIter = selection.iterator();
        while (!modelSelected && selectionIter.hasNext()) {
          Object obj = selectionIter.next();
View Full Code Here

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

public class ReverseEngineerAction extends EMAction {
  public void run(IAction action) {
    try {
      Object selectedObject = getSelectedObject();
      EOModel model = EOModelUtils.getRelatedModel(selectedObject);
      if (model == null) {
        MessageDialog.openError(getWindow().getShell(), "Select a Model", "Select a model to reverse engineer into.");
      } else {
        EODatabaseConfig activeDatabaseConfig = model.getActiveDatabaseConfig();
        ClassLoader eomodelClassLoader = IEOClassLoaderFactory.Utility.createClassLoader(model);
        IEOSQLReverseEngineer reverseEngineer = IEOSQLReverseEngineerFactory.Utility.reverseEngineerFactory().reverseEngineer(activeDatabaseConfig, eomodelClassLoader);
        List<String> tableNames = reverseEngineer.reverseEngineerTableNames();

        ListSelectionDialog dlg = new ListSelectionDialog(getWindow().getShell(), tableNames, new StringContentProvider(), new StringLabelProvider(), "Select the tables to reverse engineer:");
        dlg.setInitialSelections(tableNames.toArray());
        dlg.setTitle("Reverse Engineer");
        if (dlg.open() == Window.OK) {
          Object[] selectedTableNameObjs = dlg.getResult();
          String[] selectedTableNames = new String[selectedTableNameObjs.length];
          System.arraycopy(selectedTableNameObjs, 0, selectedTableNames, 0, selectedTableNameObjs.length);
          List<String> selectedTableNamesList = Arrays.asList(selectedTableNames);
          File reverseEngineeredEOModelFolder = reverseEngineer.reverseEngineerWithTableNamesIntoModel(selectedTableNamesList);
          Set<EOModelVerificationFailure> failures = new HashSet<EOModelVerificationFailure>();
          model.importEntitiesFromModel(reverseEngineeredEOModelFolder.toURL(), failures);
          if (failures.size() > 0) {
            EOModelErrorDialog dialog = new EOModelErrorDialog(getWindow().getShell(), failures);
            dialog.open();
          }
          model.setReverseEngineered(true);
        }
      }
    } catch (Throwable e) {
      e.printStackTrace();
      ErrorUtils.openErrorDialog(Display.getDefault().getActiveShell(), e);
View Full Code Here

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

    if (treeViewer != null) {
      Set<EOModel> oldModels = (Set<EOModel>) evt.getOldValue();
      Set<EOModel> newModels = new HashSet<EOModel>((Set<EOModel>) evt.getNewValue());
      newModels.removeAll(oldModels);
      if (newModels.size() == 1) {
        EOModel newModel = newModels.iterator().next();
        Object input = treeViewer.getInput();
        if (input instanceof EOModelLoading) {
          ((EOModelLoading) input).setModel(newModel);
        }
        Display.getDefault().asyncExec(new Runnable() {
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.