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

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

Introduction

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

Prototype

int QUESTION

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

Click Source Link

Document

Constant for the question image, or a simple dialog with the question image and Yes/No buttons (value 3).

Usage

From source file:net.sf.eclipsensis.dialogs.NSISTaskTagsPreferencePage.java

License:Open Source License

@SuppressWarnings("unchecked")
@Override//w  w w . j  a va  2 s.  c  o  m
public boolean performOk() {
    if (super.performOk()) {
        Collection<NSISTaskTag> taskTags = (Collection<NSISTaskTag>) mTableViewer.getInput();
        boolean caseSensitive = mCaseSensitiveButton.getSelection();
        boolean different = (caseSensitive != NSISPreferences.getInstance().isCaseSensitiveTaskTags());
        if (!different) {
            if (taskTags.size() == mOriginalTags.size()) {
                for (Iterator<NSISTaskTag> iter = taskTags.iterator(); iter.hasNext();) {
                    if (!mOriginalTags.contains(iter.next())) {
                        different = true;
                        break;
                    }
                }
            } else {
                different = true;
            }
        }
        if (different) {
            if (taskTags.size() > 0) {
                boolean defaultFound = false;
                for (Iterator<NSISTaskTag> iter = taskTags.iterator(); iter.hasNext();) {
                    NSISTaskTag element = iter.next();
                    if (element.isDefault()) {
                        defaultFound = true;
                        break;
                    }
                }
                if (!defaultFound) {
                    if (taskTags.size() == 1) {
                        NSISTaskTag taskTag = (NSISTaskTag) taskTags.toArray()[0];
                        taskTag.setDefault(true);
                        mTableViewer.setChecked(taskTag, true);
                    } else {
                        Common.openError(getShell(),
                                EclipseNSISPlugin.getResourceString("task.tag.dialog.missing.default"), //$NON-NLS-1$
                                EclipseNSISPlugin.getShellImage());
                        return false;
                    }
                }
            }
        }
        boolean updateTaskTags = false;
        if (different) {
            NSISPreferences.getInstance().setTaskTags(taskTags);
            NSISPreferences.getInstance().setCaseSensitiveTaskTags(caseSensitive);
            MessageDialog dialog = new MessageDialog(getShell(),
                    EclipseNSISPlugin.getResourceString("confirm.title"), //$NON-NLS-1$
                    EclipseNSISPlugin.getShellImage(),
                    EclipseNSISPlugin.getResourceString("task.tags.settings.changed"), MessageDialog.QUESTION, //$NON-NLS-1$
                    new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                            IDialogConstants.CANCEL_LABEL },
                    0);
            dialog.setBlockOnOpen(true);
            int rv = dialog.open();
            if (rv == 2) {
                //Cancel
                return false;
            } else {
                updateTaskTags = (rv == 0);
            }
            NSISPreferences.getInstance().store();
        }
        if (updateTaskTags) {
            new NSISTaskTagUpdater().updateTaskTags();
            NSISEditorUtilities.updatePresentations();
            mOriginalTags.clear();
            mOriginalTags.addAll(taskTags);
        }
        return true;
    }
    return false;
}

From source file:net.sf.eclipsensis.editor.NSISEditor.java

License:Open Source License

