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

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

Introduction

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

Prototype

String YES_LABEL

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

Click Source Link

Document

The label for yes buttons.

Usage

From source file:com.technophobia.substeps.editor.preferences.page.SubstepsPropertyPage.java

License:Open Source License

private ConfirmationStatus getConfirmationStatus(final IPath previousPath, final IPath newPath,
        final SubstepsFolderChangedListener folderChangeListener) {
    final MessageDialog messageDialog = new MessageDialog(getShell(), "Confirm", null,
            folderChangeListener.confirmationMessage(previousPath, newPath), MessageDialog.QUESTION_WITH_CANCEL,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                    IDialogConstants.CANCEL_LABEL },
            0);/*w ww  .  ja va2 s  .  c o m*/
    final int status = messageDialog.open();

    return ConfirmationStatus.values()[status];
}

From source file:com.toedter.e4.demo.contacts.swt.views.DetailsView.java

License:Open Source License

@Inject
public void setSelection(@Optional Contact contact) {
    if (contact != null) {
        if (dirtyable.isDirty()) {
            MessageDialog dialog = new MessageDialog(detailComposite.getShell(), "Save vCard", null,
                    "The current vCard has been modified. Save changes?", MessageDialog.CONFIRM,
                    new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
            dialog.create();/* w w w .j av  a 2s . co m*/
            if (engine != null) {
                ThemeUtil.applyDialogStyles(engine, dialog.getShell());
            }
            if (dialog.open() == Window.OK) {
                ParameterizedCommand saveCommand = commandService.createCommand("contacts.save",
                        Collections.EMPTY_MAP);
                handlerService.executeHandler(saveCommand);
            }
        }

        updatePartTitle(contact);
    } else {
        uiItem.setLabel("Details");
    }
    dirtyable.setDirty(false);
    detailComposite.update(contact);
}

From source file:com.trivadis.loganalysis.ui.internal.dialog.DeleteFileDialog.java

License:Open Source License

public DeleteFileDialog(IFileDescriptor file, Shell shell) {
    super(shell, getTitle(file), null, getMessage(file), MessageDialog.QUESTION,
            new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
    setShellStyle(getShellStyle() | SWT.SHEET);
}

From source file:com.twinsoft.convertigo.eclipse.dialogs.MultipleDeletionDialog.java

License:Open Source License

public MultipleDeletionDialog(Shell shell, String title, boolean hasMultiple) {
    this.title = title;
    this.shell = shell;
    this.hasMultiple = hasMultiple;
    if (hasMultiple) {
        buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.YES_TO_ALL_LABEL,
                IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL };
    } else {/*  www.  j av a  2  s  .co  m*/
        buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                IDialogConstants.CANCEL_LABEL };
    }
}

From source file:com.vectrace.MercurialEclipse.dialogs.CommitDialog.java

License:Open Source License

private boolean confirmHistoryRewrite() {
    if (HgFeatures.PHASES.isEnabled()) {
        // For secret or draft silently allow amend
        if (Phase.PUBLIC == currentChangeset.getPhase()) {
            if (!MessageDialog.openConfirm(getShell(), Messages.getString("CommitDialog.amendPublic.title"),
                    Messages.getString("CommitDialog.amendPublic.message"))) {
                return false;
            }//from  w w w. j av  a2s  .c  o  m

            currentChangeset.setDraft();
        }

        return true;
    }

    // Always prompt if phases are not supported
    MessageDialog dialog = new MessageDialog(getShell(),
            Messages.getString("CommitDialog.reallyAmendAndRewriteHistory"), //$NON-NLS-1$
            null, Messages.getString("CommitDialog.amendWarning1") //$NON-NLS-1$
                    + Messages.getString("CommitDialog.amendWarning2") //$NON-NLS-1$
                    + Messages.getString("CommitDialog.amendWarning3"), //$NON-NLS-1$
            MessageDialog.CONFIRM, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.CANCEL_LABEL }, 1 // default index - cancel
    );
    dialog.setBlockOnOpen(true); // if false then may show in background
    return dialog.open() == 0; // 0 means yes

}

