merged development with conflicts....

This commit is contained in:
Xavier Ducrohet
2009-04-30 17:35:21 -07:00
5 changed files with 74 additions and 132 deletions

View File

@@ -1,63 +0,0 @@
Compiling and deploying the Android Development Toolkit (ADT) feature.
The ADT feature is composed of four plugins:
- com.android.ide.eclipse.adt:
The ADT plugin, which provides support for compiling and debugging android
applications.
- com.android.ide.eclipse.common:
A common plugin providing utility services to the other plugins.
- com.android.ide.eclipse.editors:
A plugin providing optional XML editors.
- com.android.ide.eclipse.ddms:
A plugin version of the tool DDMS
Each of these live in development/tools/eclipse/plugins/
2 Features are used to distribute the plugins:
ADT, which contains ADT, ddms, common
Editors, which contains Editors, and requires the ADT feature.
The feature projects are located in development/tools/eclipse/features/
Finally 2 site projects are located in development/tools/eclipse/sites/
internal: is a site containing the features mentioned above as well as a test feature.
external: contains only the ADT and Editors features.
Basic requirements to develop on the plugins:
- Eclipse 3.3 or 3.4 with JDT and PDE.
----------------------------------
1- Loading the projects in Eclipse
----------------------------------
The plugins projects depend on jar files located in the Android source tree,
or, in some cases, built by the Android source.
Also, some source code (ddms) is located in a different location and needs to
be linked into the DDMS plugin source.
To automatize all of this, cd into development/tools/eclipse/scripts/
and run create_all_symlinks.sh
Once this has been done successfully, use the import project action in Eclipse
and point it to development/tools/eclipse. It will find all the projects in the
sub folder.
-----------------------------------------------
2- Launching/Debugging the plugins from Eclipse
-----------------------------------------------
- Open Debug Dialog.
- Create an "Eclipse Application" configuration.
- in the "Plug-ins" tab, make sure the plugins are selected (you may
want to disable the test plugin if you just want to run ADT)
-----------------------------
3- Building a new update site
-----------------------------
- From Eclipse, open the site.xml of the site project you want to build and click
"Build All" from the "Site Map" tab.

View File

@@ -35,6 +35,7 @@ import com.android.ide.eclipse.adt.launch.DeviceChooserDialog.DeviceChooserRespo
import com.android.ide.eclipse.adt.project.ApkInstallManager;
import com.android.ide.eclipse.adt.project.ProjectHelper;
import com.android.ide.eclipse.adt.sdk.Sdk;
import com.android.ide.eclipse.adt.wizards.actions.AvdManagerAction;
import com.android.ide.eclipse.common.project.AndroidManifestParser;
import com.android.ide.eclipse.common.project.BaseProjectHelper;
import com.android.prefs.AndroidLocation.AndroidLocationException;
@@ -64,6 +65,9 @@ import org.eclipse.jdt.launching.JavaRuntime;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import java.io.BufferedReader;
import java.io.IOException;
@@ -465,17 +469,7 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
// we are going to take the closest AVD. ie a compatible AVD that has the API level
// closest to the project target.
AvdInfo[] avds = avdManager.getValidAvds();
AvdInfo defaultAvd = null;
for (AvdInfo avd : avds) {
if (projectTarget.isCompatibleBaseFor(avd.getTarget())) {
if (defaultAvd == null ||
avd.getTarget().getApiVersionNumber() <
defaultAvd.getTarget().getApiVersionNumber()) {
defaultAvd = avd;
}
}
}
AvdInfo defaultAvd = findMatchingAvd(avdManager, projectTarget);
if (defaultAvd != null) {
response.setAvdToLaunch(defaultAvd);
@@ -487,13 +481,48 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
continueLaunch(response, project, launch, launchInfo, config);
return;
} else {
// FIXME: ask the user if he wants to create a AVD.
// we found no compatible AVD.
AdtPlugin.printErrorToConsole(project, String.format(
"Failed to find an AVD compatible with target '%1$s'. Launch aborted.",
AdtPlugin.printToConsole(project, String.format(
"Failed to find an AVD compatible with target '%1$s'.",
projectTarget.getName()));
stopLaunch(launchInfo);
return;
final Display display = AdtPlugin.getDisplay();
final int[] result = new int[] { Window.CANCEL };
// ask the user to create a new one.
display.syncExec(new Runnable() {
public void run() {
Shell shell = display.getActiveShell();
if (MessageDialog.openQuestion(shell, "AVD Error",
"No Compatible targets were found. Do you wish to create one?")) {
AvdManagerAction action = new AvdManagerAction();
action.run(null /*action*/);
result[0] = action.getDialogResult();
}
}
});
if (result[0] == Window.CANCEL) {
AdtPlugin.printErrorToConsole(project, String.format("Launch aborted."));
stopLaunch(launchInfo);
return;
} else {
// attempt to reload the AVDs and find one compatible.
defaultAvd = findMatchingAvd(avdManager, projectTarget);
if (defaultAvd == null) {
AdtPlugin.printErrorToConsole(project, String.format(
"Still no compatible AVDs with target '%1$s': Aborting launch.",
projectTarget.getName()));
stopLaunch(launchInfo);
} else {
response.setAvdToLaunch(defaultAvd);
AdtPlugin.printToConsole(project, String.format(
"Launching new emulator with compatible AVD '%1$s'",
defaultAvd.getName()));
continueLaunch(response, project, launch, launchInfo, config);
return;
}
}
}
} else if (hasDevice == false && compatibleRunningAvds.size() == 1) {
Entry<IDevice, AvdInfo> e = compatibleRunningAvds.entrySet().iterator().next();
@@ -557,6 +586,26 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
}
});
}
/**
* @param avdManager
* @param projectTarget
* @return
*/
private AvdInfo findMatchingAvd(AvdManager avdManager, final IAndroidTarget projectTarget) {
AvdInfo[] avds = avdManager.getValidAvds();
AvdInfo defaultAvd = null;
for (AvdInfo avd : avds) {
if (projectTarget.isCompatibleBaseFor(avd.getTarget())) {
if (defaultAvd == null ||
avd.getTarget().getApiVersionNumber() <
defaultAvd.getTarget().getApiVersionNumber()) {
defaultAvd = avd;
}
}
}
return defaultAvd;
}
/**
* Continues the launch based on the DeviceChooser response.

View File

@@ -144,8 +144,6 @@ class AvdManagerListPage extends WizardPage {
* Creates the AVD selector and refresh & delete buttons.
*/
private void createAvdGroup(Composite parent) {
int col = 0;
final Composite grid2 = new Composite(parent, SWT.NONE);
grid2.setLayout(new GridLayout(2, false /*makeColumnsEqualWidth*/));
grid2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));