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

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

Introduction

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

Prototype

String YES_TO_ALL_LABEL

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

Click Source Link

Document

The label for yes to all buttons.

Usage

From source file:com.amalto.workbench.export.ImportItemsWizard.java

License:Open Source License

private int isOveride(String name, String obTypeName) {

    final MessageDialog dialog = new MessageDialog(getShell(), Messages.ImportItemsWizard_12, null,
            Messages.ImportItemsWizard_13 + obTypeName + Messages.ImportItemsWizard_14 + name
                    + Messages.ImportItemsWizard_15,
            MessageDialog.QUESTION,/*from   w w  w .  j  ava2  s .c o m*/
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                    IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL },
            0);
    dialog.open();
    int result = dialog.getReturnCode();
    if (result == 0) {
        return IDialogConstants.YES_ID;
    }
    if (result == 1) {
        return IDialogConstants.YES_TO_ALL_ID;
    }
    if (result == 2) {
        return IDialogConstants.NO_ID;
    }
    return IDialogConstants.CANCEL_ID;

}

From source file:com.aptana.ide.core.ui.wizards.WizardFolderImportPage.java

License:Open Source License

/**
 * The <code>WizardDataTransfer</code> implementation of this <code>IOverwriteQuery</code> method asks the user
 * whether the existing resource at the given path should be overwritten.
 * /*from  w  w w  .  j a  v  a  2  s  . c  o  m*/
 * @param pathString
 * @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>, <code>"ALL"</code>, or
 *         <code>"CANCEL"</code>
 */
public String queryOverwrite(String pathString) {

    Path path = new Path(pathString);

    String messageString;
    // Break the message up if there is a file name and a directory
    // and there are at least 2 segments.
    if (path.getFileExtension() == null || path.segmentCount() < 2) {
        messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_existsQuestion, pathString);
    }

    else {
        messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_overwriteNameAndPathQuestion,
                path.lastSegment(), path.removeLastSegments(1).toOSString());
    }

    final MessageDialog dialog = new MessageDialog(getContainer().getShell(), IDEWorkbenchMessages.Question,
            null, messageString, MessageDialog.QUESTION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                    IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL,
                    IDialogConstants.CANCEL_LABEL },
            0);
    String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL };
    // run in syncExec because callback is from an operation,
    // which is probably not running in the UI thread.
    getControl().getDisplay().syncExec(new Runnable() {
        public void run() {
            dialog.open();
        }
    });
    return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()];
}

From source file:com.aptana.ide.ui.io.actions.CopyFilesOperation.java

License:Open Source License

/**
 * @param sourceStore/*w  ww.  java  2s  .  c o  m*/
 *            the file to be copied
 * @param destinationStore
 *            the destination location
 * @param monitor
 *            the progress monitor
 * @return true if the file is successfully copied, false if the operation did not go through for any reason
 */
protected boolean copyFile(IFileStore sourceStore, IFileStore destinationStore, IProgressMonitor monitor) {
    if (sourceStore == null || CloakingUtils.isFileCloaked(sourceStore)) {
        return false;
    }

    boolean success = true;
    monitor.subTask(MessageFormat.format(Messages.CopyFilesOperation_Copy_Subtask, sourceStore.getName(),
            destinationStore.getName()));

    if (destinationStore.equals(sourceStore)) {
        destinationStore = getNewNameFor(destinationStore);
        if (destinationStore == null) {
            return false;
        }
    }
    try {
        IFileStore[] childStores = Utils.isDirectory(sourceStore) ? sourceStore.childStores(EFS.NONE, monitor)
                : new IFileStore[0];
        if (Utils.exists(destinationStore) && sourceStore.getName().equals(destinationStore.getName())) {
            // a name conflict; ask to overwrite
            if (overwriteStatus != OverwriteStatus.YES_TO_ALL) {
                final IFileStore dStore = destinationStore;
                final IFileStore sStore = sourceStore;
                fShell.getDisplay().syncExec(new Runnable() {

                    public void run() {
                        MessageDialog dialog = new MessageDialog(fShell,
                                Messages.CopyFilesOperation_OverwriteTitle, null,
                                MessageFormat.format(Messages.CopyFilesOperation_OverwriteWarning,
                                        dStore.toString(), sStore.toString()),
                                MessageDialog.CONFIRM,
                                new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                                        IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL },
                                0);
                        int retCode = dialog.open();
                        switch (retCode) {
                        case 0: // Yes
                            overwriteStatus = OverwriteStatus.YES;
                            break;
                        case 1: // Yes to All
                            overwriteStatus = OverwriteStatus.YES_TO_ALL;
                            break;
                        case 2: // No
                            overwriteStatus = OverwriteStatus.NO;
                            break;
                        default:
                            overwriteStatus = OverwriteStatus.CANCEL;
                        }
                    }
                });
                switch (overwriteStatus) {
                case CANCEL:
                    monitor.setCanceled(true);
                    // let it fall through since it would return false as well
                case NO:
                    return false;
                }
            }
        }
        SyncUtils.copy(sourceStore, null, destinationStore, EFS.NONE, monitor);

        // copy the children recursively
        IFileStore destChildStore;
        for (IFileStore childStore : childStores) {
            destChildStore = destinationStore.getChild(childStore.getName());
            copyFile(childStore, destChildStore, monitor);
        }
    } catch (CoreException e) {
        IdeLog.logError(IOUIPlugin.getDefault(), MessageFormat
                .format(Messages.CopyFilesOperation_ERR_FailedToCopy, sourceStore, destinationStore), e);
        success = false;
    }
    return success;
}

