Example usage for org.eclipse.jface.dialogs IMessageProvider WARNING

List of usage examples for org.eclipse.jface.dialogs IMessageProvider WARNING

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IMessageProvider WARNING.

Prototype

int WARNING

To view the source code for org.eclipse.jface.dialogs IMessageProvider WARNING.

Click Source Link

Document

Constant for a warning message (value 2).

Usage

From source file:org.eclipse.jdt.debug.ui.launchConfigurations.AbstractVMInstallPage.java

License:Open Source License

/**
 * Sets this page's message based on the status severity.
 * /* ww  w.j  a v  a 2  s .c  om*/
 * @param status status with message and severity
 */
protected void setStatusMessage(IStatus status) {
    if (status.isOK()) {
        setMessage(status.getMessage());
    } else {
        switch (status.getSeverity()) {
        case IStatus.ERROR:
            setMessage(status.getMessage(), IMessageProvider.ERROR);
            break;
        case IStatus.INFO:
            setMessage(status.getMessage(), IMessageProvider.INFORMATION);
            break;
        case IStatus.WARNING:
            setMessage(status.getMessage(), IMessageProvider.WARNING);
            break;
        default:
            break;
        }
    }
}

From source file:org.eclipse.jdt.internal.debug.ui.jres.JREsPreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite ancestor) {
    initializeDialogUnits(ancestor);//from   w  ww. ja  va2  s  .c o m

    noDefaultButton();

    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    ancestor.setLayout(layout);

    SWTFactory.createWrapLabel(ancestor, JREMessages.JREsPreferencePage_2, 1, 300);
    SWTFactory.createVerticalSpacer(ancestor, 1);

    fJREBlock = new InstalledJREsBlock();
    fJREBlock.createControl(ancestor);
    Control control = fJREBlock.getControl();
    GridData data = new GridData(GridData.FILL_BOTH);
    data.horizontalSpan = 1;
    control.setLayoutData(data);

    fJREBlock.restoreColumnSettings(JDIDebugUIPlugin.getDefault().getDialogSettings(),
            IJavaDebugHelpContextIds.JRE_PREFERENCE_PAGE);

    fCompliance = new Link(ancestor, SWT.NONE);
    fCompliance.setText(JREMessages.JREsPreferencePage_14);
    fCompliance.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fCompliance.setVisible(false);
    fCompliance.addSelectionListener(new SelectionListener() {
        public void widgetDefaultSelected(SelectionEvent e) {
        }

        public void widgetSelected(SelectionEvent e) {
            openCompliancePreferencePage();
        }
    });
    PlatformUI.getWorkbench().getHelpSystem().setHelp(ancestor, IJavaDebugHelpContextIds.JRE_PREFERENCE_PAGE);
    initDefaultVM();
    fJREBlock.initializeTimeStamp();
    fJREBlock.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            IVMInstall install = getCurrentDefaultVM();
            if (install == null) {
                setValid(false);
                if (fJREBlock.getJREs().length < 1) {
                    setErrorMessage(JREMessages.JREsPreferencePage_3);
                } else {
                    setErrorMessage(JREMessages.JREsPreferencePage_13);
                }
            } else {
                //if we change the VM make sure the compliance level supports 
                //generated class files
                String compliance = getCurrentCompilerCompliance();
                if (!supportsCurrentCompliance(install, compliance)) {
                    setMessage(NLS.bind(JREMessages.JREsPreferencePage_0, new String[] { compliance }),
                            IMessageProvider.WARNING);
                    fCompliance.setVisible(true);
                } else {
                    setMessage(null);
                    fCompliance.setVisible(false);
                }
                setValid(true);
                setErrorMessage(null);
            }
        }
    });
    applyDialogFont(ancestor);
    return ancestor;
}

From source file:org.eclipse.jdt.internal.debug.ui.jres.JREsPreferencePage.java

License:Open Source License

@Override
public boolean isValid() {
    String compliance = getCurrentCompilerCompliance();
    if (!supportsCurrentCompliance(getCurrentDefaultVM(), compliance)) {
        setMessage(NLS.bind(JREMessages.JREsPreferencePage_0, new String[] { compliance }),
                IMessageProvider.WARNING);
        fCompliance.setVisible(true);//from w ww  .  j  a  v a  2 s . c  o  m
    } else {
        setMessage(null);
        fCompliance.setVisible(false);
    }
    return super.isValid();
}

From source file:org.eclipse.jpt.common.ui.internal.widgets.ValidatingDialog.java

License:Open Source License

/**
 * Updates the description pane by showing the given warning message and format
 * the text with the given list of arguments if any exists.
 *
 * @param warningMessage The warning message to show in the description pane
 * @param arguments The list of arguments used to format the error message
 */// w ww  .j  a  va  2  s.  c  om

protected final void setWarningMessage(String warningMessage, Object... arguments) {
    setMessage(NLS.bind(warningMessage, arguments), IMessageProvider.WARNING);
}

From source file:org.eclipse.jpt.common.ui.internal.widgets.ValidatingDialog.java

License:Open Source License

/**
 * Updates the error message, either shows the first error problem or hides
 * the error pane. If the progress bar is shown, then the error message will
 * not be shown.//from  w  w w . j  a  v  a 2s  .  c om
 */
