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.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   w ww  . j av  a2  s  .  c om
        super.commit(onSave);
    } else {
        page.form.setMessage(validate().getMessage(), IMessageProvider.ERROR);
    }
}

From source file:com.liferay.ide.project.ui.modules.ImportLiferayModuleProjectWizard.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(null, SapphireWizardPage.NONE);

            firstErrorMessageRemoved = true;
        }/*  ww  w .j av a2s. c o  m*/
    }

    return wizardPages;
}

From source file:com.liferay.ide.project.ui.wizard.ImportSDKProjectsWizard.java

License:Open Source License

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

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

        final String message = wizardPage.getMessage();

        if (CoreUtil.isNullOrEmpty(message)) {
            wizardPage.setMessage(INITIAL_MESSAGE);
        }/*  w ww.  ja  v a 2 s. c  o  m*/

        if (wizardPage.getMessageType() == IMessageProvider.ERROR && !supressedFirstErrorMessage) {
            supressedFirstErrorMessage = true;

            wizardPage.setMessage(INITIAL_MESSAGE);
        }
    }
    if (title != null) {
        this.getContainer().getShell().setText(title);
    }

    return wizardPages;
}

From source file:com.liferay.ide.project.ui.wizard.UpgradeLiferayProjectsWizard.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(message, SapphireWizardPage.ERROR); //$NON-NLS-1$
            firstErrorMessageRemoved = true;
        }//from   w  w  w .  j a  va2s  .  com
    }

    return wizardPages;
}

From source file:com.liferay.ide.project.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.hasWorkspace()) {
                    wizardPage.setMessage(LiferayWorkspaceUtil.hasLiferayWorkspaceMsg,
                            SapphireWizardPage.ERROR);
                } else {
                    wizardPage.setMessage("Please select the workspace location.", SapphireWizardPage.NONE);
                }//from   ww  w .  j a  v  a 2  s  .  co m
            } catch (CoreException e) {
                wizardPage.setMessage(LiferayWorkspaceUtil.multiWorkspaceErrorMsg, SapphireWizardPage.ERROR);
            }

            firstErrorMessageRemoved = true;
        }
    }

    return wizardPages;
}

From source file:com.liferay.ide.project.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.hasWorkspace()) {
                    wizardPage.setMessage(LiferayWorkspaceUtil.hasLiferayWorkspaceMsg,
                            SapphireWizardPage.ERROR);
                } else {
                    wizardPage.setMessage("Please enter the workspace name.", SapphireWizardPage.NONE);
                }/*  w w  w .j av  a  2  s  .com*/
            } catch (CoreException e) {
                wizardPage.setMessage(LiferayWorkspaceUtil.multiWorkspaceErrorMsg, SapphireWizardPage.ERROR);
            }

            firstErrorMessageRemoved = true;
        }
    }

    return wizardPages;
}

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

License:Open Source License

public void modifyText(ModifyEvent e) {
    IStatus status = validate();/*w  ww .  ja va 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.sdk.ui.SDKsPreferencePage.java

License:Open Source License

@Override
public boolean performOk() {
    super.performOk();

    if (isValid()) {
        SDK[] sdks = installedSDKsComposite.getSDKs();

        if (CoreUtil.isNullOrEmpty(sdks)) {
            SDKManager.getInstance().clearSDKs();
        } else {//from w  w  w  .  j a va2  s  .c om
            SDKManager.getInstance().setSDKs(sdks);
        }

        return true;
    } else {
        setMessage(Msgs.haveOneSDK, IMessageProvider.ERROR);

        return false;
    }
}

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 {//  w w  w.  j av a2 s .  c o  m
        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;/*from w w  w  .  j a  v a  2  s.c o 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);
    }
}