Example usage for org.eclipse.jface.dialogs MessageDialog NONE

List of usage examples for org.eclipse.jface.dialogs MessageDialog NONE

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs MessageDialog NONE.

Prototype

int NONE

To view the source code for org.eclipse.jface.dialogs MessageDialog NONE.

Click Source Link

Document

Constant for no image (value 0).

Usage

From source file:com.amazonaws.eclipse.identitymanagement.group.EditGroupNameDialog.java

License:Apache License

protected EditGroupNameDialog(String groupName) {
    super(Display.getCurrent().getActiveShell(), "Enter New Group Name", null, "Enter a new group name",
            MessageDialog.NONE, new String[] { "OK", "Cancel" }, 0);
    this.oldGroupName = groupName;
}

From source file:com.amazonaws.eclipse.identitymanagement.user.NewAccessKeyDialog.java

License:Apache License

public NewAccessKeyDialog(AmazonIdentityManagement iam, String userName, AccessKeyTable accessKeyTable) {
    super(Display.getCurrent().getActiveShell(), "Manage Access Key", null, null, MessageDialog.NONE,
            new String[] { "OK", "Cancel" }, 0);
    this.iam = iam;
    this.userName = userName;
    this.accessKeyTable = accessKeyTable;
}

From source file:com.android.ide.eclipse.adt.internal.assetstudio.ConfigureAssetSetPage.java

License:Open Source License

