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: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:/*  w  w w  .j a  v a2s . c  o  m*/
        return null;
    }
}

From source file:com.google.dart.tools.debug.ui.internal.chrome.DartChromeMainTab.java

License:Open Source License

private void validateBrowsers() {
    if (DartDebugCorePlugin.getPlugin().getConfiguredBrowsers().size() == 0) {
        browserWarningLabel.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
        browserWarningLabel.setText("No Chrome browsers are configured.");
    } else {//from ww  w  .j a v a  2 s .  c  o  m
        browserWarningLabel.setImage(null);
        browserWarningLabel.setText("");
    }
}

From source file:com.google.dart.tools.ui.internal.dialogs.SortMembersMessageDialog.java

License:Open Source License

@Override
protected Control createMessageArea(Composite parent) {
    initializeDialogUnits(parent);//from  w  w  w .  j a  va2s.c o  m

    Composite messageComposite = new Composite(parent, SWT.NONE);
    messageComposite.setFont(parent.getFont());
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    messageComposite.setLayout(layout);
    messageComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    createLinkControl(messageComposite);

    int indent = convertWidthInCharsToPixels(3);

    fNotSortAllRadio.doFillIntoGrid(messageComposite, 1);
    LayoutUtil.setHorizontalIndent(fNotSortAllRadio.getSelectionButton(null), indent);

    fSortAllRadio.doFillIntoGrid(messageComposite, 1);
    LayoutUtil.setHorizontalIndent(fSortAllRadio.getSelectionButton(null), indent);

    final Composite warningComposite = new Composite(messageComposite, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    warningComposite.setLayout(layout);
    warningComposite.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
    warningComposite.setFont(messageComposite.getFont());

    Image image = Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    final Label imageLabel1 = new Label(warningComposite, SWT.LEFT | SWT.WRAP);
    imageLabel1.setImage(image);
    imageLabel1.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 1, 1));

    final Label label = new Label(warningComposite, SWT.WRAP);
    label.setText(DialogsMessages.SortMembersMessageDialog_sort_warning_label);
    GridData gridData = new GridData(GridData.FILL, GridData.CENTER, true, false, 1, 1);
    gridData.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
    label.setLayoutData(gridData);
    label.setFont(warningComposite.getFont());

    fNotSortAllRadio.setDialogFieldListener(new IDialogFieldListener() {
        @Override
        public void dialogFieldChanged(DialogField field) {
            imageLabel1.setEnabled(!fNotSortAllRadio.isSelected());
            label.setEnabled(!fNotSortAllRadio.isSelected());
        }
    });
    imageLabel1.setEnabled(!fNotSortAllRadio.isSelected());
    label.setEnabled(!fNotSortAllRadio.isSelected());

    return messageComposite;
}

From source file:com.htmlhifive.tools.wizard.download.DownloadModule.java

License:Apache License

/**
 * 1???.//from  ww w  . ja va 2 s. c o m
 * 
 * @param monitor 
 * @param totalWork 
 * @param file 
 * @param uri URI
 * @throws CoreException 
 */