From source file:com.arm.cmsis.pack.installer.OverwriteQuery.java

License:Open Source License

@Override
public String queryOverwrite(String pathString) {
    Path path = new Path(pathString);

    String messageString;//from   w w  w  .j  a  va2  s  . c  o  m
    //Break the message up if there is a file name and a directory
    //and there are at least 2 segments.
    if (path.getFileExtension() == null || path.segmentCount() < 2) {
        messageString = NLS.bind(Messages.OverwriteQuery_ExistsQuestion, pathString);
    } else {
        messageString = NLS.bind(Messages.OverwriteQuery_OverwriteNameAndPathQuestion, path.lastSegment(),
                path.removeLastSegments(1).toOSString());
    }

    final MessageDialog dialog = new MessageDialog(shell, Messages.OverwriteQuery_Question, null, messageString,
            MessageDialog.QUESTION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                    IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL,
                    IDialogConstants.CANCEL_LABEL },
            0) {
        @Override
        protected int getShellStyle() {
            return super.getShellStyle() | SWT.SHEET;
        }
    };
    String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL };
    //run in syncExec because callback is from an operation,
    //which is probably not running in the UI thread.
    shell.getDisplay().syncExec(new Runnable() {
        @Override
        public void run() {
            dialog.open();
        }
    });
    return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()];
}

From source file:com.conwet.wirecloud.ide.wizards.WizardProjectsImportPage.java

License:Open Source License

/**
 * The <code>WizardDataTransfer</code> implementation of this
 * <code>IOverwriteQuery</code> method asks the user whether the existing
 * resource at the given path should be overwritten.
 *
 * @param pathString//from ww w.j a va 2s.  c o m
 * @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>,
 *    <code>"ALL"</code>, or <code>"CANCEL"</code>
 */
public String queryOverwrite(String pathString) {

    Path path = new Path(pathString);

    String messageString;
    // Break the message up if there is a file name and a directory
    // and there are at least 2 segments.
    if (path.getFileExtension() == null || path.segmentCount() < 2) {
        messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_existsQuestion, pathString);
    } else {
        messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_overwriteNameAndPathQuestion,
                path.lastSegment(), path.removeLastSegments(1).toOSString());
    }

    final MessageDialog dialog = new MessageDialog(getContainer().getShell(), IDEWorkbenchMessages.Question,
            null, messageString, MessageDialog.QUESTION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                    IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL,
                    IDialogConstants.CANCEL_LABEL },
            0) {
        protected int getShellStyle() {
            return super.getShellStyle() | SWT.SHEET;
        }
    };
    String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL };
    // run in syncExec because callback is from an operation,
    // which is probably not running in the UI thread.
    getControl().getDisplay().syncExec(new Runnable() {
        public void run() {
            dialog.open();
        }
    });
    return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()];
}

From source file:com.drgarbage.visualgraphic.model.ControlFlowGraphDiagramFactory.java

License:Apache License

public static int openConfirm(Shell parent, String title, String message) {
    MessageDialog dialog = new MessageDialog(parent, title, CoreImg.aboutDrGarbageIcon_16x16.createImage(),
            message, MessageDialog.QUESTION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                    IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL },
            3); /*/*from ww  w. ja  v a 2s.co  m*/
                * OK is the
                * default
                */
    return dialog.open();
}

From source file:com.google.gdt.eclipse.gph.egit.wizard.ImportProjectsWizardPage.java

License:Open Source License

/**
 * The <code>WizardDataTransfer</code> implementation of this
 * <code>IOverwriteQuery</code> method asks the user whether the existing
 * resource at the given path should be overwritten.
 * //from  w  w w.  ja va  2 s  .c  o m
 * @param pathString
 * @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>,
 *         <code>"ALL"</code>, or <code>"CANCEL"</code>
 */
