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

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

Introduction

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

Prototype

int ERROR

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

Click Source Link

Document

Constant for an error message (value 3).

Usage

From source file:org.eclipse.ease.modules.modeling.ui.views.ModelRefactoringView.java

License:Open Source License

protected void handleGoto() {
    String theText = text.getText();
    frmNavigation.setMessage(null);//from w  ww.j  a  va 2s .  c  o  m
    ISelection selec = comboViewer.getSelection();
    if (selec instanceof IStructuredSelection) {
        IStructuredSelection structured = (IStructuredSelection) selec;
        if (structured.getFirstElement() instanceof IMatcher) {
            IMatcher matcher = (IMatcher) structured.getFirstElement();
            Collection<EObject> toUse;
            try {
                toUse = matcher.getElements(theText, getCurrentEditor());
                toUse.remove(null);
                if (toUse.isEmpty()) {
                    if (frmNavigation.getMessage() == null) {
                        frmNavigation.setMessage(Messages.ModelRefactoringView_NO_ELEMENTS,
                                IMessageProvider.WARNING);
                    }
                }
                tableViewer_Search.setInput(toUse);
                frmNavigation.setMessage(toUse.size() + Messages.ModelRefactoringView_NB_ELEMENTS_FOUND,
                        IMessageProvider.INFORMATION);
            } catch (MatcherException e) {
                frmNavigation.setMessage(e.getMessage(), IMessageProvider.ERROR);
                e.printStackTrace();
            }

        }
    }

}

From source file:org.eclipse.edt.ide.deployment.rui.internal.editor.RUIFormPage.java

License:Open Source License

private void validateLocales() {
    RUIApplication app = getModelRoot().getDeployment().getRuiapplication();
    if (app != null) {
        // No locale selected is only an error if some handlers are enabled.
        if (app.isDeployAllHandlers() || (app.getRuihandler().size() != 0 && !allHandlersAreDisabled(app))) {
            String locales = EGLDDRootHelper.getParameterValue(app.getParameters(),
                    IDeploymentConstants.PARAMETER_LOCALES);
            if (locales == null || locales.length() == 0) {
                getManagedForm().getMessageManager().addMessage(VALIDATION_KEY_LOCALES,
                        Messages.no_locale_selected_error, null, IMessageProvider.ERROR, fLocalesLink);
            } else {
                getManagedForm().getMessageManager().removeMessage(VALIDATION_KEY_LOCALES, fLocalesLink);
            }//w  w w . j av  a  2  s  . co  m
        } else {
            getManagedForm().getMessageManager().removeMessage(VALIDATION_KEY_LOCALES, fLocalesLink);
        }
    }
}

From source file:org.eclipse.edt.ide.rui.internal.nls.EditLocaleWizardPage.java

License:Open Source License

protected boolean validatePage() {
    String error = "";
    String code = this.code.getText();
    String description = this.description.getText();
    String runtimeCode = LocaleUtility.getRuntimeCodeForDescription(this.runtimeLocaleChoicesCombo.getText());

    if (this.description.getText().equals("")) { //$NON-NLS-1$
        error = RUINlsStrings.NewLocaleDialog_Please_enter_a_unique_locale_descri_;
        this.description.setFocus();
    } else {//from   w w  w.  j  a  v a  2 s.c o m
        if (code.equals("")) { //$NON-NLS-1$
            error = RUINlsStrings.NewLocaleDialog_Please_enter_a_unique_locale_cod_;
            this.code.setFocus();
        } else {
            if (error.length() == 0) {
                if (!description.equalsIgnoreCase(originalDescription)) {
                    if (currentDescriptions.contains(this.description.getText())) {
                        error = RUINlsStrings.NewLocaleDialog_The_description_is_not_uniqu_;
                        this.description.setFocus();
                    }
                }
            }
            /**
             * if the user/runtime locale combination is unique then allow duplicate user locale code
             */
            if (!code.equalsIgnoreCase(originalCode) || !runtimeCode.equalsIgnoreCase(originalRuntimeCode)) {
                if (this.currentUserLocaleRuntimeLocaleCombinations.containsKey(code)) {
                    List runtimes = (List) this.currentUserLocaleRuntimeLocaleCombinations.get(code);
                    if (runtimes.contains(runtimeCode)) {
                        error = RUINlsStrings.NewLocaleDialog_locale_combo_already_exists;
                        this.code.setFocus();
                    }
                }
            }
        }
    }

    if (error.length() > 0) {
        setMessage(error, IMessageProvider.ERROR);
        return false;
    } else {
        setMessage(null);
        locale.setCode(code);
        locale.setDescription(description);
        locale.setRuntimeLocaleCode(runtimeCode);
        return true;
    }
}

