Package org.eclipse.ui

Examples of org.eclipse.ui.PartInitException


     * @throws PartInitException the part init exception
     */
    @Override
    public void init(IEditorSite site, IEditorInput input) throws PartInitException {
        if (!(input instanceof DAForJavaEditorInput)) {
            throw new PartInitException("Invalid Input");
        }

        setSite(site);
        setInput(input);

        DAForJavaEditorInput eInput = (DAForJavaEditorInput) input;
        AbstractSelectionHandler selectionHandler = SelectionHandlerFactory.getInstance().getSelectionHandler(eInput.getSelection());
        setPartName(selectionHandler.getEditorTitle());

        try {
            // initialize db connection
            IJavaProject selectedProject = selectionHandler.getSelectedProject();
            String dbUrl = initDatabaseConfiguration(selectedProject.getProject());

            IEvolizerSession session = EvolizerSessionHandler.getHandler().getCurrentSession(dbUrl);
            SnapshotAnalyzer snapshotAnalyzer = new SnapshotAnalyzer(session);
            fGraphPanel = new DAForJavaGraphPanel(new GraphLoader(snapshotAnalyzer));
            fGraphPanel.initGraphPanel();

//            site.getWorkbenchWindow().getActivePage().addPartListener(fPartListener);
            initDragAndDrop();
//            setPartName(selectionHandler.getEditorTitle());

            List<AbstractFamixEntity> entities = selectionHandler.getSelectedEntities(snapshotAnalyzer);
            if (entities.size() == 0) {
                IProgressMonitor pm = Job.getJobManager().createProgressGroup();
                pm.beginTask("Extracting and storing the FAMIX model for further use ...", 10);

                List<IJavaElement> selection = new ArrayList<IJavaElement>();
                selection.add(selectedProject);
                FamixParserJob parseJob = new FamixParserJob(selection);
                parseJob.setUser(true);
                parseJob.setProgressGroup(pm, 5);
                parseJob.schedule();
                parseJob.join();

                Job storeModelJob = new FamixStoreModelJob(dbUrl, parseJob.getFamixModel());
                storeModelJob.setUser(true);
                storeModelJob.setProgressGroup(pm, 5);
                storeModelJob.schedule();
                storeModelJob.join();

                entities = selectionHandler.getSelectedEntities(snapshotAnalyzer);
            }
           
            AbstractGraphEditCommand command = new AddEntitiesCommand(entities, fGraphPanel.getGraphLoader(), fGraphPanel.getEdgeGrouper());
            fGraphPanel.getCommandController().executeCommand(command);

            openDependencyAnalyzerPerspective();
        } catch (InterruptedException ie) {
            throw new PartInitException(ie.getMessage(), ie);
        } catch (EvolizerException ee) {
            throw new PartInitException(ee.getMessage(), ee);
        } catch (CoreException ce) {
            throw new PartInitException(ce.getMessage(), ce);
        }
    }
View Full Code Here


            throws PartInitException {
        ViewFactory factory = getViewFactory();
        IViewReference ref = factory.createView(viewId, secondaryId);
        IViewPart part = (IViewPart) ref.getPart(true);
        if (part == null) {
            throw new PartInitException(NLS.bind(WorkbenchMessages.ViewFactory_couldNotCreate, ref.getId()));
        }
        ViewSite site = (ViewSite) part.getSite();
        ViewPane pane = (ViewPane) site.getPane();

        IPreferenceStore store = WorkbenchPlugin.getDefault()
View Full Code Here

    }

    IEditorRegistry reg = getEditorRegistry();
    EditorDescriptor desc = (EditorDescriptor) reg.findEditor(editorId);
    if (desc == null) {
      throw new PartInitException(NLS.bind(
          WorkbenchMessages.EditorManager_unknownEditorIDMessage,
          editorId));
    }

    IEditorReference result = openEditorFromDescriptor(desc, input, editorState);
View Full Code Here

        IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID)) {
      IPathEditorInput pathInput = getPathEditorInput(input);
      if (pathInput != null) {
        result = openSystemExternalEditor(pathInput.getPath());
      } else {
        throw new PartInitException(
            WorkbenchMessages.EditorManager_systemEditorError);
      }
    } else if (desc.isOpenExternal()) {
      result = openExternalEditor(desc, input);
    } else {
      // this should never happen
      throw new PartInitException(NLS.bind(
          WorkbenchMessages.EditorManager_invalidDescriptor, desc
              .getId()));
    }

    if (result != null) {
View Full Code Here

            ex[0] = e;
          }
        }
      });
    } else {
      throw new PartInitException(NLS.bind(
          WorkbenchMessages.EditorManager_errorOpeningExternalEditor,
          desc.getFileName(), desc.getId()));
    }

    if (ex[0] != null) {
      throw new PartInitException(NLS.bind(
          WorkbenchMessages.EditorManager_errorOpeningExternalEditor,
          desc.getFileName(), desc.getId()), ex[0]);
    }

    // we do not have an editor part for external editors
View Full Code Here

    IEditorRegistry reg = getEditorRegistry();
    for (int i = 0; i < editorArray.length; i++) {
      EditorDescriptor innerDesc = (EditorDescriptor) reg
          .findEditor(editorArray[i]);
      if (innerDesc == null) {
        throw new PartInitException(NLS.bind(
            WorkbenchMessages.EditorManager_unknownEditorIDMessage,
            editorArray[i]));
      }
      descArray[i] = innerDesc;
      InnerEditor innerRef = new InnerEditor(ref, inputArray[i],
View Full Code Here

        UIStats.end(UIStats.INIT_PART, part, label);
      }

      // Sanity-check the site
      if (part.getSite() != site || part.getEditorSite() != site) {
        throw new PartInitException(NLS.bind(
            WorkbenchMessages.EditorManager_siteIncorrect, desc
                .getId()));
      }

    } catch (Exception e) {
      disposeEditorActionBars((EditorActionBars) site.getActionBars());
      site.dispose();
      if (e instanceof PartInitException) {
        throw (PartInitException) e;
      }

      throw new PartInitException(
          WorkbenchMessages.EditorManager_errorInInit, e);
    }

    return site;
  }
View Full Code Here

            element.getDeclaringExtension(), result,
            IExtensionTracker.REF_WEAK);
      }
      return result;
    } catch (CoreException e) {
      throw new PartInitException(StatusUtil.newStatus(
          desc.getPluginID(),
          WorkbenchMessages.EditorManager_instantiationError, e));
    }
  }
View Full Code Here

        }
      }
    });

    if (!result[0]) {
      throw new PartInitException(NLS.bind(
          WorkbenchMessages.EditorManager_unableToOpenExternalEditor,
          location));
    }

    // We do not have an editor part for external editors
View Full Code Here

      Program.launch(localHref);
    } else if ("carbon".equals(platform)) { //$NON-NLS-1$
      try {
        Runtime.getRuntime().exec("/usr/bin/open " + localHref); //$NON-NLS-1$
      } catch (IOException e) {
        throw new PartInitException(
            WorkbenchMessages.ProductInfoDialog_unableToOpenWebBrowser,
            e);
      }
    } else {
      Thread launcher = new Thread("About Link Launcher") {//$NON-NLS-1$
View Full Code Here

TOP

Related Classes of org.eclipse.ui.PartInitException

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.