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

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

Introduction

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

Prototype

String PROCEED_LABEL

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

Click Source Link

Document

The label for proceed buttons.

Usage

From source file:com.aptana.ide.debug.internal.ui.Startup.java

License:Open Source License

private String showBrowserNotFoundDialog(final boolean download) {
    final String[] path = new String[] { null };
    PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
        public void run() {

            if (Display.getCurrent().getActiveShell() == null) { // another message box is shown
                return;
            }//w w w  . j  a v a 2s .c o  m
            MessageDialogWithToggle md = new MessageDialogWithToggle(
                    PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
                    Messages.Startup_Notification, null, Messages.Startup_AptanaRequiresFirefox,
                    MessageDialog.INFORMATION,
                    new String[] { IDialogConstants.PROCEED_LABEL, StringUtils.ellipsify(CoreStrings.BROWSE),
                            download ? Messages.Startup_Download : Messages.Startup_CheckAgain },
                    0, Messages.Startup_DontAskAgain, false);
            md.setPrefKey(com.aptana.ide.debug.internal.ui.IDebugUIConstants.PREF_SKIP_FIREFOX_CHECK);
            md.setPrefStore(DebugUiPlugin.getDefault().getPreferenceStore());

            int returnCode = md.open();
            switch (returnCode) {
            case IDialogConstants.INTERNAL_ID:
                FileDialog fileDialog = new FileDialog(
                        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OPEN);
                if (Platform.OS_WIN32.equals(Platform.getOS())) {
                    fileDialog.setFilterExtensions(new String[] { "*.exe" }); //$NON-NLS-1$
                    fileDialog.setFilterNames(new String[] { Messages.Startup_ExecutableFiles });
                }
                path[0] = fileDialog.open();
                break;
            case IDialogConstants.INTERNAL_ID + 1:
                if (download) {
                    WorkbenchHelper.launchBrowser("http://www.getfirefox.com"); //$NON-NLS-1$
                }
                path[0] = StringUtils.EMPTY;
                break;
            default:
            }
        }
    });
    return path[0];
}

From source file:com.aptana.php.debug.core.launch.DebugPortNotificationDialog.java

License:Open Source License

/**
 * Creates a message dialog with a toggle. See the superclass constructor for info on the other parameters.
 * //  ww w .jav  a2s  .c  o m
 * @param parentShell
 *            the parent shell
 * @param dialogTitle
 *            the dialog title, or <code>null</code> if none
 * @param image
 *            the dialog title image, or <code>null</code> if none
 * @param message
 *            the dialog message
 * @param detailedInformation
 *            the details for this message (as an IStatus instance)
 * @param dialogImageType
 *            one of the following values:
 *            <ul>
 *            <li><code>MessageDialog.NONE</code> for a dialog with no image</li>
 *            <li><code>MessageDialog.ERROR</code> for a dialog with an error image</li>
 *            <li><code>MessageDialog.INFORMATION</code> for a dialog with an information image</li>
 *            <li><code>MessageDialog.QUESTION </code> for a dialog with a question image</li>
 *            <li><code>MessageDialog.WARNING</code> for a dialog with a warning image</li>
 *            </ul>
 * @param toggleMessage
 *            the message for the toggle control, or <code>null</code> for the default message
 * @param toggleState
 *            the initial state for the toggle
 */
public DebugPortNotificationDialog(Shell parentShell, String dialogTitle, Image image, String message,
        IStatus detailedInformation, int dialogImageType, String toggleMessage, boolean toggleState) {
    super(parentShell, dialogTitle, image, message, dialogImageType,
            new String[] { IDialogConstants.PROCEED_LABEL, IDialogConstants.ABORT_LABEL }, 0, toggleMessage,
            toggleState);
    this.detailedInformation = detailedInformation;
    setPrefStore(PHPDebugPlugin.getDefault().getPreferenceStore());
    setPrefKey(IPHPDebugCorePreferenceKeys.NOTIFY_NON_STANDARD_PORT);
}

