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

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

Introduction

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

Prototype

int INFORMATION

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

Click Source Link

Document

Constant for an info message (value 1).

Usage

From source file:org.eclipse.virgo.ide.eclipse.wizards.RuntimeConfigurationPage.java

License:Open Source License

/**
 * @see DataModelWizardPage/*from   www. j av  a2 s  .c  om*/
 */
private void setErrorMessage() {
    String error = this.status.getLastErrMsg();
    if (error == null) {
        if (getErrorMessage() != null) {
            setErrorMessage((String) null);
        }
        String warning = this.status.getLastWarningMsg();
        if (warning == null) {
            if (getMessage() != null && getMessageType() == IMessageProvider.WARNING) {
                setMessage(null, IMessageProvider.WARNING);
            } else {
                String info = this.status.getLastInfoMsg();
                if (info == null) {
                    if (getMessage() != null && getMessageType() == IMessageProvider.INFORMATION) {
                        setMessage(null, IMessageProvider.INFORMATION);
                    }
                } else if (!info.equals(getMessage())) {
                    setMessage(info, IMessageProvider.INFORMATION);
                }
            }
        } else if (!warning.equals(getMessage())) {
            setMessage(warning, IMessageProvider.WARNING);
        }
    } else if (!error.equals(getErrorMessage())) {
        setErrorMessage(error);
    }
}

From source file:org.eclipse.virgo.ide.runtime.internal.ui.ServerRuntimeComposite.java

License:Open Source License

protected void validate() {
    if (this.runtime == null) {
        this.wizard.setMessage("", IMessageProvider.ERROR);
        return;//from w  ww  . j  a v a2s .c o m
    }

    IStatus status = this.runtimeWC.validate(null);
    if (status == null) {
        this.wizard.setMessage(null, IMessageProvider.NONE);
    } else if (status.isOK()) {
        this.wizard.setMessage(status.getMessage(), IMessageProvider.INFORMATION);
    } else if (status.getSeverity() == IStatus.WARNING) {
        this.wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
    } else {
        this.wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
    }
    this.wizard.update();
    // updateConfiguration();
}

From source file:org.eclipse.vorto.perspective.view.GeneratorDialog.java

License:Open Source License

@Override
public void create() {
    super.create();
    setTitle("Generator Overview");
    setMessage(/*  w w  w.ja v  a  2s  .com*/
            "Choose the generator and click generate button, and the code will be automatically downloaded in the current workspace folder.",
            IMessageProvider.INFORMATION);
    // getButton(IDialogConstants.OK_ID).setText("Generate");
    getButton(IDialogConstants.OK_ID).setVisible(false);
    getButton(IDialogConstants.CANCEL_ID).setText("Close");
}

From source file:org.eclipse.vorto.perspective.view.ModelUploadDialog.java

License:Open Source License

@Override
public void create() {
    super.create();
    setTitle(WINDOW_TITLE);//from  w  ww.ja  v  a  2s .  c om
    if (uploadResult.statusOk()) {
        setMessage(SUCCESS_MSG, IMessageProvider.INFORMATION);
    } else {
        setMessage(ERROR_MSG + uploadResult.getErrorMessage(), IMessageProvider.ERROR);
    }
}

From source file:org.eclipse.wb.internal.core.editor.errors.report2.CreateReportDialog.java

License:Open Source License

/**
 * Disposes the main dialog content, shows success messages.
 *///from  ww w . j  av a  2s.co  m
private void showSuccessMessage() {
    // turn cancel to close
    Button cancelButton = getButton(IDialogConstants.CANCEL_ID);
    cancelButton.setText(IDialogConstants.CLOSE_LABEL);
    // remove all dialog contents
    Composite containerParent = m_container.getParent();
    m_container.dispose();
    // prepare success contents
    Composite successComposite = new Composite(containerParent, SWT.NONE);
    GridDataFactory.create(successComposite).grab().fill();
    GridLayoutFactory.create(successComposite);
    {
        Label successLabel = new Label(successComposite, SWT.NONE);
        // TODO: add link to proper bug-tracking system.
        successLabel.setText(Messages.CreateReportDialog_successLabel);
        GridDataFactory.create(successLabel).grab().alignVB().alignHC();
    }
    {
        Label successLabel = new Label(successComposite, SWT.NONE);
        successLabel.setText(Messages.CreateReportDialog_pressClosebutton);
        GridDataFactory.create(successLabel).grab().alignVT().alignHC();
    }
    containerParent.layout(true, true);
    String message = Messages.CreateReportDialog_successMessage;
    setMessage(message, IMessageProvider.INFORMATION);
    setTitle(Messages.CreateReportDialog_successTitle);
}

