Example usage for org.eclipse.jface.dialogs Dialog DLG_IMG_MESSAGE_WARNING

List of usage examples for org.eclipse.jface.dialogs Dialog DLG_IMG_MESSAGE_WARNING

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs Dialog DLG_IMG_MESSAGE_WARNING.

Prototype

String DLG_IMG_MESSAGE_WARNING

To view the source code for org.eclipse.jface.dialogs Dialog DLG_IMG_MESSAGE_WARNING.

Click Source Link

Document

Image registry key for info message image (value "dialog_messasge_warning_image").

Usage

From source file:org.jboss.tools.arquillian.ui.internal.refactoring.AddArquillianSupportWizardPage.java

License:Open Source License

@Override
public void createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginWidth = 10;/*w w  w.  j av  a 2 s . co m*/
    gridLayout.marginHeight = 10;
    composite.setLayout(gridLayout);
    initializeDialogUnits(composite);
    Dialog.applyDialogFont(composite);

    Link link = new Link(composite, SWT.NONE);
    link.setText("<a>Arquillian Settings</a>");
    GridData gd = new GridData(SWT.FILL, GridData.FILL, true, false);
    gd.horizontalSpan = 2;
    link.setLayoutData(gd);
    link.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            PreferenceDialog preferenceDialog = PreferencesUtil.createPreferenceDialogOn(getShell(),
                    ArquillianPreferencePage.ID, null, null);
            preferenceDialog.open();
        }

    });

    Label label = new Label(composite, SWT.NONE);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    label.setLayoutData(gd);
    label.setText("Arquillian version:");
    versionCombo = new Combo(composite, SWT.READ_ONLY);
    gd = new GridData(SWT.FILL, SWT.FILL, false, false);
    versionCombo.setLayoutData(gd);
    versionCombo.setItems(ArquillianUtility.getVersions(defaultVersions));
    String value = ArquillianUtility.getPreference(ArquillianConstants.ARQUILLIAN_VERSION,
            ArquillianConstants.ARQUILLIAN_VERSION_DEFAULT);
    versionCombo.setText(value);
    refactoring.setVersion(value);
    versionCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    versionCombo.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            refactoring.setVersion(versionCombo.getText());
            validate();
        }
    });

    updatePomButton = new Button(composite, SWT.CHECK);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    gd.horizontalSpan = 2;
    updatePomButton.setText("Update the pom.xml file");
    updatePomButton.setLayoutData(gd);

    dialogSettings = ArquillianUIActivator.getDefault().getDialogSettings();
    addArquillianSupportSection = dialogSettings.getSection(ADD_ARQUILLIAN_SUPPORT_SECTION);
    if (addArquillianSupportSection == null) {
        addArquillianSupportSection = dialogSettings.addNewSection(ADD_ARQUILLIAN_SUPPORT_SECTION);
    }
    value = addArquillianSupportSection.get(UPDATE_POM);
    boolean updatePom;
    if (value == null) {
        updatePom = true;
    } else {
        updatePom = addArquillianSupportSection.getBoolean(UPDATE_POM);
    }
    updatePomButton.setSelection(updatePom);

    updateDependenciesButton = new Button(composite, SWT.CHECK);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    gd.horizontalSpan = 2;
    updateDependenciesButton.setText("Update the dependencies section");
    updateDependenciesButton.setLayoutData(gd);

    value = addArquillianSupportSection.get(UPDATE_DEPENDENCIES);
    boolean updateDependencies;
    if (value == null) {
        updateDependencies = true;
    } else {
        updateDependencies = addArquillianSupportSection.getBoolean(UPDATE_DEPENDENCIES);
    }
    updateDependenciesButton.setSelection(updateDependencies);

    updateDependenciesButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            refactoring.setUpdateDependencies(updateDependenciesButton.getSelection());
            validate();
        }

    });

    updateBuildButton = new Button(composite, SWT.CHECK);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    gd.horizontalSpan = 2;
    updateBuildButton.setText("Update the build section");
    updateBuildButton.setLayoutData(gd);

    value = addArquillianSupportSection.get(UPDATE_BUILD);
    boolean updateBuild;
    if (value == null) {
        updateBuild = true;
    } else {
        updateBuild = addArquillianSupportSection.getBoolean(UPDATE_BUILD);
    }
    updateBuildButton.setSelection(updateBuild);

    updateBuildButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            refactoring.setUpdateBuild(updateBuildButton.getSelection());
            validate();
        }

    });

    addProfilesButton = new Button(composite, SWT.CHECK);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    gd.horizontalSpan = 2;
    addProfilesButton.setText("Add Profiles");
    addProfilesButton.setLayoutData(gd);

    value = addArquillianSupportSection.get(ADD_PROFILES);
    boolean addProfiles;
    if (value == null) {
        addProfiles = true;
    } else {
        addProfiles = addArquillianSupportSection.getBoolean(ADD_PROFILES);
    }
    addProfilesButton.setSelection(addProfiles);

    addProfilesButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            refactoring.setAddProfiles(addProfilesButton.getSelection());
            validate();
        }

    });

    updatePomButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            updatePomChanged();
        }

    });
    String message = null;
    try {
        IProject project = refactoring.getProject();
        IMavenProjectFacade facade = MavenPlugin.getMavenProjectRegistry().create(project,
                new NullProgressMonitor());
        if (facade != null) {
            MavenProject mavenProject = facade.getMavenProject(new NullProgressMonitor());
            String version = ArquillianUtility.getArquillianVersion(mavenProject);
            if (version != null) {
                updatePomButton.setSelection(false);
                updatePomButton.setEnabled(false);
                message = "The project already includes Arquillian settings";
            }
        } else {
            updatePomButton.setSelection(false);
            updatePomButton.setEnabled(false);
            message = "The project is not a valid maven project";
        }
    } catch (CoreException e1) {
        updatePomButton.setSelection(false);
        updatePomButton.setEnabled(false);
        message = "Some issues encountered.\nCaused by: " + e1.getLocalizedMessage();
    }
    if (message != null) {
        Composite warningComposite = new Composite(composite, SWT.NONE);
        gd = new GridData(SWT.FILL, SWT.FILL, true, false);
        gd.horizontalSpan = 2;
        warningComposite.setLayoutData(gd);
        warningComposite.setLayout(new GridLayout(2, false));
        Label emptyLabel = new Label(warningComposite, SWT.NONE);
        gd = new GridData(SWT.FILL, SWT.FILL, true, true);
        gd.horizontalSpan = 2;
        emptyLabel.setLayoutData(gd);
        Label warningImage = new Label(warningComposite, SWT.NONE);
        gd = new GridData(SWT.FILL, SWT.LEFT, false, false);
        warningImage.setLayoutData(gd);
        warningImage.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
        Label warningText = new Label(warningComposite, SWT.NONE);
        gd = new GridData(SWT.FILL, SWT.FILL, true, false);
        warningText.setLayoutData(gd);
        warningText.setText(message);
    }

    updatePomChanged();
    setControl(composite);
    validate();
}

