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:es.cv.gvcase.ide.navigator.dialogs.NavigatorSearchDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    backButton = createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
    backButton.setEnabled(false);//  w w  w .j av a  2s  .  com
    backButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            ISelection sel = viewer.getSelection();
            if (!(sel instanceof StructuredSelection)) {
                return;
            }
            StructuredSelection ssel = (StructuredSelection) sel;

            int index = matchedObjects.lastIndexOf(ssel.getFirstElement());
            if (index == 0) {
                index = matchedObjects.size() - 1;
            }
            index--;
            if (index < 0) {
                index = 0;
            }
            StructuredSelection ss = new StructuredSelection(matchedObjects.get(index));
            viewer.setSelection(ss, true);
        }
    });

    nextButton = createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, false);
    nextButton.setEnabled(false);
    nextButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            ISelection sel = viewer.getSelection();
            if (!(sel instanceof StructuredSelection)) {
                return;
            }
            StructuredSelection ssel = (StructuredSelection) sel;

            int index = matchedObjects.lastIndexOf(ssel.getFirstElement());
            if (index == matchedObjects.size() - 1) {
                index = -1;
            }
            index++;
            StructuredSelection ss = new StructuredSelection(matchedObjects.get(index));
            viewer.setSelection(ss, true);
        }
    });

    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, false);
}

From source file:eu.aniketos.wp1.ststool.commitments.actions.FilterDialog.java

License:Open Source License

/**
 * Create contents of the button bar./*from w ww. j  av  a2s . com*/
 * 
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {

    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:eu.esdihumboldt.hale.io.haleconnect.ui.projects.ShareProjectWizard.java

License:Open Source License

@Override
public boolean performFinish() {
    boolean result = super.performFinish();

    if (result) {
        try {/* w w w  .  j a v a2 s.  c  o m*/
            URI clientAccessUrl = this.getProvider().getClientAccessUrl();
            MessageDialog successDialog = new MessageDialog(getShell(), "Project upload successful", null,
                    "Project was successfully uploaded to hale connect.", MessageDialog.INFORMATION,
                    new String[] { IDialogConstants.OK_LABEL }, 0) {

                @Override
                protected Control createCustomArea(Composite parent) {
                    Link link = new Link(parent, SWT.WRAP);
                    link.setText(MessageFormat.format(
                            "To access this project online, please visit the following URL (login may be required):\n<a href=\"{0}\">{0}</a>.",
                            clientAccessUrl));
                    link.addSelectionListener(new SelectionAdapter() {

                        @Override
                        public void widgetSelected(SelectionEvent e) {
                            try {
                                // Open default external browser
                                PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser()
                                        .openURL(new URL(e.text));
                            } catch (Exception ex) {
                                log.error(MessageFormat.format("Error opening browser: {0}", ex.getMessage()),
                                        e);
                            }
                        }
                    });
                    return link;
                }

            };
            successDialog.open();

            log.info(MessageFormat.format(
                    "Project was successfully uploaded to hale connect and is available online at \"{0}\"",
                    clientAccessUrl));
        } catch (IllegalArgumentException e) {
            // bad base path?
            log.error(MessageFormat.format("Error creating client access URL: {0}", e.getMessage()), e);
            log.userInfo("Project was successfully uploaded to hale connect.");
        }
    }

    return result;
}

From source file:eu.esdihumboldt.hale.ui.codelist.selector.CodeListSelectionDialog.java

License:Open Source License

/**
 * @see Dialog#createButtonsForButtonBar(Composite)
 *//*from  w ww. j a  va2  s .c  o m*/
@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);

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

    createButton(parent, NONE_ID, Messages.CodeListSelectionDialog_4, //$NON-NLS-1$
            false);
}

From source file:eu.esdihumboldt.hale.ui.common.definition.AttributeInputDialog.java

License:Open Source License

/**
 * @see Dialog#createButtonsForButtonBar(Composite)
 *//*from   ww  w .j  a v a2  s  .c o m*/
@Override
protected void createButtonsForButtonBar(Composite parent) {
    Button okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    okButton.setEnabled(editor.isValid());
}