@Override
public void widgetSelected(SelectionEvent e) {
    if (mIgnore) {
        return;/*  w  w w . j a v  a  2 s  .  c  o m*/
    }

    Object source = e.getSource();
    boolean updateQuickly = true;

    // Tabs
    if (source == mImageRadio) {
        mValues.sourceType = CreateAssetSetWizardState.SourceType.IMAGE;
        chooseForegroundTab((Button) source, mImageForm);
        configureAssetType(mValues.type);
        updateTrimOptions();
    } else if (source == mClipartRadio) {
        mValues.sourceType = CreateAssetSetWizardState.SourceType.CLIPART;
        chooseForegroundTab((Button) source, mClipartForm);
        configureAssetType(mValues.type);
        updateTrimOptions();
    } else if (source == mTextRadio) {
        mValues.sourceType = CreateAssetSetWizardState.SourceType.TEXT;
        updateFontLabel();
        chooseForegroundTab((Button) source, mTextForm);
        configureAssetType(mValues.type);
        mText.setFocus();
        updateTrimOptions();
    }

    // Choose image file
    if (source == mPickImageButton) {
        FileDialog dialog = new FileDialog(mPickImageButton.getShell(), SWT.OPEN);

        String curLocation = mImagePathText.getText().trim();
        if (!curLocation.isEmpty()) {
            dialog.setFilterPath(curLocation);
        }

        String file = dialog.open();
        if (file != null) {
            mValues.imagePath = new File(file);
            mImagePathText.setText(file);
        }
    }

    // Enforce Radio Groups
    if (source == mCropRadio) {
        mCropRadio.setSelection(true); // Ensure that you can't toggle it off
        mCenterRadio.setSelection(false);
        mValues.crop = true;
    } else if (source == mCenterRadio) {
        mCenterRadio.setSelection(true);
        mCropRadio.setSelection(false);
        mValues.crop = false;
    }
    if (source == mSquareRadio) {
        mValues.shape = GraphicGenerator.Shape.SQUARE;
        setShape(mValues.shape);
    } else if (source == mCircleButton) {
        mValues.shape = GraphicGenerator.Shape.CIRCLE;
        setShape(mValues.shape);
    } else if (source == mNoShapeRadio) {
        mValues.shape = GraphicGenerator.Shape.NONE;
        setShape(mValues.shape);
    }

    if (source == mTrimCheckBox) {
        mValues.trim = mTrimCheckBox.getSelection();
    }

    if (source == mHoloDarkRadio) {
        mHoloDarkRadio.setSelection(true);
        mHoloLightRadio.setSelection(false);
        mValues.holoDark = true;
    } else if (source == mHoloLightRadio) {
        mHoloLightRadio.setSelection(true);
        mHoloDarkRadio.setSelection(false);
        mValues.holoDark = false;
    }

    if (source == mChooseClipart) {
        MessageDialog dialog = new MessageDialog(mChooseClipart.getShell(), "Choose Clip Art", null,
                "Choose Clip Art Image:", MessageDialog.NONE, new String[] { "Close" }, 0) {
            @Override
            protected Control createCustomArea(Composite parent) {
                // Outer form which just establishes a width for the inner form which
                // wraps in a RowLayout
                Composite outer = new Composite(parent, SWT.NONE);
                GridLayout gridLayout = new GridLayout();
                outer.setLayout(gridLayout);

                Composite chooserForm = new Composite(outer, SWT.NONE);
                GridData gd = new GridData();
                gd.grabExcessVerticalSpace = true;
                gd.widthHint = 450;
                chooserForm.setLayoutData(gd);
                RowLayout clipartFormLayout = new RowLayout(SWT.HORIZONTAL);
                clipartFormLayout.center = true;
                clipartFormLayout.wrap = true;
                chooserForm.setLayout(clipartFormLayout);

                MouseAdapter clickListener = new MouseAdapter() {
                    @Override
                    public void mouseDown(MouseEvent event) {
                        // Clicked on some of the sample art
                        if (event.widget instanceof ImageControl) {
                            ImageControl image = (ImageControl) event.widget;
                            mValues.clipartName = (String) image.getData();
                            close();

                            updateClipartPreview();
                            updatePreview();
                        }
                    }
                };
                Display display = chooserForm.getDisplay();
                Color hoverColor = display.getSystemColor(SWT.COLOR_RED);
                Iterator<String> clipartImages = GraphicGenerator.getClipartNames();
                while (clipartImages.hasNext()) {
                    String name = clipartImages.next();
                    try {
                        BufferedImage icon = GraphicGenerator.getClipartIcon(name);
                        if (icon != null) {
                            Image swtImage = SwtUtils.convertToSwt(display, icon, true, -1);
                            ImageControl img = new ImageControl(chooserForm, SWT.NONE, swtImage);
                            img.setData(name);
                            img.setHoverColor(hoverColor);
                            img.addMouseListener(clickListener);
                        }
                    } catch (IOException e1) {
                        AdtPlugin.log(e1, null);
                    }
                }
                outer.pack();
                outer.layout();
                return outer;
            }
        };
        dialog.open();
    }

    if (source == mBgButton) {
        ColorDialog dlg = new ColorDialog(mBgButton.getShell());
        dlg.setRGB(mBgColor);
        dlg.setText("Choose a new Background Color");
        RGB rgb = dlg.open();
        if (rgb != null) {
            // Dispose the old color, create the
            // new one, and set into the label
            mValues.background = rgb;
            updateColor(mBgButton.getDisplay(), rgb, true /*background*/);
        }
    } else if (source == mFgButton) {
        ColorDialog dlg = new ColorDialog(mFgButton.getShell());
        dlg.setRGB(mFgColor);
        dlg.setText("Choose a new Foreground Color");
        RGB rgb = dlg.open();
        if (rgb != null) {
            // Dispose the old color, create the
            // new one, and set into the label
            mValues.foreground = rgb;
            updateColor(mFgButton.getDisplay(), rgb, false /*background*/);
        }
    }

    if (source == mFontButton) {
        FontDialog dialog = new FontDialog(mFontButton.getShell());
        FontData[] fontList;
        if (mFontButton.getData() == null) {
            fontList = mFontButton.getDisplay().getFontList(mValues.getTextFont().getFontName(),
                    true /*scalable*/);
        } else {
            fontList = mFontButton.getFont().getFontData();
        }
        dialog.setFontList(fontList);
        FontData data = dialog.open();
        if (data != null) {
            Font font = new Font(mFontButton.getDisplay(), dialog.getFontList());
            mFontButton.setFont(font);
            mFontButton.setData(font);

            // Always use a large font for the rendering, even though user is typically
            // picking small font sizes in the font chooser
            //int dpi = mFontButton.getDisplay().getDPI().y;
            //int height = (int) Math.round(fontData.getHeight() * dpi / 72.0);
            int fontHeight = new TextRenderUtil.Options().fontSize;
            FontData fontData = font.getFontData()[0];
            int awtStyle = java.awt.Font.PLAIN;
            int swtStyle = fontData.getStyle();
            if ((swtStyle & SWT.ITALIC) != 0) {
                awtStyle |= java.awt.Font.ITALIC;
            }
            if ((swtStyle & SWT.BOLD) != 0) {
                awtStyle = java.awt.Font.BOLD;
            }
            mValues.setTextFont(new java.awt.Font(fontData.getName(), awtStyle, fontHeight));

            updateFontLabel();
            mFontButton.getParent().pack();
        }
    }

    if (source == mPaddingSlider) {
        mValues.padding = getPadding();
        mPercentLabel.setText(Integer.toString(getPadding()) + '%');

        // When dragging the slider, only do periodic updates
        updateQuickly = false;
    }

    requestUpdatePreview(updateQuickly);
}

