diff options
author | Tor Norbye <tnorbye@google.com> | 2012-08-27 12:45:20 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2012-08-27 12:48:25 -0700 |
commit | 5e306f55c4aa8a72fa208e082af74821c667e623 (patch) | |
tree | c5fda766e5e0686aec457d37aa55ca439d8a7e53 | |
parent | 1c83e8dac67c956be8561dbcb497a5a4f169fbe5 (diff) | |
download | sdk-5e306f55c4aa8a72fa208e082af74821c667e623.zip sdk-5e306f55c4aa8a72fa208e082af74821c667e623.tar.gz sdk-5e306f55c4aa8a72fa208e082af74821c667e623.tar.bz2 |
Inline devices if there is only one manufacturer
Currently the device pulldown shows a single item,
"Generic", which itself contains the various generic
devices. This CL tweaks the display code such that if
there is just a single manufacturer, the items are
inlined in the top level menu.
Change-Id: If150becaa7dfe225f9ec8e861be1d67ede4f30c4
-rw-r--r-- | eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java index 9287787..6c4df9b 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationComposite.java @@ -68,8 +68,8 @@ import com.android.sdklib.AndroidVersion; import com.android.sdklib.IAndroidTarget; import com.android.sdklib.devices.Device; import com.android.sdklib.devices.DeviceManager; -import com.android.sdklib.devices.State; import com.android.sdklib.devices.DeviceManager.DevicesChangeListener; +import com.android.sdklib.devices.State; import com.android.sdklib.internal.avd.AvdInfo; import com.android.sdklib.internal.avd.AvdManager; import com.android.sdklib.repository.PkgProps; @@ -1885,10 +1885,13 @@ public class ConfigurationComposite extends Composite devices.add(device); } for (List<Device> devices : manufacturers.values()) { - MenuItem item = new MenuItem(menu, SWT.CASCADE); - item.setText(devices.get(0).getManufacturer()); - Menu manufacturerMenu = new Menu(menu); - item.setMenu(manufacturerMenu); + Menu manufacturerMenu = menu; + if (manufacturers.size() > 1) { + MenuItem item = new MenuItem(menu, SWT.CASCADE); + item.setText(devices.get(0).getManufacturer()); + manufacturerMenu = new Menu(menu); + item.setMenu(manufacturerMenu); + } for (final Device d : devices) { MenuItem deviceItem = new MenuItem(manufacturerMenu, SWT.CHECK); deviceItem.setText(d.getName()); @@ -1904,7 +1907,6 @@ public class ConfigurationComposite extends Composite }); } } - } // TODO - how do I dispose of this? |