From source file:com.ibm.xsp.extlib.designer.tooling.utils.WizardUtils.java

License:Open Source License

public static boolean findStandardDefAndAddDependency(final String uri, final String tagName,
        final DesignerProject project, final String errorMsg, final String proceedMsg) {
    FacesDefinition def = null;//  www.j ava2s  .c  o  m
    FacesRegistry localReg = project.getFacesRegistry();
    if (localReg != null) {
        def = localReg.findDef(uri, tagName);
        if (def != null) {
            return true;
        }
    }

    FacesRegistry globalReg = StandardRegistryMaintainer.getStandardRegistry();
    if (globalReg != null) {
        def = globalReg.findDef(uri, tagName);
        if (def != null) {
            if (ExtLibToolingUtil.isPropertiesOpenInEditor(project)) {
                LWPDMessageDialog msg = new LWPDMessageDialog(null, ProductUtil.getProductName(), null,
                        errorMsg, LWPDMessageDialog.WARNING, new String[] { IDialogConstants.CLOSE_LABEL }, 0);
                msg.open();
                return false;
            }

            String id = RegistryUtil.getProject(def).getId();
            if (!StringUtil.equals("com.ibm.xsp.extlib.library", id)) { // $NON-NLS-1$
                LWPDMessageDialog msg = new LWPDMessageDialog(null, ProductUtil.getProductName(), null,
                        proceedMsg, LWPDMessageDialog.INFORMATION,
                        new String[] { IDialogConstants.PROCEED_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
                if (msg.open() != LWPDMessageDialog.OK) {
                    return false;
                }
            }
            // third party lib - need to update the current db to depend on this lib!!
            XSPProperties props = new XSPProperties((IDominoDesignerProject) project);
            props.appendDependencies(id);
            props.save();
        }
    }
    return true;
}

From source file:com.rinke.solutions.pinball.GlobalExceptionHandler.java

public void showError(Exception e) {
    display.asyncExec(new Runnable() {

        @Override//from w w w .ja  v  a2  s  . c  om
        public void run() {
            if (e instanceof LicenseException) {
                MessageBox messageBox = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK);

                messageBox.setText("License problem");
                messageBox.setMessage("This action requires a license. Error message was: " + e.getMessage()
                        + "\nIf you hav a license file please register your key file via menu Help/Register.");
                messageBox.open();
            } else {
                MultiStatus status = createMultiStatus(e.getLocalizedMessage(), e);
                ErrorDialog errorDialog = new ErrorDialog(Display.getCurrent().getActiveShell(), "Error",
                        "Ein unerwarteter Fehler ist aufgetreten", status,
                        IStatus.OK | IStatus.INFO | IStatus.WARNING | IStatus.ERROR) {
                    protected void createButtonsForButtonBar(Composite parent) {
                        createButton(parent, IDialogConstants.ABORT_ID, IDialogConstants.ABORT_LABEL, true);
                        createButton(parent, IDialogConstants.PROCEED_ID, IDialogConstants.PROCEED_LABEL,
                                false);
                        createDetailsButton(parent);
                    }

                    @Override
                    protected void buttonPressed(int id) {
                        super.buttonPressed(id);
                        if (id == IDialogConstants.ABORT_ID || id == IDialogConstants.PROCEED_ID) {
                            setReturnCode(id);
                            close();
                        }
                    }

                };
                int ret = errorDialog.open();
                if (ret == IDialogConstants.ABORT_ID)
                    System.exit(1);
            }
            //System.out.println(ret); // cancel = 1
            lastException = null;
        }
    });
}

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/*w  w  w . ja  v a2s .  c om*/
 *            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();//www.  j  ava2 s  . co m
        }
    });
}

From source file:org.eclipse.birt.report.designer.ui.dialogs.ThumbnailBuilder.java

License:Open Source License