From source file:com.android.ide.eclipse.auidt.internal.assetstudio.ConfigureAssetSetPage.java

License:Open Source License

@Override
public void widgetSelected(SelectionEvent e) {
    if (mIgnore) {
        return;//from w ww . j a va 2s . c  o m
    }

    Object source = e.getSource();
    boolean updateQuickly = true;

    // Tabs
    if (source == mImageRadio) {
        mValues.sourceType = CreateAssetSetWizardState.SourceType.IMAGE;
        chooseForegroundTab((Button) source, mImageForm);
    } else if (source == mClipartRadio) {
        mValues.sourceType = CreateAssetSetWizardState.SourceType.CLIPART;
        chooseForegroundTab((Button) source, mClipartForm);
    } else if (source == mTextRadio) {
        mValues.sourceType = CreateAssetSetWizardState.SourceType.TEXT;
        updateFontLabel();
        chooseForegroundTab((Button) source, mTextForm);
        mText.setFocus();
    }

    // Choose image file
    if (source == mPickImageButton) {
        FileDialog dialog = new FileDialog(mPickImageButton.getShell(), SWT.OPEN);
        String file = dialog.open();
        if (file != null) {
            mValues.imagePath = new File(file);
            mImagePathText.setText(file);
        }
    }

    // Enforce Radio Groups
    if (source == mCropRadio) {
        mCropRadio.setSelection(true); // Ensure that you can't toggle it off
        mCenterRadio.setSelection(false);
        mValues.crop = true;
    } else if (source == mCenterRadio) {
        mCenterRadio.setSelection(true);
        mCropRadio.setSelection(false);
        mValues.crop = false;
    }
    if (source == mSquareRadio) {
        mValues.shape = GraphicGenerator.Shape.SQUARE;
        setShape(mValues.shape);
    } else if (source == mCircleButton) {
        mValues.shape = GraphicGenerator.Shape.CIRCLE;
        setShape(mValues.shape);
    } else if (source == mNoShapeRadio) {
        mValues.shape = GraphicGenerator.Shape.NONE;
        setShape(mValues.shape);
    }

    if (SUPPORT_LAUNCHER_ICON_TYPES) {
        if (source == mSimpleRadio) {
            mSimpleRadio.setSelection(true);
            mGlossyRadio.setSelection(false);
            mFancyRadio.setSelection(false);
        } else if (source == mFancyRadio) {
            mFancyRadio.setSelection(true);
            mSimpleRadio.setSelection(false);
            mGlossyRadio.setSelection(false);
        } else if (source == mGlossyRadio) {
            mGlossyRadio.setSelection(true);
            mSimpleRadio.setSelection(false);
            mFancyRadio.setSelection(false);
        }
    }

    if (source == mTrimCheckBox) {
        mValues.trim = mTrimCheckBox.getSelection();
    }

    if (source == mHoloDarkRadio) {
        mHoloDarkRadio.setSelection(true);
        mHoloLightRadio.setSelection(false);
    } else if (source == mHoloLightRadio) {
        mHoloLightRadio.setSelection(true);
        mHoloDarkRadio.setSelection(false);
    }

    if (source == mChooseClipart) {
        MessageDialog dialog = new MessageDialog(mChooseClipart.getShell(), "Choose Clip Art", null,
                "Choose Clip Art Image:", MessageDialog.NONE, new String[] { "Close" }, 0) {
            @Override
            protected Control createCustomArea(Composite parent) {
                // Outer form which just establishes a width for the inner form which
                // wraps in a RowLayout
                Composite outer = new Composite(parent, SWT.NONE);
                GridLayout gridLayout = new GridLayout();
                outer.setLayout(gridLayout);

                Composite chooserForm = new Composite(outer, SWT.NONE);
                GridData gd = new GridData();
                gd.grabExcessVerticalSpace = true;
                gd.widthHint = 450;
                chooserForm.setLayoutData(gd);
                RowLayout clipartFormLayout = new RowLayout(SWT.HORIZONTAL);
                clipartFormLayout.center = true;
                clipartFormLayout.wrap = true;
                chooserForm.setLayout(clipartFormLayout);

                MouseAdapter clickListener = new MouseAdapter() {
                    @Override
                    public void mouseDown(MouseEvent event) {
                        // Clicked on some of the sample art
                        if (event.widget instanceof ImageControl) {
                            ImageControl image = (ImageControl) event.widget;
                            mValues.clipartName = (String) image.getData();
                            close();

                            updateClipartPreview();
                            updatePreview();
                        }
                    }
                };
                Display display = chooserForm.getDisplay();
                Color hoverColor = display.getSystemColor(SWT.COLOR_RED);
                Iterator<String> clipartImages = GraphicGenerator.getClipartNames();
                while (clipartImages.hasNext()) {
                    String name = clipartImages.next();
                    try {
                        BufferedImage icon = GraphicGenerator.getClipartIcon(name);
                        if (icon != null) {
                            Image swtImage = SwtUtils.convertToSwt(display, icon, true, -1);
                            ImageControl img = new ImageControl(chooserForm, SWT.NONE, swtImage);
                            img.setData(name);
                            img.setHoverColor(hoverColor);
                            img.addMouseListener(clickListener);
                        }
                    } catch (IOException e1) {
                        AdtPlugin.log(e1, null);
                    }
                }
                outer.pack();
                outer.layout();
                return outer;
            }
        };
        dialog.open();
    }

    if (source == mBgButton) {
        ColorDialog dlg = new ColorDialog(mBgButton.getShell());
        dlg.setRGB(mBgColor);
        dlg.setText("Choose a new Background Color");
        RGB rgb = dlg.open();
        if (rgb != null) {
            // Dispose the old color, create the
            // new one, and set into the label
            mValues.background = rgb;
            updateColor(mBgButton.getDisplay(), rgb, true /*background*/);
        }
    } else if (source == mFgButton) {
        ColorDialog dlg = new ColorDialog(mFgButton.getShell());
        dlg.setRGB(mFgColor);
        dlg.setText("Choose a new Foreground Color");
        RGB rgb = dlg.open();
        if (rgb != null) {
            // Dispose the old color, create the
            // new one, and set into the label
            mValues.foreground = rgb;
            updateColor(mFgButton.getDisplay(), rgb, false /*background*/);
        }
    }

    if (source == mFontButton) {
        FontDialog dialog = new FontDialog(mFontButton.getShell());
        FontData[] fontList;
        if (mFontButton.getData() == null) {
            fontList = mFontButton.getDisplay().getFontList(mValues.getTextFont().getFontName(),
                    true /*scalable*/);
        } else {
            fontList = mFontButton.getFont().getFontData();
        }
        dialog.setFontList(fontList);
        FontData data = dialog.open();
        if (data != null) {
            Font font = new Font(mFontButton.getDisplay(), dialog.getFontList());
            mFontButton.setFont(font);
            mFontButton.setData(font);

            // Always use a large font for the rendering, even though user is typically
            // picking small font sizes in the font chooser
            //int dpi = mFontButton.getDisplay().getDPI().y;
            //int height = (int) Math.round(fontData.getHeight() * dpi / 72.0);
            int fontHeight = new TextRenderUtil.Options().fontSize;
            FontData fontData = font.getFontData()[0];
            int awtStyle = java.awt.Font.PLAIN;
            int swtStyle = fontData.getStyle();
            if ((swtStyle & SWT.ITALIC) != 0) {
                awtStyle |= java.awt.Font.ITALIC;
            }
            if ((swtStyle & SWT.BOLD) != 0) {
                awtStyle = java.awt.Font.BOLD;
            }
            mValues.setTextFont(new java.awt.Font(fontData.getName(), awtStyle, fontHeight));

            updateFontLabel();
            mFontButton.getParent().pack();
        }
    }

    if (source == mPaddingSlider) {
        mValues.padding = getPadding();
        mPercentLabel.setText(Integer.toString(getPadding()) + '%');

        // When dragging the slider, only do periodic updates
        updateQuickly = false;
    }

    requestUpdatePreview(updateQuickly);
}

