Package org.objectstyle.wolips.eomodeler.editors

Examples of org.objectstyle.wolips.eomodeler.editors.EOModelEditor


  public void dispose() {
    listenerList = null;
  }

  public Object execute(final ExecutionEvent event) throws ExecutionException {
    EOModelEditor modelEditor = null;
    final List<IResource> files = new ArrayList<IResource>();

    if (event.getParameter(PARAM_ID_FILE_PATH) == null) {
      // Prompt the user for the resource to open.
      Object[] result = queryFileResource();

      if (result != null) {
        if (result.length == 2 && result[0] instanceof EOModelEditor) {
          modelEditor = (EOModelEditor)result[0];
          result = (Object[])result[1];
        }
        if (result != null) {
          for (int i = 0; i < result.length; i++) {
            files.add((IResource)result[i]);
          }
        }
      }

    } else {
      // Use the given parameter.
      final IResource resource = (IResource) event.getObjectParameterForExecution(PARAM_ID_FILE_PATH);
      if (!(resource instanceof IFile)) {
        throw new ExecutionException("filePath parameter must identify a file"); //$NON-NLS-1$
      }
      files.add(resource);
    }

    if (files.size() > 0) {

      final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
      if (window == null) {
        throw new ExecutionException("no active workbench window"); //$NON-NLS-1$
      }

      final IWorkbenchPage page = window.getActivePage();
      if (page == null) {
        throw new ExecutionException("no active workbench page"); //$NON-NLS-1$
      }

      for (Iterator it = files.iterator(); it.hasNext();) {
        IResource resource = (IResource)it.next();
        IFile file = null;
        if (!"eomodeld".equals(resource.getFileExtension()) && resource instanceof IFile) {
          if (modelEditor != null) {
            EOEntity entity = modelEditor.getModel().getModelGroup().getEntityNamed(ResourceUtilities.getFileNameWithoutExtension(resource));
            if (entity != null) {
              modelEditor.setSelection(new StructuredSelection(entity));
            }
          }
          else {
            file = (IFile)resource;//resource.getParent().getFile(new Path("index.eomodeld"));
            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 {
            file = ((IContainer)resource).getFile(new Path("index.eomodeld"));
            OpenEntityModelerAction.openResourceIfPossible(null, file);
View Full Code Here


      return null;
    }
    final Shell parent = window.getShell();
    IContainer input = ResourcesPlugin.getWorkspace().getRoot();
   
    EOModelEditor modelEditor = null;
    IWorkbenchPage activePage = window.getActivePage();
    if (activePage != null) {
      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();
View Full Code Here

TOP

Related Classes of org.objectstyle.wolips.eomodeler.editors.EOModelEditor

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.