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

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

Introduction

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

Prototype

int OK_ID

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

Click Source Link

Document

Button id for an "Ok" button (value 0).

Usage

From source file:au.org.intersect.exsite9.view.dialogs.AbstractElementListSelectionDialog.java

License:Open Source License

/**
 * Handles default selection (double click).
 * By default, the OK button is pressed.
 *//* w  w w . ja v a 2 s .  c  o  m*/
protected void handleDefaultSelected() {
    if (validateCurrentSelection()) {
        buttonPressed(IDialogConstants.OK_ID);
    }
}

From source file:aurora.ide.helpers.StatusDialog.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   w  w w .  j ava2  s .  c om
}

From source file:bndtools.release.ErrorDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    // create OK button only
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
}

From source file:br.puc.molic.diagram.multiline.InputDialog.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/* w  w w. ja v  a  2 s.c om*/
    text.setFocus();
    if (value != null) {
        text.setText(value);
        text.selectAll();
    }
}

From source file:br.puc.molic.diagram.multiline.InputDialog.java

License:Open Source License

/**
 * Sets or clears the error message.//from w ww . j av a 2  s. c om
 * If not <code>null</code>, the OK button is disabled.
 * 
 * @param errorMessage
 *            the error message, or <code>null</code> to clear
 * @since 3.0
 */
public void setErrorMessage(String errorMessage) {
    this.errorMessage = errorMessage;
    if (errorMessageText != null && !errorMessageText.isDisposed()) {
        errorMessageText.setText(errorMessage == null ? "" : errorMessage); //$NON-NLS-1$
        errorMessageText.getParent().update();
        // Access the OK button by id, in case clients have overridden button creation.
        // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=113643
        Control button = getButton(IDialogConstants.OK_ID);
        if (button != null) {
            button.setEnabled(errorMessage == null);
        }
    }
}

From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.CodeChooserDialog.java

License:Open Source License

@Override
public void create() {
    super.create();
    setTitle(Messages.getString("dialogs.CodeChooserDialog.add")); //$NON-NLS-1$
    setMessage(Messages.getString("dialogs.CodeChooserDialog.enterName")); //$NON-NLS-1$

    getButton(IDialogConstants.OK_ID).setEnabled(false);
}

From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.CodeChooserDialog.java

License:Open Source License

/**
 * Listens for changes in the text and validates the data entered. Displays a creation
 *  warning if the code doesn't exist.// w w  w  .j  a  v a  2  s  .  co m
 * @return
 */
private ModifyListener createModifyListener() {
    return new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            CodeChooserValidator validator = new CodeChooserValidator(fCodeName.getText().trim(), fProject,
                    fFragment);
            if (!validator.isValid()) {
                if (validator.getErrorMessage()
                        .equals(Messages.getString("dialogs.CodeChooserDialog.nameTaken"))) //$NON-NLS-1$
                {
                    setErrorMessage(null);
                    setMessage(Messages.getString("dialogs.CodeChooserDialog.enterName")); //$NON-NLS-1$
                    for (Code code : fProject.getCodes()) {
                        if (code.getCodeName().equals(fCodeName.getText().trim())) {
                            fDescription.setText(code.getDescription());
                        }
                    }
                    getButton(IDialogConstants.OK_ID).setEnabled(true);
                } else {
                    setErrorMessage(validator.getErrorMessage());
                    getButton(IDialogConstants.OK_ID).setEnabled(false);
                }
            } else {
                setErrorMessage(null);
                setMessage(Messages.getString("dialogs.CodeChooserDialog.doesNotExist"), //$NON-NLS-1$
                        IMessageProvider.WARNING);
                getButton(IDialogConstants.OK_ID).setEnabled(true);
            }

        }

    };
}

From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.NewCodeDialog.java

License:Open Source License

@Override
public void create() {
    super.create();
    setTitle(Messages.getString("dialogs.NewCodeDialog.newCode")); //$NON-NLS-1$
    setMessage(Messages.getString("dialogs.NewCodeDialog.enterName")); //$NON-NLS-1$

    getButton(IDialogConstants.OK_ID).setEnabled(false);
}

From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.NewCodeDialog.java

License:Open Source License

/**
 * @return//from  www . ja v  a  2s .  co m
 */
private ModifyListener createKeyAdapter() {
    return new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            CodeValidator lValidator = new CodeValidator(fNameText.getText().trim(), fProject);

            if (!lValidator.isValid()) {
                getButton(IDialogConstants.OK_ID).setEnabled(false);
                setErrorMessage(lValidator.getErrorMessage());
            } else {
                getButton(IDialogConstants.OK_ID).setEnabled(true);
                setErrorMessage(null);
            }
        }
    };
}

From source file:ca.mcgill.cs.swevo.qualyzer.dialogs.RenameCodeDialog.java

License:Open Source License

@Override
public void create() {
    super.create();
    setTitle("Rename Code"); //$NON-NLS-1$
    setMessage("Enter a new name for the code"); //$NON-NLS-1$
    getButton(IDialogConstants.OK_ID).setEnabled(false);
}