From c1e1b00b89b9490df742fc01fce272855a70adcd Mon Sep 17 00:00:00 2001 From: "minkee.lee" Date: Tue, 31 Mar 2015 14:29:18 +0900 Subject: [PATCH] CLI: Refactoring string resources, modified skin option. - Defined constant string resources and removed duplication. - Modified help content.(Use a term - "Profile-specific" instead of "Phone 720x1280") - Modified skin select logic. Change-Id: I29289c1f142250281d6fe2ab8469854495f1f19b Signed-off-by: minkee.lee --- .../org/tizen/emulator/manager/console/Action.java | 231 +++++++++++++------- .../tizen/emulator/manager/console/ActionList.java | 238 +++++++-------------- .../emulator/manager/console/ConsoleCreateVM.java | 33 ++- .../org/tizen/emulator/manager/platform/Skin.java | 4 +- .../org/tizen/emulator/manager/vms/SKIN_TYPE.java | 2 +- 5 files changed, 268 insertions(+), 240 deletions(-) diff --git a/common-project/src/org/tizen/emulator/manager/console/Action.java b/common-project/src/org/tizen/emulator/manager/console/Action.java index e7def55..0fdec53 100644 --- a/common-project/src/org/tizen/emulator/manager/console/Action.java +++ b/common-project/src/org/tizen/emulator/manager/console/Action.java @@ -31,8 +31,12 @@ package org.tizen.emulator.manager.console; import java.util.ArrayList; +import org.tizen.emulator.manager.resources.StringResources; +import org.tizen.emulator.manager.vms.RAM_SIZE; +import org.tizen.emulator.manager.vms.RESOLUTION; + public abstract class Action { - protected String action = null; + protected String action = null; protected ArrayList commandList = null; protected String description = null; protected String usage = null; @@ -65,12 +69,13 @@ public abstract class Action { if (commandList == null) { return null; } - + String message = null; for (Command c : commandList) { if (c != null) { if (c.isMandatory() && !c.isInCommandLine()) { - message = "--" + c.getLongName() + "(-" + c.getShortName() + ")"; + message = "--" + c.getLongName() + "(-" + c.getShortName() + + ")"; } } } @@ -82,7 +87,7 @@ public abstract class Action { if (commandList == null) { return null; } - + for (Command c : commandList) { if (c != null) { if (c.getLongName().equals(a)) { @@ -101,7 +106,7 @@ public abstract class Action { if (commandList == null) { return null; } - + for (Command c : commandList) { if (c != null) { if (c.getLongName().equals(a)) { @@ -117,7 +122,7 @@ public abstract class Action { if (commandList == null) { return null; } - + for (Command c : commandList) { if (c != null) { if (c.getShortName().equals(a)) { @@ -136,6 +141,7 @@ public abstract class Action { } class Command { + public static String RES = "RES"; private String shortName; private String longName; private String description; @@ -146,18 +152,17 @@ class Command { private boolean needsExtra; private boolean isInCommandLine; - public Command (String shortName, String longName, - String description, String defaultValue, - boolean isMandatory, boolean needsExtra) { - this.shortName = shortName; - this.longName = longName; - this.key = (shortName.isEmpty() ? "" : "-" +shortName + ", ") - + "--" + longName; - this.description = description; - this.defaultValue = defaultValue; - this.currentValue = this.defaultValue; - this.isMandatory = isMandatory; - this.needsExtra = needsExtra; + public Command(String shortName, String longName, String description, + String defaultValue, boolean isMandatory, boolean needsExtra) { + this.shortName = shortName; + this.longName = longName; + this.key = (shortName.isEmpty() ? "" : "-" + shortName + ", ") + "--" + + longName; + this.description = description; + this.defaultValue = defaultValue; + this.currentValue = this.defaultValue; + this.isMandatory = isMandatory; + this.needsExtra = needsExtra; this.isInCommandLine = false; } @@ -173,7 +178,7 @@ class Command { return key; } - public String getShortName() { + public String getShortName() { return shortName; } @@ -192,6 +197,7 @@ class Command { public void setCurrentValue(String value) { currentValue = value; } + public String getCurrentValue() { return currentValue; } @@ -217,7 +223,8 @@ class AddOptions extends Command { public AddOptions(String shortName, String longName, String description, String defaultValue, boolean isMandatory, boolean needsExtra) { - super(shortName, longName, description, defaultValue, isMandatory, needsExtra); + super(shortName, longName, description, defaultValue, isMandatory, + needsExtra); } public boolean checkExtraArg(String arg) { @@ -227,66 +234,132 @@ class AddOptions extends Command { class Actions { // global options - public final static String OP_HELP = "help"; - public final static String OP_SILENT = "silent"; - public final static String OP_VERBOSE = "verbose"; + public final static String OP_HELP = "help"; + public final static String OP_SILENT = "silent"; + public final static String OP_VERBOSE = "verbose"; // actions - public final static String AC_GLOBAL = "global"; - public final static String AC_LIST_VM = "list-vm"; - public final static String AC_LIST_IMAGE = "list-image"; - public final static String AC_CREATE = "create"; - public final static String AC_DETAIL = "detail"; - public final static String AC_DELETE = "delete"; - public final static String AC_MODIFY = "modify"; - public final static String AC_COLONE = "clone"; - public final static String AC_RESET = "reset"; - public final static String AC_LAUNCH = "launch"; - public final static String AC_CREATE_IMAGE = "create-image"; - - public final static String AC_WORKSPACE = "workspace"; - - public final static String AC_REMOTE_CREATE = "remote-create"; - public final static String AC_REMOTE_LAUNCH = "remote-launch"; - public final static String AC_REMOTE_LIST_VM = "remote-list-vm"; - public final static String AC_REMOTE_DELETE = "remote-delete"; - public final static String AC_REMOTE_MODIFY = "remote-modify"; - public final static String AC_REMOTE_CLONE = "remote-clone"; - public final static String AC_REMOTE_RESET = "remote-reset"; - public final static String AC_REMOTE_LIST_IMAGE = "remote-list-image"; - public final static String AC_REMOTE_CREATE_IMAGE = "remote-create-image"; - public final static String AC_REMOTE_DETAIL = "remote-detail"; - public final static String AC_REMOTE_WORKSPACE = "remote-workspace"; - public final static String OP_USER_ACCOUNT = "user-account"; - public final static String OP_IP = "ip"; - public final static String OP_SPICE_PORT = "spice"; - public final static String OP_SDK_PATH_NUM = "sdk-path-num"; - - // action options - public final static String OP_STANDARD = "standard"; - public final static String OP_CUSTOM = "custom"; - public final static String OP_SET = "set"; - public final static String OP_GET = "get"; - public final static String OP_NAME = "name"; - public final static String OP_DETAIL = "detail"; - public final static String OP_PATH = "custom-path"; - public final static String OP_PLATFORM = "platform"; - public final static String OP_BASE = "base-id"; - public final static String OP_TARGET = "target-name"; - public final static String OP_TEST = "test"; - public final static String OP_COUNT = "count"; - - public final static String OP_RESOLUTION = "resolution"; - public final static String OP_DPI = "dpi"; - public final static String OP_SKIN = "skin"; - public final static String OP_KEYTYPE = "key-type"; - public final static String OP_RAM = "ram-size"; - public final static String OP_FILESHARE = "file-sharing"; - public final static String OP_FILESHAREPATH = "file-sharing-path"; - public final static String OP_VIRTUALIZATION = "hw-virtualization"; - public final static String OP_MAXTOUCH = "max-touch-point"; - public final static String OP_ADDOPTION = "add-options"; - public final static String OP_GLACCELERATION = "hw-gl-acceleration"; -} + public final static String AC_GLOBAL = "global"; + public final static String AC_LIST_VM = "list-vm"; + public final static String AC_LIST_IMAGE = "list-image"; + public final static String AC_CREATE = "create"; + public final static String AC_DETAIL = "detail"; + public final static String AC_DELETE = "delete"; + public final static String AC_MODIFY = "modify"; + public final static String AC_COLONE = "clone"; + public final static String AC_RESET = "reset"; + public final static String AC_LAUNCH = "launch"; + public final static String AC_CREATE_IMAGE = "create-image"; + + public final static String AC_WORKSPACE = "workspace"; + + public final static String AC_REMOTE_CREATE = "remote-create"; + public final static String AC_REMOTE_LAUNCH = "remote-launch"; + public final static String AC_REMOTE_LIST_VM = "remote-list-vm"; + public final static String AC_REMOTE_DELETE = "remote-delete"; + public final static String AC_REMOTE_MODIFY = "remote-modify"; + public final static String AC_REMOTE_CLONE = "remote-clone"; + public final static String AC_REMOTE_RESET = "remote-reset"; + public final static String AC_REMOTE_LIST_IMAGE = "remote-list-image"; + public final static String AC_REMOTE_CREATE_IMAGE = "remote-create-image"; + public final static String AC_REMOTE_DETAIL = "remote-detail"; + public final static String AC_REMOTE_WORKSPACE = "remote-workspace"; + public final static String OP_USER_ACCOUNT = "user-account"; + public final static String OP_IP = "ip"; + public final static String OP_SPICE_PORT = "spice"; + public final static String OP_SDK_PATH_NUM = "sdk-path-num"; + + // action options + public final static String OP_STANDARD = "standard"; + public final static String OP_CUSTOM = "custom"; + public final static String OP_SET = "set"; + public final static String OP_GET = "get"; + public final static String OP_NAME = "name"; + public final static String OP_DETAIL = "detail"; + public final static String OP_PATH = "custom-path"; + public final static String OP_PLATFORM = "platform"; + public final static String OP_BASE = "base-id"; + public final static String OP_TARGET = "target-name"; + public final static String OP_TEST = "test"; + public final static String OP_COUNT = "count"; + + public final static String OP_RESOLUTION = "resolution"; + public final static String OP_DPI = "dpi"; + public final static String OP_SKIN = "skin"; + public final static String OP_KEYTYPE = "key-type"; + public final static String OP_RAM = "ram-size"; + public final static String OP_FILESHARE = "file-sharing"; + public final static String OP_FILESHAREPATH = "file-sharing-path"; + public final static String OP_VIRTUALIZATION = "hw-virtualization"; + public final static String OP_MAXTOUCH = "max-touch-point"; + public final static String OP_ADDOPTION = "add-options"; + public final static String OP_GLACCELERATION = "hw-gl-acceleration"; + + public final static String DESC_HELP = "Display information of specific command."; + public final static String DESC_VERVOSE = "Display information running emulator-manager's state"; + public final static String DESC_DETAIL = "Display more information of VMs."; + public final static String DESC_COUNT = "Display count of vm list (only display number)."; + public final static String DESC_USER_ACCOUNT = "User account of remote."; + public final static String DESC_IP = "IP address of remote."; + public final static String DESC_SDK_PATH_NUM = "SDK path number of remote."; + public final static String DESC_INQUIRY_NAME = "Name of virtual machine." + + StringResources.NEW_LINE + + " If you do not enter a name, emulator manager's information is printed."; + public final static String DESC_NAME = "Name of new VM."; + public final static String DESC_NAME_MOD = "Name of VM."; + public final static String DESC_LAUNCH_NAME = "Name of VM to start."; + public final static String DESC_DELETE_NAME = "Name of VM to delete."; + public final static String DESC_RESET_NAME = "Name of VM to reset image."; + public final static String DESC_EXPORT_NAME = "Name of VM to create base target image."; + public final static String DESC_BASE = "Select ID of base disk image." + + StringResources.NEW_LINE + + "\t\t(Avaliable disk image can be found using 'list-image' command)"; + public final static String DESC_PATH = "Select path of base target image."; + public final static String DESC_LAUNCH_PATH = "Setting path of emulator program."; + public final static String DESC_EXPORT_PATH = "Setting Location to generate base target image."; + public final static String DESC_PLATFORM = "Select Platform of base disk image." + + StringResources.NEW_LINE + + "\t\t(Avaliable disk image can be found using 'list-image' command)"; + public final static String DESC_RESOLUTION = resolutionDescription(); + public final static String DESC_DPI = "DPI. (100 ~ 480)"; + public final static String DESC_SKIN = "Select skin style (1:Generalpurpose, 2:Profile-specific)"; + public final static String DESC_RAM = ramSizeDescription(); + public final static String DESC_FILESHAREPATH = "File sharing path. If path is \"\", file sharing is disabled"; + public final static String DESC_VIRTUALIZATION = "Select enable or disable hardware virtualization.(yes | no)"; + public final static String DESC_GLACCELERATION = "Select enable or disable hardware GL acceleration.(yes | no)"; + public final static String DESC_ADDOPTION = "Add other qemu's options."; + public final static String DESC_TEST = "Print parameters of emulator without executing emulator."; + public final static String DESC_SPICE_PORT = "Enable spice mode"; + + public final static String DEFAULT_BASE = "ID of standard image in each platform"; + public final static String DEFAULT_SKIN = "(Profile dependent)"; + + public static String resolutionDescription() { + String resolution = ""; + for (RESOLUTION r : RESOLUTION.values()) { + if (!r.getType().isEmpty()) { + resolution += (r.getType() + " | "); + } else { + resolution += (r.getStrValue() + " | "); + } + } + resolution = resolution.substring(0, resolution.length() - 3); + + return "Resolution of vm. (" + + resolution + + ")" + + StringResources.NEW_LINE + + "\t\t(Custom resolution is supported as experimental feature." + + " Range is from 320 to 1920)."; + } + public static String ramSizeDescription() { + String ram = ""; + for (RAM_SIZE size : RAM_SIZE.values()) { + ram += (size.toString() + " | "); + } + ram = ram.substring(0, ram.length() - 3); + return "RAM size. (" + ram + ")"; + } +} 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 81b2bdd..4ba4887 100644 --- a/common-project/src/org/tizen/emulator/manager/console/ActionList.java +++ b/common-project/src/org/tizen/emulator/manager/console/ActionList.java @@ -146,9 +146,9 @@ class Global extends Action { this.usage =""; commandList.add(new Command("h", Actions.OP_HELP, - "Display information of specific command.", "", false, false)); + Actions.DESC_HELP, "", false, false)); commandList.add(new Command("v", Actions.OP_VERBOSE, - "Display information running emulator-manager's state", "", false ,false)); + Actions.DESC_VERVOSE, "", false ,false)); } public boolean process() { @@ -163,9 +163,9 @@ class ListVM extends Action { this.usage = "list-vm [options]"; commandList.add(new Command("d", Actions.OP_DETAIL, - "Display more information of VMs.","", false, false)); + Actions.DESC_DETAIL, "", false, false)); commandList.add(new Command("c", Actions.OP_COUNT, - "Display count of vm list (only display number).", "", false, false)); + Actions.DESC_COUNT, "", false, false)); } @Override @@ -204,15 +204,15 @@ class RemoteListVM extends Action { this.usage = "remote-list-vm -e ip -u account [options]"; commandList.add(new Command("d", Actions.OP_DETAIL, - "Display more information of VMs.","", false, false)); + Actions.DESC_DETAIL, "", false, false)); commandList.add(new Command("c", Actions.OP_COUNT, - "Display count of vm list (only display number).", "", false, false)); + Actions.DESC_COUNT, "", false, false)); commandList.add(new Command("u", Actions.OP_USER_ACCOUNT, - "User account of remote.", "", true, true)); + Actions.DESC_USER_ACCOUNT, "", true, true)); commandList.add(new Command("e", Actions.OP_IP, - "IP address of remote.", "", true, true)); + Actions.DESC_IP, "", true, true)); commandList.add(new Command("l", Actions.OP_SDK_PATH_NUM, - "SDK path number of remote.", "", false, true)); + Actions.DESC_SDK_PATH_NUM, "", false, true)); } @Override @@ -270,11 +270,11 @@ class RemoteListImage extends Action { this.usage = "remote-list-image -e ip -u account [options]"; commandList.add(new Command("u", Actions.OP_USER_ACCOUNT, - "User account of remote.", "", true, true)); + Actions.DESC_USER_ACCOUNT, "", true, true)); commandList.add(new Command("e", Actions.OP_IP, - "IP address of remote.", "", true, true)); + Actions.DESC_IP, "", true, true)); commandList.add(new Command("l", Actions.OP_SDK_PATH_NUM, - "SDK path number of remote.", "", false, true)); + Actions.DESC_SDK_PATH_NUM, "", false, true)); } @Override @@ -298,8 +298,7 @@ class Detail extends Action { this.usage = "detail -n test"; commandList.add(new Command("n", Actions.OP_NAME, - "Name of virtual machine." + StringResources.NEW_LINE + - " If you do not enter a name, emulator manager's information is printed.","", false, true)); + Actions.DESC_INQUIRY_NAME,"", false, true)); } @Override @@ -336,14 +335,13 @@ class RemoteDetail extends Action { this.usage = "remote-detail -n test -e ip -u account [options]"; commandList.add(new Command("n", Actions.OP_NAME, - "Name of virtual machine.\n" + - " If you do not enter a name, emulator manager's information is printed.","", false, true)); + Actions.DESC_INQUIRY_NAME,"", false, true)); commandList.add(new Command("u", Actions.OP_USER_ACCOUNT, - "User account of remote.", "", true, true)); + Actions.DESC_USER_ACCOUNT, "", true, true)); commandList.add(new Command("e", Actions.OP_IP, - "IP address of remote.", "", true, true)); + Actions.DESC_IP, "", true, true)); commandList.add(new Command("l", Actions.OP_SDK_PATH_NUM, - "SDK path number of remote.", "1", false, true)); + Actions.DESC_SDK_PATH_NUM, "1", false, true)); } @Override @@ -382,39 +380,24 @@ class Create extends Action { " You can not use both '-b' and '-c' at the same time."; commandList.add(new Command("n", Actions.OP_NAME, - "Name of new VM.", "", true, true)); + Actions.DESC_NAME, "", true, true)); // b : standard image // p : custom image 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)", - "ID of standard image in each platform", false, true)); + Actions.DESC_BASE, Actions.DEFAULT_BASE, false, true)); commandList.add(new Command("c", Actions.OP_PATH, - "Select path of base target image.", "", false, true)); - + Actions.DESC_PATH, "", false, true)); commandList.add(new Command("p", Actions.OP_PLATFORM, - "Select Platform of base disk image." + StringResources.NEW_LINE + - "\t\t(Avaliable disk image can be found using 'list-image' command)", - "mobile-2.4", false, true)); + Actions.DESC_PLATFORM, + "", false, true)); // Options - String resolution = ""; - for (RESOLUTION r : RESOLUTION.values()) { - if (!r.getType().isEmpty()) { - resolution += (r.getType() + " | "); - } else { - resolution += (r.getStrValue() + " | "); - } - } - resolution = resolution.substring(0, resolution.length() - 3); commandList.add(new Command("r", Actions.OP_RESOLUTION, - "Resolution of vm. (" + resolution + ")" + StringResources.NEW_LINE + - "\t\t(Custom resolution is supported as experimental feature." + - " Range is from 320 to 1920)." + Actions.DESC_RESOLUTION , RESOLUTION.HD.getType(), false, true)); commandList.add(new Command("d", Actions.OP_DPI, - "DPI. (100 ~ 480)", Integer.toString(RESOLUTION.HD.getDPI()), false, true)); + Actions.DESC_DPI, Integer.toString(RESOLUTION.HD.getDPI()), false, true)); /** TODO : resolution and skin..***********************************************/ /* @@ -430,38 +413,30 @@ class Create extends Action { */ commandList.add(new Command("k", Actions.OP_SKIN, - "Select skin style ( Generalpurpose | Phone 720x1280 )", "1", false, true)); + Actions.DESC_SKIN, Actions.DEFAULT_SKIN, false, true)); /*****************************************************************************/ - /* - commandList.add(new Command("k", Actions.OP_KEYTYPE, - "Skin'front button type. (1 | 3)", Integer.toString(property.keyType), false, true)); - */ - String ram = ""; - for (RAM_SIZE size : RAM_SIZE.values()) { - ram += (size.toString() + " | "); - } - ram = ram.substring(0, ram.length() - 3); - commandList.add(new Command("s", Actions.OP_RAM, - "RAM size. (" + ram + ")", RAM_SIZE.RAM512.toString(), false, true)); +// commandList.add(new Command("k", Actions.OP_KEYTYPE, +// "Skin'front button type. (1 | 3)", Integer.toString(property.keyType), false, true)); - commandList.add(new Command("f", Actions.OP_FILESHAREPATH, - "File sharing path. If path is \"\", file sharing is disabled", - "", false, true)); + commandList.add(new Command("s", Actions.OP_RAM, + Actions.DESC_RAM, RAM_SIZE.RAM512.toString(), false, true)); + commandList.add(new Command("f", Actions.OP_FILESHAREPATH, + Actions.DESC_FILESHAREPATH, "", false, true)); commandList.add(new Command("v", Actions.OP_VIRTUALIZATION, - "Select enable or disable hardware virtualization.(yes | no)", + Actions.DESC_VIRTUALIZATION, CheckVirtualization.getInstance().isSupportVirtualization() ? "yes" : "no", false, true)); commandList.add(new Command("g", Actions.OP_GLACCELERATION, - "Select enable or disable hardware GL acceleration.(yes | no)", + Actions.DESC_GLACCELERATION, CheckVirtualization.getInstance().isSupportGPU() ? "yes" : "no", false, true)); /* commandList.add(new Command("t", Actions.OP_MAXTOUCH, "Set count of multi touch point.(1 ~ 3)", Integer.toString(property.maxTouchCount), false, true)); */ commandList.add(new AddOptions("a", Actions.OP_ADDOPTION, - "Add other qemu's options.", "", false, true)); + Actions.DESC_ADDOPTION, "", false, true)); } @Override @@ -487,19 +462,15 @@ class RemoteCreate extends Action { // b : standard image // p : custom image commandList.add(new Command("b", Actions.OP_BASE, - "Select ID of base disk image.\n\t\t(Avaliable disk image can be found using 'list-image' command)", - "", false, true)); + Actions.DESC_BASE, "", false, true)); commandList.add(new Command("p", Actions.OP_PATH, - "Select path of base target image.", "", false, true)); - + Actions.DESC_PATH, "", false, true)); commandList.add(new Command("u", Actions.OP_USER_ACCOUNT, - "User account of remote.", "", true, true)); - + Actions.DESC_USER_ACCOUNT, "", true, true)); commandList.add(new Command("e", Actions.OP_IP, - "IP address of remote.", "", true, true)); - + Actions.DESC_IP, "", true, true)); commandList.add(new Command("l", Actions.OP_SDK_PATH_NUM, - "SDK path number of remote.", "", false, true)); + Actions.DESC_SDK_PATH_NUM, "", false, true)); } @Override public boolean process() { @@ -555,25 +526,13 @@ class Modify extends Action { this.usage = "modify -n test [options]"; commandList.add(new Command("n", Actions.OP_NAME, - "Name of VM.", "", true, true)); + Actions.DESC_NAME_MOD, "", true, true)); // Options - String resolution = ""; - for (RESOLUTION r : RESOLUTION.values()) { - if (!r.getType().isEmpty()) { - resolution += (r.getType() + " | "); - } else { - resolution += (r.getStrValue() + " | "); - } - } - resolution = resolution.substring(0, resolution.length() - 3); commandList.add(new Command("r", Actions.OP_RESOLUTION, - "Resolution of vm. (" + resolution + ")" + StringResources.NEW_LINE + - "\t\t(Custom resolution is supported as experimental feature." + - " Range is from 320 to 1920)." - , RESOLUTION.HD.getType(), false, true)); + Actions.DESC_RESOLUTION, RESOLUTION.HD.getType(), false, true)); commandList.add(new Command("d", Actions.OP_DPI, - "DPI. (100 ~ 480)", Integer.toString(RESOLUTION.HD.getDPI()), false, true)); + Actions.DESC_DPI, Integer.toString(RESOLUTION.HD.getDPI()), false, true)); /** TODO : resolution and skin..***********************************************/ /* @@ -590,7 +549,7 @@ class Modify extends Action { */ commandList.add(new Command("k", Actions.OP_SKIN, - "Select skin style ( Generalpurpose | Phone 720x1280 )", "1", false, true)); + Actions.DESC_SKIN, Actions.DEFAULT_SKIN, false, true)); /*****************************************************************************/ /* @@ -598,30 +557,22 @@ class Modify extends Action { "Skin'front button type. (1 | 3)", Integer.toString(property.keyType), false, true)); */ - String ram = ""; - for (RAM_SIZE size : RAM_SIZE.values()) { - ram += (size.toString() + " | "); - } - ram = ram.substring(0, ram.length() - 3); commandList.add(new Command("s", Actions.OP_RAM, - "RAM size. (" + ram + ")", RAM_SIZE.RAM512.toString(), false, true)); - + Actions.DESC_RAM, RAM_SIZE.RAM512.toString(), false, true)); commandList.add(new Command("f", Actions.OP_FILESHAREPATH, - "File sharing path. If path is \"\", file sharing is disabled", - "", false, true)); - + Actions.DESC_FILESHAREPATH, "", false, true)); commandList.add(new Command("v", Actions.OP_VIRTUALIZATION, - "Select enable or disable hardware virtualization.(yes | no)", + Actions.DESC_VIRTUALIZATION, CheckVirtualization.getInstance().isSupportVirtualization() ? "yes" : "no", false, true)); commandList.add(new Command("g", Actions.OP_GLACCELERATION, - "Select enable or disable hardware GL acceleration.(yes | no)", + Actions.DESC_GLACCELERATION, CheckVirtualization.getInstance().isSupportGPU() ? "yes" : "no", false, true)); /* commandList.add(new Command("t", Actions.OP_MAXTOUCH, "Set count of multi touch point.(1 or 2)", Integer.toString(property.maxTouchCount), false, true)); */ commandList.add(new AddOptions("a", Actions.OP_ADDOPTION, - "Add other qemu's options.", "", false, true)); + Actions.DESC_ADDOPTION, "", false, true)); } @Override @@ -644,33 +595,24 @@ class RemoteModify extends Action { "Resolution of vm.", "", false, true)); commandList.add(new Command("d", Actions.OP_DPI, "DPI. (100 ~ 480)", "", false, true)); - commandList.add(new Command("k", Actions.OP_SKIN, "Select skin style ( Generalpurpose | Phone 720x1280 )", "", false, true)); - commandList.add(new Command("s", Actions.OP_RAM, "RAM size.", "", false, true)); - - if (!EmulatorManager.isMac()) { commandList.add(new Command("f", Actions.OP_FILESHAREPATH, - "File sharing path. If path is \"\", file sharing is disabled", - "", false, true)); - } + Actions.DESC_FILESHAREPATH, "", false, true)); commandList.add(new Command("v", Actions.OP_VIRTUALIZATION, - "Select enable or disable hardware virtualization.(yes | no)", - "", false, true)); + Actions.DESC_VIRTUALIZATION, "", false, true)); commandList.add(new Command("g", Actions.OP_GLACCELERATION, - "Select enable or disable hardware GL acceleration.(yes | no)", - "", false, true)); - + Actions.DESC_GLACCELERATION, "", false, true)); commandList.add(new AddOptions("a", Actions.OP_ADDOPTION, - "Add other qemu's options.", "", false, true)); + Actions.DESC_ADDOPTION, "", false, true)); commandList.add(new Command("u", Actions.OP_USER_ACCOUNT, - "User account of remote.", "", true, true)); + Actions.DESC_USER_ACCOUNT, "", true, true)); commandList.add(new Command("e", Actions.OP_IP, - "IP address of remote.", "", true, true)); + Actions.DESC_IP, "", true, true)); commandList.add(new Command("l", Actions.OP_SDK_PATH_NUM, - "SDK path number of remote.", "", false, true)); + Actions.DESC_SDK_PATH_NUM, "", false, true)); } @Override @@ -744,23 +686,17 @@ class Launch extends Action { this.usage = "launch -n test [options]"; commandList.add(new Command("n", Actions.OP_NAME, - "Name of VM to start.","", true, true)); - + Actions.DESC_LAUNCH_NAME,"", true, true)); commandList.add(new Command("p", Actions.OP_PATH, - "Setting path of emulator program.", - FilePathResources.getBinPath(), false, true)); - + Actions.DESC_LAUNCH_PATH, FilePathResources.getBinPath(), false, true)); commandList.add(new Command("t", Actions.OP_TEST, - "Print parameters of emulator without executing emulator.", - "", false, false)); + Actions.DESC_TEST, "", false, false)); /* commandList.add(new Command("c", Actions.OP_COMPACT, "Compact output(It does not print arguments of emulator.)", "", false, false)); */ - commandList.add(new Command("s", Actions.OP_SPICE_PORT, - "Enable spice mode", - "", false, false)); + Actions.DESC_SPICE_PORT, "", false, false)); } @Override @@ -805,28 +741,19 @@ class RemoteLaunch extends Action { this.usage = "remote-launch -n test -e ip -u account [options]"; commandList.add(new Command("n", Actions.OP_NAME, - "Name of VM to start.","", true, true)); - + Actions.DESC_LAUNCH_NAME,"", true, true)); commandList.add(new Command("p", Actions.OP_PATH, - "Setting path of emulator program.", - FilePathResources.getBinPath(), false, true)); - + Actions.DESC_LAUNCH_PATH, FilePathResources.getBinPath(), false, true)); commandList.add(new Command("t", Actions.OP_TEST, - "Print parameters of emulator without executing emulator.", - "", false, false)); - + Actions.DESC_TEST, "", false, false)); commandList.add(new Command("s", Actions.OP_SPICE_PORT, - "Enable spice port", - "", false, false)); - + Actions.DESC_SPICE_PORT, "", false, false)); commandList.add(new Command("u", Actions.OP_USER_ACCOUNT, - "User account of remote.", "", true, true)); - + Actions.DESC_USER_ACCOUNT, "", true, true)); commandList.add(new Command("e", Actions.OP_IP, - "IP address of remote.", "", true, true)); - + Actions.DESC_IP, "", true, true)); commandList.add(new Command("l", Actions.OP_SDK_PATH_NUM, - "SDK path number of remote.", "", false, true)); + Actions.DESC_SDK_PATH_NUM, "", false, true)); /* commandList.add(new Command("c", Actions.OP_COMPACT, "Compact output(It does not print arguments of emulator.)", "", false, false)); @@ -923,13 +850,13 @@ class RemoteDelete extends Action { this.usage = "remote-delete -n test -e ip -u account [options]"; commandList.add(new Command("n", Actions.OP_NAME, - "Name of VM to delete.","", true, true)); + Actions.DESC_DELETE_NAME, "", true, true)); commandList.add(new Command("u", Actions.OP_USER_ACCOUNT, - "User account of remote.", "", true, true)); + Actions.DESC_USER_ACCOUNT, "", true, true)); commandList.add(new Command("e", Actions.OP_IP, - "IP address of remote.", "", true, true)); + Actions.DESC_IP, "", true, true)); commandList.add(new Command("l", Actions.OP_SDK_PATH_NUM, - "SDK path number of remote.", "", false, true)); + Actions.DESC_SDK_PATH_NUM, "", false, true)); } @Override @@ -961,7 +888,7 @@ class Reset extends Action { this.usage = "reset -n test"; commandList.add(new Command("n", Actions.OP_NAME, - "Name of VM to reset image.","", true, true)); + Actions.DESC_RESET_NAME, "", true, true)); } @Override @@ -989,13 +916,13 @@ class RemoteReset extends Action { this.usage = "remote-reset -n test -e ip -u account [options]"; commandList.add(new Command("n", Actions.OP_NAME, - "Name of VM to reset image.","", true, true)); + Actions.DESC_RESET_NAME, "", true, true)); commandList.add(new Command("u", Actions.OP_USER_ACCOUNT, - "User account of remote.", "", true, true)); + Actions.DESC_USER_ACCOUNT, "", true, true)); commandList.add(new Command("e", Actions.OP_IP, - "IP address of remote.", "", true, true)); + Actions.DESC_IP, "", true, true)); commandList.add(new Command("l", Actions.OP_SDK_PATH_NUM, - "SDK path number of remote.", "", false, true)); + Actions.DESC_SDK_PATH_NUM, "", false, true)); } @Override @@ -1027,9 +954,9 @@ class CreateBaseImage extends Action { this.usage = "create-image -n test [options]"; commandList.add(new Command("n", Actions.OP_NAME, - "Name of VM to create base target image.","", true, true)); + Actions.DESC_EXPORT_NAME,"", true, true)); commandList.add(new Command("p", Actions.OP_PATH, - "Setting Location to generate base target image.", + Actions.DESC_EXPORT_PATH, FilePathResources.getTizenSdkDataEmulatorPath(), false, true)); } @@ -1065,16 +992,15 @@ class RemoteCreateBaseImage extends Action { this.usage = "remote-create-image -n test -e ip -u account [options]"; commandList.add(new Command("n", Actions.OP_NAME, - "Name of VM to create base target image.","", true, true)); + Actions.DESC_EXPORT_NAME,"", true, true)); commandList.add(new Command("p", Actions.OP_PATH, - "Setting Location to generate base target image.", - "", false, true)); + Actions.DESC_EXPORT_PATH, "", false, true)); commandList.add(new Command("u", Actions.OP_USER_ACCOUNT, - "User account of remote.", "", true, true)); + Actions.DESC_USER_ACCOUNT, "", true, true)); commandList.add(new Command("e", Actions.OP_IP, - "IP address of remote.", "", true, true)); + Actions.DESC_IP, "", true, true)); commandList.add(new Command("l", Actions.OP_SDK_PATH_NUM, - "SDK path number of remote.", "", false, true)); + Actions.DESC_SDK_PATH_NUM, "", false, true)); } @Override 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 5e3ab4d..3a96306 100644 --- a/common-project/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java +++ b/common-project/src/org/tizen/emulator/manager/console/ConsoleCreateVM.java @@ -32,6 +32,7 @@ package org.tizen.emulator.manager.console; import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.List; import org.tizen.emulator.manager.logging.EMLogger; import org.tizen.emulator.manager.platform.BaseImage; @@ -46,6 +47,7 @@ import org.tizen.emulator.manager.vms.Creator; import org.tizen.emulator.manager.vms.EmulatorVMList; import org.tizen.emulator.manager.vms.RAM_SIZE; import org.tizen.emulator.manager.vms.RESOLUTION; +import org.tizen.emulator.manager.vms.SKIN_TYPE; import org.tizen.emulator.manager.vms.VMProperty; import org.tizen.emulator.manager.vms.VMPropertyValue; import org.tizen.emulator.manager.vms.helper.VMWorkerException; @@ -434,10 +436,14 @@ public class ConsoleCreateVM { } } if (list != null && !list.isEmpty()) { - if (i <= 0 || i > list.size()) { +// if (i <= 0 || i > list.size()) { +// throw new ConsoleException("Skin value (" + skinCommand.getCurrentValue() + ") is not avaliable."); +// } +// prop.skin = list.get(i-1); + if (i <= 0 || i > 2) { throw new ConsoleException("Skin value (" + skinCommand.getCurrentValue() + ") is not avaliable."); } - prop.skin = list.get(i-1); + prop.skin = getSkin(list, i == 1); } else { prop.skin = null; } @@ -450,6 +456,29 @@ public class ConsoleCreateVM { } } + private Skin getSkin(List list, boolean isGeneralSkin) { + Skin skin = null; + if (isGeneralSkin) { + for (Skin s : list) { + if (s.getType() == SKIN_TYPE.GENERAL) { + skin = s; + } + } + + } else { + for (Skin s : list) { + if (s.getType() == SKIN_TYPE.PROFILE_SPECIFIC) { + skin = s; + } + } + if (skin == null) { + System.out.println("Profile specific skin is not available with this resolution."); + System.out.println("> General skin is used."); + } + } + return (skin == null) ? list.get(0) : skin; + } + private boolean checkGLAcceleration(String currentValue, boolean isArm) throws ConsoleException{ String value = currentValue.toLowerCase(); if (value.equals("yes")) { diff --git a/common-project/src/org/tizen/emulator/manager/platform/Skin.java b/common-project/src/org/tizen/emulator/manager/platform/Skin.java index 35d1470..276c0b7 100644 --- a/common-project/src/org/tizen/emulator/manager/platform/Skin.java +++ b/common-project/src/org/tizen/emulator/manager/platform/Skin.java @@ -72,11 +72,11 @@ public class Skin { if(width.equals(StringResources.SKIN_GENERAL) && height.equals(StringResources.SKIN_GENERAL)) { type = SKIN_TYPE.GENERAL; } else { - type = SKIN_TYPE.PHONE_SHAPE; + type = SKIN_TYPE.PROFILE_SPECIFIC; re = width + "x" + height; } - if (type == SKIN_TYPE.PHONE_SHAPE) { + if (type == SKIN_TYPE.PROFILE_SPECIFIC) { for (RESOLUTION r : RESOLUTION.values()) { if(r.getStrValue().equals(re)) { this.resolution = r; diff --git a/common-project/src/org/tizen/emulator/manager/vms/SKIN_TYPE.java b/common-project/src/org/tizen/emulator/manager/vms/SKIN_TYPE.java index 0688b26..125b761 100644 --- a/common-project/src/org/tizen/emulator/manager/vms/SKIN_TYPE.java +++ b/common-project/src/org/tizen/emulator/manager/vms/SKIN_TYPE.java @@ -30,7 +30,7 @@ package org.tizen.emulator.manager.vms; public enum SKIN_TYPE { - GENERAL(0), PHONE_SHAPE(1); + GENERAL(0), PROFILE_SPECIFIC(1); int type; SKIN_TYPE(int t) { this.type = t; -- 2.7.4