// 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;