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

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

Introduction

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

Prototype

int NONE

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

Click Source Link

Document

Constant for a regular message (value 0).

Usage

From source file:com.iw.plugins.spindle.ui.preferences.AbstractPreferencePage.java

License:Open Source License

private void applyToStatusLine(DialogPage page, IStatus status) {
    String message = status.getMessage();
    switch (status.getSeverity()) {
    case IStatus.OK:
        page.setMessage(message, IMessageProvider.NONE);
        page.setErrorMessage(null);//from w ww .  j  a va  2  s  .  c  o  m
        break;
    case IStatus.WARNING:
        page.setMessage(message, IMessageProvider.WARNING);
        page.setErrorMessage(null);
        break;
    case IStatus.INFO:
        page.setMessage(message, IMessageProvider.INFORMATION);
        page.setErrorMessage(null);
        break;
    default:
        if (message.length() == 0) {
            message = null;
        }
        page.setMessage(null);
        page.setErrorMessage(message);
        break;
    }
}

From source file:com.iw.plugins.spindle.ui.properties.LibrarySearchDialog.java

License:Mozilla Public License

public void create() {
    super.create();
    setTitle(title);
    setMessage(description, IMessageProvider.NONE);
    searchWidget.setFocus();
    updateOkState();
}

From source file:com.iw.plugins.spindle.ui.PublicStaticFieldSelectionDialog.java

License:Mozilla Public License

/**
 * @see AbstractDialog#createAreaContents(Composite)
 *//*ww  w  .j a v  a2  s .  com*/
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);

    Composite innerContainer = new Composite(container, SWT.NONE);
    FormLayout layout = new FormLayout();
    layout.marginHeight = 4;
    layout.marginWidth = 4;
    innerContainer.setLayout(layout);

    //our container is embedded in a GridLayout 
    GridData gd = new GridData();
    gd.widthHint = 500;
    gd.heightHint = 300;

    innerContainer.setLayoutData(gd);

    typeField = new StringButtonField("Type:", 64);
    typeField.addListener(adapter);

    Control typeFieldControl = typeField.getControl(innerContainer);
    Text text = typeField.getTextControl(innerContainer);
    text.setEditable(false);
    text.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));

    FormData formData = new FormData();
    formData.top = new FormAttachment(0, 0);
    formData.left = new FormAttachment(0, 0);
    formData.right = new FormAttachment(100, 0);
    typeFieldControl.setLayoutData(formData);

    Control fieldListControl = createFieldList(innerContainer);

    formData = new FormData();
    formData.top = new FormAttachment(typeFieldControl, 4);
    formData.left = new FormAttachment(0, 0);
    formData.right = new FormAttachment(100, 0);
    formData.bottom = new FormAttachment(100, 0);
    fieldListControl.setLayoutData(formData);

    if (existingBinding != null) {
        populateFromExistingBinding();
    }

    setTitle("Choose Field Value");
    setMessage("Choose a Type and one of it public static fields", IMessageProvider.NONE);

    return container;
}

From source file:com.iw.plugins.spindle.ui.TextAreaDialog.java

License:Mozilla Public License

/**
 * @see AbstractDialog#createAreaContents(Composite)
 *//*from  w w w. ja va  2s.c  om*/
protected Control createDialogArea(Composite parent) {

    Composite container = (Composite) super.createDialogArea(parent);
    GridData gd;
    Control control;

    Composite innerContainer = new Composite(container, SWT.NULL);
    gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
    innerContainer.setLayoutData(gd);
    GridLayout layout = new GridLayout();
    layout = new GridLayout();
    innerContainer.setLayout(layout);

    text = new Text(innerContainer, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
    gd = new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING | GridData.GRAB_HORIZONTAL
            | GridData.GRAB_VERTICAL);
    gd.heightHint = convertHeightInCharsToPixels(20);
    gd.widthHint = convertWidthInCharsToPixels(45);
    text.setLayoutData(gd);

    text.setText(openText);

    FontData data = new FontData("courier", SWT.NULL, 6);
    // on windows platform, I need to do the following
    // even though the values are the same as the constructor's
    data.setStyle(SWT.NORMAL);
    data.setHeight(6);
    font = new Font(text.getDisplay(), data);
    text.setFont(font);

    setTitle(title);
    setMessage(message, IMessageProvider.NONE);

    return container;
}

From source file:com.liferay.ide.portlet.ui.editor.PluginPackageGeneralSection.java

License:Open Source License

@Override
public void commit(boolean onSave) {
    if (validate().isOK()) {
        page.form.setMessage("", IMessageProvider.NONE);
        refresh();/*from   ww  w . j av a2s.  c o m*/
        super.commit(onSave);
    } else {
        page.form.setMessage(validate().getMessage(), IMessageProvider.ERROR);
    }
}

From source file:com.liferay.ide.sdk.ui.AddSDKDialog.java

License:Open Source License

