Package org.eclipse.core.runtime

Examples of org.eclipse.core.runtime.IStatus


        this.bndProject = bndProject;
    }

    @Override
    public boolean performFinish() {
        IStatus status = Status.OK_STATUS;
        if (destinationPage.isFolder())
            status = generateFolder(destinationPage.getFolderPath());
        else
            status = generateJar(destinationPage.getJarPath());

        if (!status.isOK())
            ErrorDialog.openError(getShell(), "Error", null, status);

        return status.isOK();
    }
View Full Code Here


                return;
            }

            // Create resolver job and pre-validate
            final ResolveJob job = new ResolveJob(model);
            IStatus validation = job.validateBeforeRun();
            if (!validation.isOK()) {
                String message = "Unable to run the resolver. NB.: the file will still be saved.";
                ErrorDialog.openError(shell, "Resolution Validation Problem", message, validation, IStatus.ERROR | IStatus.WARNING);
                reallySave(monitor);
                return;
            }
View Full Code Here

        final Shell parentShell = page.getEditor().getSite().getShell();

        // Create the wizard and pre-validate
        final ResolveJob job = new ResolveJob(model);
        IStatus validation = job.validateBeforeRun();
        if (!validation.isOK()) {
            ErrorDialog errorDialog = new ErrorDialog(parentShell, "Validation Problem", null, validation, IStatus.ERROR | IStatus.WARNING) {
                @Override
                protected void createButtonsForButtonBar(Composite parent) {
                    // create OK, Cancel and Details buttons
                    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
                    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
                    createDetailsButton(parent);
                }
            };
            int response = errorDialog.open();
            if (Window.CANCEL == response || validation.getSeverity() >= IStatus.ERROR)
                return;
        }

        // Add the operation to perform at the end of the resolution job (i.e.,
        // showing the result)
View Full Code Here

    /*
     * @see org.eclipse.jdt.ui.wizards.NewContainerWizardPage#containerChanged()
     */
    @Override
    protected IStatus containerChanged() {
        IStatus status = super.containerChanged();
        IPackageFragmentRoot root = getPackageFragmentRoot();
        if (root == null) {
            return status;
        }

        IJavaProject project = root.getJavaProject();

        if ((fTypeKind == ANNOTATION_TYPE || fTypeKind == ENUM_TYPE) && !status.matches(IStatus.ERROR)) {
            if (!JavaModelUtil.is50OrHigher(project)) {
                // error as createType will fail otherwise (bug 96928)
                return new StatusInfo(IStatus.ERROR, Messages.format(NewWizardMessages.NewTypeWizardPage_warning_NotJDKCompliant, BasicElementLabels.getJavaElementName(project.getElementName())));
            }
            if (fTypeKind == ENUM_TYPE) {
View Full Code Here

        IJavaProject project = root != null ? root.getJavaProject() : null;

        String packName = getPackageText();
        if (packName.length() > 0) {
            IStatus val = validatePackageName(packName, project);
            if (val.getSeverity() == IStatus.ERROR) {
                status.setError(Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidPackageName, val.getMessage()));
                return status;
            } else if (val.getSeverity() == IStatus.WARNING) {
                status.setWarning(Messages.format(NewWizardMessages.NewTypeWizardPage_warning_DiscouragedPackageName, val.getMessage()));
                // continue
            }
        } else {
            status.setWarning(NewWizardMessages.NewTypeWizardPage_warning_DefaultPackageDiscouraged);
        }
View Full Code Here

            status.setError(NewWizardMessages.NewTypeWizardPage_error_QualifiedName);
            return status;
        }

        IJavaProject project = getJavaProject();
        IStatus val = validateJavaTypeName(typeName, project);
        if (val.getSeverity() == IStatus.ERROR) {
            status.setError(Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidTypeName, val.getMessage()));
            return status;
        } else if (val.getSeverity() == IStatus.WARNING) {
            status.setWarning(Messages.format(NewWizardMessages.NewTypeWizardPage_warning_TypeNameDiscouraged, val.getMessage()));
            // continue checking
        }

        // must not exist
        if (!isEnclosingTypeSelected()) {
View Full Code Here

        viewer.setLabelProvider(new StatusLabelProvider());
        viewer.setInput(status);

        viewer.addSelectionChangedListener(new ISelectionChangedListener() {
            public void selectionChanged(SelectionChangedEvent event) {
                IStatus status = (IStatus) ((IStructuredSelection) event.getSelection()).getFirstElement();

                String detail = "";
                if (status != null) {
                    ByteArrayOutputStream messageBuffer = new ByteArrayOutputStream();
                    PrintStream printer = null;
                    try {
                        printer = new PrintStream(messageBuffer, false, "UTF-8");
                        printer.println(status.toString());

                        Throwable e = status.getException();
                        if (e != null)
                            e.printStackTrace(printer);

                        printer.flush();
                        detail = messageBuffer.toString("UTF-8");
                    } catch (UnsupportedEncodingException e1) {
                        /* just ignore this, should not happen */
                    }
                }
                txtDetails.setText(detail);
            }
        });

        if (status.getSeverity() >= IStatus.WARNING) {
            setMessage("One or more warnings occurred while preparing the runtime environment.");
            lblQuestion.setText("Continue launching anyway?");
        }

        return container;
View Full Code Here

    private Image imgWarning = null;
    private Image imgInfo = null;

    @Override
    public void update(ViewerCell cell) {
        IStatus status = (IStatus) cell.getElement();

        switch (status.getSeverity()) {
        case IStatus.ERROR :
            if (imgError == null)
                imgError = AbstractUIPlugin.imageDescriptorFromPlugin(Plugin.PLUGIN_ID, "icons/error_obj.gif").createImage();
            cell.setImage(imgError);
            break;
        case IStatus.WARNING :
            if (imgWarning == null)
                imgWarning = AbstractUIPlugin.imageDescriptorFromPlugin(Plugin.PLUGIN_ID, "icons/warning_obj.gif").createImage();
            cell.setImage(imgWarning);
            break;
        case IStatus.INFO :
            if (imgInfo == null)
                imgInfo = AbstractUIPlugin.imageDescriptorFromPlugin(Plugin.PLUGIN_ID, "icons/information.gif").createImage();
            cell.setImage(imgInfo);
            break;
        case IStatus.OK :
        case IStatus.CANCEL :
        default :
            break;
        }

        StyledString label = new StyledString(status.getMessage());
        if (status.getException() != null)
            label.append(": " + status.getException().toString(), StyledString.QUALIFIER_STYLER);

        cell.setText(label.getString());
        cell.setStyleRanges(label.getStyleRanges());
    }
View Full Code Here

            if (!loc.lastSegment().equals(projectName))
                return new Status(IStatus.ERROR, Plugin.PLUGIN_ID, 0, "Project location must end with specified project name", null);
        }

        // Check valid name
        IStatus nameStatus = JavaPlugin.getWorkspace().validateName(projectName != null ? projectName : "", IResource.PROJECT);
        if (!nameStatus.isOK())
            return nameStatus;

        // Check if project name already exists
        IProject existingProject = JavaPlugin.getWorkspace().getRoot().getProject(projectName);
        if (existingProject.exists())
View Full Code Here

        return Status.OK_STATUS;
    }

    private void validate() {
        IStatus oldStatus = status;
        status = checkStatus();
        propSupport.firePropertyChange(PROP_STATUS, oldStatus, status);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.core.runtime.IStatus

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.