private boolean continueSaveImage(String fileName) {
    final int MAX_PIXEL = 1024 * 768;
    final long FILE_SIZE = 1 * 1024 * 1024;

    File file = new File(fileName);
    if (file.length() <= FILE_SIZE) {
        Image locImage = null;/*from w  w  w  .  ja v a 2 s.c om*/
        try {
            locImage = new Image(null, fileName);
            ImageData imageData = locImage.getImageData();
            if (locImage != null && locImage.getImageData() != null) {
                int imagePixel = imageData.height * imageData.width;
                if (imagePixel <= MAX_PIXEL) {
                    return true;
                }
            }
        } catch (Throwable e) {
            // catch the image format exception, doesn't do anything.
        } finally {
            if (locImage != null) {
                locImage.dispose();
            }
        }
    }

    MessageDialog dialog = new MessageDialog(UIUtil.getDefaultShell(),
            Messages.getString("ThumbnailBuilder.PreviewImage.WarningDialog.Title"), //$NON-NLS-1$
            null, // accept
            Messages.getString("ThumbnailBuilder.PreviewImage.WarningDialog.Prompt"), //$NON-NLS-1$
            MessageDialog.WARNING,
            new String[] { IDialogConstants.PROCEED_LABEL, IDialogConstants.CANCEL_LABEL }, 1);
    boolean ret = (dialog.open() == 0) ? true : false;
    return ret;

}

From source file:org.eclipse.birt.report.designer.ui.samples.ide.action.IDEOpenSampleReportAction.java

License:Open Source License

private IProject createProject(String projectName, boolean isJavaProject) {
    ProjectNameDialog projectNameDlg = new ProjectNameDialog(UIUtil.getDefaultShell());
    projectNameDlg.setTitle(Messages.getString("IDEOpenSampleReportAction.ProjectNameDialog.Title.PrjectName"));
    projectNameDlg.setProjectName(projectName);

    if (projectNameDlg.open() == Window.CANCEL) {
        return null;
    }/*from   w  ww .  j av  a2s. c  o m*/

    projectName = projectNameDlg.getProjectName();

    final IProject projectHandle = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);

    if (projectHandle.exists()) {
        String[] buttonLabels = new String[] { IDialogConstants.PROCEED_LABEL,
                Messages.getString("IDEOpenSampleReportAction.MessageDialog.ProjectExists.ButtonText"),
                IDialogConstants.CANCEL_LABEL };
        MessageDialog messageDlg = new MessageDialog(UIUtil.getDefaultShell(),
                Messages.getString("IDEOpenSampleReportAction.MessageDialog.ProjectExists.Title"), null,
                Messages.getFormattedString("IDEOpenSampleReportAction.MessageDialog.ProjectExists.Message",
                        buttonLabels),
                MessageDialog.INFORMATION, buttonLabels, 0);
        messageDlg.open();
        if (messageDlg.getReturnCode() == 0) {
            // proceed
            return projectHandle;
        }

        if (messageDlg.getReturnCode() == 1) {
            // overwrite
            try {
                projectHandle.delete(true, null);
            } catch (CoreException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        if (messageDlg.getReturnCode() == 2) {
            // cancel
            return null;
        }

    }

    final IProjectDescription description = ResourcesPlugin.getWorkspace()
            .newProjectDescription(projectHandle.getName());

    if (isJavaProject == true) {
        String[] natures = new String[] { JavaCore.NATURE_ID,
                "org.eclipse.birt.report.designer.ui.reportprojectnature", //$NON-NLS-1$
        };
        description.setNatureIds(natures);
        addJavaBuildSpec(description);
    } else {
        String[] natures = new String[] { "org.eclipse.birt.report.designer.ui.reportprojectnature", //$NON-NLS-1$
        };
        description.setNatureIds(natures);
    }

    // create the new project operation
    WorkspaceModifyOperation op = new WorkspaceModifyOperation() {

        protected void execute(IProgressMonitor monitor) throws CoreException {
            create(description, projectHandle, monitor);
        }
    };

    try {
        new ProgressMonitorDialog(composite.getShell()).run(false, true, op);
    } catch (InterruptedException e) {
        ExceptionUtil.handle(e);
        return null;
    } catch (InvocationTargetException e) {
        // ie.- one of the steps resulted in a core exception
        Throwable t = e.getTargetException();
        if (t instanceof CoreException) {
            if (((CoreException) t).getStatus().getCode() == IResourceStatus.CASE_VARIANT_EXISTS) {
                MessageDialog.openError(composite.getShell(),
                        Messages.getString("NewReportProjectWizard.errorMessage"), //$NON-NLS-1$
                        Messages.getFormattedString("NewReportProjectWizard.caseVariantExistsError", //$NON-NLS-1$
                                new String[] { projectHandle.getName() }) //,
                );
            } else {
                ErrorDialog.openError(composite.getShell(),
                        Messages.getString("NewReportProjectWizard.errorMessage"), //$NON-NLS-1$
                        null, // no special message
                        ((CoreException) t).getStatus());
            }
        } else {
            // CoreExceptions are handled above, but unexpected runtime
            // exceptions and errors may still occur.
            ExceptionUtil.handle(e);

            MessageDialog.openError(composite.getShell(),
                    Messages.getString("NewReportProjectWizard.errorMessage"), //$NON-NLS-1$
                    Messages.getFormattedString("NewReportProjectWizard.internalError", //$NON-NLS-1$
                            new Object[] { t.getMessage() }));
        }
        return null;
    }

    return projectHandle;
}

From source file:org.eclipse.cdt.launch.internal.ui.BuildErrPrompter.java

License:Open Source License

/**
 * Source is an array of three things, in the following order
 * <ul>/* ww  w .  java  2 s .  c  o m*/
 * <li>launch configuration that was invoked
 * <li>the name of the project the launch first attempted to build
 * <li>the name of the build configuration that was built, or empty string
 * if it was the active one. This argument should be non-empty ONLY if a
 * not-active configuration was built.
 * <ul>
 * 
 * @see org.eclipse.debug.core.IStatusHandler#handleStatus(org.eclipse.core.runtime.IStatus,
 *      java.lang.Object)
 */
