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:com.android.ide.eclipse.adt.ui.ResourceChooser.java

License:Open Source License

private void createNewString() {
    ExtractStringRefactoring ref = new ExtractStringRefactoring(mProject, true /*enforceNew*/);
    RefactoringWizard wizard = new ExtractStringWizard(ref, mProject);
    RefactoringWizardOpenOperation op = new RefactoringWizardOpenOperation(wizard);
    try {//  w w  w  .j  a  v a 2 s .  c  o  m
        IWorkbench w = PlatformUI.getWorkbench();
        if (op.run(w.getDisplay().getActiveShell(), wizard.getDefaultPageTitle()) == IDialogConstants.OK_ID) {

            // Recompute the "current resource" to select the new id
            setupResourceList();

            // select it if possible
            selectItemName(ref.getXmlStringId());
        }
    } catch (InterruptedException ex) {
        // Interrupted. Pass.
    }
}

From source file:com.android.ide.eclipse.auidt.internal.launch.DeviceChooserDialog.java

License:Open Source License

/**
 * Create the button bar: We override the Dialog implementation of this method
 * so that we can create the checkbox at the same level as the 'Cancel' and 'OK' buttons.
 *///www  .  j  av a 2 s.c o m
@Override
protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout(1, false);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    mUseDeviceForFutureLaunchesCheckbox = new Button(composite, SWT.CHECK);
    mUseDeviceForFutureLaunchesCheckbox.setSelection(sUseDeviceForFutureLaunchesValue);
    mResponse.setUseDeviceForFutureLaunches(sUseDeviceForFutureLaunchesValue);
    mUseDeviceForFutureLaunchesCheckbox.setText("Use same device for future launches");
    mUseDeviceForFutureLaunchesCheckbox.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            sUseDeviceForFutureLaunchesValue = mUseDeviceForFutureLaunchesCheckbox.getSelection();
            mResponse.setUseDeviceForFutureLaunches(sUseDeviceForFutureLaunchesValue);
        }
    });
    mUseDeviceForFutureLaunchesCheckbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

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

    return composite;
}

From source file:com.android.ide.eclipse.ddms.LogCatMonitorDialog.java

License:Apache License

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

From source file:com.android.ide.eclipse.gltrace.GLTraceCollectorDialog.java

License:Apache License

@Override
protected Control createButtonBar(Composite parent) {
    Composite c = new Composite(parent, SWT.NONE);
    c.setLayout(new GridLayout(0, false));
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalAlignment = GridData.CENTER;
    c.setLayoutData(gd);/*from  w  w w  .j  a v  a  2 s. c  o  m*/

    createButton(c, IDialogConstants.OK_ID, "Stop Tracing", true);
    return c;
}

From source file:com.android.ide.eclipse.gltrace.GLTraceOptionsDialog.java

License:Apache License

@Override
protected void createButtonsForButtonBar(Composite parent) {
    super.createButtonsForButtonBar(parent);

    mOkButton = getButton(IDialogConstants.OK_ID);
    mOkButton.setText("Trace");

    DialogStatus status = validateDialog();
    mOkButton.setEnabled(status.valid);// ww  w. j a v  a2  s. c  o m
}

From source file:com.android.ide.eclipse.monitor.SdkLocationChooserDialog.java

License:Apache License

private void validateInstall() {
    SdkToolsLocator locator = new SdkToolsLocator(new File(mTextBox.getText()));
    SdkInstallStatus status = locator.isValidInstallation();
    if (status.isValid()) {
        mStatusLabel.setText("");
        getButton(IDialogConstants.OK_ID).setEnabled(true);
    } else {//  www. j  a v a 2  s . c  o m
        mStatusLabel.setText(status.getErrorMessage());
        mStatusLabel.pack();
        getButton(IDialogConstants.OK_ID).setEnabled(false);
    }
}

From source file:com.android.sdkuilib.ApkConfigEditDialog.java

License:Apache License