From source file:org.eclipse.wb.internal.core.utils.dialogfields.StatusUtils.java

License:Open Source License

/**
 * Applies the status to the title area of a dialog.
 *///www .j a v a  2s. c o m
public static void applyToTitleAreaDialog(TitleAreaDialog dialog, IStatus status, String okMessage) {
    String message = status.getMessage();
    switch (status.getSeverity()) {
    case IStatus.OK:
        dialog.setMessage(okMessage);
        dialog.setErrorMessage(null);
        break;
    case IStatus.INFO:
        dialog.setMessage(message, IMessageProvider.INFORMATION);
        dialog.setErrorMessage(null);
        break;
    case IStatus.WARNING:
        dialog.setMessage(message, IMessageProvider.WARNING);
        dialog.setErrorMessage(null);
        break;
    case IStatus.ERROR:
        if (message.length() == 0) {
            message = null;
        }
        dialog.setMessage(null);
        dialog.setErrorMessage(message);
        break;
    }
}

From source file:org.eclipse.wst.jsdt.internal.ui.refactoring.ExtractConstantWizard.java

License:Open Source License

protected void addUserInputPages() {

    String message = null;/*  w  w w.  ja  v a 2s  .c om*/
    int messageType = IMessageProvider.NONE;
    if (!getExtractConstantRefactoring().selectionAllStaticFinal()) {
        message = RefactoringMessages.ExtractConstantInputPage_selection_refers_to_nonfinal_fields;
        messageType = IMessageProvider.INFORMATION;
    } else {
        message = MESSAGE;
        messageType = IMessageProvider.NONE;
    }

    String[] guessedNames = getExtractConstantRefactoring().guessConstantNames();
    String initialValue = guessedNames.length == 0 ? "" : guessedNames[0]; //$NON-NLS-1$
    addPage(new ExtractConstantInputPage(message, messageType, initialValue, guessedNames));
}

From source file:org.eclipse.wst.jsdt.internal.ui.refactoring.InlineConstantWizard.java

License:Open Source License

protected void addUserInputPages() {

    String message = null;// w w w  .j  a  va  2 s.c  o m
    int messageType = IMessageProvider.NONE;
    if (!getInlineConstantRefactoring().isInitializerAllStaticFinal()) {
        message = RefactoringMessages.InlineConstantWizard_initializer_refers_to_fields;
        messageType = IMessageProvider.INFORMATION;
    } else {
        message = MESSAGE;
        messageType = IMessageProvider.NONE;
    }

    addPage(new InlineConstantInputPage(message, messageType));
}

From source file:org.eclipse.wst.server.ui.internal.wizard.page.ModifyModulesComposite.java

License:Open Source License

