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:com.googlecode.osde.internal.ui.views.appdata.AddAppDataDialog.java

License:Apache License

private boolean validate() {
    String id = keyText.getText();
    if (StringUtils.isEmpty(id)) {
        setMessage("Please fill the key field.", IMessageProvider.ERROR);
        getButton(IDialogConstants.OK_ID).setEnabled(false);
        return false;
    }/*w w w . j av  a 2  s.c o  m*/
    String displayName = valueText.getText();
    if (StringUtils.isEmpty(displayName)) {
        setMessage("Please fill the value field.", IMessageProvider.ERROR);
        getButton(IDialogConstants.OK_ID).setEnabled(false);
        return false;
    }
    setMessage(null);
    getButton(IDialogConstants.OK_ID).setEnabled(true);
    return true;
}

From source file:com.googlecode.osde.internal.ui.views.people.AddRelationshipDialog.java

License:Apache License

@Override
protected void okPressed() {
    groupId = groupIdCombo.getText();// w ww  .  j  av a  2  s.com
    target = (Person) ((IStructuredSelection) personList.getSelection()).getFirstElement();
    if (target == null) {
        setMessage("Person is required.", IMessageProvider.ERROR);
        setReturnCode(CANCEL);
        return;
    }
    setReturnCode(OK);
    close();
}

From source file:com.googlecode.osde.internal.ui.views.people.AddRelationshipDialog.java

License:Apache License

private boolean validate() {
    String groupId = groupIdCombo.getText().trim();
    if (StringUtils.isEmpty(groupId)) {
        setMessage("Group ID is required.", IMessageProvider.ERROR);
        getButton(IDialogConstants.OK_ID).setEnabled(false);
        return false;
    }/*www .j  a  v  a 2s .  c o m*/
    setMessage(null);
    getButton(IDialogConstants.OK_ID).setEnabled(true);
    return true;
}

From source file:com.googlecode.osde.internal.ui.views.people.NewPersonDialog.java

License:Apache License

private boolean validate() {
    String id = idText.getText();
    if (StringUtils.isEmpty(id)) {
        setMessage("Please fill the ID field.", IMessageProvider.ERROR);
        getButton(IDialogConstants.OK_ID).setEnabled(false);
        return false;
    }/*ww  w. j  a va2s  .co m*/
    String displayName = displayNameText.getText();
    if (StringUtils.isEmpty(displayName)) {
        setMessage("Please fill the Display name field.", IMessageProvider.ERROR);
        getButton(IDialogConstants.OK_ID).setEnabled(false);
        return false;
    }
    setMessage(null);
    getButton(IDialogConstants.OK_ID).setEnabled(true);
    return true;
}

From source file:com.gorillalogic.monkeyconsole.editors.utils.TitleAreaDialogStyledTextMessage.java

License:Open Source License

/**
 * Sets the message for this dialog with an indication of what type of
 * message it is.// ww w.ja  va2  s. c o  m
 * <p>
 * The valid message types are one of <code>NONE</code>,
 * <code>INFORMATION</code>,<code>WARNING</code>, or
 * <code>ERROR</code>.
 * </p>
 * <p>
 * Note that for backward compatibility, a message of type
 * <code>ERROR</code> is different than an error message (set using
 * <code>setErrorMessage</code>). An error message overrides the current
 * message until the error message is cleared. This method replaces the
 * current message and does not affect the error message.
 * </p>
 * 
 * @param newMessage
 *            the message, or <code>null</code> to clear the message
 * @param newType
 *            the message type
 * @since 2.0
 */
public void setMessage(String newMessage, int newType) {
    Image newImage = null;
    if (newMessage != null) {
        switch (newType) {
        case IMessageProvider.NONE:
            break;
        case IMessageProvider.INFORMATION:
            newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_INFO);
            break;
        case IMessageProvider.WARNING:
            newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_WARNING);
            break;
        case IMessageProvider.ERROR:
            newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_ERROR);
            break;
        }
    }
    showMessage(newMessage, newImage);
}

From source file:com.hangum.tadpole.rdb.core.dialog.msg.TDBErroDialog.java

License:Open Source License

/**
 * Create contents of the dialog./* w w  w .java2  s .  c o  m*/
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    setMessage(title, IMessageProvider.ERROR);

    Composite area = (Composite) super.createDialogArea(parent);
    Composite container = new Composite(area, SWT.NONE);
    container.setLayout(new GridLayout(2, false));
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    lblMessage = new Label(container, SWT.NONE);
    lblMessage.setText(Messages.get().TDBErroDialog_2);
    new Label(container, SWT.NONE);

    textMessage = new Text(container,
            SWT.BORDER | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL | SWT.MULTI);
    textMessage.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    textMessage.setText(message);

    // google analytic
    AnalyticCaller.track(this.getClass().getName());

    return area;
}

