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.server.ui.RemoteSettingsEditorSection.java

License:Open Source License

@Override
public IStatus[] getSaveStatus() {
    IStatus status = validateSection();/*from w w  w .j av  a  2  s. c  o  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 a v  a  2 s  . co 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  . j a va2s  . 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.mentor.nucleus.bp.debug.ui.launch.ModelSelectionTab.java

License:Open Source License

public boolean isValid(ILaunchConfiguration config) {
    return modelSelectionPane.getMessageType() != IMessageProvider.ERROR;
}

From source file:com.mentor.nucleus.bp.debug.ui.launch.VerifiableElementComposite.java

License:Open Source License

public void updateControls() {
    setMessage(null, IMessageProvider.NONE);
    TreeItem[] items = tableTreeViewer.getTree().getItems();
    if (items.length == 0) {
        setMessage("Error! No projects (or opened projects) exist in the workspace.", IMessageProvider.ERROR);
    } else if (!isElementSelected()) {
        setMessage("Select at least one model to verify.", IMessageProvider.ERROR);
    }/*from ww  w .  j  a  v  a  2 s  . c  o m*/
    notifyUpdateListeners();
}

From source file:com.mg.jet.birt.report.data.oda.ejbql.ui.HibernatePageHelper.java

License:Open Source License

private int verifyConfigLocation() {
    int result = 0;
    if (m_configLocation.getText().trim().length() > 0) {
        File f = new File(m_configLocation.getText().trim());
        if (f.exists()) {
            setMessage(DEFAULT_MESSAGE, IMessageProvider.NONE);
            setPageComplete(true);/*from   w  ww . j a  v a 2  s.  c  om*/
        } else {
            setMessage(Messages.getString("wizard.dataSourcePage.cfgFileError"), IMessageProvider.ERROR); //$NON-NLS-1$
            setPageComplete(false);
            result = ERROR_FOLDER;
        }
    } else {
        setMessage(Messages.getString("wizard.dataSourcePage.cfgIsEmpty"), IMessageProvider.ERROR); //$NON-NLS-1$
        setPageComplete(true);
        result = ERROR_EMPTY_PATH;
    }
    return result;
}

From source file:com.mg.merp.wb.report.birt.data.oda.badi.ui.wizards.ColumnMappingPage.java

License:Open Source License

/**
 * check whether the column is duplicated
 *//* w w  w. j a  v  a2  s . c om*/
private boolean isUniqueName(String columnName, ColumnMappingElement actualElement) {
    boolean success = true;
    if (columnMap != null) {
        if (columnMap.get(columnName) != actualElement && columnMap.get(columnName) != null) {
            setDetailsMessage(OdaUiPlugin.getDefault().getFormattedString("error.columnMapping.sameColumnName",
                    new Object[] { columnName }), IMessageProvider.ERROR);
            success = false;
        } else {
            setDetailsMessage(DEFAULT_PAGE_NAME, IMessageProvider.NONE);
        }
    } else {
        setDetailsMessage(DEFAULT_PAGE_NAME, IMessageProvider.NONE);
        columnMap = new HashMap<String, ColumnMappingElement>();
        columnMappingList = new ArrayList<ColumnMappingElement>();
    }
    return success;
}

From source file:com.microsoft.azuretools.docker.ui.dialogs.AzureExportDockerSshKeysDialog.java

License:Open Source License

