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

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

Introduction

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

Prototype

String NO_LABEL

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

Click Source Link

Document

The label for no buttons.

Usage

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

License:Apache License

public static int openStop(Shell parent, String title, String message) {
    MessageDialog dialog = new MessageDialog(parent, title, CoreImg.aboutDrGarbageIcon_16x16.createImage(),
            message, MessageDialog.QUESTION,
            new String[] { IDialogConstants.NO_LABEL, IDialogConstants.YES_LABEL }, 1); /*
                                                                                        * YES is the
                                                                                        * default
                                                                                        */
    return dialog.open();
}

From source file:com.ge.research.sadl.ui.editor.SadlEditorCallback.java

License:Open Source License

private void handleNatureAdding(XtextEditor editor) {
    IResource resource = editor.getResource();
    if (resource != null && !toggleNature.hasNature(resource.getProject())
            && resource.getProject().isAccessible() && !resource.getProject().isHidden()) {
        String title = Messages.NatureAddingEditorCallback_MessageDialog_Title;
        String message = Messages.NatureAddingEditorCallback_MessageDialog_Msg0
                + resource.getProject().getName() + Messages.NatureAddingEditorCallback_MessageDialog_Msg1;
        MessageDialog dialog = new MessageDialog(
                editor.getEditorSite().getShell(), title, null, message, MessageDialog.QUESTION, new String[] {
                        IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL },
                0);//  w w w  .j a  v  a2s  .c om
        int open = dialog.open();
        if (open == 0) {
            toggleNature.toggleNature(resource.getProject());
        }
    }
}

From source file:com.google.code.t4eclipse.tools.dialog.InternalErrorDialog.java

License:Open Source License

/**
 * Convenience method to open a simple Yes/No question dialog.
 * //w w w  .j  a v  a 2s .c om
 * @param parent
 *            the parent shell of the dialog, or <code>null</code> if none
 * @param title
 *            the dialog's title, or <code>null</code> if none
 * @param message
 *            the message
 * @param detail
 *            the error
 * @param defaultIndex
 *            the default index of the button to select
 * @return <code>true</code> if the user presses the OK button,
 *         <code>false</code> otherwise
 */
public static boolean openQuestion(Shell parent, String title, String message, Throwable detail,
        int defaultIndex) {
    String[] labels;
    if (detail == null) {
        labels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL };
    } else {
        labels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                IDialogConstants.SHOW_DETAILS_LABEL };
    }

    InternalErrorDialog dialog = new InternalErrorDialog(parent, title, null, // accept the default window icon
            message, detail, QUESTION, labels, defaultIndex);
    if (detail != null) {
        dialog.setDetailButton(2);
    }
    return dialog.open() == 0;
}

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. j a  v a 2s  . 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.google.gdt.eclipse.suite.preferences.ui.ErrorsWarningsPage.java

License:Open Source License

@Override
public boolean performOk() {
    updateWorkingCopyFromCombos();//from   ww w . j  a v a 2s .com

    if (!GdtProblemSeverities.getInstance().equals(problemSeveritiesWorkingCopy)) {
        MessageDialog dialog = new MessageDialog(getShell(), "Errors/Warnings Settings Changed", null,
                "The Google Error/Warning settings have changed.  A full rebuild "
                        + "of all GWT/App Engine projects is required for changes to "
                        + "take effect.  Do the full build now?",
                MessageDialog.QUESTION,
                new String[] {
                        IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL },
                2); // Cancel
                                                                                                                                                                                                                                                                                                                                                                                                                              // is
                                                                                                                                                                                                                                                                                                                                                                                                                              // default
        int result = dialog.open();

        if (result == 2) { // Cancel
            return false;
        } else {
            updateWorkspaceSeveritySettingsFromWorkingCopy();

            if (result == 0) { // Yes
                BuilderUtilities.scheduleRebuildAll(GWTNature.NATURE_ID);
            }
        }
    }
    return true;
}

From source file:com.heroku.eclipse.ui.git.HerokuCredentialsProvider.java

License:Open Source License

/**
 * Opens a dialog for a single non-user, non-password type item.
 * @param shell the shell to use//from  w  w w.  ja  v  a2  s  . c o m
 * @param uri the uri of the get request
 * @param item the item to handle
 * @return <code>true</code> if the request was successful and values were supplied;
 *       <code>false</code> if the user canceled the request and did not supply all requested values.
 */