From source file:eu.geclipse.core.sla.ui.dialogs.SlaTermInputDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {
    // create OK and Cancel buttons by default
    this.okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:eu.geclipse.ui.dialogs.AccessControlRuleDialog.java

License:Open Source License

/**
 * Create the dialog buttons. We override the superclass' method to be able
 * to modify the OK button label if each entry has to be saved individually.
 *///from  w ww . j  av  a  2  s  .com
@Override
protected void createButtonsForButtonBar(final Composite parent) {

    // We change just the label of the OK button
    String buttonText = null;
    if (this.withSaveButton) {
        buttonText = Messages.getString("AccessControlRuleDialog.save_button_text"); //$NON-NLS-1$
    } else {
        buttonText = IDialogConstants.OK_LABEL;
    }

    // TODO reenable when write support is available
    Button button;
    button = createButton(parent, IDialogConstants.OK_ID, buttonText, true);
    button.setEnabled(false);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:eu.geclipse.ui.dialogs.PasswordDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(final Composite parent) {
    // create OK and Cancel buttons by default
    this.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//w ww.java2s.  c  o  m
    this.text.setFocus();
    if (this.value != null) {
        this.text.setText(this.value);
        this.text.selectAll();
    }
}

From source file:eu.hydrologis.jgrass.uibuilder.jgrassdependent.GuiBuilderDialog.java

License:Open Source License

protected void createButtonsForButtonBar(Composite parent) {

    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
    /*// w  w  w .  j  a  v a  2 s.co m
     * add the help button
     */
    ((GridLayout) parent.getLayout()).numColumns++;
    Button helpButton = new Button(parent, SWT.PUSH);
    Image helpImg = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJS_INFO_TSK);
    helpButton.setImage(helpImg);
    helpButton.setFont(JFaceResources.getDialogFont());
    helpButton.setData(new Integer(HELP_ID));
    helpButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent event) {
            buttonPressed(((Integer) event.widget.getData()).intValue());
        }
    });
}

From source file:eu.numberfour.n4js.product.N4JSApplication.java

License:Open Source License

/**
 * Return true if the argument directory is ok to use as a workspace and false otherwise. A version check will be
 * performed, and a confirmation box may be displayed on the argument shell if an older version is detected.
 *
 * @return true if the argument URL is ok to use as a workspace and false otherwise.
 *///from   w  w w.  ja v a  2 s  . c om
private boolean checkValidWorkspace(final Shell shell, final URL url) {
    // a null url is not a valid workspace
    if (url == null) {
        return false;
    }

    if (WORKSPACE_CHECK_REFERENCE_BUNDLE_VERSION == null) {
        // no reference bundle installed, no check possible
        return true;
    }

    final Version version = readWorkspaceVersion(url);
    // if the version could not be read, then there is not any existing
    // workspace data to trample, e.g., perhaps its a new directory that
    // is just starting to be used as a workspace
    if (version == null) {
        return true;
    }

    final Version ide_version = toMajorMinorVersion(WORKSPACE_CHECK_REFERENCE_BUNDLE_VERSION);
    final Version workspace_version = toMajorMinorVersion(version);
    final int versionCompareResult = workspace_version.compareTo(ide_version);

    // equality test is required since any version difference (newer
    // or older) may result in data being trampled
    if (versionCompareResult == 0) {
        return true;
    }

    // At this point workspace has been detected to be from a version
    // other than the current ide version -- find out if the user wants
    // to use it anyhow.
    int severity;
    String title;
    String message;
    if (versionCompareResult < 0) {
        // Workspace < IDE. Update must be possible without issues,
        // so only inform user about it.
        severity = INFORMATION;
        title = IDEApplication_versionTitle_olderWorkspace;
        message = NLS.bind(IDEApplication_versionMessage_olderWorkspace, url.getFile());
    } else {
        // Workspace > IDE. It must have been opened with a newer IDE version.
        // Downgrade might be problematic, so warn user about it.
        severity = WARNING;
        title = IDEApplication_versionTitle_newerWorkspace;
        message = NLS.bind(IDEApplication_versionMessage_newerWorkspace, url.getFile());
    }

    final MessageDialog dialog = new MessageDialog(shell, title, null, message, severity,
            new String[] { IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL }, 0);
    return dialog.open() == Window.OK;
}