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:hydrograph.ui.propertywindow.widgets.customwidgets.operational.OperationClassDialog.java

License:Apache License

/**
 * Create contents of the button bar./*  w w w  .  j a  v  a2  s.c om*/
 * 
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    createApplyButton(parent);

    operationClassDialogButtonBar.setPropertyDialogButtonBar(okButton, applyButton, cancelButton);
    alphanumericDecorator.hide();
    parameterDecorator.hide();
    isParameterCheckBox.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (isParameterCheckBox.getSelection()) {
                hasTextBoxAlphanumericCharactorsOnly(fileName.getText());
                if (StringUtils.isNotBlank(fileName.getText()) && !fileName.getText().startsWith("@{")
                        && !fileName.getText().endsWith("}")) {
                    fileName.setText("@{" + fileName.getText() + "}");
                    fileName.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 255));
                }
            } else {
                if (StringUtils.isNotBlank(fileName.getText()) && fileName.getText().startsWith("@{")) {
                    fileName.setText(fileName.getText().substring(2, fileName.getText().length() - 1));
                    fileName.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 255));
                }
                okButton.setEnabled(true);
                applyButton.setEnabled(true);
                alphanumericDecorator.hide();
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    fileName.addVerifyListener(new VerifyListener() {

        @Override
        public void verifyText(VerifyEvent e) {
            String currentText = ((Text) e.widget).getText();
            String textBoxValue = (currentText.substring(0, e.start) + e.text + currentText.substring(e.end))
                    .trim();
            if (isParameterCheckBox.getSelection()) {
                if (StringUtils.isNotBlank(textBoxValue)
                        && (!textBoxValue.startsWith("@{") || !textBoxValue.endsWith("}"))) {
                    ((Text) e.widget)
                            .setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 255));
                    parameterDecorator.show();
                    emptyDecorator.hide();
                    okButton.setEnabled(false);
                    applyButton.setEnabled(false);
                } else {
                    ((Text) e.widget)
                            .setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 204));
                    emptyDecorator.show();
                    parameterDecorator.hide();
                    okButton.setEnabled(true);
                    hasTextBoxAlphanumericCharactorsOnly(textBoxValue);
                }
            } else {
                if (StringUtils.isNotBlank(textBoxValue)) {
                    ((Text) e.widget)
                            .setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 255));
                    applyButton.setEnabled(true);
                    isParameterCheckBox.setEnabled(true);
                    emptyDecorator.hide();
                } else {
                    ((Text) e.widget)
                            .setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 204));
                    isParameterCheckBox.setEnabled(false);
                    emptyDecorator.show();
                }
            }
        }
    });

}

From source file:hydrograph.ui.propertywindow.widgets.customwidgets.operational.TransformDialog.java

License:Apache License

/**
 * Create contents of the button bar.//  w w  w  . j  a v  a  2  s. c om
 * 
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    Button okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    Button cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL,
            false);
    propertyDialogButtonBar.setPropertyDialogButtonBar(okButton, null, cancelButton);
}

From source file:hydrograph.ui.propertywindow.widgets.dialog.hiveInput.HivePartitionKeyValueDialog.java

License:Apache License

/**
 * Create contents of the button bar.//from   w w w.j a v  a2s  .  c  om
 * 
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {

    parent.setLayout(new GridLayout(1, false));
    parent.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout(1, false));
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    addErrorLabel(composite);

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

From source file:hydrograph.ui.propertywindow.widgets.dialogs.ELTOperationClassDialog.java

License:Apache License

/**
 * Create contents of the button bar.//from w w w.j  ava  2s .c  o m
 * 
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);

    createApplyButton(parent);

    operationClassDialogButtonBar.setPropertyDialogButtonBar(okButton, applyButton, cancelButton);
    alphanumericDecorator.hide();
    parameterDecorator.hide();

    isParameterCheckBox.addSelectionListener(new SelectionListener() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            if (isParameterCheckBox.getSelection()) {
                hasTextBoxAlphanumericCharactorsOnly(fileName.getText());
                if (StringUtils.isNotBlank(fileName.getText()) && !fileName.getText().startsWith("@{")
                        && !fileName.getText().endsWith("}")) {
                    fileName.setText("@{" + fileName.getText() + "}");
                    fileName.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 255));
                }
            } else {
                if (StringUtils.isNotBlank(fileName.getText()) && fileName.getText().startsWith("@{")) {
                    fileName.setText(fileName.getText().substring(2, fileName.getText().length() - 1));
                    fileName.setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 255));
                }
                okButton.setEnabled(true);
                applyButton.setEnabled(true);
                alphanumericDecorator.hide();
            }
        }

        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });
    fileName.addVerifyListener(new VerifyListener() {

        @Override
        public void verifyText(VerifyEvent e) {
            String currentText = ((Text) e.widget).getText();
            String textBoxValue = (currentText.substring(0, e.start) + e.text + currentText.substring(e.end))
                    .trim();
            if (isParameterCheckBox.getSelection()) {
                classNotPresentDecorator.hide();
                if (StringUtils.isNotBlank(textBoxValue)
                        && (!textBoxValue.startsWith("@{") || !textBoxValue.endsWith("}"))) {
                    ((Text) e.widget)
                            .setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 255));
                    parameterDecorator.show();
                    emptyDecorator.hide();
                    okButton.setEnabled(false);
                    applyButton.setEnabled(false);
                } else {
                    ((Text) e.widget)
                            .setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 204));
                    emptyDecorator.show();
                    parameterDecorator.hide();
                    okButton.setEnabled(true);
                    hasTextBoxAlphanumericCharactorsOnly(textBoxValue);
                }
            } else {
                if (StringUtils.isBlank(textBoxValue)) {
                    ((Text) e.widget)
                            .setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 204));
                    isParameterCheckBox.setEnabled(false);
                    classNotPresentDecorator.hide();
                    emptyDecorator.show();
                } else {
                    emptyDecorator.hide();
                    if (!(ValidatorUtility.INSTANCE.isClassFilePresentOnBuildPath(textBoxValue))) {
                        classNotPresentDecorator.show();
                    } else {
                        classNotPresentDecorator.hide();
                    }
                    ((Text) e.widget)
                            .setBackground(CustomColorRegistry.INSTANCE.getColorFromRegistry(255, 255, 255));
                    applyButton.setEnabled(true);
                    isParameterCheckBox.setEnabled(true);

                }
            }
        }
    });

}

From source file:icecaptools.launching.arduino.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/*from w w  w.  j  a v  a  2  s. co m*/
    this.text.setFocus();
    if (this.value != null) {
        this.text.setText(this.value);
        this.text.selectAll();
    }
}