From source file:org.jboss.tools.central.editors.GettingStartedPage.java

License:Open Source License

private FormText createNoteText(FormToolkit toolkit, Composite parent) {
    FormText formText = toolkit.createFormText(parent, true);
    GridData gd = new GridData(GridData.FILL, GridData.FILL, false, false);
    formText.setLayoutData(gd);/*from  www  .java  2s  . c  o m*/
    formText.setText("<form><p>" + "<img href=\"image\"/>" + " No entries found." + "</p></form>", true, false);

    Image image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);

    formText.setImage("image", image);
    return formText;
}

From source file:org.jboss.tools.central.editors.GettingStartedPage.java

License:Open Source License

private void showException(PageBook pageBook, FormText exceptionText, Throwable e) {
    JBossCentralActivator.log(e);/*from w  w w. j  a  v a2s .c  o m*/
    String message = StringEscapeUtils.escapeXml(e.getMessage());
    String text = JBossCentralActivator.FORM_START_TAG + "<img href=\"image\"/> " + message
            + JBossCentralActivator.FORM_END_TAG;
    exceptionText.setText(text, true, false);
    Image image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    exceptionText.setImage("image", image);
    pageBook.showPage(exceptionText);
}

From source file:org.jboss.tools.common.jdt.debug.ui.launching.JBossConnectTab.java

License:Open Source License

