Package org.eclipse.ui

Examples of org.eclipse.ui.PartInitException


     * 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


   */
  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

   */
  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

      } catch (CoreException e) {
        VisualSwingPlugin.getLogger().error(e);
        return true;
      }
    } else
      throw new PartInitException(Messages.AbstractDesignerEditor_Illegal_File);
    return false;
  }
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

                    Status status = new Status(Status.OK, pluginId,
                            ODOMEditorPart.MCS_ASSIGN_WIZARD_CANCELLED_CODE,
                            EditorMessages.getString(RESOURCE_PREFIX +
                            "projectAssignmentWizardCancelled.reason"),
                            null);
                    PartInitException e = new PartInitException(status);
                    throw e;
                }
            }
        }

        try {
            editorContext = LayoutEditorContextFactory.getDefaultInstance().
                    createLayoutEditorContext(this, file);

            // Register listener to handle project/resource being closed,
            // moved or deleted
            resourceCloseListener = new ResourceCloseListener(this);
            resourceCloseListener.startListener();
        } catch (PolicyFileAccessException ce) {
            String errorMessage = file.exists() ? LOAD_ERROR_MESSAGE :
                    MISSING_FILE_MESSAGE;
            throw new PartInitException(errorMessage);
        }

        // Allow the superclass to initialize the editor context
        super.init(site, input);
    }
View Full Code Here

            MessageFormat messageFormat =
                    new MessageFormat(message);
            String args [] = {file.getName()};


            throw new PartInitException(messageFormat.format(args));
        }
    }
View Full Code Here

                    "contextCreationFailure.message"); //$NON-NLS-1$
            MessageFormat messageFormat =
                    new MessageFormat(message);
            String args [] = {file.getName()};

            throw new PartInitException(messageFormat.format(args));
        }

        boolean validDeviceRepository = false;
        // if this is an mcs project then check if the device repository is
        // valid
        IProject project = context.getPolicyResource().getProject();
        try {
            if (project.hasNature(MCSProjectNature.NATURE_ID)) {
                MCSProjectNature projectNature;
                projectNature = MCSProjectNature.getMCSProjectNature(project);
                validDeviceRepository = projectNature.
                        hasValidDeviceRepository();
            }
        } catch (CoreException coreException) {
            EclipseCommonPlugin.handleError(ABPlugin.getDefault(), coreException);
        }
        if (validDeviceRepository == false) {
            // project does not have an MCS nature or the device repository has
            // become corrupt so launch wizard to add MCS nature to the project
            MCSProjectAssignmentWizard wizard =
                    new MCSProjectAssignmentWizard(project);
            // Instantiates the wizard container with the wizard and opens it
            Shell shell = getSite().getShell();
            WizardDialog dialog = new WizardDialog(shell, wizard);
            dialog.create();
            int action = dialog.open();
            if (action == WizardDialog.CANCEL) {
                String pluginId = ABPlugin.getDefault().
                        getDescriptor().getUniqueIdentifier();
                Status status = new Status(Status.OK, pluginId,
                        ODOMEditorPart.MCS_ASSIGN_WIZARD_CANCELLED_CODE,
                        EditorMessages.getString(RESOURCE_PREFIX +
                        "projectAssignmentWizardCancelled.reason"),
                        null);
                PartInitException e = new PartInitException(status);
                throw e;
            }
        }
    }
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.