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

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

Introduction

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

Prototype

String STOP_LABEL

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

Click Source Link

Document

The label for stop buttons.

Usage

From source file:net.rim.ejde.internal.launching.MDSCSChecker.java

License:Open Source License

/***
 * Check if required version of Java can be found for launching MDS-CS
 *
 * @param MDSHomePath/*from   www . ja  va 2  s . c  o  m*/
 *            The MDS-CS home path
 * @return <code>true</code> continue this launching session, otherwise <code>false</code>.
 */
public static MDSCSCheckResult checkMDSCS(File MDSHomePath) {
    String dialogTitle = "", dialogMessage = ""; //$NON-NLS-1$
    JavaVMCheckResult javaVMResult = null;

    // Get version of current MDS-CS
    CompatibilityVersion mdscsVersion = getMDSCSVersion(MDSHomePath);
    // if MDS-CS version is null, warn user that MDS-CS can not be found
    if (mdscsVersion == null) {
        dialogTitle = Messages.FledgeLaunchConfigurationDelegate_noMDSCSMsg;
    } else {
        // if versions of MDS-CS is equal or greater than 4.1.5, Java 1.6 is
        // required
        CompatibilityVersion mdscs415Version = new CompatibilityVersion("4.1.5"); //$NON-NLS-1$
        String requiredJavaVersion;
        if (mdscsVersion.compareTo(mdscs415Version) >= 0) {
            requiredJavaVersion = "1.6"; //$NON-NLS-1$
        } else {
            requiredJavaVersion = "1.5"; //$NON-NLS-1$
        }
        javaVMResult = JavaVMChecker.getInstance().checkJavaVM(requiredJavaVersion,
                JavaVMChecker.CHECK_TYPE_GREATEROREQUAL); //$NON-NLS-1$
        if (javaVMResult == null) {
            // required version of Java can not be found in system.
            dialogTitle = Messages.FledgeLaunchConfigurationDelegate_noLaunchMDSCSMsg;
            dialogMessage = NLS.bind(Messages.FledgeLaunchConfigurationDelegate_noJavaMDSCSMsg,
                    requiredJavaVersion);
        }
    }

    if (javaVMResult == null) {
        // either MDS-CS is not found or required Java to run MDS-CS is not
        // found
        dialogMessage = dialogMessage + NLS.bind(Messages.FledgeLaunchConfigurationDelegate_clickNoMDSCSMsg,
                IDialogConstants.PROCEED_LABEL, IDialogConstants.STOP_LABEL);
        askUserDecision(dialogTitle, dialogMessage);
        if (_userDecision == 0) { // continue launching
            return MDSCSCheckResult.DISABLE_MDSCS;
        } else {
            return MDSCSCheckResult.CANCEL;
        }
    }

    // required version of Java has been found
    if (javaVMResult.getLocationType() != JavaVMCheckResult.LOCATION_ENV_JAVA_HOME) {
        if (!isJavaHomeEnvEmpty() || (javaVMResult.getLocationType() != JavaVMCheckResult.LOCATION_ENV_PATH)) {
            updateBatchFiles(MDSHomePath, javaVMResult);
        }
    }

    return MDSCSCheckResult.OK;
}

From source file:net.rim.ejde.internal.launching.MDSCSChecker.java

License:Open Source License

private static void askUserDecision(final String title, final String message) {
    Display.getDefault().syncExec(new Runnable() {
        public void run() {
            Shell shell = new Shell();
            MessageDialog dialog = new MessageDialog(shell, title, null, // accept the default window icon
                    message, MessageDialog.WARNING,
                    new String[] { IDialogConstants.PROCEED_LABEL, IDialogConstants.STOP_LABEL }, 0); // proceed
            // is the default
            _userDecision = dialog.open();
            shell.dispose();/*from   www  .  ja v  a2 s . co  m*/
        }
    });
}

From source file:org.ebayopensource.vjet.eclipse.internal.ui.preferences.InstalledSdksBlock.java

License:Open Source License