protected void setEnablement() {
    wizard.setMessage(null, IMessageProvider.NONE);

    int count = 0;
    if (requiredModules != null) {
        // count how many of requiredModules are deployed
        int size = requiredModules.length;
        for (int i = 0; i < size; i++) {
            if (deployed.contains(requiredModules[i]))
                count++;/*from   www  . j ava 2s. com*/
        }
    }

    // give error if there are more than one possible required modules and none are
    // added to the server
    isComplete = true;
    if (requiredModules != null && requiredModules.length > 1 && count == 0) {
        String s = "";
        int size = requiredModules.length;
        for (int i = 0; i < size; i++) {
            if (i > 0)
                s += " | ";
            s += requiredModules[i].getName();
        }
        wizard.setMessage(NLS.bind(Messages.wizModuleRequiredModules, s), IMessageProvider.ERROR);
        isComplete = false;
    }

    // selection specific messages
    ModuleServer[] ms = getAvailableSelection();
    if (ms == null || ms.length == 0) {
        add.setEnabled(false);
    } else {
        boolean enabled = false;
        // iterate through selection, if we find at least ONE module that can't be added, exit the loop
        for (int i = 0; i < ms.length; i++) {
            IModule module = getModule(ms[i]);
            if (module != null) {
                try {
                    IStatus status = errorMap.get(module);
                    if (modules.contains(module)) {
                        if (status == null)
                            enabled = true;
                        else if (status.getSeverity() == IStatus.ERROR) {
                            // this module can't be added because has errors, exit the loop
                            enabled = false;
                            wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
                            break;
                        } else if (status.getSeverity() == IStatus.WARNING) {
                            enabled = true;
                            wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
                        } else if (status.getSeverity() == IStatus.INFO) {
                            enabled = true;
                            wizard.setMessage(status.getMessage(), IMessageProvider.INFORMATION);
                        }
                    } else {
                        // at least ONE module from the selection can't be added, exit the loop   
                        enabled = false;
                        break;
                    }
                } catch (Exception e) {
                    if (Trace.INFO) {
                        Trace.trace(Trace.STRING_INFO, "Unable to handle error map for module:" + module);
                    }
                }
            }
        }
        add.setEnabled(enabled);
    }
    addAll.setEnabled(modules.size() > 0);

    ms = getDeployedSelection();
    if (ms == null || ms.length == 0) {
        remove.setEnabled(false);
    } else {
        boolean enabled = false;
        // iterate through selection, if we find at least ONE module that can't be removed, exit the loop
        for (int i = 0; i < ms.length; i++) {
            IModule module = getModule(ms[i]);
            if (module != null && deployed.contains(module)) {
                // provide error about removing required single module
                // required modules can't be removed
                if (requiredModules != null) {
                    if (requiredModules.length == 1 && requiredModules[0].equals(module)) {
                        // this is a required module and can't be removed, exit the loop
                        wizard.setMessage(NLS.bind(Messages.wizModuleRequiredModule, module.getName()),
                                IMessageProvider.ERROR);
                        enabled = false;
                        break;
                    }
                    enabled = true;
                } else if (errorMap.containsKey(module)) {
                    // this is a required module and can't be removed, exit the loop
                    wizard.setMessage(errorMap.get(module).getMessage(), IMessageProvider.ERROR);
                    enabled = false;
                    break;
                } else
                    enabled = true;
            } else {
                // this module is not found in the 'deployed' array, the module might be a child
                // at least ONE module from the selection can't be removed, exit the loop
                enabled = false;
                break;
            }
        }
        remove.setEnabled(enabled);
    }

    if (requiredModules == null)
        removeAll.setEnabled(deployed.size() > 0);
    else
        removeAll.setEnabled(deployed.size() > 1);
}

From source file:org.eclipse.wst.server.ui.internal.wizard.page.NewManualServerComposite.java

License:Open Source License

protected void setRuntime(IRuntime runtime2) {
    runtime = runtime2;/*  www  .  j  av  a 2  s.  co m*/
    if (server != null) {
        server.setRuntime(runtime);
        ((ServerWorkingCopy) server).setDefaults(null);
        if (!serverNameModified) {
            updatingServerName = true;
            serverName.setText(server.getName());
            updatingServerName = false;
        } else {
            server.setName(serverName.getText());
        }
        // Validate if selected module is supported with the selected runtime
        wizard.setMessage(null, IMessageProvider.NONE);
        if (module != null) {
            canSupportModule = true;
            IStatus status = NewServerComposite.isSupportedModule(server, module);
            if (status != null) {
                if (status.getSeverity() == IStatus.ERROR) {
                    wizard.setMessage(status.getMessage(), IMessageProvider.ERROR);
                    canSupportModule = false;
                } else if (status.getSeverity() == IStatus.WARNING)
                    wizard.setMessage(status.getMessage(), IMessageProvider.WARNING);
                else if (status.getSeverity() == IStatus.INFO)
                    wizard.setMessage(status.getMessage(), IMessageProvider.INFORMATION);
            }
        }
    }
    listener.runtimeSelected(runtime);

}