Custom Emulator: enable to launch and modify custom vm
authorjihye424.kim <jihye424.kim@samsung.com>
Wed, 13 May 2015 04:20:28 +0000 (13:20 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 13 May 2015 05:46:35 +0000 (14:46 +0900)
- add template, item list, option list to platform for custom base image
- use template, item list of platform drawing custom emulator on detail view
- use option list of platform launching custom emulator

Change-Id: Ib0c2c3e1ec3cd7eb1fbd8109752156ff3baaecd2
Signed-off-by: jihye424.kim <jihye424.kim@samsung.com>
common-project/src/org/tizen/emulator/manager/platform/CustomBaseImage.java
common-project/src/org/tizen/emulator/manager/platform/CustomPlatform.java
common-project/src/org/tizen/emulator/manager/platform/Platform.java
common-project/src/org/tizen/emulator/manager/ui/detail/DetailViewPage.java
common-project/src/org/tizen/emulator/manager/ui/detail/PInfoViewPage.java
common-project/src/org/tizen/emulator/manager/ui/detail/PModifyViewPage.java

index f6a2f65..533d54f 100644 (file)
@@ -31,27 +31,17 @@ package org.tizen.emulator.manager.platform;
 
 import java.io.File;
 import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashSet;
 import java.util.List;
-import java.util.Set;
 
 import org.tizen.emulator.manager.resources.FilePathResources;
 import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.ui.detail.item.OptionType;
-import org.tizen.emulator.manager.vms.EmulatorVMList;
 import org.tizen.emulator.manager.vms.SKIN_SHAPE;
-import org.tizen.emulator.manager.vms.xml.template.DeviceList;
-import org.tizen.emulator.manager.vms.xml.template.Item;
+import org.tizen.emulator.manager.vms.VMProperty;
+import org.tizen.emulator.manager.vms.option.IOption;
 import org.tizen.emulator.manager.vms.xml.template.ItemList;
-import org.tizen.emulator.manager.vms.xml.template.ObjectFactory;
-import org.tizen.emulator.manager.vms.xml.template.Option;
-import org.tizen.emulator.manager.vms.xml.template.PropertyList;
 
 public class CustomBaseImage extends BaseImage {
 
-       public static ObjectFactory factory = new ObjectFactory();
-
        public CustomBaseImage(Platform platform, String path) throws IOException {
                if (platform == null) {
                        throw new IOException("Failed to create custom base image "
@@ -69,8 +59,6 @@ public class CustomBaseImage extends BaseImage {
 
                // TODO
                initLastCreatedPropertyPath();
-               //loadProperty();
-               //createTemplate();
        }
 
        private void settingProperty(Platform platform) {
@@ -82,6 +70,7 @@ public class CustomBaseImage extends BaseImage {
                binaryVersion = "";
        }
 
+       @Override
        protected void initLastCreatedPropertyPath() {
                StringBuilder sb = new StringBuilder();
                sb.append(FilePathResources.getTizenVmsPath()).append(File.separator)
@@ -91,268 +80,18 @@ public class CustomBaseImage extends BaseImage {
                lastCreatedPropertyPath = sb.toString();
        }
 
-       // Create template from standard platform's template.
-       private void createTemplate() {
-               if (PlatformList.getPlatformList() != null) {
-                       for (Platform p : PlatformList.getPlatformList()) {
-                               if (p.getProfile().equals(profile)) {
-                                       List<ItemList> templateList = new ArrayList<ItemList>();
-                                       for(BaseImage i : p.getImageList()) {
-                                               if (i.getItemList() != null) {
-                                                       templateList.add(i.getItemList());
-                                               }
-                                       }
-                                       itemList = createCustomTemplate(templateList);
-                               }
-                       }
-               }
+       @Override
+       public List<IOption> getOptionList() {
+               return platform.getCustomOptionList();
        }
 
-
-
-       private void loadProperty() {
-               // load default
-               File propertyFile = new File(platform.platformPath + File.separator
-                               + FilePathResources.getPlatformTemplatePath()
-                               + File.separator
-                               + imageName + "." + PlatformStringResources.CONFIG_EXTENSION);
-               if (propertyFile.exists()) {
-                       EmulatorVMList vmList = EmulatorVMList.getInstance();
-                       defaultProperty = vmList.parseXML(propertyFile);
-
-               } else {
-                       // If custom default property not exist, load standard property
-                       if (PlatformList.getPlatformList() != null) {
-                               Platform latest = null;
-                               for (Platform p : PlatformList.getPlatformList()) {
-                                       if (p.getProfile().equals(profile)) {
-                                               if (latest == null) {
-                                                       latest = p;
-                                               } else {
-                                                       if (p.getVersion().compareTo(latest.getVersion()) > 0) {
-                                                               latest = p;
-                                                       }
-                                               }
-                                       }
-                               }
-
-                               if (latest != null) {
-                                       for (BaseImage image : latest.getImageList()) {
-                                               if (image.getType() != null && image.getType().equals("default")) {
-                                                       defaultProperty = image.getDefaultProperty();
-                                               }
-                                       }
-                                       if (defaultProperty == null) {
-                                               if (latest.getImageList().size() > 0) {
-                                                       defaultProperty = latest.getImageList().get(0).getDefaultProperty();
-                                               }
-                                       }
-                               }
-                               // TODO  if defaultProperty == null ???
-                       }
-               }
+       @Override
+       public VMProperty getDefaultProperty() {
+               return platform.getCustomDefaultProperty();
        }
 
-       private ItemList createCustomTemplate(List<ItemList> templateList) {
-
-               if (templateList.size() == 0) {
-                       return null;
-
-               } else if (templateList.size() == 1) {
-                       ItemList template = cloneTemplate(templateList.get(0));
-                       template.setImage(null);
-                       return template;
-
-               } else { // Make union set
-                       ItemList base = cloneTemplate(templateList.get(0));
-                       for (int i=1 ; i < templateList.size() ; i++) {
-                               addToBase(base,templateList.get(i));
-                       }
-                       return base;
-               }
-       }
-
-       private void addToBase(ItemList base, ItemList newOne) {
-               // Property list add
-               PropertyList newPropertyList = newOne.getPropertyList();
-               PropertyList basePropertyList = base.getPropertyList();
-               if (newPropertyList != null) {
-                       if (basePropertyList == null) {
-                               basePropertyList = factory.createPropertyList();
-                               base.setPropertyList(basePropertyList);
-                       }
-                       for (Item newItem : newPropertyList.getItem()) {
-                               boolean itemExistInBase = false;
-                               for (Item baseItem : basePropertyList.getItem()) {
-                                       if (baseItem.getName().equals(newItem.getName())) {
-                                               itemExistInBase = true;
-                                               joinItem(baseItem, newItem);
-                                       }
-                               }
-                               if (!itemExistInBase) {
-                                       basePropertyList.getItem().add(cloneItem(newItem));
-                               }
-                       }
-               }
-
-               // Device list add
-               DeviceList newDeviceList = newOne.getDeviceList();
-               DeviceList baseDeviceList = base.getDeviceList();
-               if (newDeviceList != null) {
-                       if (baseDeviceList == null) {
-                               baseDeviceList = factory.createDeviceList();
-                               base.setDeviceList(baseDeviceList);
-                       }
-                       for (Item newItem : newDeviceList.getItem()) {
-                               boolean itemExistInBase = false;
-                               for (Item baseItem : baseDeviceList.getItem()) {
-                                       if (baseItem.getName().equals(newItem.getName())) {
-                                               itemExistInBase = true;
-                                               joinItem(baseItem, newItem);
-                                       }
-                               }
-                               if (!itemExistInBase) {
-                                       baseDeviceList.getItem().add(cloneItem(newItem));
-                               }
-                       }
-               }
-       }
-
-
-       private void joinItem(Item baseItem, Item newItem) {
-               // join sub items
-               for (Item newSub : newItem.getItem()) {
-                       boolean itemExistInBase = false;
-                       for (Item baseSub : baseItem.getItem()) {
-                               if (baseSub.getName().equals(newSub.getName())) {
-                                       itemExistInBase = true;
-                                       joinItem(baseSub, newSub);
-                               }
-                       }
-                       if (!itemExistInBase) {
-                               baseItem.getItem().add(cloneItem(newSub));
-                       }
-               }
-               // join options
-               for (Option newOption : newItem.getOption()) {
-                       boolean optionExistInBase = false;
-                       for (Option baseOption : baseItem.getOption()) {
-                               if (baseOption.getName().equals(newOption.getName())) {
-                                       optionExistInBase = true;
-                                       if (isListOption(baseOption, newOption)) {
-                                               joinOption(baseOption, newOption);
-                                       }
-                               }
-                       }
-
-                       if (!optionExistInBase) {
-                               baseItem.getOption().add(cloneOption(newOption));
-                       }
-               }
-
-       }
-
-       private void joinOption(Option baseOption, Option newOption) {
-               baseOption.setValue(joinCommaString(baseOption.getValue(), newOption.getValue()));
-       }
-
-
-       private String joinCommaString(String base, String newOne) {
-               List<String> optionList = new ArrayList<String>();
-               if (base != null) {
-                       String[] split = base.split(",");
-                       for (String str : split) {
-                               optionList.add(str.trim());
-                       }
-               }
-               if (newOne != null) {
-                       String[] split = newOne.split(",");
-                       for (String str : split) {
-                               optionList.add(str.trim());
-                       }
-               }
-
-               if (optionList.size() > 0) {
-                       Set<String> optionSet = new HashSet<String>();
-                       optionSet.addAll(optionList);
-                       optionList.clear();
-                       optionList.addAll(optionSet);
-//                     Collections.sort(optionList);
-                       StringBuilder sb = new StringBuilder();
-
-                       for (int i=0 ; i<optionList.size() ; i++) {
-                               sb.append(optionList.get(i));
-                               if (i < optionList.size()-1) {
-                                       sb.append(",");
-                               }
-                       }
-
-                       return sb.toString();
-               }
-
-               return null;
-       }
-
-       private ItemList cloneTemplate(ItemList template) {
-               ItemList newTemplate = factory.createItemList();
-               newTemplate.setProfile(template.getProfile());
-               newTemplate.setImage(template.getImage());
-
-               // clone property list
-               PropertyList propertyList = template.getPropertyList();
-               if (propertyList != null) {
-                       PropertyList newPropertyList = factory.createPropertyList();
-                       newTemplate.setPropertyList(newPropertyList);
-
-                       for (Item item : propertyList.getItem()) {
-                               newPropertyList.getItem().add(cloneItem(item));
-                       }
-               }
-
-               // clone device list.
-               DeviceList deviceList = template.getDeviceList();
-               if (deviceList != null) {
-                       DeviceList newDeviceList = factory.createDeviceList();
-                       newTemplate.setDeviceList(newDeviceList);
-
-                       for (Item item : deviceList.getItem()) {
-                               newDeviceList.getItem().add(cloneItem(item));
-                       }
-               }
-
-               return newTemplate;
-       }
-
-       private Item cloneItem(Item item) {
-               Item newItem = factory.createItem();
-               newItem.setType(item.getType());
-               newItem.setName(item.getName());
-               newItem.setTitle(item.getTitle());
-
-               for (Option option : item.getOption()) {
-                       newItem.getOption().add(cloneOption(option));
-               }
-
-               for (Item subItem : item.getItem()) {
-                       newItem.getItem().add(cloneItem(subItem));
-               }
-
-               return newItem;
-       }
-
-       private Option cloneOption(Option option) {
-               Option newOption = factory.createOption();
-               newOption.setName(option.getName());
-               newOption.setValue(option.getValue());
-               return newOption;
-       }
-
-       private boolean isListOption(Option baseOption, Option newOption) {
-               if (baseOption.getName().equals(OptionType.COMBO_LIST.getName())
-                               && newOption.getName().equals(OptionType.COMBO_LIST.getName())) {
-                       return true;
-               }
-
-               return false;
+       @Override
+       public ItemList getItemList() {
+               return platform.getCustomItemList();
        }
 }
index 8790233..6b7e8d3 100644 (file)
@@ -92,10 +92,11 @@ public class CustomPlatform extends Platform {
                                }
                        }
                }
-
+/*
                if (latest != null) {
                        template = latest.getTemplate();
                }
+               */
        }
 
        private void loadPlugin() {
index 303ebc7..73d9e8f 100644 (file)
@@ -33,7 +33,9 @@ import java.io.File;
 import java.io.FileFilter;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 
 import org.tizen.emulator.manager.logging.EMLogger;
 import org.tizen.emulator.manager.plugin.EMPlugin;
@@ -43,11 +45,16 @@ import org.tizen.emulator.manager.plugin.PluginStringResources;
 import org.tizen.emulator.manager.resources.FilePathResources;
 import org.tizen.emulator.manager.resources.StringResources;
 import org.tizen.emulator.manager.tool.SettingInfoFile;
-import org.tizen.emulator.manager.vms.EmulatorVMList;
+import org.tizen.emulator.manager.ui.detail.item.OptionType;
 import org.tizen.emulator.manager.vms.RESOLUTION;
 import org.tizen.emulator.manager.vms.VMProperty;
 import org.tizen.emulator.manager.vms.option.IOptionFactory;
+import org.tizen.emulator.manager.vms.xml.template.DeviceList;
+import org.tizen.emulator.manager.vms.xml.template.Item;
 import org.tizen.emulator.manager.vms.xml.template.ItemList;
+import org.tizen.emulator.manager.vms.xml.template.ObjectFactory;
+import org.tizen.emulator.manager.vms.xml.template.Option;
+import org.tizen.emulator.manager.vms.xml.template.PropertyList;
 import org.tizen.emulator.manager.vms.option.IOption;
 
 public class Platform {
@@ -60,13 +67,14 @@ public class Platform {
        protected static int id = 1;
        protected boolean isOldVersion = false;
 
-       // TODO : for skins
        protected ArrayList<Skin>skinList = new ArrayList<Skin>();
-       // TODO : for template
-       //private ArrayList<VMProperty> templateList = new ArrayList<VMProperty>();
-       protected VMProperty template;
        protected EMPlugin plugin;
 
+       // for custom base image
+       private ItemList customItemList;
+       private VMProperty customDefaultProperty;
+       private List<IOption> customOptionList;
+
        protected ArrayList<BaseImage> imageList = new ArrayList<BaseImage>();
        protected int currentImageIndex = -1;
        protected Platform() {
@@ -82,7 +90,6 @@ public class Platform {
                loadProperties();
                if (!imageList.isEmpty()) {
                        loadSkins();
-                       loadTemplate();
                        loadPlugin();
                }
        }
@@ -134,6 +141,20 @@ public class Platform {
                return null;
        }
 
+       // Load option list for each image.
+       public List<IOption> getCustomOptionList() {
+               if (customOptionList == null) {
+                       if (plugin != null) {
+                               ExtensionItem exItem = getPlugin().getExtensionItem(PluginStringResources.OptionFactory);
+                               IOptionFactory f = (IOptionFactory)(exItem.createClass());
+                               if (f != null) {
+                                       customOptionList =  f.makeOptionList(getCustomItemList());
+                               }
+                       }
+               }
+               return customOptionList;
+       }
+
        private void loadProperties() {
                if (platformPath == null) {
                        return;
@@ -266,6 +287,56 @@ public class Platform {
                }
        }
 
+
+       private void createCustomDefaultProperty() {
+               // If custom default property not exist, load standard property
+               for (BaseImage image : getProfileClass().getImageList()) {
+                       if (image.getPlatform() == this) {
+                               if (image.getType() != null && image.getType().equals("default")) {
+                                       customDefaultProperty = image.getDefaultProperty();
+                               }
+                       }
+               }
+
+               if (customDefaultProperty == null) {
+                       for (BaseImage image : getProfileClass().getImageList()) {
+                               if (image.getPlatform() == this) {
+                                       customDefaultProperty = image.getDefaultProperty();
+                               }
+                       }
+               }
+               // TODO: if customDefaultProperty is still null ???
+       }
+
+       private void createCustomItemList() {
+               List<ItemList> templateList = new ArrayList<ItemList>();
+               for (BaseImage image : getProfileClass().getImageList()) {
+                       if (image.getPlatform() == this) {
+                               templateList.add(image.getItemList());
+                       }
+               }
+               customItemList = createCustomTemplate(templateList);
+       }
+
+       private ItemList createCustomTemplate(List<ItemList> templateList) {
+
+               if (templateList.size() == 0) {
+                       return null;
+
+               } else if (templateList.size() == 1) {
+                       ItemList template = cloneTemplate(templateList.get(0));
+                       template.setImage(null);
+                       return template;
+
+               } else { // Make union set
+                       ItemList base = cloneTemplate(templateList.get(0));
+                       for (int i=1 ; i < templateList.size() ; i++) {
+                               addToBase(base,templateList.get(i));
+                       }
+                       return base;
+               }
+       }
+
        private void loadPlugin() {
                File pluginJar = new File(platformPath + File.separator
                                + FilePathResources.getPlatformPluginsPath()
@@ -280,18 +351,6 @@ public class Platform {
                }
        }
 
-       private void loadTemplate() {
-               File templateFile = new File(platformPath + File.separator
-                                                       + FilePathResources.getPlatformTemplatePath()
-                                                       + File.separator
-                                                       + PlatformStringResources.TemplateFile);
-               if (templateFile.exists()) {
-                       EmulatorVMList vmList = EmulatorVMList.getInstance();
-                       VMProperty property = vmList.parseXML(templateFile);
-                       template = property;
-               }
-       }
-
        private void loadSkins() {
                File dir = new File(platformPath + File.separator
                                                        + FilePathResources.getPlatformSkinsPath());
@@ -350,19 +409,6 @@ public class Platform {
                return SkinList.getInstance().findGeneralSkinList(skinList);
        }
 
-/*
-       public ArrayList<VMProperty> getTemplates() {
-               return templateList;
-       }
-*/
-       public VMProperty getTemplate() {
-               return template;
-       }
-
-       public void setTemplate(VMProperty template) {
-               this.template = template;
-       }
-
        public EMPlugin getPlugin() {
                return plugin;
        }
@@ -378,4 +424,204 @@ public class Platform {
        public void setProfileClass(Profile profileClass) {
                this.profileClass = profileClass;
        }
+
+       public ItemList getCustomItemList() {
+               if (customItemList == null) {
+                       createCustomItemList();
+               }
+
+               return customItemList;
+       }
+
+       public VMProperty getCustomDefaultProperty() {
+               if (customDefaultProperty == null) {
+                       createCustomDefaultProperty();
+               }
+               return customDefaultProperty;
+       }
+
+       public static ObjectFactory factory = new ObjectFactory();
+       private void addToBase(ItemList base, ItemList newOne) {
+               // Property list add
+               PropertyList newPropertyList = newOne.getPropertyList();
+               PropertyList basePropertyList = base.getPropertyList();
+               if (newPropertyList != null) {
+                       if (basePropertyList == null) {
+                               basePropertyList = factory.createPropertyList();
+                               base.setPropertyList(basePropertyList);
+                       }
+                       for (Item newItem : newPropertyList.getItem()) {
+                               boolean itemExistInBase = false;
+                               for (Item baseItem : basePropertyList.getItem()) {
+                                       if (baseItem.getName().equals(newItem.getName())) {
+                                               itemExistInBase = true;
+                                               joinItem(baseItem, newItem);
+                                       }
+                               }
+                               if (!itemExistInBase) {
+                                       basePropertyList.getItem().add(cloneItem(newItem));
+                               }
+                       }
+               }
+
+               // Device list add
+               DeviceList newDeviceList = newOne.getDeviceList();
+               DeviceList baseDeviceList = base.getDeviceList();
+               if (newDeviceList != null) {
+                       if (baseDeviceList == null) {
+                               baseDeviceList = factory.createDeviceList();
+                               base.setDeviceList(baseDeviceList);
+                       }
+                       for (Item newItem : newDeviceList.getItem()) {
+                               boolean itemExistInBase = false;
+                               for (Item baseItem : baseDeviceList.getItem()) {
+                                       if (baseItem.getName().equals(newItem.getName())) {
+                                               itemExistInBase = true;
+                                               joinItem(baseItem, newItem);
+                                       }
+                               }
+                               if (!itemExistInBase) {
+                                       baseDeviceList.getItem().add(cloneItem(newItem));
+                               }
+                       }
+               }
+       }
+
+
+       private void joinItem(Item baseItem, Item newItem) {
+               // join sub items
+               for (Item newSub : newItem.getItem()) {
+                       boolean itemExistInBase = false;
+                       for (Item baseSub : baseItem.getItem()) {
+                               if (baseSub.getName().equals(newSub.getName())) {
+                                       itemExistInBase = true;
+                                       joinItem(baseSub, newSub);
+                               }
+                       }
+                       if (!itemExistInBase) {
+                               baseItem.getItem().add(cloneItem(newSub));
+                       }
+               }
+               // join options
+               for (Option newOption : newItem.getOption()) {
+                       boolean optionExistInBase = false;
+                       for (Option baseOption : baseItem.getOption()) {
+                               if (baseOption.getName().equals(newOption.getName())) {
+                                       optionExistInBase = true;
+                                       if (isListOption(baseOption, newOption)) {
+                                               joinOption(baseOption, newOption);
+                                       }
+                               }
+                       }
+
+                       if (!optionExistInBase) {
+                               baseItem.getOption().add(cloneOption(newOption));
+                       }
+               }
+
+       }
+
+       private void joinOption(Option baseOption, Option newOption) {
+               baseOption.setValue(joinCommaString(baseOption.getValue(), newOption.getValue()));
+       }
+
+
+       private String joinCommaString(String base, String newOne) {
+               List<String> optionList = new ArrayList<String>();
+               if (base != null) {
+                       String[] split = base.split(",");
+                       for (String str : split) {
+                               optionList.add(str.trim());
+                       }
+               }
+               if (newOne != null) {
+                       String[] split = newOne.split(",");
+                       for (String str : split) {
+                               optionList.add(str.trim());
+                       }
+               }
+
+               if (optionList.size() > 0) {
+                       Set<String> optionSet = new HashSet<String>();
+                       optionSet.addAll(optionList);
+                       optionList.clear();
+                       optionList.addAll(optionSet);
+//                     Collections.sort(optionList);
+                       StringBuilder sb = new StringBuilder();
+
+                       for (int i=0 ; i<optionList.size() ; i++) {
+                               sb.append(optionList.get(i));
+                               if (i < optionList.size()-1) {
+                                       sb.append(",");
+                               }
+                       }
+
+                       return sb.toString();
+               }
+
+               return null;
+       }
+
+       private ItemList cloneTemplate(ItemList template) {
+               ItemList newTemplate = factory.createItemList();
+               newTemplate.setProfile(template.getProfile());
+               newTemplate.setImage(template.getImage());
+
+               // clone property list
+               PropertyList propertyList = template.getPropertyList();
+               if (propertyList != null) {
+                       PropertyList newPropertyList = factory.createPropertyList();
+                       newTemplate.setPropertyList(newPropertyList);
+
+                       for (Item item : propertyList.getItem()) {
+                               newPropertyList.getItem().add(cloneItem(item));
+                       }
+               }
+
+               // clone device list.
+               DeviceList deviceList = template.getDeviceList();
+               if (deviceList != null) {
+                       DeviceList newDeviceList = factory.createDeviceList();
+                       newTemplate.setDeviceList(newDeviceList);
+
+                       for (Item item : deviceList.getItem()) {
+                               newDeviceList.getItem().add(cloneItem(item));
+                       }
+               }
+
+               return newTemplate;
+       }
+
+       private Item cloneItem(Item item) {
+               Item newItem = factory.createItem();
+               newItem.setType(item.getType());
+               newItem.setName(item.getName());
+               newItem.setTitle(item.getTitle());
+
+               for (Option option : item.getOption()) {
+                       newItem.getOption().add(cloneOption(option));
+               }
+
+               for (Item subItem : item.getItem()) {
+                       newItem.getItem().add(cloneItem(subItem));
+               }
+
+               return newItem;
+       }
+
+       private Option cloneOption(Option option) {
+               Option newOption = factory.createOption();
+               newOption.setName(option.getName());
+               newOption.setValue(option.getValue());
+               return newOption;
+       }
+
+       private boolean isListOption(Option baseOption, Option newOption) {
+               if (baseOption.getName().equals(OptionType.COMBO_LIST.getName())
+                               && newOption.getName().equals(OptionType.COMBO_LIST.getName())) {
+                       return true;
+               }
+
+               return false;
+       }
 }
index 290d666..5262f63 100644 (file)
@@ -40,6 +40,7 @@ import org.eclipse.swt.layout.FormLayout;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Label;
 import org.tizen.emulator.manager.platform.CustomBaseImage;
+import org.tizen.emulator.manager.platform.Platform;
 import org.tizen.emulator.manager.plugin.ExtensionItem;
 import org.tizen.emulator.manager.resources.ColorResources;
 import org.tizen.emulator.manager.resources.FontResources;
@@ -300,19 +301,19 @@ class ViewItemList {
 //     ArrayList<IInfoViewItem> itemList;
 //     ArrayList<IModifyViewItem> itemList;
 //     ArrayList<? extends IViewItem> itemList;
-       String profile;
+       Platform platform;
        String imageName;
        boolean isCustom;
 
-       public ViewItemList(ExtensionItem exItem, String profile, String imageName, boolean isCustom) {
+       public ViewItemList(ExtensionItem exItem, Platform platform, String imageName, boolean isCustom) {
                this.exItem = exItem;
-               this.profile = profile;
+               this.platform = platform;
                this.imageName = imageName;
                this.isCustom = isCustom;
        }
 
        public boolean matchesWith(VMPropertyValue propertyValue) {
-               if (!profile.equals(propertyValue.profile)) {
+               if (platform != propertyValue.baseImage.getPlatform()) {
                        return false;
                } else {
                        if (imageName != null && !imageName.equals(propertyValue.baseImage.getName())) {
index 14bdbcf..7a0f105 100644 (file)
@@ -205,20 +205,12 @@ public class PInfoViewPage extends DetailViewPage {
                                                        if (template != null) {
                                                                templateList.add(template);
                                                                infoItemList.add(new InfoViewItemList(item, this.getItemListComposite(),
-                                                                               template, platform.getProfile(), image.getName(), false));
+                                                                               template, platform, image.getName(), false));
                                                        }
                                                }
-
-                                               // TODO
-                                               // add itemlist for custom.
-                                               /*
-                                               for (Platform custom : PlatformList.getCustomPlatform()) {
-                                                       if (custom.getProfile().equals(platform.getProfile())) {
-                                                               infoItemList.add(new InfoViewItemList(item, this.getItemListComposite(),
-                                                                               custom.getImageList().get(0).getItemList(), custom.getProfile(), null, true));
-                                                       }
-                                               }
-                                               */
+                                               // add item list for custom.
+                                               infoItemList.add(new InfoViewItemList(item, this.getItemListComposite(),
+                                                               platform.getCustomItemList(), platform, null, true));
                                        }
                                }
                        }
@@ -340,19 +332,12 @@ class InfoViewItemList extends ViewItemList{
        ArrayList<IInfoViewItem> itemList;
 
        InfoViewItemList(ExtensionItem item, Composite parent, ItemList template,
-                       String profile, String imageName, boolean isCustom) {
-               super(item, profile, imageName, isCustom);
+                       Platform platform, String imageName, boolean isCustom) {
+               super(item, platform, imageName, isCustom);
                makeItemList(parent, template, isCustom);
                initItemList(parent);
        }
 
-       InfoViewItemList(ExtensionItem item, Composite parent, List<ItemList> list, String profile) {
-               super(item, profile, null, true);
-               makeCustomItemList(parent, list);
-               initItemList(parent);
-       }
-
-
        private void makeItemList(Composite parent, ItemList templateList, boolean isCustom) {
                IItemListFactory f = (IItemListFactory)(exItem.createClass());
                itemList = new ArrayList<IInfoViewItem>();
@@ -362,12 +347,6 @@ class InfoViewItemList extends ViewItemList{
 //             itemList = f.getInfoItemList(deviceItemList);
        }
 
-       private void makeCustomItemList(Composite parent, List<ItemList> list) {
-               IItemListFactory f = (IItemListFactory)(exItem.createClass());
-               itemList = new ArrayList<IInfoViewItem>();
-               f.makeCustomItemList(itemList, list);
-       }
-
        private void initItemList(Composite parent){
                comp = new Composite(parent, SWT.NONE);
                comp.setLayout(new FormLayout());
index a4760cf..224cf42 100644 (file)
@@ -43,7 +43,6 @@ import org.eclipse.swt.widgets.Composite;
 import org.tizen.emulator.manager.logging.EMLogger;
 import org.tizen.emulator.manager.platform.BaseImage;
 import org.tizen.emulator.manager.platform.Platform;
-import org.tizen.emulator.manager.platform.PlatformList;
 import org.tizen.emulator.manager.platform.Profile;
 import org.tizen.emulator.manager.platform.ProfileList;
 import org.tizen.emulator.manager.plugin.ExtensionItem;
@@ -184,20 +183,12 @@ public class PModifyViewPage extends DetailViewPage
                                                        if (template != null) {
                                                                templateList.add(template);
                                                                modifyItemList.add(new ModifyViewItemList(item, this,
-                                                                               template, platform.getProfile(), image.getName(), false));
+                                                                               template, platform, image.getName(), false));
                                                        }
                                                }
-
-                                               // TODO
-                                               // add itemlist for custom.
-                                               /*
-                                               for (Platform custom : PlatformList.getCustomPlatform()) {
-                                                       if (custom.getProfile().equals(platform.getProfile())) {
-                                                               modifyItemList.add(new ModifyViewItemList(item, this,
-                                                                               custom.getImageList().get(0).getItemList(), custom.getProfile(), null, true));
-                                                       }
-                                               }
-                                               */
+                                               // add item list for custom.
+                                               modifyItemList.add(new ModifyViewItemList(item, this,
+                                                               platform.getCustomItemList(), platform, null, true));
                                        }
                                }
                        }
@@ -446,18 +437,12 @@ class ModifyViewItemList extends ViewItemList{
        ArrayList<IModifyViewItem> itemList;
 
        ModifyViewItemList(ExtensionItem item, PModifyViewPage page, ItemList template
-                       ,String profile, String imageName, boolean isCustom) {
-               super(item, profile, imageName, isCustom);
+                       ,Platform platform, String imageName, boolean isCustom) {
+               super(item, platform, imageName, isCustom);
                makeItemList(page, template, isCustom);
                initItemList(page);
        }
 
-       ModifyViewItemList(ExtensionItem item, PModifyViewPage page, List<ItemList> list, String profile) {
-               super(item, profile, null, true);
-               makeCustomItemList(page, list);
-               initItemList(page);
-       }
-
        private void makeItemList(PModifyViewPage page, ItemList deviceItemList, boolean isCustom) {
                IItemListFactory f = (IItemListFactory)(exItem.createClass());
                itemList = new ArrayList<IModifyViewItem>();
@@ -467,12 +452,6 @@ class ModifyViewItemList extends ViewItemList{
                }
        }
 
-       private void makeCustomItemList(PModifyViewPage page, List<ItemList> list) {
-               IItemListFactory f = (IItemListFactory)(exItem.createClass());
-               itemList = new ArrayList<IModifyViewItem>();
-               f.makeCustomItemList(itemList, list);
-       }
-
        private void initItemList(PModifyViewPage page) {
                comp = new Composite(page.getItemListComposite(), SWT.NONE);
                comp.setLayout(new FormLayout());