Example usage for org.eclipse.jface.dialogs IDialogConstants NO_ID

List of usage examples for org.eclipse.jface.dialogs IDialogConstants NO_ID

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs IDialogConstants NO_ID.

Prototype

int NO_ID

To view the source code for org.eclipse.jface.dialogs IDialogConstants NO_ID.

Click Source Link

Document

Button id for a "No" button (value 3).

Usage

From source file:org.opentravel.schemas.stl2developer.ApplicationWorkbenchAdvisor.java

License:Apache License

public boolean confirmExit(MainController mc) {
    final ModelController modelController = mc.getModelController();
    final ModelNode modelNode = mc.getModelNode();

    if (modelNode != null) {
        int answer = IDialogConstants.CANCEL_ID;
        if (saveOnExitWithoutConfiramation()) {
            answer = IDialogConstants.NO_ID;
        } else {/*from ww  w .  j  a  v a2  s .co m*/
            answer = askUser(modelNode.getLibraries());
        }
        return closeActions(answer, modelController, mc.getProjectController(), modelNode);
    }
    return true;
}

From source file:org.opentravel.schemas.stl2developer.ApplicationWorkbenchAdvisor.java

License:Apache License

private boolean closeActions(int answer, ModelController modelController, ProjectController projectController,
        ModelNode modelNode) {/*from www . j  ava2  s  . c  om*/
    switch (answer) {
    case IDialogConstants.OK_ID:
        modelController.saveModel(modelNode);
    case IDialogConstants.NO_ID:
        projectController.saveState();
        return true;
    case IDialogConstants.CANCEL_ID:
    default:
        return false;
    }
}

From source file:org.opentravel.schemas.stl2developer.ApplicationWorkbenchAdvisor.java

License:Apache License

private int getSaveAndExitConfirmation() {
    int answer = DialogUserNotifier.openQuestionWithCancel(Messages.getString("dialog.exit.title"),
            Messages.getString("dialog.exit.save.question"));
    switch (answer) {
    case 0:/* w  w w . j a  v a 2  s.  co  m*/
        return IDialogConstants.OK_ID;
    case 1:
        return IDialogConstants.NO_ID;
    case 2:
    default:
        return IDialogConstants.CANCEL_ID;
    }

}

From source file:org.python.pydev.navigator.actions.copied.CopyFilesAndFoldersOperation.java

License:Open Source License

/**
 * Check if the user wishes to overwrite the supplied resource or all
 * resources.// www.  j  av  a 2  s .  c o  m
 *
 * @param source
 *            the source resource
 * @param destination
 *            the resource to be overwritten
 * @return one of IDialogConstants.YES_ID, IDialogConstants.YES_TO_ALL_ID,
 *         IDialogConstants.NO_ID, IDialogConstants.CANCEL_ID indicating
 *         whether the current resource or all resources can be overwritten,
 *         or if the operation should be canceled.
 */
private int checkOverwrite(final IResource source, final IResource destination) {
    final int[] result = new int[1];

    // Dialogs need to be created and opened in the UI thread
    Runnable query = new Runnable() {
        public void run() {
            String message;
            int resultId[] = { IDialogConstants.YES_ID, IDialogConstants.YES_TO_ALL_ID, IDialogConstants.NO_ID,
                    IDialogConstants.CANCEL_ID };
            String labels[] = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                    IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL };

            if (destination.getType() == IResource.FOLDER) {
                if (homogenousResources(source, destination)) {
                    message = NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_overwriteMergeQuestion,
                            destination.getFullPath().makeRelative());
                } else {
                    if (destination.isLinked()) {
                        message = NLS.bind(
                                IDEWorkbenchMessages.CopyFilesAndFoldersOperation_overwriteNoMergeLinkQuestion,
                                destination.getFullPath().makeRelative());
                    } else {
                        message = NLS.bind(
                                IDEWorkbenchMessages.CopyFilesAndFoldersOperation_overwriteNoMergeNoLinkQuestion,
                                destination.getFullPath().makeRelative());
                    }
                    resultId = new int[] { IDialogConstants.YES_ID, IDialogConstants.NO_ID,
                            IDialogConstants.CANCEL_ID };
                    labels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                            IDialogConstants.CANCEL_LABEL };
                }
            } else {
                String[] bindings = new String[] { IDEResourceInfoUtils.getLocationText(destination),
                        IDEResourceInfoUtils.getDateStringValue(destination),
                        IDEResourceInfoUtils.getLocationText(source),
                        IDEResourceInfoUtils.getDateStringValue(source) };
                message = NLS.bind(
                        IDEWorkbenchMessages.CopyFilesAndFoldersOperation_overwriteWithDetailsQuestion,
                        bindings);
            }
            MessageDialog dialog = new MessageDialog(messageShell,
                    IDEWorkbenchMessages.CopyFilesAndFoldersOperation_resourceExists, null, message,
                    MessageDialog.QUESTION, labels, 0);
            dialog.open();
            if (dialog.getReturnCode() == SWT.DEFAULT) {
                // A window close returns SWT.DEFAULT, which has to be
                // mapped to a cancel
                result[0] = IDialogConstants.CANCEL_ID;
            } else {
                result[0] = resultId[dialog.getReturnCode()];
            }
        }
    };
    messageShell.getDisplay().syncExec(query);
    return result[0];
}

From source file:org.python.pydev.navigator.actions.copied.CopyFilesAndFoldersOperation.java

License:Open Source License

/**
 * Returns whether moving all of the given source resources to the given
 * destination container could be done without causing name collisions.
 *
 * @param destination/*from  ww  w .  j a  v  a2s .c  o m*/
 *            the destination container
 * @param sourceResources
 *            the list of resources
 * @return <code>true</code> if there would be no name collisions, and
 *         <code>false</code> if there would
 */
