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

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

Introduction

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

Prototype

String DLG_IMG_MESSAGE_ERROR

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

Click Source Link

Document

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

Usage

From source file:bndtools.utils.MessagesPopupDialog.java

License:Open Source License

static Image getMessageImage(int messageType) {
    switch (messageType) {
    case IMessageProvider.INFORMATION:
        return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO);
    case IMessageProvider.WARNING:
        return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    case IMessageProvider.ERROR:
        return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
    default:// ww w .  ja va2 s.  c om
        return null;
    }
}

From source file:com.google.gdt.eclipse.gph.wizards.ShowErrorPage.java

License:Open Source License

@Override
protected Control createPageContents(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayoutFactory.swtDefaults().margins(10, 10).numColumns(2).applyTo(composite);

    Label iconLabel = new Label(composite, SWT.NONE);
    iconLabel.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR));

    Label titleLabel = new Label(composite, SWT.NONE);
    titleLabel.setText(status.getMessage());
    titleLabel.setFont(getBoldFont(titleLabel.getFont()));
    GridDataFactory.fillDefaults().grab(true, false).applyTo(titleLabel);

    // spacer//from w  ww .java 2s.c  o  m
    new Label(composite, SWT.NONE);

    if (status.isMultiStatus() || status.getException() != null) {
        final Link link = new Link(composite, SWT.NONE);
        link.setText("<a>show details...</a>");
        link.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                replaceWithDetails(link);
            }
        });
        GridDataFactory.fillDefaults().grab(true, true).applyTo(link);
    }

    return composite;
}

From source file:com.liferay.ide.project.ui.upgrade.animated.BuildPage.java

License:Open Source License

private void createImages() {
    imageProject = PlatformUI.getWorkbench().getSharedImages().getImage(SharedImages.IMG_OBJ_PROJECT);

    if (imageProject.isDisposed()) {
        imageProject = PlatformUI.getWorkbench().getSharedImages()
                .getImageDescriptor(SharedImages.IMG_OBJ_PROJECT).createImage();
    }/*  w  w  w.j av a 2  s. c om*/

    URL greenTickUrl = ProjectUI.getDefault().getBundle().getEntry("/images/greentick.png");
    imageSuccess = ImageDescriptor.createFromURL(greenTickUrl).createImage();
    imageSuccess.getImageData().scaledTo(16, 16);

    imageFail = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);

}

From source file:com.liferay.ide.project.ui.upgrade.animated.GearControl.java

License:Open Source License

protected void init() {
    super.init();

    display = getDisplay();/*from w ww .j  ava  2 s  . com*/

    errorImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
    warningImage = JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);

    WHITE = display.getSystemColor(SWT.COLOR_WHITE);
    GRAY = display.getSystemColor(SWT.COLOR_GRAY);
    DARK_GRAY = display.getSystemColor(SWT.COLOR_DARK_GRAY);

    Font initialFont = getFont();
    FontData[] fontData = initialFont.getFontData();

    for (int i = 0; i < fontData.length; i++) {
        fontData[i].setHeight(16);
        fontData[i].setStyle(SWT.BOLD);
    }

    baseFont = new Font(display, fontData);

    numberFont = createFont(24);
    tooltipFont = createFont(24);

    radius = 32;
    setSize((int) (gearMaxNumber * 2 * radius), (int) (2 * radius));

    // Not selected.
    gearBackground[0] = createColor(169, 171, 202);
    gearForeground[0] = createColor(140, 132, 171);

    // Selected.
    gearBackground[1] = createColor(247, 148, 30);
    gearForeground[1] = createColor(207, 108, 0);

    tooltipColor = createColor(253, 232, 206);
}

From source file:com.liferay.ide.ui.form.IDEFormPage.java

License:Open Source License

protected void createFormErrorContent(IManagedForm managedForm, String errorTitle, String errorMessage,
        Exception e) {//  w  w  w. ja va2  s  . co m

    ScrolledForm form = managedForm.getForm();
    FormToolkit toolkit = managedForm.getToolkit();
    toolkit.decorateFormHeading(form.getForm());

    Composite parent = form.getBody();
    GridLayout layout = new GridLayout();
    GridData data2 = new GridData(GridData.FILL_BOTH);
    layout.marginWidth = 7;
    layout.marginHeight = 7;
    parent.setLayout(layout);
    parent.setLayoutData(data2);
    // Set the title and image of the form
    form.setText(errorTitle);
    form.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR));

    int sectionStyle = Section.DESCRIPTION | ExpandableComposite.TITLE_BAR;
    // Create the message section
    Section messageSection = createUISection(parent, Msgs.message, errorMessage, sectionStyle);
    Composite messageClient = createUISectionContainer(messageSection, 1);
    // Bind the widgets
    toolkit.paintBordersFor(messageClient);
    messageSection.setClient(messageClient);
    // Ensure the exception was defined
    if (e == null) {
        return;
    }
    // Create the details section
    Section detailsSection = createUISection(parent, Msgs.details, e.getMessage(), sectionStyle);
    Composite detailsClient = createUISectionContainer(detailsSection, 1);
    // Create text widget holding the exception trace
    int style = SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY;
    Text text = toolkit.createText(detailsClient, getStackTrace(e), style);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.heightHint = 160;
    data.widthHint = 200;
    text.setLayoutData(data);
    // Bind the widgets
    toolkit.paintBordersFor(detailsClient);
    detailsSection.setClient(detailsClient);
    // Note: The veritical scrollbar fails to appear when text widget is
    // not entirely shown
}