From source file:com.aptana.editor.common.AbstractThemeableEditor.java

License:Open Source License

@Override
protected void performSaveAs(IProgressMonitor progressMonitor) {
    progressMonitor = (progressMonitor == null) ? new NullProgressMonitor() : progressMonitor;
    IEditorInput input = getEditorInput();

    if (input instanceof UntitledFileStorageEditorInput) {
        Shell shell = getSite().getShell();

        // checks if user wants to save on the file system or in a workspace project
        boolean saveToProject = false;
        boolean byPassDialog = Platform.getPreferencesService().getBoolean(CommonEditorPlugin.PLUGIN_ID,
                IPreferenceConstants.REMEMBER_UNTITLED_FILE_SAVE_TYPE, false, null);
        if (byPassDialog) {
            // grabs from preferences
            saveToProject = Platform.getPreferencesService().getBoolean(CommonEditorPlugin.PLUGIN_ID,
                    IPreferenceConstants.SAVE_UNTITLED_FILE_TO_PROJECT, false, null);
        } else {// w w  w .  ja  va 2 s .c o m
            // asks the user
            MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell,
                    Messages.AbstractThemeableEditor_SaveToggleDialog_Title, null,
                    Messages.AbstractThemeableEditor_SaveToggleDialog_Message, MessageDialog.NONE,
                    new String[] { Messages.AbstractThemeableEditor_SaveToggleDialog_LocalFilesystem,
                            Messages.AbstractThemeableEditor_SaveToggleDialog_Project },
                    0, null, false);
            int code = dialog.open();
            if (code == SWT.DEFAULT) {
                return;
            }
            saveToProject = (code != IDialogConstants.INTERNAL_ID);
            if (dialog.getToggleState()) {
                // the decision is remembered, so saves it
                IEclipsePreferences prefs = (EclipseUtil.instanceScope()).getNode(CommonEditorPlugin.PLUGIN_ID);
                prefs.putBoolean(IPreferenceConstants.REMEMBER_UNTITLED_FILE_SAVE_TYPE, true);
                prefs.putBoolean(IPreferenceConstants.SAVE_UNTITLED_FILE_TO_PROJECT, saveToProject);
                try {
                    prefs.flush();
                } catch (BackingStoreException e) {
                    IdeLog.logError(CommonEditorPlugin.getDefault(), e);
                }
            }
        }

        if (!saveToProject) {
            // saves to local filesystem
            FileDialog fileDialog = new FileDialog(shell, SWT.SAVE);
            String path = fileDialog.open();
            if (path == null) {
                progressMonitor.setCanceled(true);
                return;
            }

            // Check whether file exists and if so, confirm overwrite
            File localFile = new File(path);
            if (localFile.exists()) {
                if (!MessageDialog.openConfirm(shell, Messages.AbstractThemeableEditor_ConfirmOverwrite_Title,
                        MessageFormat.format(Messages.AbstractThemeableEditor_ConfirmOverwrite_Message,
                                path))) {
                    progressMonitor.setCanceled(true);
                }
            }

            IFileStore fileStore;
            try {
                fileStore = EFS.getStore(localFile.toURI());
            } catch (CoreException e) {
                IdeLog.logError(CommonEditorPlugin.getDefault(), e);
                MessageDialog.openError(shell, Messages.AbstractThemeableEditor_Error_Title,
                        MessageFormat.format(Messages.AbstractThemeableEditor_Error_Message, path));
                return;
            }

            IDocumentProvider provider = getDocumentProvider();
            if (provider == null) {
                return;
            }

            IEditorInput newInput;
            IFile file = getWorkspaceFile(fileStore);
            if (file != null) {
                newInput = new FileEditorInput(file);
            } else {
                newInput = new FileStoreEditorInput(fileStore);
            }

            boolean success = false;
            try {
                provider.aboutToChange(newInput);
                provider.saveDocument(progressMonitor, newInput, provider.getDocument(input), true);
                success = true;
            } catch (CoreException e) {
                IStatus status = e.getStatus();
                if (status == null || status.getSeverity() != IStatus.CANCEL) {
                    MessageDialog.openError(shell, Messages.AbstractThemeableEditor_Error_Title,
                            MessageFormat.format(Messages.AbstractThemeableEditor_Error_Message, path));
                }
            } finally {
                provider.changed(newInput);
                if (success) {
                    setInput(newInput);
                }
            }

            progressMonitor.setCanceled(!success);
        } else {
            super.performSaveAs(progressMonitor);
        }
    } else {
        super.performSaveAs(progressMonitor);
    }
}

