From 14db1ede719af6b9ffb72245b1614713fb97576e Mon Sep 17 00:00:00 2001 From: "minkee.lee" Date: Mon, 24 Aug 2015 20:54:30 +0900 Subject: [PATCH] custom-vm: fixed custom-image import. - fixed that custom-image of extension "i386", "x86_64" is also available when create custom-vm. - removed "arm" extension. Change-Id: I7f219cbb867143a26b6c91369604bca76e56344f Signed-off-by: minkee.lee --- .../ui/detail/item/property/BaseImageViewItem.java | 2 +- src/org/tizen/emulator/manager/vms/VMProperty.java | 23 +++++++++++++++------- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/org/tizen/emulator/manager/ui/detail/item/property/BaseImageViewItem.java b/src/org/tizen/emulator/manager/ui/detail/item/property/BaseImageViewItem.java index 1343e04..9995551 100644 --- a/src/org/tizen/emulator/manager/ui/detail/item/property/BaseImageViewItem.java +++ b/src/org/tizen/emulator/manager/ui/detail/item/property/BaseImageViewItem.java @@ -406,7 +406,7 @@ public class BaseImageViewItem extends ComboViewItem { } String fileSplit[] = pathSplit[pathSplit.length - 1].split("\\."); //$NON-NLS-1$ String extension = fileSplit[fileSplit.length - 1]; - if (!extension.equals("x86")) { //$NON-NLS-1$ + if (!Architecture.isSupported(extension)) { //$NON-NLS-1$ return false; } // Check whether file is exist. diff --git a/src/org/tizen/emulator/manager/vms/VMProperty.java b/src/org/tizen/emulator/manager/vms/VMProperty.java index c009cab..0f835ef 100644 --- a/src/org/tizen/emulator/manager/vms/VMProperty.java +++ b/src/org/tizen/emulator/manager/vms/VMProperty.java @@ -301,17 +301,26 @@ public class VMProperty { } public enum Architecture { - x86("x86"), i386("i386"), x86_64("x86_64"), ARM("arm"); //$NON-NLS-1$ //$NON-NLS-2$ + x86("x86"), i386("i386"), x86_64("x86_64"); //$NON-NLS-1$ //$NON-NLS-2$ - private String arch; + private String name; Architecture(String arch) { - this.arch = arch; + this.name = arch; } @Override public String toString() { - return arch; + return name; + } + + public static boolean isSupported(String extension) { + for (Architecture arch : Architecture.values()) { + if (arch.name.equals(extension.toLowerCase())) { + return true; + } + } + return false; } public boolean isPriorInList(Architecture obj) { @@ -325,12 +334,12 @@ public class VMProperty { } public static Architecture getDisplayType(String arch) { - if (arch.equals(x86.arch) || arch.equals(i386.arch)) { + if (arch.equals(x86.name) || arch.equals(i386.name)) { return i386; // for legacy image (.x86) } else { for (Architecture type : Architecture.values()) { - if (arch.equals(type.arch)) { + if (arch.equals(type.name)) { return type; } } @@ -340,7 +349,7 @@ public class VMProperty { public static Architecture getType(String arch) { for (Architecture type : Architecture.values()) { - if (arch.equals(type.arch)) { + if (arch.equals(type.name)) { return type; } } -- 2.7.4