diff --git a/plugins/android-designer/src/com/intellij/android/designer/profile/ProfileManager.java b/plugins/android-designer/src/com/intellij/android/designer/profile/ProfileManager.java index 740453efbca6..687cf123c4bd 100644 --- a/plugins/android-designer/src/com/intellij/android/designer/profile/ProfileManager.java +++ b/plugins/android-designer/src/com/intellij/android/designer/profile/ProfileManager.java @@ -44,6 +44,7 @@ import java.util.*; * @author Alexander Lobas */ public class ProfileManager { + private static final LayoutDevice NO_DEVICES = new LayoutDevice("[None]", LayoutDevice.Type.CUSTOM); private static final LayoutDevice CUSTOM_DEVICE = new LayoutDevice("Edit Devices", LayoutDevice.Type.CUSTOM); private final ModuleProvider myModuleProvider; @@ -84,6 +85,9 @@ public class ProfileManager { @Override protected boolean selectionChanged(LayoutDevice item) { + if (item == NO_DEVICES) { + return false; + } if (item == CUSTOM_DEVICE) { configureCustomDevices(false); } @@ -455,6 +459,9 @@ public class ProfileManager { if (sdkData != null) { myLayoutDeviceManager.loadDevices(sdkData); myDevices = new ArrayList(myLayoutDeviceManager.getCombinedList()); + if (myDevices.isEmpty()) { + myDevices.add(NO_DEVICES); + } myDevices.add(CUSTOM_DEVICE); targets = new ArrayList(); @@ -465,7 +472,7 @@ public class ProfileManager { } } else { - myDevices = Collections.emptyList(); + myDevices = Arrays.asList(NO_DEVICES); } LayoutDevice newDevice = null; @@ -536,8 +543,17 @@ public class ProfileManager { private void updateDevice(@Nullable LayoutDevice device, @Nullable String configurationName) { myProfile.setDevice(device == null ? null : device.getName()); - List configurations = - device == null ? Collections.emptyList() : device.getConfigurations(); + List configurations; + if (device == null) { + configurations = Collections.emptyList(); + } + else { + configurations = device.getConfigurations(); + if (configurations == null) { + configurations = Collections.emptyList(); + } + } + LayoutDeviceConfiguration newConfiguration = null; if (configurationName != null) {