Bug Fix: change loading option list function
authorjihye424.kim <jihye424.kim@samsung.com>
Wed, 13 May 2015 07:26:49 +0000 (16:26 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Wed, 13 May 2015 07:54:11 +0000 (16:54 +0900)
- bug: loading only first platform's plug-in
- fix: delay calling plug-in function until completed plug-in list

Change-Id: Ife79dc03a7cd879a63d8ea432d8bd563a268d905
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/Platform.java
common-project/src/org/tizen/emulator/manager/platform/PlatformList.java
common-project/src/org/tizen/emulator/manager/platform/ProfileList.java

index 407b784..14f71ce 100644 (file)
@@ -100,17 +100,15 @@ public class BaseImage {
                settingImagePath(path);
                initLastCreatedPropertyPath();
                loadTemplate();
-               setOptionList(platform.loadOptionList(getItemList()));
        }
 
        public List<IOption> getOptionList() {
+               if (optionList == null) {
+                       optionList = platform.loadOptionList(getItemList());
+               }
                return optionList;
        }
 
-       public void setOptionList(List<IOption> optionList) {
-               this.optionList = optionList;
-       }
-
        public VMProperty getDefaultProperty() {
                return defaultProperty;
        }
index 26a9f9b..f90048d 100644 (file)
@@ -117,19 +117,6 @@ public class Platform {
        }
 
        // Load option list for each image.
-       public void loadOptionList() {
-               if (plugin != null) {
-                       ExtensionItem exItem = getPlugin().getExtensionItem(PluginStringResources.OptionFactory);
-                       IOptionFactory f = (IOptionFactory)(exItem.createClass());
-                       if (f != null) {
-                               for (BaseImage img : imageList) {
-                                       img.setOptionList(f.makeOptionList(img.getItemList()));
-                               }
-                       }
-               }
-       }
-
-       // Load option list for each image.
        public List<IOption> loadOptionList(ItemList itemTemplate) {
                if (plugin != null) {
                        ExtensionItem exItem = getPlugin().getExtensionItem(PluginStringResources.OptionFactory);
@@ -141,7 +128,7 @@ public class Platform {
                return null;
        }
 
-       // Load option list for each image.
+       // Load option list for custom image
        public List<IOption> getCustomOptionList() {
                if (customOptionList == null) {
                        if (plugin != null) {
index a3dbc4a..bc381d1 100644 (file)
@@ -143,16 +143,7 @@ public class PlatformList {
                checkLastCreatedPropertyFile();
 
                // Load option list
-               loadOptionList();
-       }
-
-       private static void loadOptionList() {
-               for (Platform p : platformList) {
-                       p.loadOptionList();
-               }
-               for (Platform cp : customList) {
-                       cp.loadOptionList();
-               }
+               //loadOptionList();
        }
 
        private static void addProfile(String profile) {
index 676664c..4b02239 100644 (file)
@@ -60,6 +60,20 @@ public class ProfileList {
                return totalProfile;
        }
 
+       public static Profile findProfile(String profileName) {
+               if (profileList == null) {
+                       initProfileList();
+               }
+
+               for (Profile profile : profileList) {
+                       if (profile.getName().equals(profileName)) {
+                               return profile;
+                       }
+               }
+
+               return null;
+       }
+
        private static void initProfileList() {
                profileList = new ArrayList<Profile>();