From aa8a1fc362a05b1f32b7cb564cd7b015cd5d9c0a Mon Sep 17 00:00:00 2001 From: "minkee.lee" Date: Wed, 17 Sep 2014 20:19:43 +0900 Subject: [PATCH] Template: Use standard template file if image template file doesn't exist. - 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 --- .../org/tizen/emulator/manager/platform/BaseImage.java | 18 +++++++++++++++++- .../emulator/manager/ui/detail/PInfoViewPage.java | 10 +++++----- .../emulator/manager/ui/detail/PModifyViewPage.java | 8 ++++---- 3 files changed, 26 insertions(+), 10 deletions(-) diff --git a/common-project/src/org/tizen/emulator/manager/platform/BaseImage.java b/common-project/src/org/tizen/emulator/manager/platform/BaseImage.java index a5fb2c9..7f4bf8f 100644 --- a/common-project/src/org/tizen/emulator/manager/platform/BaseImage.java +++ b/common-project/src/org/tizen/emulator/manager/platform/BaseImage.java @@ -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 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); diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/PInfoViewPage.java b/common-project/src/org/tizen/emulator/manager/ui/detail/PInfoViewPage.java index 29c0305..da34324 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/PInfoViewPage.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/PInfoViewPage.java @@ -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(); 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)); } } } diff --git a/common-project/src/org/tizen/emulator/manager/ui/detail/PModifyViewPage.java b/common-project/src/org/tizen/emulator/manager/ui/detail/PModifyViewPage.java index 368013f..ef22de1 100644 --- a/common-project/src/org/tizen/emulator/manager/ui/detail/PModifyViewPage.java +++ b/common-project/src/org/tizen/emulator/manager/ui/detail/PModifyViewPage.java @@ -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(); 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)); } } } -- 2.7.4