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

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

Introduction

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

Prototype

String CANCEL_LABEL

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

Click Source Link

Document

The label for cancel buttons.

Usage

From source file:com.ecfeed.ui.dialogs.GeneratorSetupDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    fOkButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    if (fGenerateExecutableContent) {
        for (MethodParameterNode parameter : fMethod.getMethodParameters()) {
            EImplementationStatus parameterStatus = fStatusResolver.getImplementationStatus(parameter);
            if ((parameter.getChoices().isEmpty()
                    && (parameter.isExpected() == false || JavaTypeHelper.isUserType(parameter.getType())))
                    || parameterStatus == EImplementationStatus.NOT_IMPLEMENTED) {
                setOkButtonStatus(false);
                break;
            }/*from w ww  .j  a  v a2  s .  c o m*/
        }
    } else {
        for (MethodParameterNode parameter : fMethod.getMethodParameters()) {
            if (parameter.getChoicesWithCopies().isEmpty()
                    && (parameter.isExpected() == false || JavaTypeHelper.isUserType(parameter.getType()))) {
                setOkButtonStatus(false);
                break;
            }
        }
    }

    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    updateOkButtonAndErrorMsg();
}

From source file:com.ecfeed.ui.dialogs.RenameTestSuiteDialog.java

License:Open Source License

/**
 * Create contents of the button bar./* w  w w  .  jav a  2s  . c  om*/
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    fOkButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    fOkButton.setEnabled(false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.ecfeed.ui.dialogs.SetupDialogGenerator.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    fOkButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    if (fGenerateExecutableContent) {
        for (MethodParameterNode parameter : fMethod.getMethodParameters()) {
            EImplementationStatus parameterStatus = fStatusResolver.getImplementationStatus(parameter);
            if ((parameter.getChoices().isEmpty()
                    && (parameter.isExpected() == false || JavaUtils.isUserType(parameter.getType())))
                    || parameterStatus == EImplementationStatus.NOT_IMPLEMENTED) {
                setOkButtonStatus(false);
                break;
            }//from  www  .j av a  2  s.  co  m
        }
    } else {
        for (MethodParameterNode parameter : fMethod.getMethodParameters()) {
            if (parameter.getChoices().isEmpty()
                    && (parameter.isExpected() == false || JavaUtils.isUserType(parameter.getType()))) {
                setOkButtonStatus(false);
                break;
            }
        }
    }

    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    updateOkButtonAndErrorMsg();
}

From source file:com.ecfeed.ui.wizards.NewEctFileCreationPage.java

License:Open Source License

public boolean performFinish() {
    IFile file = fPage.createNewFile();/*w  ww .j  a  v a 2s  .  c  om*/
    try {
        if (file.getContents().read() != -1) {
            MessageDialog dialog = new MessageDialog(getShell(), Messages.WIZARD_FILE_EXISTS_TITLE,
                    Display.getDefault().getSystemImage(SWT.ICON_QUESTION), Messages.WIZARD_FILE_EXISTS_MESSAGE,
                    MessageDialog.QUESTION_WITH_CANCEL,
                    new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL },
                    IDialogConstants.OK_ID);
            if (dialog.open() != IDialogConstants.OK_ID) {
                return false;
            }
        }

        final IPath newFileFullPath = fPage.getContainerFullPath().append(fPage.getFileName());
        String modelName = newFileFullPath.removeFileExtension().lastSegment();
        RootNode model = new RootNode(modelName != null ? modelName : Constants.DEFAULT_NEW_ECT_MODEL_NAME,
                ModelVersionDistributor.getCurrentVersion());

        ByteArrayOutputStream ostream = new ByteArrayOutputStream();
        new EctSerializer(ostream, ModelVersionDistributor.getCurrentVersion()).serialize(model);
        ByteArrayInputStream istream = new ByteArrayInputStream(ostream.toByteArray());
        file.setContents(istream, true, true, null);

        //open new file in an ect editor
        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();

        page.openEditor(new FileEditorInput(file), Constants.ECT_EDITOR_ID);
    } catch (Exception e) {
        e.printStackTrace();
    }

    return true;
}

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);//from   w  w  w .ja v  a 2s .  c om
        int open = dialog.open();
        if (open == 0) {
            toggleNature.toggleNature(resource.getProject());
        }
    }
}

From source file:com.genuitec.eclipse.gerrit.tools.dialogs.SettingsDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    parent.setLayoutData(new GridData(SWT.RIGHT, SWT.FILL, false, false));
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    revalidate();//  w  w  w  . j  a va 2  s  .c o m
}

From source file:com.genuitec.org.eclipse.egit.ui.internal.branch.BranchOperationUI.java

License:Open Source License