private boolean getSingleSpecial(Shell shell, URIish uri, CredentialItem item) {
    if (item instanceof CredentialItem.InformationalMessage) {
        MessageDialog.openInformation(shell, UIText.EGitCredentialsProvider_information, item.getPromptText());
        return true;
    } else if (item instanceof CredentialItem.YesNoType) {
        CredentialItem.YesNoType v = (CredentialItem.YesNoType) item;
        String[] labels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                IDialogConstants.CANCEL_LABEL };
        int[] resultIDs = new int[] { IDialogConstants.YES_ID, IDialogConstants.NO_ID,
                IDialogConstants.CANCEL_ID };

        MessageDialog dialog = new MessageDialog(shell, UIText.EGitCredentialsProvider_question, null,
                item.getPromptText(), MessageDialog.QUESTION_WITH_CANCEL, labels, 0);
        dialog.setBlockOnOpen(true);
        int r = dialog.open();
        if (r < 0) {
            return false;
        }

        switch (resultIDs[r]) {
        case IDialogConstants.YES_ID: {
            v.setValue(true);
            return true;
        }
        case IDialogConstants.NO_ID: {
            v.setValue(false);
            return true;
        }
        default:
            // abort
            return false;
        }
    } else {
        // generically handles all other types of items
        return getMultiSpecial(shell, uri, item);
    }
}

From source file:com.ibm.xsp.extlib.designer.bluemix.action.DeployAction.java

License:Open Source License

public static void deployWithQuestion() {
    if (ToolbarAction.project != null) {
        ManifestMultiPageEditor editor = BluemixUtil.getManifestEditor(ToolbarAction.project);
        if (editor != null) {
            if (editor.isDirty()) {
                MessageDialog dg = new MessageDialog(null, _DEPLOY_TXT, null,
                        "Do you want to save the Manifest before deployment?", // $NLX-DeployAction.DoyouwanttosavetheManifest-1$
                        MessageDialog.QUESTION, new String[] { IDialogConstants.YES_LABEL,
                                IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL },
                        0);//from w  w w .j  av  a 2 s .  c  om

                switch (dg.open()) {
                case 0:
                    //yes
                    editor.doSave(null);
                    break;
                case 1:
                    //no
                    break;
                case 2:
                    //cancel
                    return;
                }
            }
        }

        // Check for a valid configuration
        BluemixConfig config = ConfigManager.getInstance().getConfig(ToolbarAction.project);
        if (config.isValid(true)) {
            // Check the Server configuration
            if (BluemixUtil.isServerConfigured()) {
                // All good - Deploy !!!
                DeployJob job = new DeployJob(config, ToolbarAction.project);
                job.start();
            } else {
                // Server configuration problem
                BluemixUtil.displayConfigureServerDialog();
            }
        } else {
            if (config.isValid(false)) {
                // Something is wrong with the Manifest
                if (ManifestUtil.doesManifestExist(config)) {
                    // Corrupt
                    String msg = "The Manifest for this application is invalid. Cannot deploy."; // $NLX-DeployAction.TheManifestforthisapplicationisin-1$
                    MessageDialog.openError(null, _DEPLOY_TXT, msg);
                } else {
                    // Missing
                    String msg = "The Manifest for this application is missing. Do you want to open the Configuration Wizard?"; // $NLX-DeployAction.TheManifestforthisapplicationismi-1$
                    if (MessageDialog.openQuestion(null, _DEPLOY_TXT, msg)) {
                        ConfigBluemixWizard.launch();
                    }
                }
            } else {
                // App has not been configured or the bluemix.properties file is missing or corrupt
                String msg = "This application is not configured for deployment. Do you want to open the Configuration Wizard?"; // $NLX-DeployAction.Thisapplicationisnotconfiguredfor-1$
                if (MessageDialog.openQuestion(null, _DEPLOY_TXT, msg)) {
                    ConfigBluemixWizard.launch();
                }
            }
        }
    } else {
        MessageDialog.openError(null, _DEPLOY_TXT,
                "No application has been selected or the selected application is not open."); // $NLX-DeployAction.Noapplicationhasbeenselectedorthe-1$
    }
}

From source file:com.liferay.ide.server.tomcat.ui.CleanAppServerAction.java

License:Open Source License

protected void cleanAppServer(IProject project, String bundleZipLocation) throws CoreException {
    String[] labels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL };

    MessageDialog dialog = new MessageDialog(getDisplay().getActiveShell(), getTitle(), null,
            Msgs.deleteEntireTomcatDirectory, MessageDialog.WARNING, labels, 1);

    int retval = dialog.open();

    if (retval == MessageDialog.OK) {
        new CleanAppServerJob(project, bundleZipLocation).schedule();
    }// w w w . j  a  v a2  s.c  om
}

From source file:com.maccasoft.ui.internal.application.WorkbenchExceptionHandler.java

License:Open Source License

private boolean openQuestion(Shell parent, String title, String message, Throwable detail, int defaultIndex) {
    String[] labels;/*from w  w w.  j a  v a 2s.c  o  m*/
    if (detail == null) {
        labels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL };
    } else {
        labels = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,
                IDialogConstants.SHOW_DETAILS_LABEL };
    }

    dialog = new InternalErrorDialog(parent, title, null, message, detail, MessageDialog.QUESTION, labels,
            defaultIndex);

    if (detail != null) {
        dialog.setDetailButton(2);
    }
    boolean result = dialog.open() == Window.OK;
    dialog = null;
    return result;
}

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//w w w  .ja  v  a  2s. 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()];
}