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:net.certiv.fluentmark.tables.TableDialog.java

License:Open Source License

/**
 * Creates a new TableDialog with the given style.
 * /*from w  ww .  j  a va  2 s . c o  m*/
 * @param editor
 * @param part
 */
public TableDialog(PagePart part, int style) {
    super(Display.getCurrent().getActiveShell(), "Table Editor", null, null, MessageDialog.NONE,
            new String[] { "Apply", "Cancel" }, 1);
    this.part = part;
    this.style = style;
    setShellStyle(getShellStyle() | SWT.RESIZE);
}

From source file:net.rim.ejde.internal.ui.views.process.ProcessView.java

License:Open Source License

@Override
public void setOptions() {
    ProcessViewOptionsDialog dialog = new ProcessViewOptionsDialog(this.getSite().getShell(),
            Messages.ProcessOptionsDialog_TITLE, null, "", MessageDialog.NONE, new String[] { "OK", "Cancel" },
            0);/*  ww  w.  ja  va 2 s.  com*/
    if (dialog.open() == 0) {
        startLiveupdate();
    }
}

From source file:org.dita_op.core.ui.dialogs.FileSelectionDialog.java

License:Open Source License

/**
 * Creates a resource selection dialog rooted at the given element.
 * /* w ww.j a va  2 s.c  o  m*/
 * @param parentShell
 *            the parent shell
 * @param rootElement
 *            the root element to populate this dialog with
 * @param message
 *            the message to be displayed at the top of this dialog, or
 *            <code>null</code> to display a default message
 */
public FileSelectionDialog(Shell parentShell, IAdaptable rootElement, String message) {
    super(parentShell, Messages.getString("FileSelectionDialog.title"), null, message, //$NON-NLS-1$
            MessageDialog.NONE, new String[] { Messages.getString("FileSelectionDialog.okButton"), //$NON-NLS-1$
                    Messages.getString("FileSelectionDialog.cancelButton") }, //$NON-NLS-1$
            0);
    root = rootElement;
    setShellStyle(getShellStyle() | SWT.RESIZE);
}

From source file:org.eclipse.andmore.internal.assetstudio.ConfigureAssetSetPage.java

License:Open Source License

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

    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.getResourcesNames("images/clipart/big/",
                        ".png");
                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) {
                        AndmoreAndroidPlugin.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:org.eclipse.buckminster.ui.dialogs.ShowListMessageDialog.java

License:Open Source License

public ShowListMessageDialog(Shell shell, String title, String msg, String[] list, Font font, int maxHeightHint,
        int maxWidthHint) {
    super(shell, title, null, msg, MessageDialog.NONE, new String[] { Messages.ok }, 0);
    int shellStyle = this.getShellStyle();
    shellStyle |= SWT.RESIZE;/*from  w  ww .  j a  va  2  s .  c o  m*/
    this.setShellStyle(shellStyle);
    this.list = list;
    this.maxHeightHint = maxHeightHint;
    this.maxWidthHint = maxWidthHint;
    this.font = font;
}

From source file:org.eclipse.datatools.sqltools.sqlbuilder.actions.RevertToPreviousAction.java

License:Open Source License

/**
 * Runs the action.  The user is prompted whether or not to revert to the previous
 * good (parsable) version of the statement.
 *//*w ww  . j av  a  2 s. c o  m*/
public void run() {
    Shell shell = getShell();
    if (shell != null) {
        if (fRevertDialog == null) {
            String[] buttons = { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL };
            fRevertDialog = new SQLBuilderRevertActionDialog(shell, Messages._UI_REVERT_TO_LAST_CORRECT_SOURCE,
                    null, null, MessageDialog.NONE, buttons, 0);
        }

        if (getSQLBuilder() != null) {
            SQLSourceViewer sourceViewer = getSQLBuilder().getSourceViewer();
            if (sourceViewer != null) {
                fRevertDialog.setProperSourceString(sourceViewer.getLastKnownProperSource());
                fRevertDialog.create();
                int buttonIndex = fRevertDialog.open();
                if (buttonIndex == 0) {
                    sourceViewer.revertToLastKnownProperSource();
                }
            }
        }
    }
}

From source file:org.eclipse.edt.ide.rui.visualeditor.internal.util.BrowserManager.java

License:Open Source License

public void displayBrowserInfo(Browser browser) {
    Object agent = null;//  w  ww .  j av  a 2  s  . c o m
    Shell shell = null;

    if (browser != null) {
        agent = browser.evaluate("return navigator.userAgent;");
        shell = browser.getDisplay().getActiveShell();
    }

    if (!(agent instanceof String)) {
        agent = Messages.NL_User_Agent_Error_Retrieving;
    }

    if (shell == null) {
        shell = Display.getDefault().getActiveShell();
    }

    new MessageDialog(shell, Messages.NL_User_Agent_Title, null, (String) agent, MessageDialog.NONE,
            new String[] { IDialogConstants.OK_LABEL }, 0).open();
}

From source file:org.eclipse.egit.ui.internal.branch.LaunchFinder.java

License:Open Source License

private static boolean showContinueDialogInUI(final IPreferenceStore store,
        final ILaunchConfiguration launchConfiguration) {
    String[] buttons = new String[] { UIText.BranchOperationUI_Continue, IDialogConstants.CANCEL_LABEL };
    String message = NLS.bind(UIText.LaunchFinder_RunningLaunchMessage, launchConfiguration.getName()) + ' '
            + UIText.LaunchFinder_ContinueQuestion;
    MessageDialogWithToggle continueDialog = new MessageDialogWithToggle(
            PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(),
            UIText.LaunchFinder_RunningLaunchTitle, null, message, MessageDialog.NONE, buttons, 0,
            UIText.LaunchFinder_RunningLaunchDontShowAgain, false);
    int result = continueDialog.open();
    // cancel// www  . j  a v a2s  .  c  o m
    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);
    return false;
}