From source file:com.genuitec.org.eclipse.egit.ui.internal.branch.BranchOperationUI.java

License:Open Source License

private boolean shouldCancelBecauseOfRunningLaunches() {
    if (mode == MODE_CHECKOUT)
        return false;
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    if (!store.getBoolean(UIPreferences.SHOW_RUNNING_LAUNCH_ON_CHECKOUT_WARNING))
        return false;

    ILaunchConfiguration launchConfiguration = getRunningLaunchConfiguration();
    if (launchConfiguration != null) {
        String[] buttons = new String[] { UIText.BranchOperationUI_Continue, IDialogConstants.CANCEL_LABEL };
        String message = NLS.bind(UIText.BranchOperationUI_RunningLaunchMessage, launchConfiguration.getName());
        MessageDialogWithToggle continueDialog = new MessageDialogWithToggle(getShell(),
                UIText.BranchOperationUI_RunningLaunchTitle, null, message, MessageDialog.NONE, buttons, 0,
                UIText.BranchOperationUI_RunningLaunchDontShowAgain, false);
        int result = continueDialog.open();
        // cancel
        if (result == IDialogConstants.CANCEL_ID || result == SWT.DEFAULT)
            return true;
        boolean dontWarnAgain = continueDialog.getToggleState();
        if (dontWarnAgain)
            store.setValue(UIPreferences.SHOW_RUNNING_LAUNCH_ON_CHECKOUT_WARNING, false);
    }/*from w w  w.j a  va2  s .  c om*/
    return false;
}

