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

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


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

    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

public class GenerateSQLAction extends EMAction {
  public void run(IAction action) {
    try {
      IStructuredSelection selection = getSelection();
      if (selection != null) {
        EOModel model = null;
        boolean modelSelected = false;
        List<String> entityNames = new LinkedList<String>();
        Iterator selectionIter = selection.iterator();
        while (!modelSelected && selectionIter.hasNext()) {
          Object obj = selectionIter.next();
          EOEntity entity = EOModelUtils.getRelatedEntity(obj);
          if (entity != null) {
            model = entity.getModel();
            entityNames.add(entity.getName());
          } else {
            model = EOModelUtils.getRelatedModel(obj);
            if (model != null) {
              modelSelected = true;
            }
          }
        }

        if (modelSelected) {
          entityNames = null;
        }

        if (model != null) {
          if (model.isDirty()) {
            MessageDialog.openWarning(getWindow().getShell(), "Model Not Saved", "Your model has unsaved changes. Unsaved changes will not be reflected in generated SQL.");
          }
          GenerateSQLDialog dialog = new GenerateSQLDialog(getWindow().getShell(), model, entityNames);
          dialog.open();
        }
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.