@Override
public Object handleStatus(IStatus status, Object source) throws CoreException {

    if (!(source instanceof Object[])) {
        assert false : "status handler not given expected arguments"; //$NON-NLS-1$
        return Boolean.TRUE;
    }

    Object[] args = (Object[]) source;
    if (args.length != 3 || !(args[0] instanceof ILaunchConfiguration) || !(args[1] instanceof String)
            || !(args[2] instanceof String)) {
        assert false : "status handler not given expected arguments"; //$NON-NLS-1$
        return Boolean.TRUE;
    }

    final ILaunchConfiguration launchConfig = (ILaunchConfiguration) args[0];
    final String projectName = (String) args[1];
    final String buildConfigName = (String) args[2];

    // The platform does this check; we should, too
    if (DebugUITools.isPrivate(launchConfig)) {
        return Boolean.TRUE;
    }

    Shell shell = DebugUIPlugin.getShell();
    String title = LaunchConfigurationsMessages.CompileErrorPromptStatusHandler_0;
    String message;
    if (status.getCode() == STATUS_CODE_ERR_IN_MAIN_PROJ) {
        if (buildConfigName.length() > 0) {
            message = MessageFormat.format(LaunchMessages.BuildErrPrompter_error_in_specific_config,
                    projectName, buildConfigName);
        } else {
            message = MessageFormat.format(LaunchMessages.BuildErrPrompter_error_in_active_config, projectName);
        }
    } else if (status.getCode() == STATUS_CODE_ERR_IN_REFERENCED_PROJS) {
        if (buildConfigName.length() > 0) {
            message = MessageFormat.format(LaunchMessages.BuildErrPrompter_error_in_referenced_project_specific,
                    projectName, buildConfigName);
        } else {
            message = MessageFormat.format(LaunchMessages.BuildErrPrompter_error_in_referenced_project_active,
                    projectName);
        }
    } else {
        assert false : "this prompter was called for an unexpected status"; //$NON-NLS-1$
        return Boolean.TRUE;
    }

    // The rest is monkey-see, monkey-do (copied from
    // CompileErrorProjectPromptStatusHandler)

    IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();
    String pref = store.getString(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR);
    if (pref != null) {
        if (pref.equals(MessageDialogWithToggle.ALWAYS)) {
            return Boolean.TRUE;
        }
    }
    MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell, title, null, message,
            MessageDialog.QUESTION,
            new String[] { IDialogConstants.PROCEED_LABEL, IDialogConstants.CANCEL_LABEL }, 0,
            LaunchConfigurationsMessages.CompileErrorProjectPromptStatusHandler_1, false);
    int open = dialog.open();
    if (open == IDialogConstants.PROCEED_ID) {
        if (dialog.getToggleState()) {
            store.setValue(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR,
                    MessageDialogWithToggle.ALWAYS);
        }
        return Boolean.TRUE;
    } else {
        return Boolean.FALSE;
    }
}