@Override
public String queryOverwrite(String pathString) {

    Path path = new Path(pathString);

    String messageString;
    // Break the message up if there is a file name and a directory
    // and there are at least 2 segments.
    if (path.getFileExtension() == null || path.segmentCount() < 2) {
        messageString = NLS.bind("''{0}'' already exists.  Would you like to overwrite it?", pathString);
    } else {
        messageString = NLS.bind("Overwrite ''{0}'' in folder ''{1}''?", path.lastSegment(),
                path.removeLastSegments(1).toOSString());
    }

    final MessageDialog dialog = new MessageDialog(getContainer().getShell(), "Question", null, messageString,
            MessageDialog.QUESTION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                    IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL,
                    IDialogConstants.CANCEL_LABEL },
            0) {
        @Override
        protected int getShellStyle() {
            return super.getShellStyle() | SWT.SHEET;
        }
    };
    String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL };
    // run in syncExec because callback is from an operation,
    // which is probably not running in the UI thread.
    getControl().getDisplay().syncExec(new Runnable() {
        @Override
        public void run() {
            dialog.open();
        }
    });
    return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()];
}

From source file:com.mobilesorcery.sdk.importproject.MoSyncWizardProjectsImportPage.java

License:Open Source License

/**
 * The <code>WizardDataTransfer</code> implementation of this
 * <code>IOverwriteQuery</code> method asks the user whether the existing
 * resource at the given path should be overwritten.
 *
 * @param pathString//from ww w  . j  a  v  a2s .c  o m
 * @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>,
 *    <code>"ALL"</code>, or <code>"CANCEL"</code>
 */
@Override
public String queryOverwrite(String pathString) {

    Path path = new Path(pathString);

    String messageString;
    // Break the message up if there is a file name and a directory
    // and there are at least 2 segments.
    if (path.getFileExtension() == null || path.segmentCount() < 2) {
        messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_existsQuestion, pathString);
    } else {
        messageString = NLS.bind(IDEWorkbenchMessages.WizardDataTransfer_overwriteNameAndPathQuestion,
                path.lastSegment(), path.removeLastSegments(1).toOSString());
    }

    final MessageDialog dialog = new MessageDialog(getContainer().getShell(), IDEWorkbenchMessages.Question,
            null, messageString, MessageDialog.QUESTION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                    IDialogConstants.NO_LABEL, IDialogConstants.NO_TO_ALL_LABEL,
                    IDialogConstants.CANCEL_LABEL },
            0) {
        @Override
        protected int getShellStyle() {
            return super.getShellStyle() | SWT.SHEET;
        }
    };
    String[] response = new String[] { YES, ALL, NO, NO_ALL, CANCEL };
    // run in syncExec because callback is from an operation,
    // which is probably not running in the UI thread.
    getControl().getDisplay().syncExec(new Runnable() {
        @Override
        public void run() {
            dialog.open();
        }
    });
    return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()];
}

From source file:com.motorola.studio.android.common.utilities.EclipseUtils.java

License:Apache License

/**
 * Show a question message using the given title and message
 * // ww w.  j a  v  a  2s  .c om
 * @param title
 *            of the dialog
 * @param message
 *            to be displayed in the dialog.
 */
public static int showQuestionYesAllCancelDialog(final String title, final String message) {
    class IntWrapper {
        public int diagReturn = 0;
    }

    final IntWrapper intWrapper = new IntWrapper();
    Display.getDefault().syncExec(new Runnable() {

        public void run() {
            IWorkbench workbench = PlatformUI.getWorkbench();
            IWorkbenchWindow ww = workbench.getActiveWorkbenchWindow();
            Shell shell = ww.getShell();
            MessageDialog dialog = new MessageDialog(shell, title, null, message, MessageDialog.QUESTION,
                    new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                            IDialogConstants.NO_LABEL },
                    0);
            int diagResults = dialog.open();
            switch (diagResults) {
            case 0:
                intWrapper.diagReturn = IDialogConstants.YES_ID;
                break;
            case 1:
                intWrapper.diagReturn = IDialogConstants.YES_TO_ALL_ID;
                break;
            case 2:
            default:
                intWrapper.diagReturn = IDialogConstants.NO_ID;
                break;
            }
        }
    });

    return intWrapper.diagReturn;
}

From source file:com.nokia.s60tools.remotecontrol.ui.dialogs.ConfirmReplaceDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    GridLayout gdl = new GridLayout(1, false);
    GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
    parent.setLayout(gdl);/*from   w  w  w .  jav  a2 s  .c  o  m*/
    parent.setLayoutData(gd);

    createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true);
    if (multiFile) {
        createButton(parent, IDialogConstants.YES_TO_ALL_ID, IDialogConstants.YES_TO_ALL_LABEL, false);
    }
    createButton(parent, RENAME_ID, Messages.getString("ConfirmReplaceDialog.Rename_Button_Label"), false); //$NON-NLS-1$
    createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}