From source file:com.vectrace.MercurialEclipse.wizards.ProjectsImportPage.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// w w w .j a va2  s . c om
 * @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 = "'" + pathString + "' already exists.  Would you like to overwrite it?";
    } else {
        messageString = "Overwrite '" + path.lastSegment() + "' in folder '"
                + 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() {
            // TODO add  "| SWT.SHEET" flag as soon as we drop Eclipse 3.4 support
            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.windowtester.eclipse.ui.target.NewTargetProvisionerPage.java

License:Open Source License

protected boolean queryYesNoQuestion(String message) {
    MessageDialog dialog = new MessageDialog(getContainer().getShell(), "Question", (Image) null, message,
            MessageDialog.NONE, new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
    // ensure yes is the default

    return dialog.open() == 0;
}

From source file:de.fhg.igd.swingrcp.ComponentMessageDialog.java

License:Open Source License

/**
 * @see MessageDialog#getButtonLabels(int)
 *///from w  w  w .j a  v a  2  s . co  m
static String[] getButtonLabels(int kind) {
    String[] dialogButtonLabels;
    switch (kind) {
    case ERROR:
    case INFORMATION:
    case WARNING: {
        dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL };
        break;
    }
    case CONFIRM: {
        dialogButtonLabels = new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL };
        break;
    }
    case QUESTION: {
        dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL };
        break;
    }
    case QUESTION_WITH_CANCEL: {
        dialogButtonLabels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                IDialogConstants.CANCEL_LABEL };
        break;
    }
    default: {
        throw new IllegalArgumentException("Illegal value for kind in MessageDialog.open()"); //$NON-NLS-1$
    }
    }
    return dialogButtonLabels;
}

From source file:de.fraunhofer.esk.ernest.core.cdt.wizards.GenerateSimulationWizard.java

License:Open Source License

@Override
public boolean performFinish() {
    /* Initializing */
    final String projName = this.page.getProjName();
    final String projPath = this.page.getLocation() + "/" + this.page.getProjName();
    final String projTool = "MinGW GCC";

    /* If Project/Folder with this name already exists in path, ask override question (message dialog) */
    if (new java.io.File(projPath).exists()) {
        final MessageDialog dg = new MessageDialog(
                PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), UI_USERMSG_TITLE, null,
                UI_USERMSG_EXISTQST, MessageDialog.QUESTION,
                new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL }, 0);
        /* override dialog returns
         * in case "yes" 0//from  www . j av  a2  s  . co  m
         * in case "no" 1
         */
        if (dg.open() == 1) {
            return false;
        }
    }

    /*
     * ProgressMonitor, work parted in
     * 70% GenerateSimulationProject
     * 30% runGenerator
     */
    try {
        this.getContainer().run(true, true, new IRunnableWithProgress() {
            @Override
            public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                monitor.beginTask(UI_MONITOR_MAINTASKNAME, 100000);
                /* Generate Project */
                if (!new GenerateSimulationProject().createSimulationProj(projName, projPath, monitor, 70000,
                        projTool)) {
                    return;
                }
                if (monitor.isCanceled()) {
                    return;
                }

                /* Execute Generator */
                try {
                    GenerateSimulationWizard.this.runGenerator(GenerateSimulationWizard.this.file, projPath,
                            monitor, 30000);
                } catch (CoreException e) {
                    e.printStackTrace();
                } catch (IOException e) {
                    e.printStackTrace();
                }

                /* End Monitor */
                monitor.done();

            }
        });
    } catch (InvocationTargetException e) {
        e.printStackTrace();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    return true;
}

From source file:de.ovgu.featureide.examples.wizards.ExampleNewWizardPage.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  v  a  2s .  c om
 * @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 = pathString + " already exists. Would you like to overwrite it?";
    } else {
        messageString = "Overwrite " + path.lastSegment() + " in folder "
                + 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);

    // 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()];
}