Example usage for org.eclipse.jface.resource JFaceColors getErrorText

List of usage examples for org.eclipse.jface.resource JFaceColors getErrorText

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceColors getErrorText.

Prototype

public static Color getErrorText(Display display) 

Source Link

Usage

From source file:cc.warlock.rcp.stormfront.ui.prefs.AccountEditDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    if (buttonId == TEST_ACCOUNT) {
        AccountVerifier verifier = new AccountVerifier(usernameField.getText(), passwordField.getText());

        boolean verified = verifier.verify();
        if (!verified) {
            statusLabel.setBackground(JFaceColors.getErrorBackground(getShell().getDisplay()));
            statusLabel.setForeground(JFaceColors.getErrorText(getShell().getDisplay()));
            String loginError = LoginUtil.getAuthenticationError(verifier.getErrorCode());
            statusLabel.setText(loginError);

            getButton(OK).setEnabled(false);
        } else {/*  w  w w  . ja  v a  2  s  .  co m*/
            statusLabel.setBackground(getShell().getBackground());
            statusLabel.setForeground(new Color(getShell().getDisplay(), 0, 128, 0));
            statusLabel.setText("Succesfully logged in to the server");

            getButton(OK).setEnabled(true);
        }
    } else {
        super.buttonPressed(buttonId);
    }
}

From source file:codemirror.eclipse.swt.search.FindReplaceDialog.java

License:Open Source License

/**
 * Sets the given status message in the status line.
 *
 * @param error <code>true</code> if it is an error
 * @param message the error message//  ww  w .j  av a  2  s.c o  m
 */
private void statusMessage(boolean error, String message) {
    fStatusLabel.setText(message);

    if (error)
        fStatusLabel.setForeground(JFaceColors.getErrorText(fStatusLabel.getDisplay()));
    else
        fStatusLabel.setForeground(null);

    /*IEditorStatusLine statusLine= getStatusLineManager();
    if (statusLine != null)
       statusLine.setMessage(error, message, null);
    */
    if (error)
        getShell().getDisplay().beep();
}

From source file:com.agynamix.platform.frontend.gui.ApplicationStatusLineManager.java

License:Open Source License

@Override
public void setErrorMessage(String message) {
    setCurrentError(null, message);
    super.setErrorMessage(message);
    JFaceColors.getErrorText(null);
}

From source file:com.google.dart.tools.search.internal.ui.text.TextSearchPage.java

License:Open Source License

private void statusMessage(boolean error, String message) {
    fStatusLabel.setText(message);//  w  w w. ja v a  2s  . c om
    if (error) {
        fStatusLabel.setForeground(JFaceColors.getErrorText(fStatusLabel.getDisplay()));
    } else {
        fStatusLabel.setForeground(null);
    }
}

From source file:com.googlecode.spektom.gcsearch.ui.GCSearchPage.java

private void setError(String message) {
    if (message != null) {
        statusLabel.setText(message);/*from  ww  w .jav a2 s  .  c o m*/
        statusLabel.setForeground(JFaceColors.getErrorText(statusLabel.getDisplay()));
    } else {
        statusLabel.setText(" (Search via regular expression, e.g. ^java/.*\\.java$)");
        statusLabel.setForeground(null);
    }
}

From source file:com.iw.plugins.spindle.ui.widgets.ContainerSelectionDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {
    // create composite
    Composite area = (Composite) super.createDialogArea(parent);

    Listener listener = new Listener() {
        public void handleEvent(Event event) {
            if (statusMessage != null && validator != null) {
                String errorMsg = validator.isValid(group.getContainerFullPath());
                if (errorMsg == null || errorMsg.equals("")) { //$NON-NLS-1$
                    statusMessage.setText(""); //$NON-NLS-1$
                    getOkButton().setEnabled(true);
                } else {
                    statusMessage.setForeground(JFaceColors.getErrorText(statusMessage.getDisplay()));
                    statusMessage.setText(errorMsg);
                    getOkButton().setEnabled(false);
                }//from   w  w w . j a  v a 2  s  .  c  om
            }
        }
    };

    // container selection group
    group = new ContainerSelectionGroup(area, listener, allowNewContainerName, getMessage(), showClosedProjects,
            initialSelection);

    if (fFilter != null) {
        group.getTreeViewer().addFilter(fFilter);
    }

    if (initialSelection != null) {
        group.setSelectedContainer(initialSelection);
    }

    statusMessage = new Label(parent, SWT.NONE);
    statusMessage.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    statusMessage.setFont(parent.getFont());

    return dialogArea;
}

From source file:com.mentor.nucleus.bp.core.ui.dialogs.ElementSelectionFlatView.java

License:Open Source License

private void updateStatusLabel() {
    if (!fStatusLabel.getText().equals(NON_REGEX_INFO_TEXT) && !fUseRegularExpressions) {
        fStatusLabel.setText(NON_REGEX_INFO_TEXT);
        fStatusLabel.setForeground(null);
    } else {/*  w w w.j a  v a 2s  .c om*/
        if (fUseRegularExpressions) {
            if (fStatusMessage != null && !fStatusMessage.equals("")) {
                fStatusLabel.setText(fStatusMessage);
                fStatusLabel.setForeground(JFaceColors.getErrorText(fStatusLabel.getDisplay()));
            } else {
                fStatusLabel.setText("");
            }
        }
    }
}

From source file:com.mentor.nucleus.bp.ui.search.pages.ModelSearchPage.java

License:Open Source License

private void setStatusMessage(boolean error, String message) {
    statusLabel.setText(message);/*from   w w w . ja v  a  2s.c  om*/
    if (error)
        statusLabel.setForeground(JFaceColors.getErrorText(statusLabel.getDisplay()));
    else
        statusLabel.setForeground(null);
}

From source file:com.nokia.carbide.cpp.internal.project.ui.editors.common.ControlHandler.java

License:Open Source License

public IStatus validate() {
    IStatus result = Status.OK_STATUS;//from w  w w. ja  v a  2  s.c  om
    if (validator != null) {
        result = validator.validate(control);
        if (result == null || result.isOK()) {
            clearLabelModifications();
            // this is needed so UI can clear out error indications
            fireValidationSucceeded();
        } else {
            if (label != null) {
                label.setForeground(JFaceColors.getErrorText(control.getDisplay()));
            }
            fireValidationFailed(result.getMessage());
        }
    }
    return result;
}

From source file:com.nokia.carbide.search.system.internal.ui.text.ReplaceDialog2.java

License:Open Source License

private void statusMessage(boolean error, String message) {
    fStatusLabel.setText(message);// www  .  j  a  va  2 s  .  c o m

    if (error)
        fStatusLabel.setForeground(JFaceColors.getErrorText(fStatusLabel.getDisplay()));
    else
        fStatusLabel.setForeground(null);

    if (error)
        getShell().getDisplay().beep();
}