/**
- * Display the emulator detail information
+ * Detailed Information Of VM
*
* Copyright (C) 2011 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
*
package org.tizen.emulator.skin.dialog;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
+import java.util.List;
import java.util.Map.Entry;
import java.util.logging.Level;
import java.util.logging.Logger;
*
*/
public class DetailInfoDialog extends SkinDialog {
+ public final static String TABLE_COLUMN_NAME_0 = "Feature";
+ public final static String TABLE_COLUMN_NAME_1 = "Value";
+
public final static String DATA_DELIMITER = "#";
+ public final static String QEMU_PARAMETER_KVM = "-enable-kvm";
+ public final static String QEMU_PARAMETER_HAX = "-enable-hax";
+ public final static String QEMU_PARAMETER_GL = "-enable-gl";
+ public final static String QEMU_PARAMETER_RAM = "-m";
+ public final static String QEMU_PARAMETER_DRIVE = "-drive";
public final static String KEY_VM_NAME = "VM Name";
public final static String KEY_SKIN_NAME = "Skin Name";
/**
* Constructor
*/
- public DetailInfoDialog(Shell parent, String emulatorName,
- SocketCommunicator communicator, EmulatorConfig config, SkinInformation skinInfo) {
- super(parent, "Detail Info" + " - " + emulatorName,
+ public DetailInfoDialog(Shell parent, SocketCommunicator communicator,
+ EmulatorConfig config, SkinInformation skinInfo) {
+ super(parent, "Detail Info" + " - " + SkinUtil.makeEmulatorName(config),
SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.RESIZE | SWT.MAX);
this.communicator = communicator;
TableColumn[] column = new TableColumn[2];
column[0] = new TableColumn(table, SWT.LEFT);
- column[0].setText("Feature");
+ column[0].setText(TABLE_COLUMN_NAME_0);
column[1] = new TableColumn(table, SWT.LEFT);
- column[1].setText("Value");
+ column[1].setText(TABLE_COLUMN_NAME_1);
int index = 0;
return;
}
- TableItem tableItem = ((TableItem)table.getSelection()[0]);
+ TableItem tableItem = table.getItem(table.getSelectionIndex());
String openPath = VALUE_NONE;
- if (tableItem.getText().compareTo(KEY_LOG_PATH) == 0) {
- openPath = refinedData.get(KEY_LOG_PATH);
- } else if (tableItem.getText().compareTo(KEY_IMAGE_PATH) == 0) {
- openPath = refinedData.get(KEY_IMAGE_PATH);
- } else if (tableItem.getText().compareTo(KEY_FILESHARED_PATH) == 0) {
- openPath = refinedData.get(KEY_FILESHARED_PATH);
+ if (tableItem.getText(0).compareTo(KEY_FILESHARED_PATH) == 0
+ || tableItem.getText(0).compareTo(KEY_LOG_PATH) == 0
+ || tableItem.getText(0).startsWith(KEY_IMAGE_PATH) == true) {
+ openPath = tableItem.getText(1);
+ } else {
+ return;
+ }
+
+ if (openPath == null || openPath.compareTo(VALUE_NONE) == 0 ||
+ openPath.compareTo("") == 0) {
+ return;
}
try {
+ logger.info("open " + openPath);
openPath = StringUtil.getCanonicalPath(openPath);
} catch (IOException e) {
logger.warning("Invalid path");
}
- if (openPath.compareTo(VALUE_NONE) == 0 ||
- openPath.compareTo("") == 0) {
- return;
- }
-
Program.launch(openPath);
/*ProcessBuilder procBrowser = new ProcessBuilder();
@Override
protected void setShellSize() {
- if (SwtUtil.isLinuxPlatform()) {
- shell.setSize((int) (402 * 1.618/* golden ratio */), 402);
+ /* if (SwtUtil.isLinuxPlatform()) {
+ shell.setSize((int) (402 * 1.618), 402);
} else {
shell.setSize((int) (372 * 1.618), 372);
- }
+ } */
+
+ shell.pack();
}
private String queryData() {
String cpu = "";
String ramSize = "";
String dpi = "";
- String imagePath = "";
+ List<String> imagePathList = new ArrayList<String>();
String sharedPath = "";
boolean isCpuVirtual = false;
boolean isGpuVirtual = false;
String logPath = "";
boolean isHaxError = false;
- if (SwtUtil.isLinuxPlatform()) {
- cpuVirtualCompare = "-enable-kvm";
- } else if (SwtUtil.isWindowsPlatform()) {
- cpuVirtualCompare = "-enable-hax";
+ if (SwtUtil.isLinuxPlatform() == true) {
+ cpuVirtualCompare = QEMU_PARAMETER_KVM;
+ } else {
+ cpuVirtualCompare = QEMU_PARAMETER_HAX;
}
- gpuVirtualCompare = "-enable-gl";
+ gpuVirtualCompare = QEMU_PARAMETER_GL;
String[] split = infoData.split(DATA_DELIMITER);
for (int i = 0; i < split.length; i++) {
- if (0 == i) {
+ if (0 == i) { /* emulator binary name */
String exec = split[i].trim().toLowerCase();
+
if (SwtUtil.isWindowsPlatform()) {
if (4 <= exec.length()) {
/* remove '.exe' in Windows */
} else if (exec.endsWith("arm")) {
cpu = "ARM";
}
- } else {
+ } else { /* qemu arguments */
if (i + 1 <= split.length) {
String arg = split[i].trim();
- if ("-m".equals(arg))
+ if (QEMU_PARAMETER_RAM.equals(arg))
{
ramSize = split[i + 1].trim();
}
- else if ("-drive".equals(arg))
+ else if (QEMU_PARAMETER_DRIVE.equals(arg))
{
/* arg : file=/path/emulimg.x86,... */
arg = split[i + 1].trim();
String[] sp2 = sp[0].split("=");
String drivePath = sp2[sp2.length - 1];
- imagePath = drivePath;
+ imagePathList.add(drivePath);
}
}
else if ("-virtfs".equals(arg))
sharedPath = sp[1].substring(spIndex + 1, sp[1].length());
}
}
- else if ("-append".equals(arg))
+ else if ("-append".equals(arg)) /* kernel parameters */
{
arg = split[i + 1].trim();
String[] splitSub = arg.split(" ");
}
/* platform image path */
- if (StringUtil.isEmpty(imagePath)) {
- result.put(KEY_IMAGE_PATH, "Not identified");
+ int nPath = imagePathList.size();
+ if (nPath == 0) {
+ result.put(KEY_IMAGE_PATH, VALUE_NONE);
+ } else if (nPath == 1) {
+ result.put(KEY_IMAGE_PATH, imagePathList.get(0));
} else {
- result.put(KEY_IMAGE_PATH, imagePath);
+ for (int i = 0; i < nPath; i ++) {
+ result.put(KEY_IMAGE_PATH + " " + (i + 1), imagePathList.get(i));
+ }
}
/* emulator log path */