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

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

Introduction

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

Prototype

String OK_LABEL

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

Click Source Link

Document

The label for OK buttons.

Usage

From source file:eu.portavita.coverage.handlers.ComboInputDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Cancel buttons by default
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    // do this here because setting the text will set enablement on the ok
    // button/*from w  ww  . j a  v a 2 s . c  o m*/
    combo.setFocus();
    if (value != null) {
        combo.setText(value);
        // combo.selectAll();
    }
}

From source file:eu.transkribus.swt_canvas.util.ExceptionDetailsErrorDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Details buttons
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createDetailsButton(parent);//from  ww  w.j a v  a 2 s  .  com
    createButton(parent, IDialogConstants.HELP_ID, "Send bug report", false);
    getButton(IDialogConstants.HELP_ID).addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            setReturnCode(IDialogConstants.HELP_ID);
            close();
        }
    });
}

From source file:ext.org.eclipse.jdt.internal.ui.compare.CompareDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    String buttonLabel = JavaCompareUtilities.getString(fBundle, "buttonLabel", IDialogConstants.OK_LABEL); //$NON-NLS-1$
    createButton(parent, IDialogConstants.CANCEL_ID, buttonLabel, false);
}

From source file:ext.org.eclipse.jdt.internal.ui.dialogs.SortMembersMessageDialog.java

License:Open Source License

public SortMembersMessageDialog(Shell parentShell) {
    super(OPTIONAL_ID, parentShell, DialogsMessages.SortMembersMessageDialog_dialog_title, null, new String(),
            INFORMATION, new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);

    fDialogSettings = JavaPlugin.getDefault().getDialogSettings();

    boolean isSortAll = fDialogSettings.getBoolean(DIALOG_SETTINGS_SORT_ALL);

    fNotSortAllRadio = new SelectionButtonDialogField(SWT.RADIO);
    fNotSortAllRadio.setLabelText(DialogsMessages.SortMembersMessageDialog_do_not_sort_fields_label);
    fNotSortAllRadio.setSelection(!isSortAll);

    fSortAllRadio = new SelectionButtonDialogField(SWT.RADIO);
    fSortAllRadio.setLabelText(DialogsMessages.SortMembersMessageDialog_sort_all_label);
    fSortAllRadio.setSelection(isSortAll);
}

From source file:ext.org.eclipse.jdt.internal.ui.javadocexport.JavadocWizard.java

License:Open Source License

@Override
public boolean performFinish() {
    updateStore();//from w w  w  . j  a  v a2s .c  om

    IJavaProject[] checkedProjects = fTreeWizardPage.getCheckedProjects();
    fStore.updateDialogSettings(getDialogSettings(), checkedProjects);

    // Wizard should not run with dirty editors
    if (!new RefactoringSaveHelper(RefactoringSaveHelper.SAVE_ALL_ALWAYS_ASK).saveEditors(getShell())) {
        return false;
    }

    fDestination = Path.fromOSString(fStore.getDestination());
    fDestination.toFile().mkdirs();

    fOpenInBrowser = fStore.doOpenInBrowser();

    //Ask if you wish to set the javadoc location for the projects (all) to
    //the location of the newly generated javadoc
    if (fStore.isFromStandard()) {
        try {

            URL newURL = fDestination.toFile().toURI().toURL();
            String newExternalForm = newURL.toExternalForm();
            List<IJavaProject> projs = new ArrayList<IJavaProject>();
            //get javadoc locations for all projects
            for (int i = 0; i < checkedProjects.length; i++) {
                IJavaProject curr = checkedProjects[i];
                URL currURL = JavaUI.getProjectJavadocLocation(curr);
                if (currURL == null || !newExternalForm.equals(currURL.toExternalForm())) {
                    //if not all projects have the same javadoc location ask if you want to change
                    //them to have the same javadoc location
                    projs.add(curr);
                }
            }
            if (!projs.isEmpty()) {
                setAllJavadocLocations(projs.toArray(new IJavaProject[projs.size()]), newURL);
            }
        } catch (MalformedURLException e) {
            JavaPlugin.log(e);
        }
    }

    if (fLastWizardPage.generateAnt()) {
        //@Improve: make a better message
        OptionalMessageDialog.open(JAVADOC_ANT_INFORMATION_DIALOG, getShell(),
                JavadocExportMessages.JavadocWizard_antInformationDialog_title, null,
                JavadocExportMessages.JavadocWizard_antInformationDialog_message, MessageDialog.INFORMATION,
                new String[] { IDialogConstants.OK_LABEL }, 0);
        try {
            Element javadocXMLElement = fStore.createXML(checkedProjects);
            if (javadocXMLElement != null) {

                if (!fTreeWizardPage.getCustom()) {
                    for (int i = 0; i < fContributedJavadocWizardPages.length; i++) {
                        fContributedJavadocWizardPages[i].updateAntScript(javadocXMLElement);
                    }
                }
                File file = fStore.writeXML(javadocXMLElement);
                IFile[] files = fRoot.findFilesForLocationURI(file.toURI());
                if (files != null) {
                    for (int i = 0; i < files.length; i++) {
                        files[i].refreshLocal(IResource.DEPTH_ONE, null);
                    }
                }
            }

        } catch (CoreException e) {
            ExceptionHandler.handle(e, getShell(), JavadocExportMessages.JavadocWizard_error_writeANT_title,
                    JavadocExportMessages.JavadocWizard_error_writeANT_message);
        }
    }

    if (!executeJavadocGeneration())
        return false;

    return true;
}