From source file:org.eclipse.edt.ide.rui.internal.nls.NewLocaleWizardPage.java

License:Open Source License

protected boolean validatePage() {
    String error = "";
    String code = this.code.getText();
    String runtimeCode = LocaleUtility.getRuntimeCodeForDescription(this.runtimeLocaleChoicesCombo.getText());

    if (this.description.getText().equals("")) { //$NON-NLS-1$
        error = RUINlsStrings.NewLocaleDialog_Please_enter_a_unique_locale_descri_;
    } else {/*  w ww.ja  va 2 s .c  o  m*/
        if (code.equals("")) { //$NON-NLS-1$
            error = RUINlsStrings.NewLocaleDialog_Please_enter_a_unique_locale_cod_;
        } else {

            /**
             * if the user/runtime locale combination is unique then allow duplicate user locale code
             */
            if (this.currentUserLocaleRuntimeLocaleCombinations.containsKey(code)) {
                List runtimes = (List) this.currentUserLocaleRuntimeLocaleCombinations.get(code);
                if (runtimes.contains(runtimeCode)) {
                    error = RUINlsStrings.NewLocaleDialog_locale_combo_already_exists;
                } else {
                    if (currentDescriptions.contains(this.description.getText())) {
                        error = RUINlsStrings.NewLocaleDialog_The_description_is_not_uniqu_;
                    }
                }
            }
        }
    }

    if (error.length() > 0) {
        setMessage(error, IMessageProvider.ERROR);
        return false;
    } else {
        setMessage(null);
        locale.setCode(code);
        locale.setDescription(description.getText());
        locale.setRuntimeLocaleCode(runtimeCode);
        return true;
    }
}

From source file:org.eclipse.egit.ui.internal.dialogs.CommitMessageComponent.java

License:Open Source License

/**
 * Get the status of whether the commit operation should be enabled or
 * disabled.//from  w ww  .  j a v  a  2  s .com
 * <p>
 * This method checks the current state of the widgets and must always be
 * called from the UI-thread.
 * <p>
 * The returned status includes a message and type denoting why committing
 * cannot be completed.
 *
 * @return non-null commit status
 */
public CommitStatus getStatus() {
    if (!commitAllowed)
        return new CommitStatus(cannotCommitMessage, IMessageProvider.ERROR);

    String authorValue = authorText.getText();
    if (authorValue.length() == 0 || RawParseUtils.parsePersonIdent(authorValue) == null)
        return new CommitStatus(UIText.CommitMessageComponent_MessageInvalidAuthor, IMessageProvider.ERROR);

    String committerValue = committerText.getText();
    if (committerValue.length() == 0 || RawParseUtils.parsePersonIdent(committerValue) == null) {
        return new CommitStatus(UIText.CommitMessageComponent_MessageInvalidCommitter, IMessageProvider.ERROR);
    }

    if (amending && amendingCommitInRemoteBranch)
        return new CommitStatus(UIText.CommitMessageComponent_AmendingCommitInRemoteBranch,
                IMessageProvider.WARNING);

    return CommitStatus.OK;
}