private IResource[] validateNoNameCollisions(IContainer destination, IResource[] sourceResources) {
    List<IResource> copyItems = new ArrayList<IResource>();
    IWorkspaceRoot workspaceRoot = destination.getWorkspace().getRoot();
    int overwrite = IDialogConstants.NO_ID;

    // Check to see if we would be overwriting a parent folder.
    // Cancel entire copy operation if we do.
    for (int i = 0; i < sourceResources.length; i++) {
        final IResource sourceResource = sourceResources[i];
        final IPath destinationPath = destination.getFullPath().append(sourceResource.getName());
        final IPath sourcePath = sourceResource.getFullPath();

        IResource newResource = workspaceRoot.findMember(destinationPath);
        if (newResource != null && destinationPath.isPrefixOf(sourcePath)) {
            displayError(NLS.bind(IDEWorkbenchMessages.CopyFilesAndFoldersOperation_overwriteProblem,
                    destinationPath, sourcePath));

            canceled = true;
            return null;
        }
    }
    // Check for overwrite conflicts
    for (int i = 0; i < sourceResources.length; i++) {
        final IResource source = sourceResources[i];
        final IPath destinationPath = destination.getFullPath().append(source.getName());

        IResource newResource = workspaceRoot.findMember(destinationPath);
        if (newResource != null) {
            if (overwrite != IDialogConstants.YES_TO_ALL_ID || (newResource.getType() == IResource.FOLDER
                    && homogenousResources(source, destination) == false)) {
                overwrite = checkOverwrite(source, newResource);
            }
            if (overwrite == IDialogConstants.YES_ID || overwrite == IDialogConstants.YES_TO_ALL_ID) {
                copyItems.add(source);
            } else if (overwrite == IDialogConstants.CANCEL_ID) {
                canceled = true;
                return null;
            }
        } else {
            copyItems.add(source);
        }
    }
    return copyItems.toArray(new IResource[copyItems.size()]);
}

From source file:org.roussev.http4e.httpclient.ui.dialog.example.DumbUser.java

License:Apache License

/**
 * Creates the buttons//www .j av  a 2s  .  co m
 * 
 * @param parent the parent composite
 */
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true);
    createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false);
    createButton(parent, I_DUNNO_ID, I_DUNNO_LABEL, false);
}

From source file:org.rssowl.ui.internal.dialogs.AggregateNewsDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    switch (buttonId) {
    case IDialogConstants.YES_ID:
        fPreferences.putBoolean(DefaultPreferences.REMEMBER_AGGREGATE_NEWS_OPTION,
                fRememberDecisionCheck.getSelection());
        if (fRememberDecisionCheck.getSelection())
            fPreferences.putBoolean(DefaultPreferences.AGGREGATE_NEWS_AS_SEARCH, true);
        setReturnCode(buttonId);//from w w w  .  j  a v a 2  s.c o m
        close();
        break;

    case IDialogConstants.NO_ID:
        fPreferences.putBoolean(DefaultPreferences.REMEMBER_AGGREGATE_NEWS_OPTION,
                fRememberDecisionCheck.getSelection());
        if (fRememberDecisionCheck.getSelection())
            fPreferences.putBoolean(DefaultPreferences.AGGREGATE_NEWS_AS_SEARCH, false);
        setReturnCode(buttonId);
        close();
        break;
    }

    super.buttonPressed(buttonId);
}

From source file:org.rssowl.ui.internal.dialogs.AggregateNewsDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true);
    createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false);
    getButton(IDialogConstants.YES_ID).setFocus();
}

From source file:org.search.niem.uml.qvt.ui.handlers.TransformDelegate.java

License:Open Source License

private boolean shouldContinue(final Shell shell, final IStatus status) {
    final ErrorDialog dialog = new ErrorDialog(shell,
            Activator.INSTANCE.getString("_UI_NIEM_TransformDelegate_validation_dialog_title"),
            getValidationMessage(status), status, IStatus.ERROR | IStatus.WARNING | IStatus.INFO) {

        @Override//  ww w.jav  a  2  s.c  o m
        protected Control createContents(final Composite parent) {
            final Control contents = super.createContents(parent);
            shell.getDisplay().asyncExec(new Runnable() {
                @Override
                public void run() {
                    buttonPressed(IDialogConstants.DETAILS_ID);
                }
            });
            return contents;
        }

        @Override
        protected void createButtonsForButtonBar(final Composite parent) {
            createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, false);
            createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, true);
            createDetailsButton(parent);
        }

        @Override
        protected void buttonPressed(final int id) {
            if (id == IDialogConstants.YES_ID) {
                super.buttonPressed(IDialogConstants.OK_ID);
            } else if (id == IDialogConstants.NO_ID) {
                super.buttonPressed(IDialogConstants.CANCEL_ID);
            }
            super.buttonPressed(id);
        }

        @Override
        protected int getShellStyle() {
            return super.getShellStyle() | SWT.SHEET;
        }
    };
    final AtomicBoolean result = new AtomicBoolean();
    shell.getDisplay().syncExec(new Runnable() {
        @Override
        public void run() {
            result.set(dialog.open() == IDialogConstants.OK_ID);
        }
    });
    return result.get();
}

From source file:org.springframework.ide.eclipse.boot.dash.cloudfoundry.deployment.ManifestDiffDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.YES_ID, "Use Manifest", true);
    createButton(parent, IDialogConstants.CANCEL_ID, fCompareEditorInput.getCancelButtonLabel(), false);
    createButton(parent, IDialogConstants.NO_ID, "Forget Manifest", false);
}