From 01aeccafa050a483b1939959939bdc70db6da73c Mon Sep 17 00:00:00 2001 From: "minkee.lee" Date: Tue, 14 Oct 2014 20:23:00 +0900 Subject: [PATCH] Property: Add base-image(platform) information to Custom VM. Change-Id: I5d87ad66746b3680ab9cf83e836659b8d87862fa Signed-off-by: minkee.lee --- .../manager/ui/detail/item/CommonItemListFactory.java | 10 ++++++---- .../tizen/emulator/manager/ui/detail/item/OptionType.java | 3 ++- .../manager/ui/detail/item/property/BaseImageViewItem.java | 2 +- .../manager/ui/detail/item/template/ComboSubViewItem.java | 4 ++-- .../src/org/tizen/emulator/manager/vms/Creator.java | 6 +++--- .../src/org/tizen/emulator/manager/vms/Modifier.java | 6 ++++++ .../src/org/tizen/emulator/manager/vms/VMPropertyValue.java | 12 ++++++++++++ 7 files changed, 32 insertions(+), 11 deletions(-) diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/CommonItemListFactory.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/CommonItemListFactory.java index cb42c41..39d12db 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/CommonItemListFactory.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/CommonItemListFactory.java @@ -71,7 +71,8 @@ public abstract class CommonItemListFactory implements IItemListFactory{ public static ObjectFactory factory = new ObjectFactory(); // Override if need. - public void makePropertyItemList(List list, PropertyList propertyList) { + public void makePropertyItemList(List list, PropertyList propertyList, + String profile, boolean isStandard) { if (propertyList != null) { List itemList = (List)list; List propertyItemList = propertyList.getItem(); @@ -157,8 +158,9 @@ public abstract class CommonItemListFactory implements IItemListFactory{ } if (templateList.size() == 1) { - makePropertyItemList(list, templateList.get(0).getPropertyList()); - makeDeviceItemList(list, templateList.get(0).getDeviceList()); + ItemList item = templateList.get(0); + makePropertyItemList(list, item.getPropertyList(), item.getProfile(), false); + makeDeviceItemList(list, item.getDeviceList()); return; } @@ -168,7 +170,7 @@ public abstract class CommonItemListFactory implements IItemListFactory{ for (int i=1 ; i < templateList.size() ; i++) { addToBase(base,templateList.get(i)); } - makePropertyItemList(list, base.getPropertyList()); + makePropertyItemList(list, base.getPropertyList(), base.getProfile(), false); makeDeviceItemList(list, base.getDeviceList()); } } diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/OptionType.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/OptionType.java index 86da2b2..7a3ada5 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/OptionType.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/OptionType.java @@ -40,7 +40,8 @@ public enum OptionType { DISABLE_ON_CREATE("disableOnCreate"), HIDE_LABEL("hideLabel"), DEFAULT_IF_EMPTY("defaultIfEmpty"), - SPREAD_ON_START("spreadOnStart") + SPREAD_ON_START("spreadOnStart"), + PROFILE("profile") ; private String name; diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/BaseImageViewItem.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/BaseImageViewItem.java index ee2f025..bed13d4 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/BaseImageViewItem.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/property/BaseImageViewItem.java @@ -217,7 +217,7 @@ public class BaseImageViewItem extends FileViewItem { } - private boolean checkBaseImageFile(String baseImagePath){ + public static boolean checkBaseImageFile(String baseImagePath){ if (baseImagePath == null || baseImagePath.isEmpty()) { return false; } diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ComboSubViewItem.java b/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ComboSubViewItem.java index de7be47..6f2666a 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ComboSubViewItem.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/item/template/ComboSubViewItem.java @@ -62,8 +62,8 @@ public class ComboSubViewItem extends SubViewItem { protected Image INPUTBOX_ON_IMAGE = null; protected static int COMBO_WIDTH = 105; - private boolean useDefaultOnCreate = false; - private String defaultOnCreate = null; + protected boolean useDefaultOnCreate = false; + protected String defaultOnCreate = null; public ComboSubViewItem(LabelViewItem parentItem, Composite comp, Item template) { super(parentItem, comp, template); diff --git a/common-project/src/org/tizen/emulator/manager/vms/Creator.java b/common-project/src/org/tizen/emulator/manager/vms/Creator.java index 20cc9b9..88b2669 100644 --- a/common-project/src/org/tizen/emulator/manager/vms/Creator.java +++ b/common-project/src/org/tizen/emulator/manager/vms/Creator.java @@ -283,13 +283,13 @@ public class Creator { // TODO : temp name ec.getBaseInformation().getDiskImage().setVersion("Standard"); } - if (newVM.baseName != null) { - ec.getBaseInformation().getDiskImage().setBase(newVM.baseName); - } } else { ec.getBaseInformation().getDiskImage().setType("custom"); ec.getBaseInformation().setArchitecture(EmulatorVMList.getInstance().CustomArch); } + if (newVM.baseName != null) { + ec.getBaseInformation().getDiskImage().setBase(newVM.baseName); + } // ec.getBaseInformation().getDiskImage().setProfile(newVM.profile); diff --git a/common-project/src/org/tizen/emulator/manager/vms/Modifier.java b/common-project/src/org/tizen/emulator/manager/vms/Modifier.java index ddd41f1..9a9d31b 100644 --- a/common-project/src/org/tizen/emulator/manager/vms/Modifier.java +++ b/common-project/src/org/tizen/emulator/manager/vms/Modifier.java @@ -128,6 +128,12 @@ public class Modifier { } } + if (newVM.baseName != null) { // baseName can be modified only in Custom VM. + if (!newVM.baseName.equals(oldVM.baseName)) { + property.getConfiguration().getBaseInformation().getDiskImage().setBase(newVM.baseName); + } + } + if (newVM.addOptions != null) { if (oldVM.addOptions == null || !newVM.addOptions.equals(oldVM.addOptions)) { property.getConfiguration().getUsability().setAdvancedOptions(newVM.addOptions); diff --git a/common-project/src/org/tizen/emulator/manager/vms/VMPropertyValue.java b/common-project/src/org/tizen/emulator/manager/vms/VMPropertyValue.java index 6d649e3..4090f11 100644 --- a/common-project/src/org/tizen/emulator/manager/vms/VMPropertyValue.java +++ b/common-project/src/org/tizen/emulator/manager/vms/VMPropertyValue.java @@ -124,6 +124,7 @@ public class VMPropertyValue implements Cloneable { if (baseImagePathName == null) { baseImagePathName = template.getPropertyValue().baseImagePathName; } + baseName = template.getConfiguration().getBaseInformation().getDiskImage().getBase(); } } else { isStandard = true; @@ -276,6 +277,17 @@ public class VMPropertyValue implements Cloneable { return false; } + if (this.baseName != null) { + if (dest.baseName == null + || (dest.baseName != null && !this.baseName.equals(dest.baseName))) { + return false; + } + } else { + if (dest.baseName != null) { + return false; + } + } + if (this.maxTouchCount != dest.maxTouchCount) { return false; } -- 2.7.4