From source file:org.eclipse.emf.cdo.security.internal.ui.editor.CDOSecurityPage.java

License:Open Source License

protected void checkForUnsupportedModelContent() {
    Object input = getManagedForm().getInput();
    if (!(input instanceof Realm)) {
        getManagedForm().getMessageManager().addMessage(this, Messages.CDOSecurityPage_4, null,
                IMessageProvider.ERROR);
    }/*  w w  w  .  j  a  va2 s .c  o  m*/
}

From source file:org.eclipse.emf.ecoretools.legacy.tabbedproperties.sections.AbstractTabbedPropertySection.java

License:Open Source License

/**
 * Add a decorator to the given control. A tool tip will display the given
 * message/*ww  w  .  j  av  a  2  s  .c  om*/
 * 
 * @param control
 * @param message
 * 
 * @since 1.0 M3
 */
protected void setErrorDecorator(Control control, String message) {
    setDecorator(control, message, IMessageProvider.ERROR);
}

From source file:org.eclipse.emf.editor.ModelCheckor.java

License:Open Source License

private List<MessageData> checkValidation(EObject root) {
    List<MessageData> messages = new ArrayList<MessageData>();
    Issues issues = facade.check(root);/* w  w w.  j a v  a  2 s  .co m*/
    for (MWEDiagnostic issue : issues.getErrors()) {
        messages.add(createMessageFromIssue(issue, IMessageProvider.ERROR));
    }
    for (MWEDiagnostic issue : issues.getWarnings()) {
        messages.add(createMessageFromIssue(issue, IMessageProvider.WARNING));
    }
    return messages;
}

From source file:org.eclipse.emf.editor.ModelCheckor.java

License:Open Source License

private List<MessageData> ecoreValidation(EObject rootObject) {
    int status = IMessageProvider.INFORMATION;
    Diagnostic diagnostic = Diagnostician.INSTANCE.validate(rootObject);

    switch (diagnostic.getSeverity()) {
    case Diagnostic.ERROR:
        status = IMessageProvider.ERROR;
        break;//from w w  w  .jav  a2  s . com
    case Diagnostic.WARNING:
        status = IMessageProvider.WARNING;
        break;
    case Diagnostic.INFO:
        status = IMessageProvider.INFORMATION;
    default:
        break;
    }
    return createMessagesFromDiagnostic(rootObject, diagnostic, status);
}

From source file:org.eclipse.emf.eef.runtime.tests.ui.properties.section.EEFReflectiveEditionSection.java

License:Open Source License

/**
 * @see org.eclipse.ui.views.properties.tabbed.ISection#createControls(org.eclipse.swt.widgets.Composite,
 *      org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetPage)
 *//*from w w  w  . ja  va  2  s.c om*/
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
    super.createControls(parent, aTabbedPropertySheetPage);
    //      this.propertySheetPage = aTabbedPropertySheetPage;
    this.parent = parent;
    scrolledForm = getWidgetFactory().createForm(parent);
    scrolledForm.getBody().setLayout(new GridLayout());
    scrolledForm.getBody().setLayoutData(new GridData(GridData.FILL_BOTH));
    Composite container = getWidgetFactory().createComposite(scrolledForm.getBody());
    GridLayout containerLayout = new GridLayout();
    container.setLayout(containerLayout);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));
    getWidgetFactory().decorateFormHeading(scrolledForm);
    viewer = new PropertiesEditionViewer(container, null, SWT.NONE, 1);
    viewer.setToolkit(getWidgetFactory());
    viewer.setDynamicTabHeader(true);
    getWidgetFactory().decorateFormHeading(scrolledForm);
    messageManager = new PropertiesEditionMessageManager() {

        @Override
        protected void updateStatus(String message) {
            if (message != null)
                scrolledForm.setMessage(message, IMessageProvider.ERROR);
            else
                scrolledForm.setMessage(""); //$NON-NLS-1$
        }
    };
}