From source file:com.mindquarry.desktop.preferences.pages.ServerProfilesPage.java

License:Open Source License

private void createMindquarryServerSettings(Composite parent) {
    mqServerSettings = new Composite(parent, SWT.NORMAL);
    mqServerSettings.setLayoutData(new GridData(GridData.FILL_BOTH));
    mqServerSettings.setLayout(new GridLayout(1, true));

    // initialize server URL section
    CLabel quarryEndpointLabel = new CLabel(mqServerSettings, SWT.LEFT);
    quarryEndpointLabel.setText(I18N.get("URL of the Mindquarry Server:")); //$NON-NLS-1$
    quarryEndpointLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Composite errorComp = createErrorBorderComposite(mqServerSettings, 1);
    url = new Text(errorComp, SWT.SINGLE | SWT.BORDER);
    registerErrorBorderComposite(errorComp, url);
    url.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    url.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            String[] selection = profileList.getSelection();
            if (selection.length > 0) {
                Profile profile = findByName(selection[0]);
                profile.setServerURL(url.getText());
                performValidation();// w ww. ja  v  a 2 s  . c om
            }
        }
    });
    url.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent e) {
            url.selectAll();
        }
    });
    // initialize login section
    CLabel loginLabel = new CLabel(mqServerSettings, SWT.LEFT);
    loginLabel.setText(I18N.get("Your Login ID:")); //$NON-NLS-1$
    loginLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    errorComp = createErrorBorderComposite(mqServerSettings, 1);
    login = new Text(errorComp, SWT.SINGLE | SWT.BORDER);
    registerErrorBorderComposite(errorComp, login);
    login.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    login.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            String[] selection = profileList.getSelection();
            if (selection.length > 0) {
                Profile profile = findByName(selection[0]);
                profile.setLogin(login.getText());
                performValidation();
            }
        }
    });
    login.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent e) {
            login.selectAll();
        }
    });
    // initialize password section
    CLabel pwdLabel = new CLabel(mqServerSettings, SWT.LEFT);
    pwdLabel.setText(I18N.get("Your Password:")); //$NON-NLS-1$
    pwdLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    errorComp = createErrorBorderComposite(mqServerSettings, 1);
    pwd = new Text(errorComp, SWT.PASSWORD | SWT.BORDER);
    registerErrorBorderComposite(errorComp, pwd);
    pwd.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    pwd.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            String[] selection = profileList.getSelection();
            if (selection.length > 0) {
                Profile profile = findByName(selection[0]);
                profile.setPassword(pwd.getText());
                performValidation();
            }
        }
    });
    pwd.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent e) {
            pwd.selectAll();
        }
    });
    // init verify server button
    Composite verifyArea = new Composite(mqServerSettings, SWT.NONE);
    verifyArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    GridLayout layout = new GridLayout(2, false);
    layout.marginBottom = 0;
    layout.marginTop = 0;
    layout.marginLeft = 0;
    layout.marginRight = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    verifyArea.setLayout(layout);
    Button verifyServerButton = new Button(verifyArea, SWT.LEFT | SWT.PUSH);
    verifyServerButton.setText(I18N.get("Verify server settings"));

    final CLabel verifiedLabel = new CLabel(verifyArea, SWT.WRAP);
    verifiedLabel.setLayoutData(new GridData(300, 20));

    verifyServerButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            try {
                HttpUtilities.CheckResult result = HttpUtilities.checkServerExistence(login.getText(),
                        pwd.getText(), url.getText());

                if (HttpUtilities.CheckResult.AUTH_REFUSED == result) {
                    String msg = I18N.get("Login ID or password is incorrect.");
                    setInvalid(msg, login, pwd);
                    verifiedLabel.setText(msg);
                    verifiedLabel.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR));
                } else if (HttpUtilities.CheckResult.NOT_AVAILABLE == result) {
                    String msg = I18N.get("Server could not be found.");
                    setInvalid(msg, url);
                    verifiedLabel.setText(msg);
                    verifiedLabel.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR));
                } else {
                    setValid();
                    String msg = I18N.get("Server settings are correct.");
                    setMessage(msg, INFORMATION);
                    verifiedLabel.setText(msg);
                    verifiedLabel.setImage(OK_IMAGE);
                }
            } catch (MalformedURLException murle) {
                String msg = I18N.get("Server URL is not a valid URL ({0})", murle.getLocalizedMessage());
                setInvalid(msg, url);
                verifiedLabel.setText(msg);
                verifiedLabel.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR));
            }
            verifiedLabel.getParent().layout();
        }
    });

    // initialize workspace folder section
    CLabel locationLabel = new CLabel(mqServerSettings, SWT.LEFT);
    locationLabel.setText(I18N.get("Folder for Workspaces:")); //$NON-NLS-1$
    locationLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Composite locationArea = new Composite(mqServerSettings, SWT.NONE);
    locationArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    layout = new GridLayout(2, false);
    layout.marginBottom = 0;
    layout.marginTop = 0;
    layout.marginLeft = 0;
    layout.marginRight = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    locationArea.setLayout(layout);

    errorComp = createErrorBorderComposite(locationArea, 1);
    folder = new Text(errorComp, SWT.BORDER);
    registerErrorBorderComposite(errorComp, folder);
    folder.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    folder.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            String[] selection = profileList.getSelection();
            if (selection.length > 0) {
                Profile profile = findByName(selection[0]);
                profile.setWorkspaceFolder(folder.getText());
                performValidation();
            }
        }
    });
    folder.addFocusListener(new FocusAdapter() {
        public void focusGained(FocusEvent e) {
            folder.selectAll();
        }
    });
    Button selectWSLocationButton = new Button(locationArea, SWT.PUSH);
    selectWSLocationButton.setText(I18N.get("Browse")); //$NON-NLS-1$
    selectWSLocationButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
            DirectoryDialog fd = new DirectoryDialog(getShell(), SWT.OPEN);
            fd.setText(I18N.get("Select folder for workspaces.")); //$NON-NLS-1$

            String path = fd.open();
            if (path != null) {
                folder.setText(path);
            }
        }
    });
}

