From: minkee.lee Date: Tue, 12 Aug 2014 13:40:14 +0000 (+0900) Subject: CLI: Modify create VM. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=90195a4e0632563ac1a2a1f51ab66b7867bbd225;p=sdk%2Femulator%2Femulator-manager.git CLI: Modify create VM. - Fix default-property selection when more than one base-image exist. Change-Id: Ia41656b19029ec8442edb3132e19fe4122f1ab88 Signed-off-by: minkee.lee --- diff --git a/common-project/src/org/tizen/emulator/manager/console/ActionList.java b/common-project/src/org/tizen/emulator/manager/console/ActionList.java index 88b8bdd..a7a67be 100644 --- a/common-project/src/org/tizen/emulator/manager/console/ActionList.java +++ b/common-project/src/org/tizen/emulator/manager/console/ActionList.java @@ -389,7 +389,7 @@ class Create extends Action { commandList.add(new Command("b", Actions.OP_BASE, "Select ID of base disk image." + StringResources.NEW_LINE + "\t\t(Avaliable disk image can be found using 'list-image' command)", - "1", false, true)); + "ID of standard image in each platform", false, true)); commandList.add(new Command("c", Actions.OP_PATH, "Select path of base target image.", "", false, true)); diff --git a/common-project/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java b/common-project/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java index 16bd73b..419950e 100644 --- a/common-project/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java +++ b/common-project/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java @@ -213,7 +213,7 @@ public class ConsoleCreateVM { throw new ConsoleException("Inputted base image id's platform does not match inputted platform name." + StringResources.NEW_LINE + "Base Image ID Platform: " + image.getPlatformName() - + "Platform: " + property.baseImage.getPathName()); + + ", Input platform: " + property.baseImage.getPathName()); } else { // property = new VMPropertyValue(image, image.getPlatform().getTemplate()); property = new VMPropertyValue(image); @@ -229,23 +229,53 @@ public class ConsoleCreateVM { } else if (c.getShortName() == "p") { boolean check = false; - for (Platform platform : PlatformList.getPlatformList()) { - for (BaseImage image : platform.getImageList()) { - if (image.getPlatform().getName().equals(c.getCurrentValue())) { - check = true; - if (property != null - && !property.baseImage.getID().equals(image.getID())) { - throw new ConsoleException("Inputted platform name does not match inputted base image id's platform." - + StringResources.NEW_LINE - + "Base Image ID Platform: " + image.getPlatformName() - + "Platform: " + property.baseImage.getPathName()); - } else { -// property = new VMPropertyValue(image, image.getPlatform().getTemplate()); - property = new VMPropertyValue(image); + if (property != null) { + // check inputted platform name + if ((property.baseImage.getPlatformName().equals(c.getCurrentValue())) ) { + check = true; + } else { + throw new ConsoleException("Inputted platform name does not match inputted base image id's platform." + + StringResources.NEW_LINE + + "Base Image ID Platform: " + property.baseImage.getPlatformName() + + ", Input Platform: " + c.getCurrentValue()); + } + + } else { + // Find property from platform's imagelist + for (Platform platform : PlatformList.getPlatformList()) { + if (platform.getName().equals(c.getCurrentValue())) { + for (BaseImage image : platform.getImageList()) { + if (image.getName().contains("standard")) { + check = true; + property = new VMPropertyValue(image); + break; + } + } + if (property == null) { + if (platform.getImageList().size() > 0) { + check = true; + property = new VMPropertyValue(platform.getImageList().get(0)); + } } } } } +// for (Platform platform : PlatformList.getPlatformList()) { +// for (BaseImage image : platform.getImageList()) { +// if (image.getPlatform().getName().equals(c.getCurrentValue())) { +// check = true; +// if (property != null +// && !property.baseImage.getID().equals(image.getID())) { +// throw new ConsoleException("Inputted platform name does not match inputted base image id's platform." +// + StringResources.NEW_LINE +// + "Base Image ID Platform: " + image.getPlatformName() +// + "Platform: " + property.baseImage.getPathName()); +// } else { +// property = new VMPropertyValue(image); +// } +// } +// } +// } if (!check) { throw new ConsoleException("The Platform (" + c.getCurrentValue() +") is not avaliable.");