From source file:com.inavare.maven.platform.WizardPageExtension.java

License:Open Source License

protected void update() {
    String dir = this.directoryText.getText();
    File file = new File(dir);

    setMessage(null);//www . j  a  v a  2 s  .co m
    setPageComplete(false);

    if (!file.exists()) {
        setMessage(String.format("Directory '%s' does not exists", file.getAbsolutePath()),
                IMessageProvider.ERROR);
        return;
    }
    if (!file.isDirectory()) {
        setMessage(String.format("Path '%s' is not a directory", file.getAbsolutePath()),
                IMessageProvider.ERROR);
        return;
    }
    if (!file.canRead()) {
        setMessage(String.format("Directory '%s' is not readable", file.getAbsolutePath()),
                IMessageProvider.WARNING);
    }
    if (!file.isAbsolute()) {
        setMessage(String.format("Path to '%s' is not absolute", file.getAbsolutePath()),
                IMessageProvider.WARNING);
    }

    setPageComplete(true);
}

From source file:com.liferay.ide.gradle.ui.modules.NewModuleFragmentWizard.java

License:Open Source License

@Override
public IWizardPage[] getPages() {
    final IWizardPage[] wizardPages = super.getPages();

    if (!firstErrorMessageRemoved && wizardPages != null) {
        final SapphireWizardPage wizardPage = (SapphireWizardPage) wizardPages[0];

        final String message = wizardPage.getMessage();
        final int messageType = wizardPage.getMessageType();

        if (messageType == IMessageProvider.ERROR && !CoreUtil.isNullOrEmpty(message)) {
            wizardPage.setMessage("Please enter a project name.", SapphireWizardPage.NONE); //$NON-NLS-1$
            firstErrorMessageRemoved = true;
        }//from   w w  w.  jav  a 2 s.c  o  m
    }

    return wizardPages;
}

From source file:com.liferay.ide.gradle.ui.workspace.ImportLiferayWorkspaceWizard.java

License:Open Source License

@Override
public IWizardPage[] getPages() {
    final IWizardPage[] wizardPages = super.getPages();

    if (!firstErrorMessageRemoved && wizardPages != null) {
        final SapphireWizardPage wizardPage = (SapphireWizardPage) wizardPages[0];

        final String message = wizardPage.getMessage();
        final int messageType = wizardPage.getMessageType();

        if (messageType == IMessageProvider.ERROR && !CoreUtil.isNullOrEmpty(message)) {
            try {
                if (LiferayWorkspaceUtil.hasLiferayWorkspace()) {
                    wizardPage.setMessage(LiferayWorkspaceUtil.hasLiferayWorkspaceMsg,
                            SapphireWizardPage.ERROR);
                } else {
                    wizardPage.setMessage("Please select the workspace location.", SapphireWizardPage.NONE);
                }/*  ww  w.j a  v a2 s . c  o  m*/
            } catch (CoreException e) {
                wizardPage.setMessage(LiferayWorkspaceUtil.multiWorkspaceError, SapphireWizardPage.ERROR);
            }

            firstErrorMessageRemoved = true;
        }
    }

    return wizardPages;
}

From source file:com.liferay.ide.gradle.ui.workspace.NewLiferayWorkspaceWizard.java

License:Open Source License

@Override
public IWizardPage[] getPages() {
    final IWizardPage[] wizardPages = super.getPages();

    if (!firstErrorMessageRemoved && wizardPages != null) {
        final SapphireWizardPage wizardPage = (SapphireWizardPage) wizardPages[0];

        final String message = wizardPage.getMessage();
        final int messageType = wizardPage.getMessageType();

        if (messageType == IMessageProvider.ERROR && !CoreUtil.isNullOrEmpty(message)) {
            try {
                if (LiferayWorkspaceUtil.hasLiferayWorkspace()) {
                    wizardPage.setMessage(LiferayWorkspaceUtil.hasLiferayWorkspaceMsg,
                            SapphireWizardPage.ERROR);
                } else {
                    wizardPage.setMessage("Please enter the workspace name.", SapphireWizardPage.NONE);
                }// w ww.  j  av a2  s . co m
            } catch (CoreException e) {
                wizardPage.setMessage(LiferayWorkspaceUtil.multiWorkspaceError, SapphireWizardPage.ERROR);
            }

            firstErrorMessageRemoved = true;
        }
    }

    return wizardPages;
}