/**
 * Search for installed VMs in the file system
 *//* ww w .j  a v  a  2s  .  c om*/
protected void search() {

    // choose a root directory for the search 
    DirectoryDialog dialog = new DirectoryDialog(getShell());
    //      dialog.setMessage(JREMessages.InstalledJREsBlock_9); 
    //      dialog.setText(JREMessages.InstalledJREsBlock_10); 
    dialog.setMessage("Temp code");
    dialog.setText("Temp code");
    String path = dialog.open();
    if (path == null) {
        return;
    }

    // ignore installed locations
    final Set exstingLocations = new HashSet();
    Iterator iter = fVMs.iterator();
    while (iter.hasNext()) {
        exstingLocations.add(((ISdkEnvironment) iter.next()).getSdkPaths());
    }

    // search
    final File rootDir = new File(path);
    final List locations = new ArrayList();
    final List types = new ArrayList();

    IRunnableWithProgress r = new IRunnableWithProgress() {
        public void run(IProgressMonitor monitor) {
            //            monitor.beginTask(JREMessages.InstalledJREsBlock_11, IProgressMonitor.UNKNOWN); 
            monitor.beginTask("Temp code", IProgressMonitor.UNKNOWN);
            search(rootDir, locations, types, exstingLocations, monitor);
            monitor.done();
        }
    };

    try {
        ProgressMonitorDialog progress = new ProgressMonitorDialog(getShell()) {
            /*
             * Overridden createCancelButton to replace Cancel label with Stop label
             * More accurately reflects action taken when button pressed.
             * Bug [162902]
             */
            protected void createCancelButton(Composite parent) {
                cancel = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.STOP_LABEL, true);
                if (arrowCursor == null) {
                    arrowCursor = new Cursor(cancel.getDisplay(), SWT.CURSOR_ARROW);
                }
                cancel.setCursor(arrowCursor);
                setOperationCancelButtonEnabled(enableCancelButton);
            }
        };
        progress.run(true, true, r);
    } catch (InvocationTargetException e) {
        VjetPlugin.error("Error", e);
    } catch (InterruptedException e) {
        // canceled
        return;
    }

    if (locations.isEmpty()) {
        //         MessageDialog.openInformation(getShell(), JREMessages.InstalledJREsBlock_12, MessageFormat.format(JREMessages.InstalledJREsBlock_13, new String[]{path})); // 
    } else {
        iter = locations.iterator();
        Iterator iter2 = types.iterator();
        //         while (iter.hasNext()) {
        //            File location = (File)iter.next();
        //            ISdkEnvironmentType type = (ISdkEnvironmentType)iter2.next();
        //            ISdkEnvironment vm = new VMStandin(type, createUniqueId(type));
        //            String name = location.getName();
        //            String nameCopy = new String(name);
        //            int i = 1;
        //            while (isDuplicateName(nameCopy)) {
        //               nameCopy = name + '(' + i++ + ')'; 
        //            }
        //            vm.setName(nameCopy);
        //            vm.setInstallLocation(location);
        //            if (type instanceof AbstractVMInstallType) {
        //               //set default java doc location
        //               AbstractVMInstallType abs = (AbstractVMInstallType)type;
        //               vm.setJavadocLocation(abs.getDefaultJavadocLocation(location));
        //            }
        //            vmAdded(vm);
        //         }
    }

}

From source file:org.eclipse.jdt.internal.debug.ui.jres.InstalledJREsBlock.java

License:Open Source License

/**
 * Search for installed VMs in the file system
 *//*from  w w  w. j a v a  2s. c  o  m*/