@Override
protected void installTextDragAndDrop(ISourceViewer viewer) {
    if (mTextDragAndDropEnabled || viewer == null) {
        return;//from  w w w  .j  ava 2 s. c om
    }

    if (mTextDragAndDropInstalled) {
        mTextDragAndDropEnabled = true;
        return;
    }

    final IDragAndDropService dndService = (IDragAndDropService) getSite()
            .getService(IDragAndDropService.class);
    if (dndService == null) {
        return;
    }

    mTextDragAndDropEnabled = true;

    final StyledText st = viewer.getTextWidget();

    // Install drag source
    final ISelectionProvider selectionProvider = viewer.getSelectionProvider();
    final DragSource source = new DragSource(st, DND.DROP_COPY | DND.DROP_MOVE);
    source.setTransfer(new Transfer[] { TextTransfer.getInstance() });
    source.addDragListener(new DragSourceAdapter() {
        String mSelectedText;
        Point mSelection;

        @Override
        public void dragStart(DragSourceEvent event) {
            mTextDragAndDropToken = null;

            if (!mTextDragAndDropEnabled) {
                event.doit = false;
                event.image = null;
                return;
            }

            try {
                mSelection = st.getSelection();
                int offset = st.getOffsetAtLocation(new Point(event.x, event.y));
                Point p = st.getLocationAtOffset(offset);
                if (p.x > event.x) {
                    offset--;
                }
                event.doit = offset > mSelection.x && offset < mSelection.y;

                ISelection selection = selectionProvider.getSelection();
                if (selection instanceof ITextSelection) {
                    mSelectedText = ((ITextSelection) selection).getText();
                } else {
                    mSelectedText = st.getSelectionText();
                }
            } catch (IllegalArgumentException ex) {
                event.doit = false;
            }
        }

        @Override
        public void dragSetData(DragSourceEvent event) {
            event.data = mSelectedText;
            mTextDragAndDropToken = this; // Can be any non-null object
        }

        @Override
        public void dragFinished(DragSourceEvent event) {
            try {
                if (event.detail == DND.DROP_MOVE && validateEditorInputState()) {
                    Point newSelection = st.getSelection();
                    int length = mSelection.y - mSelection.x;
                    int delta = 0;
                    if (newSelection.x < mSelection.x) {
                        delta = length;
                    }
                    st.replaceTextRange(mSelection.x + delta, length, ""); //$NON-NLS-1$

                    if (mTextDragAndDropToken == null) {
                        // Move in same editor - end compound change
                        IRewriteTarget target = (IRewriteTarget) getAdapter(IRewriteTarget.class);
                        if (target != null) {
                            target.endCompoundChange();
                        }
                    }

                }
            } finally {
                mTextDragAndDropToken = null;
            }
        }
    });

    // Install drag target
    DropTargetListener dropTargetListener = new DropTargetAdapter() {
        private Point mSelection;

        @Override
        public void dragEnter(DropTargetEvent event) {
            if (NSISCommandTransfer.INSTANCE.isSupportedType(event.currentDataType)
                    || FileTransfer.getInstance().isSupportedType(event.currentDataType)) {
                //Don't want default feedback- we will do it ourselves
                event.feedback = DND.FEEDBACK_NONE;
                if (event.detail == DND.DROP_DEFAULT) {
                    event.detail = DND.DROP_COPY;
                }
            } else {
                mTextDragAndDropToken = null;
                mSelection = st.getSelection();

                if (!mTextDragAndDropEnabled) {
                    event.detail = DND.DROP_NONE;
                    event.feedback = DND.FEEDBACK_NONE;
                    return;
                }

                if (event.detail == DND.DROP_DEFAULT) {
                    event.detail = DND.DROP_MOVE;
                }
            }
        }

        @Override
        public void dragOperationChanged(DropTargetEvent event) {
            if (NSISCommandTransfer.INSTANCE.isSupportedType(event.currentDataType)
                    || FileTransfer.getInstance().isSupportedType(event.currentDataType)) {
                // Don't want default feedback- we will do it ourselves
                event.feedback = DND.FEEDBACK_NONE;
                if (event.detail == DND.DROP_DEFAULT) {
                    event.detail = DND.DROP_COPY;
                }
            } else {
                if (!mTextDragAndDropEnabled) {
                    event.detail = DND.DROP_NONE;
                    event.feedback = DND.FEEDBACK_NONE;
                    return;
                }

                if (event.detail == DND.DROP_DEFAULT) {
                    event.detail = DND.DROP_MOVE;
                }
            }
        }

        @Override
        public void dragOver(DropTargetEvent event) {
            if (NSISCommandTransfer.INSTANCE.isSupportedType(event.currentDataType)
                    || FileTransfer.getInstance().isSupportedType(event.currentDataType)) {
                // Don't want default feedback- we will do it ourselves
                event.feedback = DND.FEEDBACK_NONE;
                st.setFocus();
                Point location = st.getDisplay().map(null, st, event.x, event.y);
                location.x = Math.max(0, location.x);
                location.y = Math.max(0, location.y);
                int offset;
                try {
                    offset = st.getOffsetAtLocation(new Point(location.x, location.y));
                } catch (IllegalArgumentException ex) {
                    try {
                        offset = st.getOffsetAtLocation(new Point(0, location.y));
                    } catch (IllegalArgumentException ex2) {
                        offset = st.getCharCount();
                        Point maxLocation = st.getLocationAtOffset(offset);
                        if (location.y >= maxLocation.y) {
                            if (location.x < maxLocation.x) {
                                offset = st.getOffsetAtLocation(new Point(location.x, maxLocation.y));
                            }
                        }
                    }
                }
                IDocument doc = getDocumentProvider().getDocument(getEditorInput());
                offset = getCaretOffsetForInsertCommand(doc, offset);

                st.setCaretOffset(offset);
            } else {
                if (!mTextDragAndDropEnabled) {
                    event.feedback = DND.FEEDBACK_NONE;
                    return;
                }

                event.feedback |= DND.FEEDBACK_SCROLL;
            }
        }

        @Override
        public void drop(DropTargetEvent event) {
            if (NSISCommandTransfer.INSTANCE.isSupportedType(event.currentDataType)) {
                insertCommand((NSISCommand) event.data, false);
            } else if (FileTransfer.getInstance().isSupportedType(event.currentDataType)) {
                int dropNSISFilesAction = NSISPreferences.getInstance().getPreferenceStore()
                        .getInt(DROP_EXTERNAL_FILES_ACTION);
                switch (dropNSISFilesAction) {
                case DROP_EXTERNAL_FILES_ASK:
                    MessageDialog dialog = new MessageDialog(getSite().getShell(),
                            EclipseNSISPlugin.getResourceString("drop.external.files.ask.title"), //$NON-NLS-1$
                            EclipseNSISPlugin.getShellImage(),
                            EclipseNSISPlugin.getResourceString("drop.external.files.ask.message"), //$NON-NLS-1$
                            MessageDialog.QUESTION,
                            new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
                    if (dialog.open() != 0) {
                        break;
                    }
                    //$FALL-THROUGH$
                case DROP_EXTERNAL_FILES_OPEN_IN_EDITORS:
                    openFiles((String[]) event.data);
                    return;
                default:
                    break;
                }
                insertFiles((String[]) event.data);
            } else {
                try {
                    if (!mTextDragAndDropEnabled) {
                        return;
                    }

                    if (mTextDragAndDropToken != null && event.detail == DND.DROP_MOVE) {
                        // Move in same editor
                        int caretOffset = st.getCaretOffset();
                        if (mSelection.x <= caretOffset && caretOffset <= mSelection.y) {
                            event.detail = DND.DROP_NONE;
                            return;
                        }

                        // Start compound change
                        IRewriteTarget target = (IRewriteTarget) getAdapter(IRewriteTarget.class);
                        if (target != null) {
                            target.beginCompoundChange();
                        }
                    }

                    if (!validateEditorInputState()) {
                        event.detail = DND.DROP_NONE;
                        return;
                    }

                    String text = (String) event.data;
                    Point newSelection = st.getSelection();
                    st.insert(text);
                    st.setSelectionRange(newSelection.x, text.length());
                } finally {
                    mTextDragAndDropToken = null;
                }
            }
        }
    };
    dndService.addMergedDropTarget(st, DND.DROP_DEFAULT | DND.DROP_MOVE | DND.DROP_COPY, new Transfer[] {
            NSISCommandTransfer.INSTANCE, FileTransfer.getInstance(), TextTransfer.getInstance() },
            dropTargetListener);

    mTextDragAndDropInstalled = true;
    mTextDragAndDropEnabled = true;
}

From source file:net.sf.eclipsensis.installoptions.actions.PreviewAction.java

License:Open Source License

@Override
public void run() {
    if (mEditor != null) {
        Shell shell = mEditor.getSite().getShell();
        if (mEditor.isDirty()) {
            boolean autosaveBeforePreview = mPreferenceStore
                    .getBoolean(IInstallOptionsConstants.PREFERENCE_AUTOSAVE_BEFORE_PREVIEW);
            boolean shouldSave = autosaveBeforePreview;
            if (!shouldSave) {
                MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell,
                        EclipseNSISPlugin.getResourceString("confirm.title"), //$NON-NLS-1$
                        InstallOptionsPlugin.getShellImage(),
                        InstallOptionsPlugin.getResourceString("save.before.preview.confirm"), //$NON-NLS-1$
                        MessageDialog.QUESTION,
                        new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0,
                        InstallOptionsPlugin.getResourceString("confirm.toggle.message"), false); //$NON-NLS-1$
                dialog.open();//from   w  w  w .j a  va2s  .  c  o m
                shouldSave = dialog.getReturnCode() == IDialogConstants.OK_ID;
                if (shouldSave && dialog.getToggleState()) {
                    mPreferenceStore.setValue(IInstallOptionsConstants.PREFERENCE_AUTOSAVE_BEFORE_PREVIEW,
                            true);
                }
            }
            if (shouldSave) {
                ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
                dialog.open();
                IProgressMonitor progressMonitor = dialog.getProgressMonitor();
                mEditor.doSave(progressMonitor);
                dialog.close();
                if (progressMonitor.isCanceled()) {
                    return;
                }
            } else {
                return;
            }
        }
        INIFile iniFile = mEditor.getINIFile();
        if (iniFile.hasErrors()) {
            Common.openError(shell, InstallOptionsPlugin.getResourceString("ini.errors.preview.error"), //$NON-NLS-1$
                    InstallOptionsPlugin.getShellImage());
            return;
        }
        INISection settings = iniFile.findSections(InstallOptionsModel.SECTION_SETTINGS)[0];
        INIKeyValue numFields = settings.findKeyValues(InstallOptionsModel.PROPERTY_NUMFIELDS)[0];
        if (Integer.parseInt(numFields.getValue()) <= 0) {
            Common.openError(shell, InstallOptionsPlugin.getResourceString("ini.numfields.preview.error"), //$NON-NLS-1$
                    InstallOptionsPlugin.getShellImage());
        } else {
            IPathEditorInput editorInput = NSISEditorUtilities.getPathEditorInput(mEditor);
            if (editorInput instanceof IFileEditorInput) {
                IFile file = ((IFileEditorInput) editorInput).getFile();
                if (file.exists()) {
                    IPath location = file.getLocation();
                    if (location != null) {
                        doPreview(iniFile, location.toFile());
                    } else {
                        Common.openError(shell, EclipseNSISPlugin.getResourceString("local.filesystem.error"), //$NON-NLS-1$
                                InstallOptionsPlugin.getShellImage());
                    }
                }
            } else if (editorInput != null) {
                doPreview(iniFile, new File(editorInput.getPath().toOSString()));
            }
        }
    }
}