@Override
protected Control createContents(Composite parent) {
    Control control = super.createContents(parent);

    mOkButton = getButton(IDialogConstants.OK_ID);
    validateButtons();//  w w  w  .j  a v  a2 s  . c  o m

    return control;
}

From source file:com.android.sdkuilib.internal.repository.SdkUpdaterChooserDialog.java

License:Apache License

/**
 * Creates and returns the contents of this dialog's button bar.
 * <p/>/*  www  .ja  v  a 2 s .  c  o  m*/
 * This reimplements most of the code from the base class with a few exceptions:
 * <ul>
 * <li>Enforces 3 columns.
 * <li>Inserts a full-width error label.
 * <li>Inserts a help label on the left of the first button.
 * <li>Renames the OK button into "Install"
 * </ul>
 */
@Override
protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // this is incremented by createButton
    layout.makeColumnsEqualWidth = false;
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    composite.setLayout(layout);
    GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1);
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());

    // Error message area
    mErrorLabel = new Label(composite, SWT.NONE);
    mErrorLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));

    // Label at the left of the install/cancel buttons
    Label label = new Label(composite, SWT.NONE);
    label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    label.setText("[*] Something depends on this package");
    label.setEnabled(false);
    layout.numColumns++;

    // Add the ok/cancel to the button bar.
    createButtonsForButtonBar(composite);

    // the ok button should be an "install" button
    Button button = getButton(IDialogConstants.OK_ID);
    button.setText("Install");

    return composite;
}

From source file:com.android.sdkuilib.internal.repository.SdkUpdaterChooserDialog.java

License:Apache License

private void updateLicenceRadios(ArchiveInfo ai) {
    if (mInternalLicenseRadioUpdate) {
        return;//www. ja v a2  s . co  m
    }
    mInternalLicenseRadioUpdate = true;

    boolean oneAccepted = false;

    mLicenseRadioAcceptLicense.setSelection(mAcceptSameAllLicense);
    oneAccepted = ai != null && ai.isAccepted();
    mLicenseRadioAccept.setEnabled(ai != null);
    mLicenseRadioReject.setEnabled(ai != null);
    mLicenseRadioAccept.setSelection(oneAccepted);
    mLicenseRadioReject.setSelection(ai != null && ai.isRejected());

    // The install button is enabled if there's at least one package accepted.
    // If the current one isn't, look for another one.
    boolean missing = mErrorLabel.getText() != null && mErrorLabel.getText().length() > 0;
    if (!missing && !oneAccepted) {
        for (ArchiveInfo ai2 : mArchives) {
            if (ai2.isAccepted()) {
                oneAccepted = true;
                break;
            }
        }
    }

    getButton(IDialogConstants.OK_ID).setEnabled(!missing && oneAccepted);

    mInternalLicenseRadioUpdate = false;
}

From source file:com.android.sdkuilib.internal.repository.UpdateChooserDialog.java

License:Apache License

/**
 * Creates and returns the contents of this dialog's button bar.
 * <p/>/*from  ww  w .ja  v a2  s . com*/
 * This reimplements most of the code from the base class with a few exceptions:
 * <ul>
 * <li>Enforces 3 columns.
 * <li>Inserts a full-width error label.
 * <li>Inserts a help label on the left of the first button.
 * <li>Renames the OK button into "Install"
 * </ul>
 */
@Override
protected Control createButtonBar(Composite parent) {

    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // this is incremented by createButton
    layout.makeColumnsEqualWidth = false;
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    composite.setLayout(layout);
    GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1);
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());

    // Error message area
    mErrorLabel = new Label(composite, SWT.NONE);
    mErrorLabel.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 3, 1));

    // Label at the left of the install/cancel buttons
    Label label = new Label(composite, SWT.NONE);
    label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    label.setText("[*] Something depends on this package");
    label.setEnabled(false);
    layout.numColumns++;

    // Add the ok/cancel to the button bar.
    createButtonsForButtonBar(composite);

    // the ok button should be an "install" button
    Button button = getButton(IDialogConstants.OK_ID);
    button.setText("Install");

    return composite;
}