From 60bc64a754eb797295aff2994b3427ae0b5a2be5 Mon Sep 17 00:00:00 2001 From: "jihye424.kim" Date: Fri, 15 Jan 2016 17:05:29 +0900 Subject: [PATCH] vm property: move 'isRemote' method to VMProperty Change-Id: Icfa7768a8cc152956a339bef79d00ee96e9bf789 Signed-off-by: jihye424.kim --- .../ui/detail/item/CommonItemListFactory.java | 4 +-- .../emulator/manager/ui/widgets/VMButton.java | 3 +- src/org/tizen/emulator/manager/vms/VMProperty.java | 16 +++++++++ .../manager/vms/helper/VMCreatorException.java | 39 ++++++++++++++++++++++ .../manager/vms/helper/VMLauncherException.java | 13 ++++++++ ...RunningEmulator.java => VMWorkerException.java} | 24 +++++-------- .../emulator/manager/vms/option/RemoteOption.java | 3 +- 7 files changed, 80 insertions(+), 22 deletions(-) create mode 100644 src/org/tizen/emulator/manager/vms/helper/VMCreatorException.java create mode 100644 src/org/tizen/emulator/manager/vms/helper/VMLauncherException.java rename src/org/tizen/emulator/manager/vms/helper/{CheckingRunningEmulator.java => VMWorkerException.java} (61%) diff --git a/src/org/tizen/emulator/manager/ui/detail/item/CommonItemListFactory.java b/src/org/tizen/emulator/manager/ui/detail/item/CommonItemListFactory.java index 650d54f..60fe76d 100644 --- a/src/org/tizen/emulator/manager/ui/detail/item/CommonItemListFactory.java +++ b/src/org/tizen/emulator/manager/ui/detail/item/CommonItemListFactory.java @@ -64,7 +64,6 @@ import org.tizen.emulator.manager.ui.detail.item.template.FileViewItem; import org.tizen.emulator.manager.ui.detail.item.template.LabelViewItem; import org.tizen.emulator.manager.ui.detail.item.template.OnOffViewItem; import org.tizen.emulator.manager.ui.detail.item.template.TextViewItem; -import org.tizen.emulator.manager.vms.helper.CheckingRunningEmulator; import org.tizen.emulator.manager.vms.xml.template.DeviceList; import org.tizen.emulator.manager.vms.xml.template.Item; import org.tizen.emulator.manager.vms.xml.template.ObjectFactory; @@ -94,6 +93,7 @@ public abstract class CommonItemListFactory implements IItemListFactory{ public static String ITEM_INPUT_DEVICE = "inputDevice"; //$NON-NLS-1$ public static String ITEM_OCI_DEVICE = "ociDevice"; //$NON-NLS-1$ public static String ITEM_TUNER = "tuner"; //$NON-NLS-1$ + public static String ITEM_VIEWER = "viewer"; public static ObjectFactory factory = new ObjectFactory(); @@ -158,7 +158,7 @@ public abstract class CommonItemListFactory implements IItemListFactory{ String name = item.getName(); String type = item.getType(); - if (name.equals(CheckingRunningEmulator.OPTION_VIEWER)) { + if (name.equals(ITEM_VIEWER)) { if (EmulatorManager.isLinux()) { itemList.add(new LabelViewItem(item, currentLineLabel)); } diff --git a/src/org/tizen/emulator/manager/ui/widgets/VMButton.java b/src/org/tizen/emulator/manager/ui/widgets/VMButton.java index 1e602f8..d201620 100644 --- a/src/org/tizen/emulator/manager/ui/widgets/VMButton.java +++ b/src/org/tizen/emulator/manager/ui/widgets/VMButton.java @@ -65,7 +65,6 @@ import org.tizen.emulator.manager.ui.list.VMButtonFactory; import org.tizen.emulator.manager.vms.SKIN_SHAPE; import org.tizen.emulator.manager.vms.VMProperty; import org.tizen.emulator.manager.vms.VMProperty.FSImageType; -import org.tizen.emulator.manager.vms.helper.CheckingRunningEmulator; import org.tizen.emulator.manager.vms.helper.HelperClass; public class VMButton extends ImageButton { @@ -445,7 +444,7 @@ public class VMButton extends ImageButton { private void checkToolTipText(VMButton button) { VMProperty prop = button.getProperty(); if (prop != null) { - if (CheckingRunningEmulator.isRemote(prop) && prop.isRunning()) { + if (prop.isRemote() && prop.isRunning()) { int webVMPort = 0; /* FIXME synchronized (ECSSocket.list) { diff --git a/src/org/tizen/emulator/manager/vms/VMProperty.java b/src/org/tizen/emulator/manager/vms/VMProperty.java index 11522e6..e164a9b 100644 --- a/src/org/tizen/emulator/manager/vms/VMProperty.java +++ b/src/org/tizen/emulator/manager/vms/VMProperty.java @@ -35,6 +35,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import org.tizen.emulator.manager.EmulatorManager; +import org.tizen.emulator.manager.EmulatorManager.ManagerModeType; import org.tizen.emulator.manager.platform.BaseImage; import org.tizen.emulator.manager.plugin.EMPlugin; import org.tizen.emulator.manager.plugin.ExtensionItem; @@ -344,6 +346,20 @@ public final class VMProperty { this.lastLaunched = lastLaunched; } + // FIXME + public static String OPTION_VIEWER = "viewer"; //$NON-NLS-1$ + public static String OPTION_TYPE = "type"; //$NON-NLS-1$ + public static String VAL_WEB = "Web"; //$NON-NLS-1$ + + public boolean isRemote() { + if (EmulatorManager.isLinux() + && EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE + && getPropertyValue().getAdvancedOptionSubValue(OPTION_VIEWER, OPTION_TYPE).equals(VAL_WEB)) { + return true; + } + return false; + } + public enum Architecture { x86("x86", 32), i386("i386", 32), x86_64("x86_64", 64); //$NON-NLS-1$ //$NON-NLS-2$ diff --git a/src/org/tizen/emulator/manager/vms/helper/VMCreatorException.java b/src/org/tizen/emulator/manager/vms/helper/VMCreatorException.java new file mode 100644 index 0000000..d784eac --- /dev/null +++ b/src/org/tizen/emulator/manager/vms/helper/VMCreatorException.java @@ -0,0 +1,39 @@ +/* + * Emulator Manager + * + * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * MunKyu Im + * SeokYeon Hwang + * JiHye Kim + * YeongKyoon Lee + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * Contributors: + * - S-Core Co., Ltd + * + */ + +package org.tizen.emulator.manager.vms.helper; + +@SuppressWarnings("serial") +@Deprecated // It is temporary wrapper for plugins +public class VMCreatorException extends org.tizen.emulator.manager.vms.exception.VMCreatorException { + public VMCreatorException(String message) { + super(message); + } +} diff --git a/src/org/tizen/emulator/manager/vms/helper/VMLauncherException.java b/src/org/tizen/emulator/manager/vms/helper/VMLauncherException.java new file mode 100644 index 0000000..124eafd --- /dev/null +++ b/src/org/tizen/emulator/manager/vms/helper/VMLauncherException.java @@ -0,0 +1,13 @@ +package org.tizen.emulator.manager.vms.helper; + +@SuppressWarnings("serial") +@Deprecated // It is temporary wrapper for plugins +public class VMLauncherException extends org.tizen.emulator.manager.vms.exception.VMLauncherException { + public VMLauncherException(String message) { + super(message); + } + + public VMLauncherException(String message, boolean isCritical) { + super(message, isCritical); + } +} diff --git a/src/org/tizen/emulator/manager/vms/helper/CheckingRunningEmulator.java b/src/org/tizen/emulator/manager/vms/helper/VMWorkerException.java similarity index 61% rename from src/org/tizen/emulator/manager/vms/helper/CheckingRunningEmulator.java rename to src/org/tizen/emulator/manager/vms/helper/VMWorkerException.java index 0ba0c21..408f0ff 100644 --- a/src/org/tizen/emulator/manager/vms/helper/CheckingRunningEmulator.java +++ b/src/org/tizen/emulator/manager/vms/helper/VMWorkerException.java @@ -30,22 +30,14 @@ package org.tizen.emulator.manager.vms.helper; -import org.tizen.emulator.manager.EmulatorManager; -import org.tizen.emulator.manager.EmulatorManager.ManagerModeType; -import org.tizen.emulator.manager.vms.VMProperty; - -public final class CheckingRunningEmulator { - // FIXME - public static String OPTION_VIEWER = "viewer"; //$NON-NLS-1$ - public static String OPTION_TYPE = "type"; //$NON-NLS-1$ - public static String VAL_WEB = "Web"; //$NON-NLS-1$ +@SuppressWarnings("serial") +@Deprecated // It is temporary wrapper for plugins +public class VMWorkerException extends org.tizen.emulator.manager.vms.exception.VMWorkerException { + public VMWorkerException(String message) { + super(message); + } - public static boolean isRemote(VMProperty prop) { - if (EmulatorManager.isLinux() - && EmulatorManager.getManagerMode() == ManagerModeType.INHOUSE_MODE - && prop.getPropertyValue().getAdvancedOptionSubValue(OPTION_VIEWER, OPTION_TYPE).equals(VAL_WEB)) { - return true; - } - return false; + public VMWorkerException(String message, boolean isNeedRefresh) { + super(message, isNeedRefresh); } } diff --git a/src/org/tizen/emulator/manager/vms/option/RemoteOption.java b/src/org/tizen/emulator/manager/vms/option/RemoteOption.java index 3866fea..4c8749a 100644 --- a/src/org/tizen/emulator/manager/vms/option/RemoteOption.java +++ b/src/org/tizen/emulator/manager/vms/option/RemoteOption.java @@ -31,7 +31,6 @@ package org.tizen.emulator.manager.vms.option; import org.tizen.emulator.manager.console.RemoteManager; import org.tizen.emulator.manager.vms.VMProperty; import org.tizen.emulator.manager.vms.exception.VMLauncherException; -import org.tizen.emulator.manager.vms.helper.CheckingRunningEmulator; public class RemoteOption extends Option { @@ -60,7 +59,7 @@ public class RemoteOption extends Option { public static boolean isRemoteMode(VMProperty property) { if (RemoteManager.getSpiceMode() - || CheckingRunningEmulator.isRemote(property)) { + || property.isRemote()) { return true; } return false; -- 2.7.4