From source file:net.sf.eclipsensis.util.Common.java

License:Open Source License

public static boolean openConfirm(Shell parent, String title, String message, Image icon) {
    MessageDialog dialog = new MessageDialog(parent, title, icon, message, MessageDialog.QUESTION,
            new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
    return dialog.open() == 0;
}

From source file:net.sf.eclipsensis.util.Common.java

License:Open Source License

public static boolean openQuestion(Shell parent, String title, String message, Image icon) {
    MessageDialog dialog = new MessageDialog(parent, title, icon, message, MessageDialog.QUESTION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
    return dialog.open() == 0;
}

From source file:net.sf.eclipsensis.util.NSISCompileTestUtility.java

License:Open Source License

private boolean saveEditors(List<IEditorPart> editors, int beforeCompileSave) {
    List<IEditorPart> editors2 = editors;
    if (!Common.isEmptyCollection(editors2)) {
        boolean ok = false;
        String message = null;//from   w w  w  . j  av a2s. c o  m
        switch (beforeCompileSave) {
        case INSISPreferenceConstants.BEFORE_COMPILE_SAVE_ASSOCIATED_CONFIRM:
            if (editors2.size() > 1) {
                StringBuffer buf = new StringBuffer();
                for (Iterator<IEditorPart> iter = editors2.iterator(); iter.hasNext();) {
                    IEditorPart editor = iter.next();
                    buf.append(INSISConstants.LINE_SEPARATOR).append(
                            ((IFileEditorInput) editor.getEditorInput()).getFile().getFullPath().toString());
                }
                message = EclipseNSISPlugin.getFormattedString("compile.save.associated.confirmation", //$NON-NLS-1$
                        new String[] { buf.toString() });
                break;
            }
            //$FALL-THROUGH$
        case INSISPreferenceConstants.BEFORE_COMPILE_SAVE_CURRENT_CONFIRM:
            IEditorPart editor = editors2.get(0);
            if (editors2.size() > 1) {
                editors2 = editors2.subList(0, 1);
            }
            IPathEditorInput input = NSISEditorUtilities.getPathEditorInput(editor);
            IPath path = (input instanceof IFileEditorInput ? ((IFileEditorInput) input).getFile().getFullPath()
                    : input.getPath());
            message = EclipseNSISPlugin.getFormattedString("compile.save.current.confirmation", //$NON-NLS-1$
                    new String[] { path.toString() });
            break;
        case INSISPreferenceConstants.BEFORE_COMPILE_SAVE_ALL_CONFIRM:
            message = EclipseNSISPlugin.getResourceString("compile.save.all.confirmation"); //$NON-NLS-1$
            break;
        case INSISPreferenceConstants.BEFORE_COMPILE_SAVE_CURRENT_AUTO:
        case INSISPreferenceConstants.BEFORE_COMPILE_SAVE_ASSOCIATED_AUTO:
        case INSISPreferenceConstants.BEFORE_COMPILE_SAVE_ALL_AUTO:
            ok = true;
        }
        Shell shell = Display.getDefault().getActiveShell();
        if (!ok) {
            MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell,
                    EclipseNSISPlugin.getResourceString("confirm.title"), //$NON-NLS-1$
                    EclipseNSISPlugin.getShellImage(), message, MessageDialog.QUESTION,
                    new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0,
                    EclipseNSISPlugin.getResourceString("compile.save.toggle.message"), false); //$NON-NLS-1$
            dialog.open();
            ok = dialog.getReturnCode() == IDialogConstants.OK_ID;
            if (ok && dialog.getToggleState()) {
                NSISPreferences.getInstance().setBeforeCompileSave(
                        beforeCompileSave | INSISPreferenceConstants.BEFORE_COMPILE_SAVE_AUTO_FLAG);
                NSISPreferences.getInstance().store();
            }
        }
        if (ok) {
            ProgressMonitorDialog dialog = new ProgressMonitorDialog(shell);
            dialog.open();
            IProgressMonitor progressMonitor = dialog.getProgressMonitor();
            if (editors2.size() > 1) {
                progressMonitor.beginTask(
                        EclipseNSISPlugin.getResourceString("saving.before.compilation.task.name"), //$NON-NLS-1$
                        editors2.size());
                for (Iterator<IEditorPart> iter = editors2.iterator(); iter.hasNext();) {
                    IEditorPart editor = iter.next();
                    SubProgressMonitor monitor = new SubProgressMonitor(progressMonitor, 1);
                    editor.doSave(monitor);
                    if (monitor.isCanceled()) {
                        break;
                    }
                }
            } else {
                editors2.get(0).doSave(progressMonitor);
            }
            dialog.close();
            if (progressMonitor.isCanceled()) {
                return false;
            }
        }
        return ok;
    }
    return true;
}

From source file:net.sf.eclipsensis.wizard.NSISWizardContentsPage.java

License:Open Source License

/**
 * @param tv//from w w w.j  a v  a 2s  . com
 * @param sel
 */
private void deleteElements(final TreeViewer tv, ISelection sel) {
    if (sel instanceof IStructuredSelection) {
        IStructuredSelection ssel = (IStructuredSelection) sel;
        if (!ssel.isEmpty()) {
            try {
                int buttonId = -1;
                for (Iterator<?> iter = ssel.iterator(); iter.hasNext();) {
                    INSISInstallElement element = (INSISInstallElement) iter.next();
                    if (element.hasChildren()) {
                        if (buttonId == IDialogConstants.NO_TO_ALL_ID) {
                            continue;
                        } else if (buttonId != IDialogConstants.YES_TO_ALL_ID) {
                            int index = new MessageDialog(getShell(), cDeleteConfirmTitle,
                                    EclipseNSISPlugin.getShellImage(),
                                    MessageFormat
                                            .format(cDeleteConfirmMessageFormat,
                                                    new Object[] { element.getDisplayName() }),
                                    MessageDialog.QUESTION,
                                    new String[] { IDialogConstants.YES_LABEL,
                                            IDialogConstants.YES_TO_ALL_LABEL, IDialogConstants.NO_LABEL,
                                            IDialogConstants.NO_TO_ALL_LABEL },
                                    0).open();
                            if (index >= 0) {
                                buttonId = cDeleteConfirmButtonIds[index];
                            } else {
                                return;
                            }

                            if (buttonId == IDialogConstants.NO_ID
                                    || buttonId == IDialogConstants.NO_TO_ALL_ID) {
                                continue;
                            }
                        }
                    }
                    INSISInstallElement parent = element.getParent();
                    if (parent != null) {
                        parent.removeChild(element);
                        tv.refresh(parent, true);
                    }
                }
                setPageComplete(validatePage(VALIDATE_ALL));
            } catch (Exception ex) {
                delayedValidateAfterError(ex.getLocalizedMessage(), 2000);
            } finally {
                tv.refresh(false);
            }
        }
    }
}

From source file:net.sf.jasperreports.eclipse.ui.util.UIUtils.java

License:Open Source License

/**
 * @return true if yes/*from  www .  j  ava 2 s .  c  o  m*/
 */
public static boolean showConfirmation(String title, String message) {
    MessageDialog dialog = new MessageDialog(getShell(), title, null, message, MessageDialog.QUESTION,
            new String[] { Messages.UIUtils_AnswerYes, Messages.UIUtils_AnswerNo }, 0) {

        @Override
        protected void setShellStyle(int newShellStyle) {
            super.setShellStyle(newShellStyle | SWT.SHEET);
        }
    };
    return dialog.open() == 0;
}

From source file:net.sf.jmoney.serializeddatastore.SessionManager.java

License:Open Source License

boolean requestSave(IWorkbenchWindow window) {
    String title = Messages.SessionManager_SaveTitle;
    String question = Messages.SessionManager_SaveQuestion;
    MessageDialog dialog = new MessageDialog(window.getShell(), title, null, // accept the default window icon
            question, MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL,
                    IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL },
            2); // CANCEL is the
    // default/*from w ww  .  jav  a2  s  .  c om*/

    int answer = dialog.open();
    switch (answer) {
    case 0: // YES
        saveSession(window);
        return true;
    case 1: // NO
        return true;
    case 2: // CANCEL
        return false;
    default:
        throw new RuntimeException("bad switch value"); //$NON-NLS-1$
    }
}

From source file:net.sf.versiontree.views.VersionTreeView.java

License:Open Source License

private boolean confirmOverwrite() {
    IFile file = getFile();/*  w ww .  j ava2s.c o  m*/
    if (file != null && file.exists()) {
        ICVSFile cvsFile = CVSWorkspaceRoot.getCVSFileFor(file);
        try {
            if (cvsFile.isModified(null)) {
                String title = VersionTreePlugin.getResourceString("VersionTreeView.CVS_Version_Tree_Name"); //$NON-NLS-1$
                String msg = VersionTreePlugin.getResourceString("VersionTreeView.Overwrite_Changes_Question"); //$NON-NLS-1$
                final MessageDialog dialog = new MessageDialog(getViewSite().getShell(), title, null, msg,
                        MessageDialog.QUESTION,
                        new String[] { IDialogConstants.YES_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
                final int[] result = new int[1];
                getViewSite().getShell().getDisplay().syncExec(new Runnable() {
                    public void run() {
                        result[0] = dialog.open();
                    }
                });
                if (result[0] != 0) {
                    // cancel
                    return false;
                }
            }
        } catch (CVSException e) {
            CVSUIPlugin.log(e.getStatus());
        }
    }
    return true;
}