public void createControl(Composite parent) {
    Font font = parent.getFont();
    Composite comp = SWTFactory.createComposite(parent, font, 1, 1, GridData.FILL_BOTH);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = 0;//from ww  w .j a va2 s .c o m
    comp.setLayout(layout);

    createVerticalSpacer(comp, 2);
    jbossConfigurationButton = createCheckButton(comp, "JBoss Remote Configuration");
    jbossConfigurationButton.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            setDirty(true);
            updateLaunchConfigurationDialog();
        }

    });
    createVerticalSpacer(comp, 2);
    messageGroup = new Group(comp, SWT.NONE);
    messageGroup.setText(Messages.JavaConnectTab_Warning);
    messageGroup.setLayout(new GridLayout(3, false));
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    messageGroup.setLayoutData(gd);

    Label noteLabel = new Label(messageGroup, SWT.NONE);
    gd = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
    noteLabel.setLayoutData(gd);
    Image image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    image.setBackground(noteLabel.getBackground());
    noteLabel.setImage(image);

    Text noteText = new Text(messageGroup, SWT.WRAP | SWT.READ_ONLY);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    GC gc = new GC(parent);
    gd.heightHint = Dialog.convertHeightInCharsToPixels(gc.getFontMetrics(), 3);
    gc.dispose();
    noteText.setLayoutData(gd);
    noteText.setText(Messages.JavaConnectTab_JDK_Required);

    messageGroup.setVisible(!RemoteDebugActivator.getDefault().isJdk());

    Button addJDK = new Button(messageGroup, SWT.PUSH);
    addJDK.setText(Messages.JavaConnectTab_Add_JDK);
    gd = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
    addJDK.setLayoutData(gd);
    addJDK.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            String preferenceId = "org.eclipse.jdt.debug.ui.preferences.VMPreferencePage"; //$NON-NLS-1$
            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), preferenceId, null,
                    null);
            dialog.open();
            updateLaunchConfigurationDialog();
            messageGroup.setVisible(!RemoteDebugActivator.getDefault().isJdk());
        }
    });

    setControl(comp);
}

From source file:org.jboss.tools.common.jdt.debug.ui.launching.xpl.JavaConnectTab.java

License:Open Source License

public void createControl(Composite parent) {
    Font font = parent.getFont();
    Composite comp = SWTFactory.createComposite(parent, font, 1, 1, GridData.FILL_BOTH);
    GridLayout layout = new GridLayout();
    layout.verticalSpacing = 0;/*from  w ww  .  java 2 s .  c o m*/
    comp.setLayout(layout);
    createProjectEditor(comp);
    createVerticalSpacer(comp, 1);

    //connection properties
    Group group = SWTFactory.createGroup(comp, Messages.JavaConnectTab_Connection_Properties_1, 2, 1,
            GridData.FILL_HORIZONTAL);
    Composite cgroup = SWTFactory.createComposite(group, font, 2, 1, GridData.FILL_HORIZONTAL);
    fArgumentComposite = cgroup;
    updateConnector();

    createVerticalSpacer(comp, 2);
    fAllowTerminateButton = createCheckButton(comp, Messages.JavaConnectTab__Allow_termination_of_remote_VM_6);
    fAllowTerminateButton.addSelectionListener(getDefaultListener());

    createVerticalSpacer(comp, 2);
    defaultButton = createCheckButton(comp, Messages.JavaConnectTab_SetAsDefault);
    defaultButton.addSelectionListener(getDefaultListener());

    createVerticalSpacer(comp, 2);
    messageGroup = new Group(comp, SWT.NONE);
    messageGroup.setText(Messages.JavaConnectTab_Warning);
    messageGroup.setLayout(new GridLayout(3, false));
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    messageGroup.setLayoutData(gd);

    Label noteLabel = new Label(messageGroup, SWT.NONE);
    gd = new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false);
    noteLabel.setLayoutData(gd);
    Image image = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    image.setBackground(noteLabel.getBackground());
    noteLabel.setImage(image);

    Text noteText = new Text(messageGroup, SWT.WRAP | SWT.READ_ONLY);
    gd = new GridData(SWT.FILL, SWT.FILL, true, false);
    GC gc = new GC(parent);
    gd.heightHint = Dialog.convertHeightInCharsToPixels(gc.getFontMetrics(), 3);
    gc.dispose();
    noteText.setLayoutData(gd);
    noteText.setText(Messages.JavaConnectTab_JDK_Required);

    messageGroup.setVisible(!RemoteDebugActivator.getDefault().isJdk());

    Button addJDK = new Button(messageGroup, SWT.PUSH);
    addJDK.setText(Messages.JavaConnectTab_Add_JDK);
    gd = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
    addJDK.setLayoutData(gd);
    addJDK.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            String preferenceId = "org.eclipse.jdt.debug.ui.preferences.VMPreferencePage"; //$NON-NLS-1$
            PreferenceDialog dialog = PreferencesUtil.createPreferenceDialogOn(getShell(), preferenceId, null,
                    null);
            dialog.open();
            refresh(hostCombo.getText(), false);
            updateLaunchConfigurationDialog();
            messageGroup.setVisible(!RemoteDebugActivator.getDefault().isJdk());
        }
    });

    setControl(comp);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
            IJavaDebugHelpContextIds.LAUNCH_CONFIGURATION_DIALOG_CONNECT_TAB);
}

From source file:org.jboss.tools.maven.conversion.ui.dialog.IdentifyMavenDependencyPage.java

