Package org.eclipse.ui

Examples of org.eclipse.ui.PartInitException


                    IFacetedProject facetedProject = ProjectFacetsManager.create(project);
                    model.setProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME, facetedProject.getPrimaryRuntime());
                    IDataModelOperation op = new ImportDeploymentPlanOperation(model);
                    op.execute(new NullProgressMonitor(), null);
                } catch (Exception e) {
                   throw new PartInitException(e.getMessage());
                }
               
                try {
          deploymentPlan = loadDeploymentPlan(fei.getFile());
        } catch (Exception e) {
          throw new PartInitException("Error in loading deployment plan");
        }
               
                if (deploymentPlan == null) {   
                    MessageDialog.openInformation(Display.getDefault().getActiveShell(), Messages.errorOpenDialog, Messages.editorDefault);
                }
View Full Code Here


                 *    fixed: https://bugs.eclipse.org/bugs/show_bug.cgi?id=81640
                 */
                CoreException e= (CoreException)t;
                IStatus status= e.getStatus();
                if (status.getException() != null)
                    throw new PartInitException(status);
                 throw new PartInitException(new Status(status.getSeverity(), status.getPlugin(), status.getCode(), status.getMessage(), t));
            }
      throw new PartInitException(new Status(IStatus.ERROR, TextEditorPlugin.PLUGIN_ID, IStatus.OK, EditorMessages.Editor_error_init, t));
    }
  }
View Full Code Here

  @Override
  public void init(IEditorSite site, IEditorInput input) throws PartInitException {
    super.init(site, input);
   
    if (!(input instanceof IFileEditorInput)) throw new PartInitException(new Status(IStatus.ERROR, "q_impress", "Invalid input for editor."));
   
    // save the original editor input
    this.originalInput = (IFileEditorInput)input;
   
    // now try to load the project
    IFileEditorInput specificInput = (IFileEditorInput) input;
    InputStream inStream = null;
    try {
      inStream = specificInput.getFile().getContents();
     
      LoadingService service = new LoadingService();
      service.setInStream(inStream);
      service.setLocationSolver(new WorkspaceLocationSolver());
      service.initialize();
      service.invoke();
     
      IResource loadedRes = service.getLoadedResource();
      if (!(loadedRes instanceof ModelingProject)) throw new PartInitException(new Status(IStatus.ERROR, "q_impress", "Invalid input for editor."));
      else {
        this.setInput(new ModelingProjectEditorInput((ModelingProject) loadedRes, this.originalInput));
        this.projectInput = (ModelingProjectEditorInput) this.getEditorInput();
      }
    } catch (CoreException e) {
      throw new PartInitException(new Status(IStatus.ERROR, "q_impress", "Invalid input for editor : " + e.getMessage() , e));
    } catch (ServiceException e) {
      throw new PartInitException(new Status(IStatus.ERROR, "q_impress", "Invalid input for editor : " + e.getMessage() , e));
    } finally {
      if (inStream != null) {
        try {
          inStream.close();
        } catch (IOException e) {} // never happens
View Full Code Here

   */
  public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
    XMLInputSource input;

    if (!(editorInput instanceof IFileEditorInput))
      throw new PartInitException(Messages.getString("MultiPageEditor.invalidInputClass")); //$NON-NLS-1$
    fileNeedingContext = file = ((IFileEditorInput) editorInput).getFile();
    String filePathName = file.getLocation().toOSString();

    try {
      input = new XMLInputSource(filePathName);
    } catch (IOException e) {
      String m = Messages.getFormattedString("MultiPageEditor.IOError", //$NON-NLS-1$
              new String[] { AbstractSection.maybeShortenFileName(filePathName) })
              + Messages.getString("MultiPageEditor.10") + getMessagesToRootCause(e); //$NON-NLS-1$
      // skip showing a message because the partInitException
      // shows it
      throw new PartInitException(m);
    }

    // leaves isBadXML set, if it can't parse but isn't throwing
    isContextLoaded = false;
    try {
      parseSource(input, filePathName);
    } catch (MultilevelCancel e) {
      throw new PartInitException("Operation Cancelled");
    }

    isContextLoaded = true;

    super.init(site, editorInput);
View Full Code Here

        setCasConsumerDescription((CasConsumerDescription) inputDescription);
      } else if (inputDescription instanceof FlowControllerDescription) {
        validateDescriptorType(DESCRIPTOR_FLOWCONTROLLER);
        setFlowControllerDescription((FlowControllerDescription) inputDescription);
      } else {
        throw new PartInitException(Messages.getFormattedString(
                "MultiPageEditor.unrecognizedDescType", //$NON-NLS-1$
                new String[] { AbstractSection.maybeShortenFileName(filePathName) })
                + Messages.getString("MultiPageEditor.11")); //$NON-NLS-1$
      }
      isBadXML = false;
View Full Code Here

     * The <code>MultiPageEditorExample</code> implementation of this method checks that the input
     * is an instance of <code>IFileEditorInput</code>.
     */
    public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
        if (!(editorInput instanceof IFileEditorInput)) {
            throw new PartInitException("Invalid Input: Must be IFileEditorInput");
        }
        super.init(site, editorInput);
    }
View Full Code Here

     * The <code>MultiPageEditorExample</code> implementation of this method checks that the input
     * is an instance of <code>IFileEditorInput</code>.
     */
    public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
        if (!(editorInput instanceof IFileEditorInput)) {
            throw new PartInitException("Invalid Input: Must be IFileEditorInput");
        }
        super.init(site, editorInput);
    }
View Full Code Here

      throws PartInitException {
    try {
      IEditorPart part = page.openEditor(editorInput, editorId,
          OpenStrategy.activateOnOpen());
      if (part == null) {
        throw new PartInitException(NLS.bind(
            UIText.EgitUiUtils_CouldNotOpenEditorMessage, editorId));
      }
      return part;
    } catch (PartInitException e) {
      if (editorId.equals("org.eclipse.ui.DefaultTextEditor")) { //$NON-NLS-1$
View Full Code Here

   *      org.eclipse.ui.IEditorInput)
   */
  public void init(IEditorSite site, IEditorInput input)
      throws PartInitException {
    if (input.getAdapter(RepositoryCommit.class) == null)
      throw new PartInitException(
          "Input could not be adapted to commit object"); //$NON-NLS-1$
    super.init(site, input);
    setPartName(input.getName());
    setTitleToolTip(input.getToolTipText());
  }
View Full Code Here

     *
     */
    @Override
    public void init(IEditorSite site, IEditorInput input) throws PartInitException
    {
        if (!(input instanceof SearchInput)) throw new PartInitException(
            "Invalid input: must be an instance of: " + SearchInput.class.getName());

        setSite(site);
        setInput(input);

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.