public void modifyText(ModifyEvent e) {
    IStatus status = validate();//www . jav a  2  s. c  om

    if (!status.isOK()) {
        switch (status.getSeverity()) {

        case IStatus.WARNING:
            setMessage(status.getMessage(), IMessageProvider.WARNING);
            break;

        case IStatus.ERROR:
            setMessage(status.getMessage(), IMessageProvider.ERROR);
            this.getButton(IDialogConstants.OK_ID).setEnabled(false);
            break;
        }
    } else {
        this.getButton(IDialogConstants.OK_ID).setEnabled(true);
        setMessage(getDefaultMessage(), IMessageProvider.NONE);
    }
}

From source file:com.liferay.ide.server.ui.portal.PortalRuntimeComposite.java

License:Open Source License

protected void validate() {
    final IStatus status = this.runtimeWC.validate(null);

    if (status == null || status.isOK()) {
        this.wizard.setMessage(null, IMessageProvider.NONE);
    } else if (status.getSeverity() == IStatus.WARNING) {
        this.wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
    } else {/*from  w  ww  .  j  av  a 2s. c om*/
        this.wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
    }

    this.wizard.update();
}

From source file:com.liferay.ide.server.ui.wizard.LiferayRuntimeStubComposite.java

License:Open Source License

protected IStatus validate() {
    if (liferayRuntime == null) {
        wizard.setMessage(StringPool.EMPTY, IMessageProvider.ERROR);
        return Status.OK_STATUS;
    }/*from   ww w.ja  va 2  s .  c  o m*/

    IStatus status = runtimeWC.validate(null);

    if (status == null || status.isOK()) {
        wizard.setMessage(null, IMessageProvider.NONE);
    } else if (status.getSeverity() == IStatus.WARNING) {
        wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
    } else {
        wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
    }

    wizard.update();

    return status;
}

From source file:com.liferay.ide.server.ui.wizard.RemoteServerComposite.java

License:Open Source License

protected void validate() {
    if (disableValidation) {
        return;// w  w w. ja v a  2 s  .c om
    }

    if (serverWC == null) {
        wizard.setMessage(StringPool.EMPTY, IMessageProvider.ERROR);
        return;
    }

    try {
        IRunnableWithProgress validateRunnable = new IRunnableWithProgress() {

            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {

                final IStatus updateStatus = validateServer(monitor);

                if (updateStatus.isOK()) {
                    String contextPath = RemoteUtil.detectServerManagerContextPath(getRemoteServer(), monitor);

                    remoteServerWC.setServerManagerContextPath(contextPath);
                }

                RemoteServerComposite.this.getDisplay().syncExec(new Runnable() {
                    public void run() {
                        if (updateStatus == null || updateStatus.isOK()) {
                            wizard.setMessage(null, IMessageProvider.NONE);
                        } else if (updateStatus.getSeverity() == IStatus.WARNING
                                || updateStatus.getSeverity() == IStatus.ERROR) {
                            if (updateStatus.getMessage().contains("Your license key has expired")
                                    || updateStatus.getMessage()
                                            .contains("Register Your Server or Application")) {
                                wizard.setMessage("Server is not registered or license key has expired ",
                                        IMessageProvider.WARNING);
                            } else {
                                wizard.setMessage(updateStatus.getMessage(), IMessageProvider.WARNING);
                            }
                        }

                        wizard.update();

                    }
                });
            }
        };

        wizard.run(true, true, validateRunnable);
        wizard.update();

        if (fragment.lastServerStatus != null && fragment.lastServerStatus.isOK()) {
            ignoreModifyEvents = true;

            textServerManagerContextPath.setText(this.remoteServerWC.getServerManagerContextPath());
            textLiferayPortalContextPath.setText(this.remoteServerWC.getLiferayPortalContextPath());

            ignoreModifyEvents = false;
        }
    } catch (final Exception e) {
        RemoteServerComposite.this.getDisplay().syncExec(new Runnable() {

            public void run() {
                wizard.setMessage(e.getMessage(), IMessageProvider.WARNING);
                wizard.update();
            }
        });
    }
}

From source file:com.matlab.eclipse.meditor.AbstractMatlabenginePrefsPage.java

License:Open Source License

/**
 * Applies the status to the status line of a dialog page.
 * @param page the dialog page// w  ww .j  a va2s  . c  o  m
 * @param status the status
 */
public void applyToStatusLine(DialogPage page, IStatus status) {
    String message = status.getMessage();
    switch (status.getSeverity()) {
    case IStatus.OK:
        page.setMessage(message, IMessageProvider.NONE);
        page.setErrorMessage(null);
        break;
    case IStatus.WARNING:
        page.setMessage(message, IMessageProvider.WARNING);
        page.setErrorMessage(null);
        break;
    case IStatus.INFO:
        page.setMessage(message, IMessageProvider.INFORMATION);
        page.setErrorMessage(null);
        break;
    default:
        if (message.length() == 0) {
            message = null;
        }
        page.setMessage(null);
        page.setErrorMessage(message);
        break;
    }
}