/**
 * Create contents of the dialog.//  w ww  . j av  a  2s. c  om
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    setTitle("Export SSH Keys");
    setMessage(pathToolTip);

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

    exportSshPathTextField = new Text(mainContainer, SWT.BORDER);
    exportSshPathTextField.setToolTipText(pathToolTip);
    exportSshPathTextField.setText(path);
    exportSshPathTextField.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent event) {
            path = (((Text) event.getSource()).getText());
            if (Files.isDirectory(Paths.get(path))) {
                errDispatcher.removeMessage("exportSshPathTextField", exportSshPathTextField);
                setErrorMessage(null);
            } else {
                errDispatcher.addMessage("exportSshPathTextField", pathToolTip, null, IMessageProvider.ERROR,
                        exportSshPathTextField);
                setErrorMessage("Invalid directory path");
            }
        }
    });
    GridData gd_exportSshPathTextField = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    gd_exportSshPathTextField.verticalIndent = 5;
    gd_exportSshPathTextField.horizontalIndent = 5;
    exportSshPathTextField.setLayoutData(gd_exportSshPathTextField);

    Button exportSshPathBrowseButton = new Button(mainContainer, SWT.NONE);
    exportSshPathBrowseButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog directoryDialog = new DirectoryDialog(exportSshPathTextField.getShell());
            directoryDialog.setText("Select SSH Keys Directory");
            directoryDialog.setFilterPath(System.getProperty("user.home"));
            String pathSelected = directoryDialog.open();
            if (pathSelected == null) {
                return;
            }
            path = pathSelected;
            exportSshPathTextField.setText(path);
        }
    });
    GridData gd_exportSshPathBrowseButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_exportSshPathBrowseButton.verticalIndent = 5;
    exportSshPathBrowseButton.setLayoutData(gd_exportSshPathBrowseButton);
    exportSshPathBrowseButton.setText("Browse...");

    Label lblNote = new Label(mainContainer, SWT.NONE);
    GridData gd_lblNote = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblNote.verticalIndent = 5;
    gd_lblNote.horizontalIndent = 5;
    lblNote.setLayoutData(gd_lblNote);
    lblNote.setText("Note:");
    new Label(mainContainer, SWT.NONE);

    Label lblAnyExistingidrsa = new Label(mainContainer, SWT.NONE);
    GridData gd_lblAnyExistingidrsa = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_lblAnyExistingidrsa.horizontalIndent = 20;
    lblAnyExistingidrsa.setLayoutData(gd_lblAnyExistingidrsa);
    lblAnyExistingidrsa.setText("Any existing \"id_rsa\" and \"id_rsa.pub\" files in the selected directory");

    Label lblWillBeOverwritten = new Label(mainContainer, SWT.NONE);
    GridData gd_lblWillBeOverwritten = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblWillBeOverwritten.horizontalIndent = 20;
    lblWillBeOverwritten.setLayoutData(gd_lblWillBeOverwritten);
    lblWillBeOverwritten.setText("will be overwritten!");
    new Label(mainContainer, SWT.NONE);

    FormToolkit toolkit = new FormToolkit(mainContainer.getDisplay());
    toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER);
    managedForm = new ManagedForm(mainContainer);
    errMsgForm = managedForm.getForm();
    errMsgForm.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    errMsgForm.setBackground(mainContainer.getBackground());
    errDispatcher = managedForm.getMessageManager();

    //      return area;
    return super.createDialogArea(parent);
}

From source file:com.microsoft.azuretools.docker.ui.dialogs.AzureExportDockerTlsKeysDialog.java

License:Open Source License

/**
 * Create contents of the dialog./*from   ww w .  j a  va  2 s .  c  om*/
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    setTitle("Export TLS Certificates");
    setMessage(pathToolTip);

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

    exportTlsPathTextField = new Text(mainContainer, SWT.BORDER);
    exportTlsPathTextField.setToolTipText(pathToolTip);
    exportTlsPathTextField.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent event) {
            path = (((Text) event.getSource()).getText());
            if (path != null && Files.isDirectory(Paths.get(path))) {
                errDispatcher.removeMessage("exportTlsPathTextField", exportTlsPathTextField);
                setErrorMessage(null);
            } else {
                errDispatcher.addMessage("exportTlsPathTextField", pathToolTip, null, IMessageProvider.ERROR,
                        exportTlsPathTextField);
                setErrorMessage("Invalid directory path");
            }
        }
    });
    GridData gd_exportTlsPathTextField = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    gd_exportTlsPathTextField.widthHint = 380;
    gd_exportTlsPathTextField.verticalIndent = 5;
    gd_exportTlsPathTextField.horizontalIndent = 5;
    exportTlsPathTextField.setLayoutData(gd_exportTlsPathTextField);

    Button exportTlsPathBrowseButton = new Button(mainContainer, SWT.NONE);
    exportTlsPathBrowseButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog directoryDialog = new DirectoryDialog(exportTlsPathTextField.getShell());
            directoryDialog.setText("Select TLS Certificates Directory");
            directoryDialog.setFilterPath(System.getProperty("user.home"));
            String pathSelected = directoryDialog.open();
            if (pathSelected == null) {
                return;
            }
            path = pathSelected;
            exportTlsPathTextField.setText(path);
        }
    });
    GridData gd_exportTlsPathBrowseButton = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_exportTlsPathBrowseButton.verticalIndent = 5;
    exportTlsPathBrowseButton.setLayoutData(gd_exportTlsPathBrowseButton);
    exportTlsPathBrowseButton.setText("Browse...");

    Label lblNote = new Label(mainContainer, SWT.NONE);
    GridData gd_lblNote = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
    gd_lblNote.verticalIndent = 5;
    gd_lblNote.horizontalIndent = 5;
    lblNote.setLayoutData(gd_lblNote);
    lblNote.setText("Note:");
    new Label(mainContainer, SWT.NONE);

    Label lblAnyExisting = new Label(mainContainer, SWT.NONE);
    GridData gd_lblAnyExisting = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_lblAnyExisting.horizontalIndent = 20;
    lblAnyExisting.setLayoutData(gd_lblAnyExisting);
    lblAnyExisting.setText(
            "Any existing \"ca.pem\", \"ca-key.pem\", \"cert.pem\",\"key.pem\", \"server.pem\" and \"server-key.pem\"");

    Label lblWillBeOverwritten = new Label(mainContainer, SWT.NONE);
    GridData gd_lblWillBeOverwritten = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_lblWillBeOverwritten.horizontalIndent = 20;
    lblWillBeOverwritten.setLayoutData(gd_lblWillBeOverwritten);
    lblWillBeOverwritten.setText("certificate files in the selected directory will be overwritten!");

    FormToolkit toolkit = new FormToolkit(mainContainer.getDisplay());
    toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER);
    managedForm = new ManagedForm(mainContainer);
    errMsgForm = managedForm.getForm();
    errMsgForm.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    errMsgForm.setBackground(mainContainer.getBackground());
    errDispatcher = managedForm.getMessageManager();

    return area;
}