private String getTargetWithCheckoutRemoteTrackingDialog() {
    String[] buttons = new String[] { UIText.BranchOperationUI_CheckoutRemoteTrackingAsLocal,
            UIText.BranchOperationUI_CheckoutRemoteTrackingCommit, IDialogConstants.CANCEL_LABEL };
    MessageDialog questionDialog = new MessageDialog(getShell(),
            UIText.BranchOperationUI_CheckoutRemoteTrackingTitle, null,
            UIText.BranchOperationUI_CheckoutRemoteTrackingQuestion, MessageDialog.QUESTION, buttons, 0);
    int result = questionDialog.open();
    if (result == 0) {
        // Check out as new local branch
        CreateBranchWizard wizard = new CreateBranchWizard(repository, target);
        WizardDialog createBranchDialog = new WizardDialog(getShell(), wizard);
        createBranchDialog.open();/*from  w  w w .  ja  v a  2 s. c om*/
        return null;
    } else if (result == 1) {
        // Check out commit
        return target;
    } else {
        // Cancel
        return null;
    }
}

From source file:com.genuitec.org.eclipse.egit.ui.internal.branch.BranchOperationUI.java

License:Open Source License

private boolean shouldCancelBecauseOfRunningLaunches() {
    if (mode == MODE_CHECKOUT)
        return false;
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    if (!store.getBoolean(UIPreferences.SHOW_RUNNING_LAUNCH_ON_CHECKOUT_WARNING))
        return false;

    ILaunchConfiguration launchConfiguration = getRunningLaunchConfiguration();
    if (launchConfiguration != null) {
        String[] buttons = new String[] { UIText.BranchOperationUI_Continue, IDialogConstants.CANCEL_LABEL };
        String message = NLS.bind(UIText.BranchOperationUI_RunningLaunchMessage, launchConfiguration.getName());
        MessageDialogWithToggle continueDialog = new MessageDialogWithToggle(getShell(),
                UIText.BranchOperationUI_RunningLaunchTitle, null, message, MessageDialog.NONE, buttons, 0,
                UIText.BranchOperationUI_RunningLaunchDontShowAgain, false);
        int result = continueDialog.open();
        // cancel
        if (result == IDialogConstants.CANCEL_ID || result == SWT.DEFAULT)
            return true;
        boolean dontWarnAgain = continueDialog.getToggleState();
        if (dontWarnAgain)
            store.setValue(UIPreferences.SHOW_RUNNING_LAUNCH_ON_CHECKOUT_WARNING, false);
    }/*  ww w  .  j  a  v  a2s . c o  m*/
    return false;
}

From source file:com.genuitec.org.eclipse.egit.ui.internal.branch.CleanupUncomittedChangesDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);
    createButton(parent, IDialogConstants.PROCEED_ID, UIText.BranchResultDialog_buttonCommit, false);
    createButton(parent, IDialogConstants.SKIP_ID, UIText.BranchResultDialog_buttonStash, false);
    createButton(parent, IDialogConstants.ABORT_ID, UIText.BranchResultDialog_buttonReset, false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
}

From source file:com.google.appengine.eclipse.core.preferences.ui.GaePreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    noDefaultAndApplyButton();/*from  w  w  w. ja v  a 2  s .c om*/

    sdkSet = GaePreferences.getSdks();

    return new SdkTable<GaeSdk>(parent, SWT.NONE, sdkSet, null, this) {
        @Override
        protected IStatus doAddSdk() {
            AddSdkDialog<GaeSdk> addGaeSdkDialog = new AddSdkDialog<GaeSdk>(getShell(), sdkSet,
                    AppEngineCorePlugin.PLUGIN_ID, "Add App Engine SDK", GaeSdk.getFactory());
            if (addGaeSdkDialog.open() == Window.OK) {
                GaeSdk newSdk = addGaeSdkDialog.getSdk();
                if (newSdk != null) {
                    sdkSet.add(newSdk);
                }

                return Status.OK_STATUS;
            }

            return Status.CANCEL_STATUS;
        }

        @Override
        protected IStatus doDownloadSdk() {
            MessageDialog dialog = new MessageDialog(AppEngineCorePlugin.getActiveWorkbenchShell(),
                    "Google Eclipse Plugin", null,
                    "Would you like to open the Google App Engine download page in your "
                            + "web browser?\n\nFrom there, you can "
                            + "download the latest App Engine SDK and extract it to the"
                            + " location of your choice. Add it to Eclipse" + " with the \"Add...\" button.",
                    MessageDialog.QUESTION, new String[] { "Open Browser", IDialogConstants.CANCEL_LABEL }, 0);

            if (dialog.open() == Window.OK) {
                if (BrowserUtilities
                        .launchBrowserAndHandleExceptions(AppEngineCorePlugin.SDK_DOWNLOAD_URL) == null) {
                    return Status.CANCEL_STATUS;
                }
            } else {
                return Status.CANCEL_STATUS;
            }
            return Status.OK_STATUS;
        }
    };
}