License:Open Source License

private void createWarning(Composite container) {
    warningImg = new Label(container, SWT.CENTER);
    warningLink = new Link(container, SWT.NONE);
    warningLink.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 2, 1));
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(warningImg);
    warningImg.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
    warningLink.setText(/*from   w  w  w . ja  v  a2  s  .c  om*/
            "Some selected dependencies can not be resolved. Click <a>here</a> to configure repositories in your settings.xml.");
    warningLink.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            openSettingsRepositoriesWizard();
        }

        private void openSettingsRepositoriesWizard() {
            ConfigureMavenRepositoriesWizard wizard = new ConfigureMavenRepositoriesWizard();
            WizardDialog dialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
            dialog.create();
            dialog.open();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
            widgetSelected(e);
        }
    });
}

From source file:org.jboss.tools.maven.project.examples.wizard.MissingRepositoryWarningComponent.java

License:Open Source License

public MissingRepositoryWarningComponent(Composite parent, boolean visibleInitially) {
    super(parent, SWT.NORMAL);

    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).span(3, 1).applyTo(this);
    GridLayoutFactory.fillDefaults().numColumns(2).applyTo(this);

    Label warningImg = new Label(this, SWT.CENTER | SWT.TOP);
    Image warningIcon = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(warningImg);
    warningImg.setImage(warningIcon);/*from w  w w  . ja  va  2s.  com*/

    warninglink = new Link(this, SWT.NONE | SWT.FILL);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(warninglink);
    warninglink.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {

            ConfigureMavenRepositoriesWizard wizard = new ConfigureMavenRepositoriesWizard(null,
                    "redhat-techpreview-all-repository"); //$NON-NLS-1$
            WizardDialog dialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
            dialog.create();
            dialog.open();
        }
    });

    setVisible(visibleInitially);
}

From source file:org.jboss.tools.openshift.internal.ui.preferences.OpenShiftPreferencePage.java

License:Open Source License

@Override
public void createFieldEditors() {
    Link link = new Link(getFieldEditorParent(), SWT.WRAP);
    link.setText(/*from ww  w .j  av a 2 s.c  o m*/
            "The OpenShift client binary (oc) is required for features such as Port Forwarding or Log Streaming. "
                    + "You can find more information about how to install it from <a>here</a>.");
    GridDataFactory.fillDefaults().span(3, 1).hint(1, 60).grab(true, false).applyTo(link);
    link.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            new BrowserUtility().checkedCreateExternalBrowser(DOWNLOAD_INSTRUCTIONS_URL,
                    OpenShiftUIActivator.PLUGIN_ID, OpenShiftUIActivator.getDefault().getLog());
        }
    });
    this.cliLocationEditor = new CliFileEditor();
    cliLocationEditor.setFilterPath(SystemUtils.getUserHome());
    cliLocationEditor.setFileExtensions(ocBinary.getExtensions());
    cliLocationEditor.setValidateStrategy(FileFieldEditor.VALIDATE_ON_KEY_STROKE);
    addField(cliLocationEditor);

    ocVersionLabel = new Label(getFieldEditorParent(), SWT.WRAP);
    ocVersionLabel.setFont(JFaceResources.getFontRegistry().getItalic(JFaceResources.DEFAULT_FONT));
    GridDataFactory.fillDefaults().span(3, 1).applyTo(ocVersionLabel);
    ocMessageComposite = new Composite(getFieldEditorParent(), SWT.NONE);
    GridDataFactory.fillDefaults().span(3, 1).applyTo(ocMessageComposite);
    GridLayoutFactory.fillDefaults().numColumns(2).applyTo(ocMessageComposite);
    Label label = new Label(ocMessageComposite, SWT.NONE);
    label.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
    GridDataFactory.fillDefaults().align(SWT.BEGINNING, SWT.TOP).applyTo(label);
    ocMessageLabel = new Label(ocMessageComposite, SWT.NONE);
    GridDataFactory.fillDefaults().grab(true, false).applyTo(ocMessageLabel);
    ocMessageComposite.setVisible(false);
}

From source file:org.jboss.tools.openshift.internal.ui.server.ServerSettingsWizardPage.java

License:Open Source License