From source file:org.eclipse.emf.compare.ui.internal.ModelComparator.java

License:Open Source License

/**
 * This will run the comparison process and return the resulting {@link ComparisonSnapshot snapshot}.
 * //ww w  . j  ava  2s. c om
 * @param configuration
 *            Compared configuration of this comparison. Properties will be set on this to hold comparison
 *            data.
 * @return Result of the comparison of the loaded resources.
 */
public ComparisonSnapshot compare(CompareConfiguration configuration) {
    if (!loadingSucceeded) {
        // We couldn't load the resource. It's useless to carry on.
        comparisonResult = DiffFactory.eINSTANCE.createComparisonResourceSetSnapshot();
    }

    if (comparisonResult == null) {
        final Date start = Calendar.getInstance().getTime();

        MatchService.setMatchEngineSelector(new VisualEngineSelector());
        DiffService.setDiffEngineSelector(new VisualEngineSelector());

        // show prompt to select the match scope
        final MessageDialog queryMatchScopeDialog = new MessageDialog(
                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                EMFCompareUIMessages.getString("ModelComparator.MatchModeSelectionDialogTitle"), null, //$NON-NLS-1$
                EMFCompareUIMessages.getString("ModelComparator.MatchModeSelectionDialogMessage"), //$NON-NLS-1$
                MessageDialog.NONE,
                new String[] {
                        EMFCompareUIMessages
                                .getString("ModelComparator.MatchModelSelectionDialogResourceOption"), //$NON-NLS-1$
                        EMFCompareUIMessages
                                .getString("ModelComparator.MatchModelSelectionDialogResourceSetOption") }, //$NON-NLS-1$
                0);
        final boolean doResourceMatchOnly = queryMatchScopeDialog.open() == 0;

        if (doResourceMatchOnly) {
            comparisonResult = doResourceCompare();
        } else {
            comparisonResult = doResourceSetCompare();
        }

        // set date of comparison
        final Date end = Calendar.getInstance().getTime();
        comparisonResult.setDate(end);

        configuration.setLeftEditable(configuration.isLeftEditable() && !isLeftRemote());
        configuration.setRightEditable(configuration.isRightEditable() && !isRightRemote());
        configuration.setProperty(EMFCompareConstants.PROPERTY_COMPARISON_TIME,
                end.getTime() - start.getTime());
        if (isLeftRemote()) {
            if (doResourceMatchOnly) {
                configuration.setLeftLabel(EMFCompareUIMessages.getString(
                        EMFCompareUIMessages.getString("ModelComparator.remoteResourceCompareLabel"))); //$NON-NLS-1$
                configuration.setRightLabel(EMFCompareUIMessages.getString(
                        EMFCompareUIMessages.getString("ModelComparator.localResourceCompareLabel"))); //$NON-NLS-1$
            } else {

                configuration.setLeftLabel(EMFCompareUIMessages.getString(
                        EMFCompareUIMessages.getString("ModelComparator.remoteResourceSetCompareLabel"))); //$NON-NLS-1$
                configuration.setRightLabel(EMFCompareUIMessages.getString(
                        EMFCompareUIMessages.getString("ModelComparator.localResourceSetCompareLabel"))); //$NON-NLS-1$

            }
        }
    }
    return comparisonResult;
}

From source file:org.eclipse.emf.diffmerge.ui.specification.ext.ConfigureComparisonDialog.java

License:Open Source License

/**
 * Constructor/* ww w .  j  a va 2  s  .  c  om*/
 * @param shell_p a non-null shell
 * @param data_p a non-null data object
 */
public ConfigureComparisonDialog(Shell shell_p,
        ConfigureComparisonDialog.ComparisonMethodConfigurationData data_p) {
    super(shell_p, Messages.ConfigureComparisonDialog_Title, null, Messages.ConfigureComparisonDialog_Label,
            MessageDialog.NONE, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
    _data = data_p;
}