import org.tizen.emulator.manager.ui.detail.item.property.FileShareViewItem;
import org.tizen.emulator.manager.ui.detail.item.property.HWSupportViewItem;
import org.tizen.emulator.manager.ui.detail.item.property.MaxTouchViewItem;
+import org.tizen.emulator.manager.ui.detail.item.property.ProcessorViewItem;
import org.tizen.emulator.manager.ui.detail.item.property.RamSizeItem;
import org.tizen.emulator.manager.ui.detail.item.property.VMNameViewItem;
import org.tizen.emulator.manager.ui.detail.item.template.CheckLabelViewItem;
public abstract class CommonItemListFactory implements IItemListFactory{
- protected static String ITEM_VM_NAME = "vmName";
- protected static String ITEM_BASE_IMAGE = "baseImage";
- protected static String ITEM_DISPLAY = "display";
- protected static String ITEM_RAM_SIZE = "ramSize";
- protected static String ITEM_MAX_TOUCH = "maxTouch";
- protected static String ITEM_FILE_SHARE = "fileShare";
- protected static String ITEM_HW_SUPPORT = "hwSupport";
+ public static String ITEM_VM_NAME = "vmName";
+ public static String ITEM_BASE_IMAGE = "baseImage";
+ public static String ITEM_DISPLAY = "display";
+ public static String ITEM_RAM_SIZE = "ramSize";
+ public static String ITEM_MAX_TOUCH = "maxTouch";
+ public static String ITEM_FILE_SHARE = "fileShare";
+ public static String ITEM_HW_SUPPORT = "hwSupport";
+ public static String ITEM_PROCESSORS = "processors";
public static ObjectFactory factory = new ObjectFactory();
} else if (itemName.equals(ITEM_DISPLAY)) {
itemList.add(new DisplayViewItem(item, currentLineLabel));
+ } else if (itemName.equals(ITEM_PROCESSORS)) {
+ itemList.add(new ProcessorViewItem(item, currentLineLabel));
+
} else if (itemName.equals(ITEM_RAM_SIZE)) {
itemList.add(new RamSizeItem(item, currentLineLabel));
--- /dev/null
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2011 - 2012 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * JiHye Kim <jihye1128.kim@samsung.com>
+ * Minkee Lee <minkee.lee@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * 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.ui.detail.item.property;
+
+import java.util.List;
+
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.tizen.emulator.manager.tool.CheckVirtualization;
+import org.tizen.emulator.manager.ui.StatusBar;
+import org.tizen.emulator.manager.ui.detail.item.AdvancedViewItem;
+import org.tizen.emulator.manager.ui.detail.item.CommonItemListFactory;
+import org.tizen.emulator.manager.ui.detail.item.LineLabelViewItem;
+import org.tizen.emulator.manager.ui.detail.item.template.ComboViewItem;
+import org.tizen.emulator.manager.ui.dialog.MessageDialog;
+import org.tizen.emulator.manager.vms.CPU;
+import org.tizen.emulator.manager.vms.VMPropertyValue;
+import org.tizen.emulator.manager.vms.helper.HelperClass;
+import org.tizen.emulator.manager.vms.xml.template.Item;
+import org.tizen.emulator.manager.vms.xml.template.Option;
+
+public class ProcessorViewItem extends ComboViewItem {
+
+ public ProcessorViewItem(Item template, LineLabelViewItem lineLabelViewItem) {
+ super(template, lineLabelViewItem);
+ COMBOBOX_WIDTH = 135;
+ }
+
+ @Override
+ protected void parseOption(List<Option> optionList) {
+ // make comboOptions
+ for (CPU r : CPU.values()) {
+ comboOptions.add(r.toString());
+ }
+ }
+
+ @Override
+ public boolean settingDetailItem(VMPropertyValue value) {
+ valueLabel.setText(Integer.toString(value.cpu));
+ return false;
+ }
+
+ @Override
+ public void setValue(VMPropertyValue value) {
+ value.cpu = Integer.parseInt(newValue);
+ }
+
+ @Override
+ protected void addWidgetListener() {
+ combo.addSelectionListener(new SelectionListener() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ newValue = combo.getText();
+
+ if (!isCreateMode()) {
+ getListener().ChangeValue(getThis());
+ getListener().changeConfirmButton(getThis());
+ }
+
+ if (checkUGWarning()) {
+ String msg = "\nPlease use processors 1 at non-UG platform." +
+ "\nMulti-processors might cause VM slower.";
+ new MessageDialog().openWarningDialog("Emulator Manager Warning", msg);
+ }
+ }
+
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ // TODO Auto-generated method stub
+ }
+ });
+ }
+
+ @Override
+ public boolean settingModifyItem(VMPropertyValue value) {
+
+ newValue = getItemValue(value);
+
+ // makeComboBox
+ if (comboOptions != null) {
+ if (combo != null) {
+ combo.removeAll();
+ }
+ for(String option : comboOptions) {
+ combo.add(option);
+ }
+ }
+
+ if (isCreateMode()) {
+ if (CheckVirtualization.getInstance().isNonUG()) {
+ value.cpu = 1;
+
+ } else {
+ // set MAX cpu value.
+ String val = combo.getItem(combo.getItemCount()-1);
+ int maxNum = Integer.parseInt(val);
+ if (maxNum > 4) {
+ value.cpu = 4; // 4 : target max cpu.
+ } else {
+ value.cpu = maxNum;
+ }
+ }
+ }
+ newValue = oldValue = String.valueOf(value.cpu);
+
+ // Select combo-box item.
+ int index=-1;
+ for (int i=0 ; i < comboOptions.size(); i++) {
+ if (comboOptions.get(i).equals(newValue)) {
+ index = i;
+ break;
+ }
+ }
+ if (comboOptions.size() > 0) {
+ if (index == -1) {
+ // if value not matches..
+ combo.select(0);
+ newValue = combo.getItem(0);
+ } else {
+ combo.select(index);
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public String getItemValue(VMPropertyValue value) {
+ return String.valueOf(value.cpu);
+ }
+
+ @Override
+ public boolean checkValue() {
+ return true;
+ }
+
+ private boolean checkUGWarning() {
+ if (CheckVirtualization.getInstance().isNonUG()) {
+ if (Integer.parseInt(newValue) > 1) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+}
import org.tizen.emulator.manager.vms.helper.VMLauncherException;
import org.tizen.emulator.manager.vms.helper.VMWorkerException;
import org.tizen.emulator.manager.vms.helper.WorkerLock;
+import org.tizen.emulator.manager.vms.xml.CpuType;
public class VMWorkerCommon {
}
}
+ // Check non-UG mode.
+ CpuType cpuOption = property.getConfiguration().getDevice().getCPU();
+ if (cpuOption != null) {
+ int cpu = cpuOption.getValue().getValue();
+ if (CheckVirtualization.getInstance().isNonUG() && cpu > 1) {
+ MessageDialog dialog = new MessageDialog();
+ int response = dialog.openWarningAndSelectionDialog(
+ "Using multi-processor option might cause VM slower" +
+ "\nin non-UG platform." +
+ "\n\n Do you want to continue launching anyway?");
+ if (response != SWT.OK){
+ throw new VMWorkerException("User stops launching emulator.");
+ }
+ }
+ }
+
isRunningNow();
if (!launcher.launch(property, wait)) {