private void createInfoControls(Composite container, ServerSettingsWizardPageModel model,
        DataBindingContext dbc) {/* w  w w .  ja  v a  2s .  co  m*/
    Composite composite = new Composite(container, SWT.NONE);
    GridDataFactory.fillDefaults().span(4, 1).applyTo(composite);
    GridLayoutFactory.fillDefaults().numColumns(2).applyTo(composite);

    ValueBindingBuilder.bind(WidgetProperties.visible().observe(composite))
            .to(BeanProperties.value(ServerSettingsWizardPageModel.PROPERTY_OC_BINARY_STATUS).observe(model))
            .converting(new Converter(IStatus.class, Boolean.class) {

                @Override
                public Object convert(Object fromObject) {
                    return !((IStatus) fromObject).isOK();
                }

            }).in(dbc);

    Label label = new Label(composite, SWT.NONE);
    ValueBindingBuilder.bind(WidgetProperties.image().observe(label))
            .to(BeanProperties.value(ServerSettingsWizardPageModel.PROPERTY_OC_BINARY_STATUS).observe(model))
            .converting(new Converter(IStatus.class, Image.class) {

                @Override
                public Object convert(Object fromObject) {
                    switch (((IStatus) fromObject).getSeverity()) {
                    case IStatus.WARNING:
                        return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
                    case IStatus.ERROR:
                        return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
                    }
                    return null;
                }
            }).in(dbc);

    Link link = new Link(composite, SWT.WRAP);
    ValueBindingBuilder.bind(WidgetProperties.text().observe(link))
            .to(BeanProperties.value(ServerSettingsWizardPageModel.PROPERTY_OC_BINARY_STATUS).observe(model))
            .converting(new Converter(IStatus.class, String.class) {

                @Override
                public Object convert(Object fromObject) {
                    return ((IStatus) fromObject).getMessage();
                }

            }).in(dbc);
    link.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            if ("download".equals(e.text)) {
                new BrowserUtility().checkedCreateExternalBrowser(DOWNLOAD_INSTRUCTIONS_URL,
                        OpenShiftUIActivator.PLUGIN_ID, OpenShiftUIActivator.getDefault().getLog());
            } else {
                int rc = PreferencesUtil.createPreferenceDialogOn(getShell(), OPEN_SHIFT_PREFERENCE_PAGE_ID,
                        new String[] { OPEN_SHIFT_PREFERENCE_PAGE_ID }, null).open();
                if (rc == Dialog.OK) {
                    new Job("Checking oc binary") {

                        @Override
                        protected IStatus run(IProgressMonitor monitor) {
                            OCBinary ocBinary = OCBinary.getInstance();
                            boolean valid = ocBinary.isCompatibleForPublishing(monitor);
                            ServerSettingsWizardPage.this.model
                                    .setOCBinaryStatus(getOCBinaryStatus(valid, ocBinary.getLocation()));
                            return Status.OK_STATUS;
                        }
                    }.schedule();
                }
            }
        }
    });
    GridDataFactory.fillDefaults().hint(600, SWT.DEFAULT).applyTo(link);
    MultiValidator validator = new MultiValidator() {

        @Override
        protected IStatus validate() {
            IObservableValue<IStatus> observable = BeanProperties
                    .value(ServerSettingsWizardPageModel.PROPERTY_OC_BINARY_STATUS).observe(model);
            Status status = (Status) observable.getValue();
            switch (status.getSeverity()) {
            case IStatus.ERROR:
                return OpenShiftUIActivator.statusFactory()
                        .errorStatus(OpenShiftUIMessages.OCBinaryErrorMessage);
            case IStatus.WARNING:
                return OpenShiftUIActivator.statusFactory()
                        .warningStatus(OpenShiftUIMessages.OCBinaryWarningMessage);
            }
            return status;
        }
    };
    dbc.addValidationStatusProvider(validator);
}

From source file:org.jkiss.dbeaver.ui.controls.resultset.StatusLabel.java

License:Apache License

public void setStatus(String message, DBPMessageType messageType) {
    if (statusText.isDisposed()) {
        return;/* w  ww . j  a v  a2  s  .  c o  m*/
    }
    this.messageType = messageType;

    Color fg;
    String statusIconId;
    switch (messageType) {
    case ERROR:
        fg = colorError;
        statusIconId = Dialog.DLG_IMG_MESSAGE_ERROR;
        break;
    case WARNING:
        fg = colorWarning;
        statusIconId = Dialog.DLG_IMG_MESSAGE_WARNING;
        break;
    default:
        fg = colorDefault;
        statusIconId = Dialog.DLG_IMG_MESSAGE_INFO;
        break;
    }
    statusText.setForeground(fg);
    if (message == null) {
        message = "???"; //$NON-NLS-1$
    }
    statusIcon.setImage(JFaceResources.getImage(statusIconId));
    statusText.setText(TextUtils.getSingleLineString(message));
    if (messageType != DBPMessageType.INFORMATION) {
        statusText.setToolTipText(message);
    } else {
        statusText.setToolTipText(null);
    }
}