Template: Use standard template file if image template file doesn't exist.
authorminkee.lee <minkee.lee@samsung.com>
Wed, 17 Sep 2014 11:19:43 +0000 (20:19 +0900)
committerminkee.lee <minkee.lee@samsung.com>
Wed, 17 Sep 2014 12:11:04 +0000 (21:11 +0900)
- If image's template file doesn't exist,
  use "x86-standard-template.xml" and "x86-standard.xml" for VM property.
  If image is for arm, "arm-standard... .xml" will be used.
- If standard file also doesn't exist, fail message is displayed.

Change-Id: I243ec3db21e042b765b2d3a69aa69a719ceca354
Signed-off-by: minkee.lee <minkee.lee@samsung.com>
common-project/src/org/tizen/emulator/manager/platform/BaseImage.java
common-project/src/org/tizen/emulator/manager/ui/detail/PInfoViewPage.java
common-project/src/org/tizen/emulator/manager/ui/detail/PModifyViewPage.java

index a5fb2c9..7f4bf8f 100644 (file)
@@ -297,6 +297,15 @@ public class BaseImage {
                                + imageName + "-" + PlatformStringResources.TEMPLATE
                                + "." + PlatformStringResources.CONFIG_EXTENSION);
 
+               if (!templateFile.exists()) {
+                       // load standard-template file (x86-standard-template.xml)
+                       templateFile = new File(platform.platformPath + File.separator
+                                       + FilePathResources.getPlatformTemplatePath()
+                                       + File.separator
+                                       + cpu + "-standard-" + PlatformStringResources.TEMPLATE
+                                       + "." + PlatformStringResources.CONFIG_EXTENSION);
+               }
+
                if (templateFile.exists()) {
                        JAXBElement<ItemList> element = null;
                        try {
@@ -313,12 +322,19 @@ public class BaseImage {
                        }
                }
 
-
                // load default
                File propertyFile = new File(platform.platformPath + File.separator
                                + FilePathResources.getPlatformTemplatePath()
                                + File.separator
                                + imageName + "." + PlatformStringResources.CONFIG_EXTENSION);
+
+               if (!propertyFile.exists()) {
+                       // load standard-default file.(x86-standard.xml)
+                       propertyFile = new File(platform.platformPath + File.separator
+                                       + FilePathResources.getPlatformTemplatePath()
+                                       + File.separator
+                                       + cpu + "-standard" + "." + PlatformStringResources.CONFIG_EXTENSION);
+               }
                if (propertyFile.exists()) {
                        EmulatorVMList vmList = EmulatorVMList.getInstance();
                        defaultProperty = vmList.parseXML(propertyFile);
index 29c0305..da34324 100644 (file)
@@ -187,7 +187,7 @@ public class PInfoViewPage extends DetailViewPage {
        private TextDetailBox emptyView;
        private void makeDetailView() {
                emptyView = new TextDetailBox(this.getItemListComposite(),
-                                                                               "Failed to load plug-in");
+                                                                               "Failed to load template");
 
                infoItemList = new ArrayList<InfoViewItemList>();
                ExtensionItem item = null;
@@ -200,17 +200,17 @@ public class PInfoViewPage extends DetailViewPage {
                                                ItemList template = image.getItemList();
                                                if (template != null) {
                                                        templateList.add(template);
+                                                       infoItemList.add(new InfoViewItemList(item, this.getItemListComposite(),
+                                                                       template, platform.getProfile(), image.getName(), false));
                                                }
-                                               infoItemList.add(new InfoViewItemList(item, this.getItemListComposite(),
-                                                               template, platform.getProfile(), image.getName(), false));
                                        }
                                        // add itemlist for custom.
                                        if (templateList.size() > 0) {
                                                infoItemList.add(new InfoViewItemList(item, this.getItemListComposite(),
                                                                templateList, platform.getProfile()));
                                        } else {
-                                               infoItemList.add(new InfoViewItemList(item, this.getItemListComposite(),
-                                                               null, platform.getProfile(), null, true));
+//                                             infoItemList.add(new InfoViewItemList(item, this.getItemListComposite(),
+//                                                             null, platform.getProfile(), null, true));
                                        }
                                }
                        }
index 368013f..ef22de1 100644 (file)
@@ -148,7 +148,7 @@ public class PModifyViewPage extends DetailViewPage
        private TextDetailBox emptyView;
        private void makeModifyView() {
                emptyView = new TextDetailBox(this.getItemListComposite(),
-                                                               "Failed to load plug-in");
+                                                               "Failed to load template");
                modifyItemList = new ArrayList<ModifyViewItemList>();
                ExtensionItem item = null;
                for (Platform platform : PlatformList.getPlatformList()) {
@@ -160,16 +160,16 @@ public class PModifyViewPage extends DetailViewPage
                                                ItemList template = image.getItemList();
                                                if (template != null) {
                                                        templateList.add(template);
+                                                       modifyItemList.add(new ModifyViewItemList(item, this,
+                                                                       template, platform.getProfile(), image.getName(), false));
                                                }
-                                               modifyItemList.add(new ModifyViewItemList(item, this,
-                                                               template, platform.getProfile(), image.getName(), false));
                                        }
                                        // add itemlist for custom.
                                        if (templateList.size() > 0) {
                                                modifyItemList.add(new ModifyViewItemList(item, this,
                                                                templateList, platform.getProfile()));
                                        } else {
-                                               modifyItemList.add(new ModifyViewItemList(item, this, null, platform.getProfile(), null, true));
+//                                             modifyItemList.add(new ModifyViewItemList(item, this, null, platform.getProfile(), null, true));
                                        }
                                }
                        }