From source file:com.hydra.project.myplugin_nebula.xviewer.customize.dialog.XViewerCustomizeDialog.java

License:Open Source License

private XViewerCustomizeDialog(XViewer xViewer, Shell parentShell) {
    super(parentShell, "", null, "", MessageDialog.NONE, buttons, 0); //$NON-NLS-1$ //$NON-NLS-2$
    this.xViewerToCustomize = xViewer;
    setShellStyle(getShellStyle() | SWT.RESIZE);
}

From source file:com.hydra.project.myplugin_nebula.xviewer.util.internal.dialog.DateSelectionDialog.java

License:Open Source License

public DateSelectionDialog(String dialogTitle, String dialogMessage, Date selectedDate) {
    this(Display.getCurrent().getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.NONE,
            new String[] { XViewerText.get("button.ok"), XViewerText.get("button.cancel") }, 0, selectedDate); //$NON-NLS-1$ //$NON-NLS-2$
}

From source file:com.hydra.project.myplugin_nebula.xviewer.util.internal.dialog.XCheckFilteredTreeDialog.java

License:Open Source License

public XCheckFilteredTreeDialog(String dialogTitle, String dialogMessage, PatternFilter patternFilter,
        IContentProvider contentProvider, IBaseLabelProvider labelProvider, ViewerSorter viewerSorter) {
    super(Display.getCurrent().getActiveShell(), dialogTitle, null, dialogMessage, MessageDialog.NONE,
            new String[] { XViewerText.get("button.ok"), XViewerText.get("button.cancel") }, 0); //$NON-NLS-1$ //$NON-NLS-2$
    this.contentProvider = contentProvider;
    this.labelProvider = labelProvider;
    this.patternFilter = patternFilter;
    this.viewerSorter = viewerSorter;
    setShellStyle(getShellStyle() | SWT.RESIZE);
}

From source file:com.sap.netweaver.porta.ide.eclipse.server.ui.dialogs.PublishProblemDialog.java

License:Open Source License

private static int getImage(DeployResultStatus status) {
    switch (status) {
    case ERROR://from   www  .j  a va 2s . co m
        return MessageDialog.ERROR;
    case WARNING:
        return MessageDialog.WARNING;
    default:
        return MessageDialog.NONE;
    }
}