From source file:org.eclipse.debug.internal.ui.launchConfigurations.CompileErrorProjectPromptStatusHandler.java

License:Open Source License

public Object handleStatus(IStatus status, Object source) throws CoreException {
    ILaunchConfiguration config = null;/*from w  w  w.  j a  v a  2  s . co  m*/
    List projects = new ArrayList();

    if (source instanceof List) {
        List args = (List) source;
        Iterator iterator = args.iterator();
        while (iterator.hasNext()) {
            Object arg = iterator.next();
            if (arg instanceof ILaunchConfiguration) {
                config = (ILaunchConfiguration) arg;
                if (DebugUITools.isPrivate(config)) {
                    return Boolean.TRUE;
                }
            } else if (arg instanceof IProject) {
                projects.add(arg);
            }
        }
    }
    Shell shell = DebugUIPlugin.getShell();
    StringBuffer projectList = new StringBuffer();
    //we need to limit this
    int size = Math.min(20, projects.size());
    for (int i = 0; i < size; i++) {
        if (i > 0) {
            projectList.append(", "); //$NON-NLS-1$
        }
        projectList.append(((IProject) projects.get(i)).getName());
    }
    String projectMessage = null;
    if (projects.size() > 20) {
        projectMessage = MessageFormat.format(
                LaunchConfigurationsMessages.CompileErrorProjectPromptStatusHandler_0,
                new Object[] { projectList.toString() });
    } else {
        projectMessage = projectList.toString();
    }
    String title = LaunchConfigurationsMessages.CompileErrorPromptStatusHandler_0;
    String message = MessageFormat.format(LaunchConfigurationsMessages.CompileErrorPromptStatusHandler_2,
            new String[] { projectMessage });
    IPreferenceStore store = DebugUIPlugin.getDefault().getPreferenceStore();

    String pref = store.getString(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR);
    if (pref != null) {
        if (pref.equals(MessageDialogWithToggle.ALWAYS)) {
            return Boolean.TRUE;
        }
    }
    MessageDialogWithToggle dialog = new MessageDialogWithToggle(shell, title, null, message,
            MessageDialog.QUESTION,
            new String[] { IDialogConstants.PROCEED_LABEL, IDialogConstants.CANCEL_LABEL }, 0,
            LaunchConfigurationsMessages.CompileErrorProjectPromptStatusHandler_1, false);
    int open = dialog.open();
    if (open == IDialogConstants.PROCEED_ID) {
        if (dialog.getToggleState()) {
            store.setValue(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR,
                    MessageDialogWithToggle.ALWAYS);
        }
        return Boolean.TRUE;
    } else {
        return Boolean.FALSE;
    }
}