private void updateMessage() {
    if (getSubject().branchProblemsSize() == 0) {
        clearMessage();
    } else {
        for (ListIterator<Node.Problem> problems = getSubject().branchProblems(); problems.hasNext();) {
            Node.Problem problem = problems.next();
            if (problem.messageType() == IMessageProvider.ERROR) {
                this.setErrorMessage(problem.messageKey(), problem.messageArguments());
            } else if (problem.messageType() == IMessageProvider.WARNING) {
                this.setWarningMessage(problem.messageKey(), problem.messageArguments());
            }
        }
    }
    if (!this.containsErrorMessage()) {
        clearErrorMessage();
    }
}

From source file:org.eclipse.jpt.jaxb.ui.internal.wizards.schemagen.NewSchemaFileWizardPage.java

License:Open Source License

@Override
protected boolean validatePage() {
    this.dataModel.setProperty(PROJECT, this.getProjectNamed(this.getContainerName()));
    this.dataModel.setProperty(CONTAINER_PATH, this.getContainerFullPath());
    this.dataModel.setProperty(FILE_NAME, this.getFileName());

    boolean valid = super.validatePage();
    if (!valid) {
        return valid;
    }/*  w  ww. ja v  a  2  s  . c o m*/
    this.overrideFileExistsWarning();

    //TODO move this validation to the dataModel - see NewJptFileWizardPage
    // Validate Project
    valid = ProjectTools.isJavaProject(this.getProject());
    if (!valid) {
        this.setErrorMessage(JptJaxbUiMessages.NEW_SCHEMA_FILE_WIZARD_PAGE_ERROR_NOT_JAVA_PROJECT);
        return valid;
    }
    // Validate XSD file not exists.
    valid = this.xsdFileNotExists();
    if (!valid) {
        this.setMessage(JptJaxbUiMessages.NEW_SCHEMA_FILE_WIZARD_PAGE_OVERWRITE_EXISTING_SCHEMAS,
                IMessageProvider.WARNING);
        return true;
    }
    this.setErrorMessage(null);

    return valid;
}

From source file:org.eclipse.jpt.jpa.eclipselink.ui.internal.details.EclipseLinkConverterStateObject.java

License:Open Source License

private void addNameProblemsTo(List<Problem> currentProblems) {
    if (StringTools.isBlank(this.name)) {
        currentProblems.add(buildProblem(
                JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_CONVERTER_STATE_OBJECT_NAME_MUST_BE_SPECIFIED,
                IMessageProvider.ERROR));
    } else if (names().contains(this.name)) {
        currentProblems.add(//from   w ww.j  a v  a2 s .c  o  m
                buildProblem(JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_CONVERTER_STATE_OBJECT_NAME_EXISTS,
                        IMessageProvider.WARNING));
    } else if (ArrayTools.contains(EclipseLinkConvert.RESERVED_CONVERTER_NAMES, this.name)) {
        currentProblems.add(buildProblem(
                JptJpaEclipseLinkUiDetailsMessages.ECLIPSELINK_CONVERTER_STATE_OBJECT_NAME_IS_RESERVED,
                IMessageProvider.ERROR));
    }
}

From source file:org.eclipse.jpt.jpa.ui.internal.details.AddQueryStateObject.java

License:Open Source License

private void addNameProblemsTo(List<Problem> currentProblems) {
    if (StringTools.isBlank(this.name)) {
        currentProblems.add(buildProblem(JptJpaUiDetailsMessages.QueryStateObject_nameMustBeSpecified,
                IMessageProvider.ERROR));
    } else if (names().contains(this.name)) {
        currentProblems/*from ww w .java2s .  c  om*/
                .add(buildProblem(JptJpaUiDetailsMessages.AddQueryDialog_nameExists, IMessageProvider.WARNING));
    }
}

From source file:org.eclipse.jpt.jpa.ui.internal.details.orm.AddGeneratorStateObject.java

License:Open Source License

private void addNameProblemsTo(List<Problem> currentProblems) {
    if (StringTools.isBlank(this.name)) {
        currentProblems//from  w w w  . j  a  va  2 s  .c  o m
                .add(buildProblem(JptJpaUiDetailsOrmMessages.GENERATOR_STATE_OBJECT_NAME_MUST_BE_SPECIFIED,
                        IMessageProvider.ERROR));
    } else if (names().contains(this.name)) {
        currentProblems.add(buildProblem(JptJpaUiDetailsOrmMessages.GENERATOR_STATE_OBJECT_NAME_EXISTS,
                IMessageProvider.WARNING));
    }
}

From source file:org.eclipse.jpt.jpa.ui.internal.properties.DataModelPropertyPage.java

License:Open Source License

/**
 * Set the error message for this page based on the last error in the ValidationStatus.
 *///w  w  w.  ja v  a  2s . co m
protected void setErrorMessage() {
    String error = status.getLastErrMsg();
    if (error == null) {
        if (getErrorMessage() != null)
            setErrorMessage((String) null);
        String warning = status.getLastWarningMsg();
        if (warning == null) {
            if (getMessage() != null && getMessageType() == IMessageProvider.WARNING)
                setMessage(null, IMessageProvider.WARNING);
            else {
                String info = status.getLastInfoMsg();
                if (info == null) {
                    if (getMessage() != null && getMessageType() == IMessageProvider.INFORMATION)
                        setMessage(null, IMessageProvider.INFORMATION);
                } else if (!info.equals(getMessage())) {
                    setMessage(info, IMessageProvider.INFORMATION);
                }
            }
        } else if (!warning.equals(getMessage()))
            setMessage(warning, IMessageProvider.WARNING);
    } else if (!error.equals(getErrorMessage()))
        setErrorMessage(error);
}