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.sdkuilib.internal.repository.UpdateChooserDialog.java

License:Apache License

private void updateLicenceRadios(ArchiveInfo ai) {
    if (mInternalLicenseRadioUpdate) {
        return;/* www . java2s.c  om*/
    }
    mInternalLicenseRadioUpdate = true;

    boolean oneAccepted = false;

    if (mLicenseAcceptAll) {
        mLicenseRadioAcceptAll.setSelection(true);
        mLicenseRadioAccept.setEnabled(true);
        mLicenseRadioReject.setEnabled(true);
        mLicenseRadioAccept.setSelection(false);
        mLicenseRadioReject.setSelection(false);
    } else {
        mLicenseRadioAcceptAll.setSelection(false);
        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.widgets.AvdCreationDialog.java

License:Apache License

@Override
protected Control createContents(Composite parent) {
    Control control = super.createContents(parent);
    getShell().setText(mEditAvdInfo == null ? "Create new Android Virtual Device (AVD)"
            : "Edit Android Virtual Device (AVD)");

    mOkButton = getButton(IDialogConstants.OK_ID);

    fillExistingAvdInfo();//from   www. j av  a  2  s .c o m
    validatePage();

    return control;
}

From source file:com.android.sdkuilib.internal.widgets.AvdCreationSwtView.java

License:Apache License

@Override
protected Control createContents(Composite parent) {
    // super.createContents will call createDialogContent()
    // below and then continue here.
    Control control = super.createContents(parent);
    getShell().setMinimumSize(new Point(350, 600));

    mBtnOK = getButton(IDialogConstants.OK_ID);

    registerControlMap();//from   w ww .j a  v a2  s  . c o m
    mPresenter.onViewInit();

    return control;
}

From source file:com.android.sdkuilib.internal.widgets.AvdStartDialog.java

License:Apache License

@Override
protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
    if (id == IDialogConstants.OK_ID) {
        label = "Launch";
    }// ww w.j a va  2s.c om

    return super.createButton(parent, id, label, defaultButton);
}

From source file:com.android.sdkuilib.internal.widgets.DeviceCreationDialog.java

License:Apache License

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

    mOkButton = getButton(IDialogConstants.OK_ID);

    if (mDevice == null) {
        getShell().setText("Create New Device");
    } else {// w  w w . jav a2s.c o m
        if (mUserDevices.contains(mDevice)) {
            getShell().setText("Edit Device");
        } else {
            getShell().setText("Clone Device");
        }
    }

    Object ld = mOkButton.getLayoutData();
    if (ld instanceof GridData) {
        ((GridData) ld).widthHint = 100;
    }

    validatePage();

    return control;
}

From source file:com.android.sdkuilib.internal.widgets.ResolutionChooserDialog.java

License:Apache License

@Override
protected Control createContents(Composite parent) {
    Control control = super.createContents(parent);
    mButton = getButton(IDialogConstants.OK_ID);
    mButton.setEnabled(false);/*from  w w w. j  a v a 2s.  c om*/
    return control;
}

From source file:com.android.uiautomator.ControlDefineDialog.java

License:Apache License

/**
 * Create contents of the button bar./*from  ww  w .  j av  a  2s.  c o  m*/
 *
 * @param parent
 */
@Override
protected void createButtonsForButtonBar(Composite parent) {
    mOkButton = createButton(parent, IDialogConstants.OK_ID, "", true);
    mOkButton.addListener(SWT.Selection, new Listener() {
        @Override
        public void handleEvent(Event event) {
            saveFile();
        }
    });
    createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
}

From source file:com.android.uiautomator.OpenDialog.java

License:Apache License

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

From source file:com.apicloud.navigator.dialogs.AddFeatureDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    if (buttonId == IDialogConstants.OK_ID) {
        if (selectFeature == null) {
            MessageDialog.openInformation(getShell(), Messages.AddFeatureDialog_INFORMATION,
                    Messages.AddFeatureDialog_MESSAGE);
            return;
        }//w ww.j ava2s. c om
        for (Feature feature : config.getFeatures()) {
            if (feature.getName().equals(selectFeature.getName())) {
                MessageDialog.openInformation(getShell(), Messages.AddFeatureDialog_INFORMATION,
                        Messages.CreateFeatureDialog_FEATURE_NAME_DUP);
                return;
            }
        }
        if (text_urlScheme.isVisible() && text_urlScheme.getText().isEmpty()) {
            MessageDialog.openInformation(getShell(), Messages.AddFeatureDialog_INFORMATION,
                    lblParamkey.getText().trim() + Messages.AddFeatureDialog_MESSAGE_NULL);
            return;
        }
        if (text_apiKey.isVisible() && text_apiKey.getText().isEmpty()) {
            MessageDialog.openInformation(getShell(), Messages.AddFeatureDialog_INFORMATION,
                    lblParamvalue.getText().trim() + Messages.AddFeatureDialog_MESSAGE_NULL);
            return;
        }
        feature = new Feature();
        feature.setName(selectFeature.getName());
        if (text_urlScheme.isVisible()) {
            Param p = new Param();
            p.setName("urlScheme");
            if (feature.getName().equals("baiduMap")) {
                p.setName("android_api_key");
            }

            p.setValue(text_urlScheme.getText());
            feature.getParams().add(p);
        }
        if (text_apiKey.isVisible()) {
            Param p = new Param();
            p.setName("apiKey");
            if (feature.getName().equals("baiduMap")) {
                p.setName("ios_api_key");
            }
            p.setValue(text_apiKey.getText());
            feature.getParams().add(p);
        }

        config.addFeature(feature);
        TreeNode node = new TreeNode(feature);
        treeViewer.setInput(config.createTreeNode());
        treeViewer.collapseAll();
        StructuredSelection selection = new StructuredSelection(node);
        treeViewer.setSelection(selection, true);
        treeViewer.refresh();
        editor.setDirty(true);
        editor.change();
    }
    super.buttonPressed(buttonId);
}

From source file:com.apicloud.navigator.dialogs.CreateFeatureDialog.java

License:Open Source License

@Override
protected void buttonPressed(int buttonId) {
    setErrorMessage(null);/* ww  w .j  a v a 2 s  .co m*/
    if (buttonId == IDialogConstants.OK_ID) {
        if ("".equals(this.featureNameText.getText())) { //$NON-NLS-1$
            setErrorMessage(Messages.CreateFeatureDialog_FEATURE_NMAE_NOT_NULL);
            return;
        }
        for (Feature feature : config.getFeatures()) {
            if (feature.getName().equals(this.featureNameText.getText())) {
                setErrorMessage(Messages.CreateFeatureDialog_FEATURE_NAME_DUP);
                return;
            }
        }
        feature = new Feature();
        feature.setName(this.featureNameText.getText());
        config.addFeature(feature);
        TreeNode node = new TreeNode(feature);
        treeViewer.setInput(config.createTreeNode());
        treeViewer.collapseAll();
        StructuredSelection selection = new StructuredSelection(node);
        treeViewer.setSelection(selection, true);
        treeViewer.refresh();
        editor.setDirty(true);
        editor.change();
    }
    super.buttonPressed(buttonId);
}