From source file:com.nokia.tools.s60ct.confml.widgets.ErrorToolTipWidget.java

License:Open Source License

private static void buildErrorImage(Shell errorToolTip) {
    Label imageLabel = new Label(errorToolTip, SWT.NONE);
    imageLabel.setForeground(errorToolTip.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
    imageLabel.setBackground(errorToolTip.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
    imageLabel.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR));
}

From source file:com.sap.dirigible.ide.common.status.DefaultProgressMonitor.java

License:Open Source License

/**
 * Sets the message, along with a image corresponding to error/warning/info
 * severity. If another argument is provided in severity, the method
 * returns.//w w w.  j a  v a2  s .  c  o m
 */
public void setMessage(final String message, final int severity) {
    String imageCode = null;
    switch (severity) {
    case (IStatus.INFO):
        imageCode = Dialog.DLG_IMG_MESSAGE_INFO;
        break;
    case (IStatus.WARNING):
        imageCode = Dialog.DLG_IMG_MESSAGE_WARNING;
        break;
    case (IStatus.ERROR):
        imageCode = Dialog.DLG_IMG_MESSAGE_ERROR;
        break;
    }
    if (imageCode == null) {
        return;
    } else {
        this.statusLineManager.setMessage(JFaceResources.getImage(imageCode), message);
    }
}

From source file:com.sap.dirigible.ide.common.status.StatusLineManagerUtil.java

License:Open Source License

public static void setErrorMessage(String message) {
    getDefaultStatusLineManager().removeAll();
    getDefaultStatusLineManager().setErrorMessage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR),
            message);//from   w w  w .j  av a 2s  .c om
}

From source file:com.siteview.mde.internal.ui.editor.MDEFormPage.java

License:Open Source License

protected void createFormErrorContent(IManagedForm managedForm, String errorTitle, String errorMessage,
        Exception e) {/*w ww  .j  a  v a2  s.  co m*/

    ScrolledForm form = managedForm.getForm();
    FormToolkit toolkit = managedForm.getToolkit();
    toolkit.decorateFormHeading(form.getForm());

    Composite parent = form.getBody();
    GridLayout layout = new GridLayout();
    GridData data2 = new GridData(GridData.FILL_BOTH);
    layout.marginWidth = 7;
    layout.marginHeight = 7;
    parent.setLayout(layout);
    parent.setLayoutData(data2);
    // Set the title and image of the form
    form.setText(errorTitle);
    form.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR));

    int sectionStyle = Section.DESCRIPTION | ExpandableComposite.TITLE_BAR;
    // Create the message section
    Section messageSection = createUISection(parent, MDEUIMessages.PDEFormPage_titleMessage, errorMessage,
            sectionStyle);
    Composite messageClient = createUISectionContainer(messageSection, 1);
    // Bind the widgets
    toolkit.paintBordersFor(messageClient);
    messageSection.setClient(messageClient);
    // Ensure the exception was defined
    if (e == null) {
        return;
    }
    // Create the details section
    Section detailsSection = createUISection(parent, MDEUIMessages.PDEFormPage_titleDetails, e.getMessage(),
            sectionStyle);
    Composite detailsClient = createUISectionContainer(detailsSection, 1);
    // Create text widget holding the exception trace
    int style = SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.READ_ONLY;
    Text text = toolkit.createText(detailsClient, getStackTrace(e), style);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.heightHint = 160;
    data.widthHint = 200;
    text.setLayoutData(data);
    // Bind the widgets
    toolkit.paintBordersFor(detailsClient);
    detailsSection.setClient(detailsClient);
    // Note: The veritical scrollbar fails to appear when text widget is
    // not entirely shown
}