Package org.eclipse.ui

Examples of org.eclipse.ui.PartInitException


   */
  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);
    }

    super.init(site, editorInput); // to allow other editors to get site and editorInput
       
    // 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


      } else {
        if (null == extensionEditor) {
          extensionEditor = getRequiredEditor(inputDescription);
        }
        if (null == extensionEditor) {
          throw new PartInitException(Messages.getFormattedString(
                  "MultiPageEditor.unrecognizedDescType", //$NON-NLS-1$
                  new String[] { AbstractSection.maybeShortenFileName(filePathName) })
                  + Messages.getString("MultiPageEditor.11")); //$NON-NLS-1$
        } else {
          extensionEditor.activateEditor(getEditorSite(), getEditorInput(), this, inputDescription);
View Full Code Here

    return true;
  }

  public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
    if (!(editorInput instanceof IFileEditorInput)){
      throw new PartInitException("Unsupported editor input.");
    }
    super.init(site, editorInput);
    setPartName(editorInput.getName());
  }
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);
    }

    super.init(site, editorInput); // to allow other editors to get site and editorInput
       
    // leaves isBadXML set, if it can't parse but isn't throwing
    isContextLoaded = false;
    try {
      parseSource(input, filePathName, PRESERVE_COMMENTS);
    } catch (MultilevelCancel e) {
      throw new PartInitException("Operation Cancelled");
    }

    isContextLoaded = true;

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

      } else {
        if (null == extensionEditor) {
          extensionEditor = getRequiredEditor(inputDescription);
        }
        if (null == extensionEditor) {
          throw new PartInitException(Messages.getFormattedString(
                  "MultiPageEditor.unrecognizedDescType", //$NON-NLS-1$
                  new String[] { AbstractSection.maybeShortenFileName(filePathName) })
                  + Messages.getString("MultiPageEditor.11")); //$NON-NLS-1$
        } else {
          extensionEditor.activateEditor(getEditorSite(), getEditorInput(), this, inputDescription);
View Full Code Here

          try {
            linkedFile = ExtLinkedFileHelper.obtainLink(uri, true);
            linkedFile.setPersistentProperty(TmpFileStoreEditorInput.UNTITLED_PROPERTY, "true");
          }
          catch(CoreException e) {
            throw new PartInitException(e.getStatus());
          }
        else {
          linkedFile = ExtLinkedFileHelper.obtainLink(uri, false);
        }
        IFileEditorInput linkedInput = new FileEditorInput(linkedFile);
View Full Code Here

   */
  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);
    IFileEditorInput fileInput = (IFileEditorInput)editorInput;
    if (Activator.getProjectManager().getCurrentHaxeProject() != null)
    {
View Full Code Here

          } catch (CoreException ce) {
            if (_log != null) {
              _log.error("Error.HTMLEditor.0", ce); //$NON-NLS-1$
            }
          }
          throw new PartInitException("Resource " + input.getName() //$NON-NLS-1$
              + " does not exist."); //$NON-NLS-1$
        }
                throw new PartInitException("Editor could not be open on " //$NON-NLS-1$
                    + input.getName());
      }
    } else if (input instanceof IStorageEditorInput) {
      InputStream contents = null;
      try {
        contents = ((IStorageEditorInput) input).getStorage()
            .getContents();
        if (contents == null) {
          throw new PartInitException("Editor could not be open on " //$NON-NLS-1$
              + input.getName());
        }
      } catch (CoreException noStorageExc) {
        // Error in geting storage contents
        _log.error("Error.HTMLEditor.1", noStorageExc); //$NON-NLS-1$
View Full Code Here

    final IDocumentProvider docProvider = sourcePage.getDocumentProvider();
    IDocument document = docProvider.getDocument(input);
    try {
      model.loadFrom(document);
    } catch (IOException e) {
      throw new PartInitException("Error reading editor input.", e);
    }
   
    // Ensure the field values are updated if the file content is replaced
        docProvider.addElementStateListener(new IElementStateListener() {
            public void elementMoved(Object originalElement, Object movedElement) {
View Full Code Here

          } catch (CoreException ce) {
            if (_log != null) {
              _log.error("Error.HTMLEditor.0", ce); //$NON-NLS-1$
            }
          }
          throw new PartInitException("Resource " + input.getName() //$NON-NLS-1$
              + " does not exist."); //$NON-NLS-1$
        }
                throw new PartInitException("Editor could not be open on " //$NON-NLS-1$
                    + input.getName());
      }
    } else if (input instanceof IStorageEditorInput) {
      InputStream contents = null;
      try {
        contents = ((IStorageEditorInput) input).getStorage()
            .getContents();
        if (contents == null) {
          throw new PartInitException("Editor could not be open on " //$NON-NLS-1$
              + input.getName());
        }
      } catch (CoreException noStorageExc) {
        // Error in geting storage contents
        _log.error("Error.HTMLEditor.1", noStorageExc); //$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.