From source file:io.aos.jface.sample.spl02.JFaceSample02.java

License:Apache License

private Action createAboutAction() {
    return new Action() {
        public String getText() {
            return "Essai";
        }//from  w  w  w . ja  v a2 s  . c o  m

        public void run() {
            String[] tab = { IDialogConstants.OK_LABEL };
            MessageDialog dialog = new MessageDialog(getShell(), "Essai JFace", null,
                    "Ceci est une fentre d''information", MessageDialog.INFORMATION, tab, 0);
            dialog.open();
        }
    };
}

From source file:io.aos.jface.sample.spl02.JFaceSample02.java

License:Apache License

protected void handleShellCloseEvent() {
    String[] tab = { IDialogConstants.OK_LABEL };
    MessageDialog dialog = new MessageDialog(getShell(), "Fin de l'essai", null,
            "Nous allons quitter l'application", MessageDialog.INFORMATION, tab, 0);
    dialog.open();/*  w  w  w .  j  a v  a 2  s .  c  o m*/
    setReturnCode(CANCEL);
    close();
}

From source file:io.takari.stats.m2e.internal.UsageStatsDialog.java

License:Open Source License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true).setFocus();
}

From source file:io.usethesource.impulse.preferences.fields.details.DetailsDialogForBooleanFields.java

License:Open Source License

/**
* Add buttons to the dialog's button bar.
* 
* Subclasses should override./*from  www.  jav  a2 s .  c  o  m*/
* 
* @param parent
*            the button bar composite
*/
protected void createButtonsForButtonBar(Composite parent) {
    parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Button removeButton = createButton(parent, REMOVE_ID, PreferenceDialogConstants.REMOVE_LABEL, false);
    removeButton.setEnabled(field.getChangeControl().isEnabled() && (field.getPreferencesLevel() != null)
            && field.getPreferencesLevel().equals(field.getLevelFromWhichLoaded()) && field.isRemovable());

    Label l = new Label(parent, SWT.NONE);
    l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    GridLayout layout = (GridLayout) parent.getLayout();
    layout.numColumns++;
    layout.makeColumnsEqualWidth = false;

    Button b = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    b.setFocus();
}

From source file:io.usethesource.impulse.preferences.fields.details.DetailsDialogForColorFields.java

License:Open Source License

/**
* Add buttons to the dialog's button bar.
* 
* Subclasses should override.//w w w  . j a  v  a 2  s  .  c om
* 
* @param parent
*            the button bar composite
*/
protected void createButtonsForButtonBar(Composite parent) {
    parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    if (!field.getPreferencesLevel().equals(IPreferencesService.DEFAULT_LEVEL)) {
        copyButton = createButton(parent, COPY_ID, PreferenceDialogConstants.COPY_LABEL, false);
        copyButton.setEnabled(field.getPreferencesLevel() != null && field.isInherited()
                && field.getColorSelector().getButton().isEnabled());
    }

    //           emptyButton = createButton(parent, EMPTY_ID, PreferenceDialogConstants.EMPTY_LABEL, false);
    //           emptyButton.setEnabled(field.getPreferencesLevel() != null &&
    //                 field.isEmptyStringAllowed() && field.getComboBoxControl(parent).isEnabled());

    removeButton = createButton(parent, REMOVE_ID, PreferenceDialogConstants.REMOVE_LABEL, false);
    removeButton.setEnabled((field.getPreferencesLevel() != null) && !field.isInherited() && field.isRemovable()
            && field.getColorSelector().getButton().isEnabled());

    Label l = new Label(parent, SWT.NONE);
    l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    GridLayout layout = (GridLayout) parent.getLayout();
    layout.numColumns++;
    layout.makeColumnsEqualWidth = false;

    Button b = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
    b.setFocus();
}