protected void search() {
    if (Platform.OS_MACOSX.equals(Platform.getOS())) {
        doMacSearch();
        return;
    }
    // choose a root directory for the search 
    DirectoryDialog dialog = new DirectoryDialog(getShell());
    dialog.setMessage(JREMessages.InstalledJREsBlock_9);
    dialog.setText(JREMessages.InstalledJREsBlock_10);
    String path = dialog.open();
    if (path == null) {
        return;
    }

    // ignore installed locations
    final Set<File> exstingLocations = new HashSet<File>();
    for (IVMInstall vm : fVMs) {
        exstingLocations.add(vm.getInstallLocation());
    }

    // search
    final File rootDir = new File(path);
    final List<File> locations = new ArrayList<File>();
    final List<IVMInstallType> types = new ArrayList<IVMInstallType>();

    IRunnableWithProgress r = new IRunnableWithProgress() {
        public void run(IProgressMonitor monitor) {
            monitor.beginTask(JREMessages.InstalledJREsBlock_11, IProgressMonitor.UNKNOWN);
            search(rootDir, locations, types, exstingLocations, monitor);
            monitor.done();
        }
    };

    try {
        ProgressMonitorDialog progress = new ProgressMonitorDialog(getShell()) {
            /*
             * Overridden createCancelButton to replace Cancel label with Stop label
             * More accurately reflects action taken when button pressed.
             * Bug [162902]
             */
            @Override
            protected void createCancelButton(Composite parent) {
                cancel = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.STOP_LABEL, true);
                if (arrowCursor == null) {
                    arrowCursor = new Cursor(cancel.getDisplay(), SWT.CURSOR_ARROW);
                }
                cancel.setCursor(arrowCursor);
                setOperationCancelButtonEnabled(enableCancelButton);
            }
        };
        progress.run(true, true, r);
    } catch (InvocationTargetException e) {
        JDIDebugUIPlugin.log(e);
    } catch (InterruptedException e) {
        // canceled
        return;
    }

    if (locations.isEmpty()) {
        String messagePath = path.replaceAll("&", "&&"); // @see bug 29855  //$NON-NLS-1$//$NON-NLS-2$
        MessageDialog.openInformation(getShell(), JREMessages.InstalledJREsBlock_12,
                NLS.bind(JREMessages.InstalledJREsBlock_13, new String[] { messagePath })); // 
    } else {
        Iterator<IVMInstallType> iter2 = types.iterator();
        for (File location : locations) {
            IVMInstallType type = iter2.next();
            AbstractVMInstall vm = new VMStandin(type, createUniqueId(type));
            String name = location.getName();
            String nameCopy = new String(name);
            int i = 1;
            while (isDuplicateName(nameCopy)) {
                nameCopy = name + '(' + i++ + ')';
            }
            vm.setName(nameCopy);
            vm.setInstallLocation(location);
            if (type instanceof AbstractVMInstallType) {
                //set default java doc location
                AbstractVMInstallType abs = (AbstractVMInstallType) type;
                vm.setJavadocLocation(abs.getDefaultJavadocLocation(location));
                vm.setVMArgs(abs.getDefaultVMArguments(location));
            }
            vmAdded(vm);
        }
    }
}

From source file:org.eclipse.sirius.common.ui.tools.api.dialog.SiriusMessageDialogWithToggle.java

License:Open Source License

/**
 * Attempt to find a standard JFace button id that matches the specified
 * button label. If no match can be found, use the default id provided.
 * /*w w  w.j  a va 2 s  . co  m*/
 * Overridden to investigate the provided buttons.
 * 
 * @param buttonLabel
 *            the button label whose id is sought
 * @param defaultId
 *            the id to use for the button if there is no standard id
 * @return the id for the specified button label
 */