From source file:ext.org.eclipse.jdt.internal.ui.refactoring.reorg.RenameTypeWizardSimilarElementsOptionsDialog.java

License:Open Source License

public RenameTypeWizardSimilarElementsOptionsDialog(Shell parentShell, int defaultStrategy) {
    super(parentShell, RefactoringMessages.RenameTypeWizardSimilarElementsOptionsDialog_title, null,
            new String(), INFORMATION,
            new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
    fSelectedStrategy = defaultStrategy;
}

From source file:ext.org.eclipse.jdt.internal.ui.search.SearchUtil.java

License:Open Source License

public static void warnIfBinaryConstant(IJavaElement element, Shell shell) {
    if (isPrimitiveConstantOrString(element))
        OptionalMessageDialog.open(BIN_PRIM_CONST_WARN_DIALOG_ID, shell,
                SearchMessages.Search_FindReferencesAction_BinPrimConstWarnDialog_title, null,
                SearchMessages.Search_FindReferencesAction_BinPrimConstWarnDialog_message,
                MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
}

From source file:ext.org.eclipse.jdt.internal.ui.text.java.CompletionProposalComputerRegistry.java

License:Open Source License

/**
 * Log the status and inform the user about a misbehaving extension.
 *
 * @param descriptor the descriptor of the misbehaving extension
 * @param status a status object that will be logged
 *//*from   w  w w.ja  v  a  2  s .c o m*/
void informUser(CompletionProposalComputerDescriptor descriptor, IStatus status) {
    JavaPlugin.log(status);
    String title = JavaTextMessages.CompletionProposalComputerRegistry_error_dialog_title;
    CompletionProposalCategory category = descriptor.getCategory();
    IContributor culprit = descriptor.getContributor();
    Set<String> affectedPlugins = getAffectedContributors(category, culprit);

    final String avoidHint;
    final String culpritName = culprit == null ? null : culprit.getName();
    if (affectedPlugins.isEmpty())
        avoidHint = Messages.format(JavaTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHint,
                new Object[] { culpritName, category.getDisplayName() });
    else
        avoidHint = Messages.format(
                JavaTextMessages.CompletionProposalComputerRegistry_messageAvoidanceHintWithWarning,
                new Object[] { culpritName, category.getDisplayName(), toString(affectedPlugins) });

    String message = status.getMessage();
    // inlined from MessageDialog.openError
    MessageDialog dialog = new MessageDialog(JavaPlugin.getActiveWorkbenchShell(), title,
            null /* default image */, message, MessageDialog.ERROR, new String[] { IDialogConstants.OK_LABEL },
            0) {
        @Override
        protected Control createCustomArea(Composite parent) {
            Link link = new Link(parent, SWT.NONE);
            link.setText(avoidHint);
            link.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(SelectionEvent e) {
                    PreferencesUtil
                            .createPreferenceDialogOn(getShell(),
                                    "org.eclipse.jdt.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$
                            .open();
                }
            });
            GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
            gridData.widthHint = this.getMinimumMessageWidth();
            link.setLayoutData(gridData);
            return link;
        }
    };
    dialog.open();
}

From source file:fable.framework.toolbox.ExceptionMessageDialog.java

License:Open Source License

/**
 * Convenience method to open a standard ExceptionMessageDialog.
 * /* www. j a v  a 2 s .  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 t
 *            The Throwable.
 */
public static void openException(Shell parent, String title, String msg, Throwable t) {
    String throwableName = "Exception";
    if (t instanceof Error) {
        throwableName = "Error";
    }
    final String fullMsg = msg + LS + LS + throwableName + ": " + t + LS + "Message: " + t.getMessage();
    ExceptionMessageDialog dialog = new ExceptionMessageDialog(parent, title, null, fullMsg, ERROR,
            new String[] { IDialogConstants.OK_LABEL }, 0, t);
    dialog.open();
    return;
}

From source file:fr.inria.soctrace.framesoc.ui.dialogs.AbstractLaunchToolDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Cancel buttons by default
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    // OK enabled only if the Framesoc tool says so
    updateOk();/*w  ww.j  a v  a 2 s. c  o m*/
}