From source file:com.microsoft.azuretools.docker.ui.dialogs.AzureInputDockerLoginCredsDialog.java

License:Open Source License

private void initUIComponents(Composite mainContainer) {
    setTitle("Docker Host Log In Credentials");
    if (resetCredentials) {
        setMessage(String.format("Update %s with new log in credentials",
                editableDockerHost.originalDockerHost.name), IMessageProvider.INFORMATION);
    } else {//from  w w w. j  av  a 2s .com
        setMessage(String.format("Docker host %s log in credentials not found; enter your log in credentials",
                editableDockerHost.originalDockerHost.name), IMessageProvider.INFORMATION);
    }

    copyFromAzureKeyButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            AzureSelectKeyVault azureSelectKeyVaultDialog = new AzureSelectKeyVault(mainContainer.getShell(),
                    dockerManager);
            if (azureSelectKeyVaultDialog.open() == Window.OK
                    && azureSelectKeyVaultDialog.getSelectedKeyvault() != null) {
                updateUIWithKeyvault(azureSelectKeyVaultDialog.getSelectedKeyvault());
            }
            okButton.setEnabled(doValidate());
        }
    });

    dockerHostUsernameTextField.setText((editableDockerHost.originalDockerHost.certVault != null
            && editableDockerHost.originalDockerHost.certVault.vmUsername != null)
                    ? editableDockerHost.originalDockerHost.certVault.vmUsername
                    : "");
    dockerHostUsernameTextField.setToolTipText(AzureDockerValidationUtils.getDockerHostUserNameTip());
    dockerHostUsernameTextField.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent event) {
            if (!resetCredentials || AzureDockerValidationUtils
                    .validateDockerHostUserName(((Text) event.getSource()).getText())) {
                errDispatcher.removeMessage("dockerHostUsernameTextField", dockerHostUsernameTextField);
                setErrorMessage(null);
                okButton.setEnabled(doValidate());
            } else {
                errDispatcher.addMessage("dockerHostUsernameTextField",
                        AzureDockerValidationUtils.getDockerHostUserNameTip(), null, IMessageProvider.ERROR,
                        dockerHostUsernameTextField);
                setErrorMessage("Invalid user name");
                okButton.setEnabled(false);
            }
        }
    });

    dockerHostFirstPwdField.setToolTipText(AzureDockerValidationUtils.getDockerHostPasswordTip());
    dockerHostFirstPwdField.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent event) {
            String text = ((Text) event.getSource()).getText();
            if (text == null || text.isEmpty()
                    || (!resetCredentials || AzureDockerValidationUtils.validateDockerHostPassword(text))) {
                errDispatcher.removeMessage("dockerHostFirstPwdField", dockerHostFirstPwdField);
                setErrorMessage(null);
                if (!resetCredentials) {
                    dockerHostSecondPwdField.setText(text);
                }
                okButton.setEnabled(doValidate());
            } else {
                errDispatcher.addMessage("dockerHostFirstPwdField",
                        AzureDockerValidationUtils.getDockerHostPasswordTip(), null, IMessageProvider.ERROR,
                        dockerHostFirstPwdField);
                setErrorMessage("Invalid password");
                okButton.setEnabled(false);
            }
        }
    });

    dockerHostSecondPwdField.setVisible(resetCredentials);
    dockerHostSecondPwdField.setToolTipText(AzureDockerValidationUtils.getDockerHostPasswordTip());
    dockerHostSecondPwdField.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent event) {
            String pwd1 = dockerHostFirstPwdField.getText();
            String pwd2 = ((Text) event.getSource()).getText();
            if ((pwd1 == null && pwd2 == null) || pwd2.equals(pwd1)) {
                errDispatcher.removeMessage("dockerHostSecondPwdField", dockerHostSecondPwdField);
                setErrorMessage(null);
                okButton.setEnabled(doValidate());
            } else {
                errDispatcher.addMessage("dockerHostSecondPwdField",
                        AzureDockerValidationUtils.getDockerHostPasswordTip(), null, IMessageProvider.ERROR,
                        dockerHostSecondPwdField);
                setErrorMessage("Invalid confirmation password");
                okButton.setEnabled(false);
            }
        }
    });

    dockerHostKeepSshRadioButton.setSelection(true);
    dockerHostKeepSshRadioButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            dockerHostImportSSHTextField.setEnabled(false);
            dockerHostImportSSHBrowseButton.setEnabled(false);
            errDispatcher.removeMessage("dockerHostImportSSHTextField", dockerHostImportSSHTextField);
            setErrorMessage(null);
            if (editableDockerHost.originalDockerHost.hasSSHLogIn) {
                AzureDockerCertVaultOps.copyVaultSshKeys(editableDockerHost.updatedDockerHost.certVault,
                        editableDockerHost.originalDockerHost.certVault);
            }
            editableDockerHost.updatedDockerHost.hasSSHLogIn = editableDockerHost.originalDockerHost.hasSSHLogIn;
            okButton.setEnabled(doValidate());
        }
    });

    dockerHostImportSshRadioButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            dockerHostImportSSHTextField.setEnabled(true);
            dockerHostImportSSHBrowseButton.setEnabled(true);
            okButton.setEnabled(doValidate());
        }
    });

    dockerHostImportSSHTextField.setEnabled(false);
    dockerHostImportSSHTextField.setToolTipText(AzureDockerValidationUtils.getDockerHostSshDirectoryTip());
    dockerHostImportSSHTextField.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent event) {
            if (AzureDockerValidationUtils
                    .validateDockerHostSshDirectory(((Text) event.getSource()).getText())) {
                errDispatcher.removeMessage("dockerHostImportSSHTextField", dockerHostImportSSHTextField);
                setErrorMessage(null);
                okButton.setEnabled(doValidate());
            } else {
                errDispatcher.addMessage("dockerHostImportSSHTextField",
                        AzureDockerValidationUtils.getDockerHostSshDirectoryTip(), null, IMessageProvider.ERROR,
                        dockerHostImportSSHTextField);
                setErrorMessage("SSH key files not found in the specified directory");
                okButton.setEnabled(false);
            }
        }
    });

    dockerHostImportSSHBrowseButton.setEnabled(false);
    dockerHostImportSSHBrowseButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog directoryDialog = new DirectoryDialog(dockerHostImportSSHBrowseButton.getShell());
            directoryDialog.setText("Select SSH Keys Directory");
            directoryDialog.setFilterPath(System.getProperty("user.home"));
            String path = directoryDialog.open();
            if (path == null) {
                return;
            }
            dockerHostImportSSHTextField.setText(path);
            okButton.setEnabled(doValidate());
        }
    });

    dockerHostAutoSshRadioButton.setVisible(resetCredentials);
    dockerHostAutoSshRadioButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            dockerHostImportSSHTextField.setEnabled(false);
            dockerHostImportSSHBrowseButton.setEnabled(false);
            errDispatcher.removeMessage("dockerHostImportSSHTextField", dockerHostImportSSHTextField);
            setErrorMessage(null);
            AzureDockerCertVault certVault = AzureDockerCertVaultOps.generateSSHKeys(null,
                    "SSH keys for " + editableDockerHost.updatedDockerHost.name);
            AzureDockerCertVaultOps.copyVaultSshKeys(editableDockerHost.updatedDockerHost.certVault, certVault);
            editableDockerHost.updatedDockerHost.hasSSHLogIn = true;
            okButton.setEnabled(doValidate());
        }
    });

}