// CHECKSTYLE:OFF
private int mapButtonLabelToButtonID(String buttonLabel, int defaultId) {
    // CHECKSTYLE:OON
    // Not pretty but does the job...
    if (IDialogConstants.OK_LABEL.equals(buttonLabel)) {
        return IDialogConstants.OK_ID;
    }

    if (IDialogConstants.YES_LABEL.equals(buttonLabel)) {
        return IDialogConstants.YES_ID;
    }

    if (IDialogConstants.NO_LABEL.equals(buttonLabel)) {
        return IDialogConstants.NO_ID;
    }

    if (IDialogConstants.CANCEL_LABEL.equals(buttonLabel)) {
        return IDialogConstants.CANCEL_ID;
    }

    if (IDialogConstants.YES_TO_ALL_LABEL.equals(buttonLabel)) {
        return IDialogConstants.YES_TO_ALL_ID;
    }

    if (IDialogConstants.SKIP_LABEL.equals(buttonLabel)) {
        return IDialogConstants.SKIP_ID;
    }

    if (IDialogConstants.STOP_LABEL.equals(buttonLabel)) {
        return IDialogConstants.STOP_ID;
    }

    if (IDialogConstants.ABORT_LABEL.equals(buttonLabel)) {
        return IDialogConstants.ABORT_ID;
    }

    if (IDialogConstants.RETRY_LABEL.equals(buttonLabel)) {
        return IDialogConstants.RETRY_ID;
    }

    if (IDialogConstants.IGNORE_LABEL.equals(buttonLabel)) {
        return IDialogConstants.IGNORE_ID;
    }

    if (IDialogConstants.PROCEED_LABEL.equals(buttonLabel)) {
        return IDialogConstants.PROCEED_ID;
    }

    if (IDialogConstants.OPEN_LABEL.equals(buttonLabel)) {
        return IDialogConstants.OPEN_ID;
    }

    if (IDialogConstants.CLOSE_LABEL.equals(buttonLabel)) {
        return IDialogConstants.CLOSE_ID;
    }

    if (IDialogConstants.BACK_LABEL.equals(buttonLabel)) {
        return IDialogConstants.BACK_ID;
    }

    if (IDialogConstants.NEXT_LABEL.equals(buttonLabel)) {
        return IDialogConstants.NEXT_ID;
    }

    if (IDialogConstants.FINISH_LABEL.equals(buttonLabel)) {
        return IDialogConstants.FINISH_ID;
    }

    if (IDialogConstants.HELP_LABEL.equals(buttonLabel)) {
        return IDialogConstants.HELP_ID;
    }

    if (IDialogConstants.NO_TO_ALL_LABEL.equals(buttonLabel)) {
        return IDialogConstants.NO_TO_ALL_ID;
    }

    if (IDialogConstants.SHOW_DETAILS_LABEL.equals(buttonLabel)) {
        return IDialogConstants.DETAILS_ID;
    }

    if (IDialogConstants.HIDE_DETAILS_LABEL.equals(buttonLabel)) {
        return IDialogConstants.DETAILS_ID;
    }

    for (String providedButton : buttonsMap.keySet()) {
        if (providedButton.equals(buttonLabel)) {
            return buttonsMap.get(providedButton);
        }
    }

    // No XXX_LABEL in IDialogConstants for these. Unlikely
    // they would be used in a message dialog though.
    // public int SELECT_ALL_ID = 18;
    // public int DESELECT_ALL_ID = 19;
    // public int SELECT_TYPES_ID = 20;

    return defaultId;
}

From source file:org.fusesource.ide.sap.ui.dialog.TestServerDialog.java

License:Open Source License

/**
 * Create contents of the button bar./*from   w w w.j a v a  2s  . c  o  m*/
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, START_ID, Messages.TestServerDialog_Start, false);
    createButton(parent, IDialogConstants.STOP_ID, IDialogConstants.STOP_LABEL, false);
    createButton(parent, CLEAR_ID, Messages.TestServerDialog_Clear, false);
    createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL, true);
}

From source file:org.jkiss.dbeaver.ui.dialogs.exec.ExecutionQueueErrorDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Details buttons
    createButton(parent, IDialogConstants.STOP_ID, IDialogConstants.STOP_LABEL, true);
    createButton(parent, IDialogConstants.RETRY_ID, IDialogConstants.RETRY_LABEL, false);
    if (script) {
        createButton(parent, IDialogConstants.SKIP_ID, IDialogConstants.SKIP_LABEL, false);
        createButton(parent, IDialogConstants.IGNORE_ID, IDialogConstants.IGNORE_LABEL, false);
    }/*from ww w .j  a  v  a  2 s. c om*/
    createDetailsButton(parent);
}