private ZipFile download(final IProgressMonitor monitor, final int totalWork, ResultStatus logger, IFile file,
        final String urlStr) throws CoreException {

    // PI0111=INFO,[{0}]...
    monitor.subTask(Messages.PI0111.format(urlStr));

    lastDownloadStatus = false;

    int ret = 0;
    while (ret == 0) {
        try {
            if (file != null) {
                // ??.

                IConnectMethod method = ConnectMethodFactory.getMethod(urlStr, true);
                method.setConnectionTimeout(PluginConstant.URL_LIBRARY_CONNECTION_TIMEOUT);
                method.setProxy(getProxyService());
                method.getInputStream();

                boolean updateResult = updateFile(monitor, 0, logger, file, method);
                if (updateResult) {
                    lastDownloadStatus = true;
                }
                monitor.worked(totalWork);
            } else {
                // file?null?????ZipFile???.

                BufferedInputStream bufferIs = null;
                OutputStream os = null;

                try {
                    IConnectMethod method = ConnectMethodFactory.getMethod(urlStr, true);
                    method.setConnectionTimeout(PluginConstant.URL_LIBRARY_CONNECTION_TIMEOUT);
                    method.setProxy(getProxyService());
                    if (!method.connect()) {
                        // SE0101=ERROR,({0})??????URL={1}, File={2}
                        logger.log(Messages.SE0101, urlStr, file != null ? file.toString() : "");
                        return null;
                    }
                    final int contentLength = method.getContentLength();
                    //                  final int perWork;
                    //                  if (contentLength > 0) {
                    //                     perWork = Math.max(1, totalWork * DEFAULT_BUFFER_SIZE / 8 / contentLength);
                    //                  }else{
                    //                     perWork  = totalWork;
                    //                  }
                    InputStream is = method.getInputStream();

                    //                  if (H5IOUtils.isClassResources(urlStr)) {
                    //                     // url?null??????.
                    //                     is = DownloadModule.class.getResourceAsStream(urlStr);
                    //                  } else {
                    //                     // ?URL
                    //                     HttpMethod method = DownloadModule.this.connect(urlStr,
                    //                           PluginResource.URL_LIBRARY_CONNECTION_TIMEOUT);
                    //                     if (method == null) {
                    //                        return null;
                    //                     }
                    //
                    //                     // ??????.
                    //                     Header header = method.getResponseHeader("Content-Length");
                    //                     if (header != null) {
                    //                        contentLength = Integer.valueOf(header.getValue());
                    //                     }
                    //                     if (contentLength > 0) {
                    //                        perWork = Math.max(1, perWork * DEFAULT_BUFFER_SIZE / contentLength);
                    //                     }
                    //                     is = method.getResponseBodyAsStream();
                    //                  }
                    if (is == null) {
                        // SE0101=ERROR,({0})??????URL={1}, File={2}
                        logger.log(Messages.SE0101, urlStr, file != null ? file.toString() : "");
                        return null;
                    }

                    bufferIs = new BufferedInputStream(is) {
                        private int current = 0;
                        private final int perWork = Math.max(1, totalWork * buf.length / 8 / contentLength);

                        @Override
                        public synchronized int read() throws IOException {

                            int result = super.read();
                            current += result * 16;
                            monitor.subTask(Messages.PI0143.format(current, contentLength, urlStr));
                            //monitor.worked(result * 16);
                            monitor.worked(perWork);

                            return result;
                        }
                    };

                    // SE0093=INFO,{0}???
                    logger.log(Messages.SE0093, urlStr);

                    // ZIP.
                    File tempFile = File.createTempFile(H5WizardPlugin.getId(), "tmp");
                    // VM????.
                    tempFile.deleteOnExit();
                    // ??.
                    os = FileUtils.openOutputStream(tempFile);
                    IOUtils.copy(bufferIs, os);

                    //                  byte[] buffer = new byte[DEFAULT_BUFFER_SIZE];
                    //                  int n = 0;
                    //                  while (-1 != (n = is.read(buffer))) {
                    //                     os.write(buffer, 0, n);
                    //                     if (contentLength > 0) {
                    //                        monitor.worked(perWork);
                    //                     }
                    //                  }
                    if (contentLength == 0) {
                        monitor.worked(totalWork);
                    }

                    // SE0094=INFO,{0}????
                    logger.log(Messages.SE0094, urlStr);

                    lastDownloadStatus = true;
                    return new ZipFile(tempFile);
                } finally {
                    IOUtils.closeQuietly(bufferIs);
                    IOUtils.closeQuietly(os);
                }
            }
            ret = 1;
        } catch (IOException e) {
            // SE0101=ERROR,({0})??????URL={1}, File={2}
            logger.log(e, Messages.SE0101, urlStr, file != null ? file.toString() : "");

            // ?????.
            MessageDialog dialog = new MessageDialog(null, Messages.SE0115.format(),
                    Dialog.getImage(Dialog.DLG_IMG_MESSAGE_WARNING), Messages.SE0116.format(urlStr),
                    MessageDialog.QUESTION,
                    new String[] { UIMessages.Dialog_RETRY, UIMessages.Dialog_IGNORE, UIMessages.Dialog_STOP },
                    0);
            ret = dialog.open();
            if (ret == 2) {
                // 
                throw new OperationCanceledException(
                        Messages.SE0101.format(urlStr, file != null ? file.toString() : ""));
            }
        }
    }
    return null;
}

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  w w  .  j  av a 2  s  .  c  om

    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.nokia.tools.theme.s60.ui.preferences.ComponentStorePrefPage.java

License:Open Source License

private Composite setWarningMessage(Composite parent) {
    if (warningMessage != null) {
        messageComposite = new Composite(parent, SWT.NONE);
        GridLayout messageLayout = new GridLayout();
        messageLayout.numColumns = 2;//from w  w  w  .  j  a v a 2s.  c o  m
        messageLayout.marginWidth = 0;
        messageLayout.marginHeight = 0;
        messageLayout.makeColumnsEqualWidth = false;
        messageComposite.setLayout(messageLayout);

        messageImageLabel = new Label(messageComposite, SWT.NONE);
        messageImageLabel.setImage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING));
        messageImageLabel.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));

        messageText = new Text(messageComposite, SWT.WRAP);
        messageText.setEditable(false);
        GridData textData = new GridData(
                GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER);
        messageText.setLayoutData(textData);
        messageText.setText(warningMessage);
    }
    return messageComposite;
}

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./*from  ww w. ja va 2  s .  co 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 setWarningMessage(String message) {
    getDefaultStatusLineManager().removeAll();
    getDefaultStatusLineManager().setMessage(JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING), message);
}

From source file:de.walware.ecommons.ui.util.StatusLineMessageManager.java

License:Open Source License

private Image getIcon(final int severity) {
    if (!this.showIcons) {
        return null;
    }/*from   www  .j  a  va  2s. c o m*/
    switch (severity) {
    case IStatus.INFO:
        return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO);
    case IStatus.WARNING:
        return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    case IStatus.ERROR:
        return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
    default:
        return null;
    }
}

From source file:de.walware.statet.r.internal.ui.pkgmanager.StatusLabelProvider.java

License:Open Source License

public Image getImage(final IStatus status) {
    switch (status.getSeverity()) {
    case IStatus.ERROR:
        return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_ERROR);
    case IStatus.WARNING:
        return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_WARNING);
    default:/*ww w. j  a  v  a2  s. co  m*/
        return JFaceResources.getImage(Dialog.DLG_IMG_MESSAGE_INFO);
    }
}