FileDocCategorySizeDatePackage
AndroidPropertyPage.javaAPI DocAndroid 1.5 API4063Wed May 06 22:41:10 BST 2009com.android.ide.eclipse.adt.project.properties

AndroidPropertyPage

public class AndroidPropertyPage extends org.eclipse.ui.dialogs.PropertyPage implements org.eclipse.ui.IWorkbenchPropertyPage
Property page for "Android" project. This is accessible from the Package Explorer when right clicking a project and choosing "Properties".

Fields Summary
private org.eclipse.core.resources.IProject
mProject
private com.android.sdkuilib.SdkTargetSelector
mSelector
private com.android.sdkuilib.ApkConfigWidget
mApkConfigWidget
Constructors Summary
public AndroidPropertyPage()

        // pass
    
Methods Summary
protected org.eclipse.swt.widgets.ControlcreateContents(org.eclipse.swt.widgets.Composite parent)

        // get the element (this is not yet valid in the constructor).
        mProject = (IProject)getElement();

        // get the targets from the sdk
        IAndroidTarget[] targets = null;
        if (Sdk.getCurrent() != null) {
            targets = Sdk.getCurrent().getTargets();
        }

        // build the UI.
        Composite top = new Composite(parent, SWT.NONE);
        top.setLayoutData(new GridData(GridData.FILL_BOTH));
        top.setLayout(new GridLayout(1, false));

        Label l = new Label(top, SWT.NONE);
        l.setText("Project Build Target");
        
        mSelector = new SdkTargetSelector(top, targets);

        l = new Label(top, SWT.SEPARATOR | SWT.HORIZONTAL);
        l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

        l = new Label(top, SWT.NONE);
        l.setText("Project APK Configurations");

        mApkConfigWidget = new ApkConfigWidget(top);

        // fill the ui
        Sdk currentSdk = Sdk.getCurrent();
        if (currentSdk != null && mProject.isOpen()) {
            // get the target
            IAndroidTarget target = currentSdk.getTarget(mProject);
            if (target != null) {
                mSelector.setSelection(target);
            }
            
            // get the apk configurations
            Map<String, String> configs = currentSdk.getProjectApkConfigs(mProject);
            mApkConfigWidget.fillTable(configs);
        }

        mSelector.setSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                // look for the selection and validate the page if there is a selection
                IAndroidTarget target = mSelector.getSelected();
                setValid(target != null);
            }
        });
        
        if (mProject.isOpen() == false) {
            // disable the ui.
        }

        return top;
    
public booleanperformOk()

        Sdk currentSdk = Sdk.getCurrent();
        if (currentSdk != null) {
            currentSdk.setProject(mProject, mSelector.getSelected(),
                    mApkConfigWidget.getApkConfigs());
        }
        
        return true;