Launch Option: modify loading option list using base image
authorjihye424.kim <jihye424.kim@samsung.com>
Tue, 12 May 2015 07:59:04 +0000 (16:59 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 13 May 2015 05:46:19 +0000 (14:46 +0900)
- make option list when making base image
- use this option list when crate and launch emulator

Change-Id: I1868b96c854ec7007381b9e36399bd69f94dc697
Signed-off-by: jihye424.kim <jihye424.kim@samsung.com>
common-project/src/org/tizen/emulator/manager/platform/BaseImage.java
common-project/src/org/tizen/emulator/manager/platform/CustomBaseImage.java
common-project/src/org/tizen/emulator/manager/platform/Platform.java
common-project/src/org/tizen/emulator/manager/ui/detail/PInfoViewPage.java
common-project/src/org/tizen/emulator/manager/ui/detail/PModifyViewPage.java
common-project/src/org/tizen/emulator/manager/vms/Creator.java
common-project/src/org/tizen/emulator/manager/vms/VMWorkerCommon.java
common-project/src/org/tizen/emulator/manager/vms/option/LaunchConfig.java

index 74cf2c8..407b784 100644 (file)
@@ -100,6 +100,7 @@ public class BaseImage {
                settingImagePath(path);
                initLastCreatedPropertyPath();
                loadTemplate();
+               setOptionList(platform.loadOptionList(getItemList()));
        }
 
        public List<IOption> getOptionList() {
index 4f86c5e..f6a2f65 100644 (file)
@@ -67,9 +67,10 @@ public class CustomBaseImage extends BaseImage {
 
                settingProperty(platform);
 
+               // TODO
                initLastCreatedPropertyPath();
-               loadProperty();
-               createTemplate();
+               //loadProperty();
+               //createTemplate();
        }
 
        private void settingProperty(Platform platform) {
index 3169c6b..303ebc7 100644 (file)
@@ -33,6 +33,7 @@ import java.io.File;
 import java.io.FileFilter;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.List;
 
 import org.tizen.emulator.manager.logging.EMLogger;
 import org.tizen.emulator.manager.plugin.EMPlugin;
@@ -46,6 +47,8 @@ import org.tizen.emulator.manager.vms.EmulatorVMList;
 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.ItemList;
+import org.tizen.emulator.manager.vms.option.IOption;
 
 public class Platform {
        // platform name = profile + version = profile-version
@@ -119,6 +122,18 @@ public class Platform {
                }
        }
 
+       // Load option list for each image.
+       public List<IOption> loadOptionList(ItemList itemTemplate) {
+               if (plugin != null) {
+                       ExtensionItem exItem = getPlugin().getExtensionItem(PluginStringResources.OptionFactory);
+                       IOptionFactory f = (IOptionFactory)(exItem.createClass());
+                       if (f != null) {
+                               return f.makeOptionList(itemTemplate);
+                       }
+               }
+               return null;
+       }
+
        private void loadProperties() {
                if (platformPath == null) {
                        return;
index 3e7ae60..14bdbcf 100644 (file)
@@ -356,7 +356,9 @@ class InfoViewItemList extends ViewItemList{
        private void makeItemList(Composite parent, ItemList templateList, boolean isCustom) {
                IItemListFactory f = (IItemListFactory)(exItem.createClass());
                itemList = new ArrayList<IInfoViewItem>();
-               f.makeItemList(itemList, templateList, isCustom);
+               if (f != null) {
+                       f.makeItemList(itemList, templateList, isCustom);
+               }
 //             itemList = f.getInfoItemList(deviceItemList);
        }
 
index 957dc4c..a4760cf 100644 (file)
@@ -462,7 +462,9 @@ class ModifyViewItemList extends ViewItemList{
                IItemListFactory f = (IItemListFactory)(exItem.createClass());
                itemList = new ArrayList<IModifyViewItem>();
 //             itemList = f.getModifyItemList(deviceItemList);
-               f.makeItemList(itemList, deviceItemList, isCustom);
+               if (f != null) {
+                       f.makeItemList(itemList, deviceItemList, isCustom);
+               }
        }
 
        private void makeCustomItemList(PModifyViewPage page, List<ItemList> list) {
index c8145f8..798a9ea 100644 (file)
@@ -56,6 +56,7 @@ public class Creator {
 
        private Creator(VMPropertyValue newVM) {
                this.property = EmulatorVMList.getInstance().getNewProperty(newVM.vmsName);
+               this.property.setPropertyValue(newVM);
                this.newVM = newVM;
 
                this.folder = new File(FilePathResources.getVirtualTargetPath(newVM.vmsName));
index 6a58aee..b91faec 100644 (file)
@@ -41,7 +41,6 @@ import java.util.logging.Level;
 import org.tizen.emulator.manager.EmulatorManager;
 import org.tizen.emulator.manager.EmulatorManager.ManagerModeType;
 import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.platform.PlatformList;
 import org.tizen.emulator.manager.resources.FilePathResources;
 import org.tizen.emulator.manager.resources.StringResources;
 import org.tizen.emulator.manager.ui.VMsMainView;
@@ -50,7 +49,6 @@ import org.tizen.emulator.manager.vms.helper.QemuImgProc;
 import org.tizen.emulator.manager.vms.helper.VMLauncherException;
 import org.tizen.emulator.manager.vms.helper.VMWorkerException;
 import org.tizen.emulator.manager.vms.helper.WorkerLock;
-import org.tizen.emulator.manager.vms.xml.CpuType;
 import org.tizen.emulator.manager.vms.option.IOption;
 
 public class VMWorkerCommon {
@@ -125,7 +123,7 @@ public class VMWorkerCommon {
                        }
 
                        // Do argument validation.
-                       List<IOption> optList = PlatformList.getOptionList(property);
+                       List<IOption> optList = property.getPropertyValue().baseImage.getOptionList();
                        if (optList == null) {
                                throw new VMLauncherException("Failed to get option list.");
                        }
index 3a8b59c..a2dcb7a 100644 (file)
@@ -41,7 +41,6 @@ import java.util.List;
 import java.util.Map;
 
 import org.tizen.emulator.manager.logging.EMLogger;
-import org.tizen.emulator.manager.platform.PlatformList;
 import org.tizen.emulator.manager.resources.FilePathResources;
 import org.tizen.emulator.manager.resources.StringResources;
 import org.tizen.emulator.manager.vms.VMProperty;
@@ -84,7 +83,7 @@ public class LaunchConfig {
        public static void createLaunchConfig(VMProperty property)
                        throws VMWorkerException {
                // 1. Get option list which is matched with base-image.
-               List<IOption> optList = PlatformList.getOptionList(property);
+               List<IOption> optList = property.getPropertyValue().baseImage.getOptionList();
                if (optList == null) {
                        throw new VMWorkerException("Failed to get option list.");
                }