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:com.liferay.ide.project.ui.wizard.PortletPluginFacetInstallPage.java

License:Open Source License

public PortletPluginFacetInstallPage() {
    super(DataModelFactory.createDataModel(new PortletPluginFacetInstallDataModelProvider()),
            "portlet.plugin.facet.install.page"); //$NON-NLS-1$

    setImageDescriptor(ImageDescriptor/*from w ww.  jav a2s .co  m*/
            .createFromURL(ProjectUI.getDefault().getBundle().getEntry("/icons/wizban/plugin_project.png"))); //$NON-NLS-1$

    setTitle(Msgs.modifyLiferayPluginProject);

    setMessage(Msgs.convertingProjectsNotAvailable, IMessageProvider.WARNING);
}

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

License:Open Source License

public void modifyText(ModifyEvent e) {
    IStatus status = validate();// www  . j  a v a  2 s.c o m

    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  w  w  .  j  a va2  s. c om
        this.wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
    }

    this.wizard.update();
}

From source file:com.liferay.ide.server.ui.RemoteSettingsEditorSection.java

License:Open Source License

@Override
public void createSection(Composite parent) {
    FormToolkit toolkit = getFormToolkit(parent.getDisplay());

    remoteSettings = createSettingsSection(parent, toolkit);
    remoteSettings.setText(Msgs.remoteLiferaySettings);
    remoteSettings.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));
    remoteSettings.setDescription(Msgs.specifySettings);

    Composite settingsComposite = createSectionComposite(toolkit, remoteSettings);

    Label soapPortLabel = createLabel(toolkit, settingsComposite, Msgs.httpPortLabel);
    soapPortLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));

    textHttpPort = toolkit.createText(settingsComposite, null);
    GridData data = new GridData(SWT.FILL, SWT.TOP, true, false);
    data.widthHint = 50;/*  ww w  .  jav a 2s  .co m*/
    textHttpPort.setLayoutData(data);
    textHttpPort.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            if (updating) {
                return;
            }

            updating = true;
            execute(new SetHttpPortCommand(remoteServer, textHttpPort.getText().trim()));
            updating = false;
            // validate();
        }

    });

    Label usernameLabel = createLabel(toolkit, settingsComposite, Msgs.username);
    usernameLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));

    textUsername = toolkit.createText(settingsComposite, null);
    textUsername.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    textUsername.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            if (updating) {
                return;
            }

            updating = true;
            execute(new SetUsernameCommand(remoteServer, textUsername.getText().trim()));
            updating = false;
            // validate();
        }

    });

    Label passwordLabel = createLabel(toolkit, settingsComposite, Msgs.passwordLabel);
    passwordLabel.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));

    textPassword = toolkit.createText(settingsComposite, null, SWT.PASSWORD);
    textPassword.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    textPassword.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            if (updating) {
                return;
            }

            updating = true;
            execute(new SetPasswordCommand(remoteServer, textPassword.getText().trim()));
            updating = false;
            // validate();
        }

    });

    Label labelLiferayPortalContextPath = createLabel(toolkit, settingsComposite,
            Msgs.liferayPortalContextPathLabel);
    labelLiferayPortalContextPath.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));

    textLiferayPortalContextPath = toolkit.createText(settingsComposite, null);
    textLiferayPortalContextPath.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    textLiferayPortalContextPath.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            if (updating) {
                return;
            }

            updating = true;
            execute(new SetLiferayPortalContextPathCommand(remoteServer,
                    textLiferayPortalContextPath.getText().trim()));
            updating = false;
            // validate();
        }
    });

    Label labelServerManagerContextPath = createLabel(toolkit, settingsComposite,
            Msgs.serverManagerContextPathLabel);
    labelServerManagerContextPath.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false));

    textServerManagerContextPath = toolkit.createText(settingsComposite, null);
    textServerManagerContextPath.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
    textServerManagerContextPath.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
            if (updating) {
                return;
            }

            updating = true;
            execute(new SetServerManagerContextPathCommand(remoteServer,
                    textServerManagerContextPath.getText().trim()));
            updating = false;
            // validate();
        }
    });

    adjustTimestamp = toolkit.createButton(settingsComposite, Msgs.adjustDeploymentTimestamps, SWT.CHECK);
    GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gd.horizontalSpan = 2;
    adjustTimestamp.setLayoutData(gd);
    adjustTimestamp.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            if (updating) {
                return;
            }

            updating = true;
            execute(new SetAdjustDeploymentTimestampCommand(remoteServer, adjustTimestamp.getSelection()));
            updating = false;
        }
    });

    initialize();

    IStatus status = validateSection();

    if (!status.isOK()) {
        this.getManagedForm().getMessageManager().addMessage(remoteServer, status.getMessage(), status,
                status.getSeverity() == IStatus.ERROR ? IMessageProvider.ERROR : IMessageProvider.WARNING);
    }
}

From source file:com.liferay.ide.server.ui.RemoteSettingsEditorSection.java

License:Open Source License

@Override
public IStatus[] getSaveStatus() {
    IStatus status = validateSection();/*from   w  w w.  j  av  a 2 s  .co  m*/

    if (!status.isOK()) {
        this.getManagedForm().getMessageManager().addMessage(remoteServer, status.getMessage(), status,
                status.getSeverity() == IStatus.ERROR ? IMessageProvider.ERROR : IMessageProvider.WARNING);
    } else {
        this.getManagedForm().getMessageManager().removeMessage(remoteServer);
    }

    return new IStatus[] { Status.OK_STATUS };
}

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  w w  w .j ava2  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;//from  www  .java2  s  . c  o m
    }

    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.liferay.ide.ui.editor.InputContext.java

License:Open Source License

/**
 * @param monitor//from   w w w . jav  a  2s.  c o m
 */
public void doSaveAs(IProgressMonitor monitor) throws Exception {
    // Get the editor shell
    Shell shell = getEditor().getSite().getShell();
    // Create the save as dialog
    SaveAsDialog dialog = new SaveAsDialog(shell);
    // Set the initial file name to the original file name
    IFile file = null;
    if (fEditorInput instanceof IFileEditorInput) {
        file = ((IFileEditorInput) fEditorInput).getFile();
        dialog.setOriginalFile(file);
    }
    // Create the dialog
    dialog.create();
    // Warn the user if the underlying file does not exist
    if (fDocumentProvider.isDeleted(fEditorInput) && (file != null)) {
        String message = NLS.bind("File does not exist: {0}", file.getName()); //$NON-NLS-1$
        dialog.setErrorMessage(null);
        dialog.setMessage(message, IMessageProvider.WARNING);
    }
    // Open the dialog
    if (dialog.open() == Window.OK) {
        // Get the path to where the new file will be stored
        IPath path = dialog.getResult();
        handleSaveAs(monitor, path);
    }
}

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  w w . j a  va2 s . 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;
    }
}

From source file:com.microsoft.tfs.client.common.ui.framework.validation.DialogPageValidatorBinding.java

License:Open Source License

@Override
protected void update(final IValidity validity) {
    if (!firstTime && validity != null && validity.getSeverity() != Severity.OK) {
        final IValidationMessage message = validity.getFirstMessage();
        if (message != null && message.getMessage() != null) {
            final int type = message.getSeverity() == Severity.WARNING ? IMessageProvider.WARNING
                    : IMessageProvider.ERROR;
            dialogPage.setMessage(message.getMessage(), type);
            return;
        }//from  w  w w. j  a  v  a2 s  .c  om
    }

    dialogPage.setMessage(null);
    return;
}