*/
public class EmulatorSkin {
public enum SkinBasicColor {
- BLUE(0, 174, 239),
- YELLOW(246, 226, 0),
- LIME(0, 246, 12),
- VIOLET(168, 43, 255),
- ORANGE(246, 110, 0),
- MAGENTA(245, 48, 233),
- PURPLE(94, 73, 255),
- GREEN(179, 246, 0),
- RED(245, 48, 48),
- CYON(29, 223, 221);
+ BLUE(0, 174, 239), YELLOW(246, 226, 0), LIME(0, 246, 12), VIOLET(168,
+ 43, 255), ORANGE(246, 110, 0), MAGENTA(245, 48, 233), PURPLE(
+ 94, 73, 255), GREEN(179, 246, 0), RED(245, 48, 48), CYON(29,
+ 223, 221);
private int channelRed;
private int channelGreen;
}
}
- private static Logger logger =
- SkinLogger.getSkinLogger(EmulatorSkin.class).getLogger();
+ private static Logger logger = SkinLogger.getSkinLogger(EmulatorSkin.class)
+ .getLogger();
public EmulatorConfig config;
protected Shell shell;
/**
* @brief constructor
- * @param config : configuration of emulator skin
- * @param isOnTop : always on top flag
+ * @param config
+ * : configuration of emulator skin
+ * @param isOnTop
+ * : always on top flag
*/
protected EmulatorSkin(EmulatorConfig config, SkinInformation skinInfo,
int displayCanvasStyle, boolean isOnTop) {
int red = rand.nextInt(255);
int green = rand.nextInt(255);
int blue = rand.nextInt(255);
- this.colorVM = new Color(shell.getDisplay(), new RGB(red, green, blue));
+ this.colorVM = new Color(shell.getDisplay(), new RGB(red, green,
+ blue));
} else {
int vmIndex = (portNumber % 100) / 10;
imageRegistry = ImageRegistry.getInstance();
/* set emulator states */
- currentState.setCurrentResolutionWidth(config.getValidResolutionWidth());
- currentState.setCurrentResolutionHeight(config.getValidResolutionHeight());
+ currentState
+ .setCurrentResolutionWidth(config.getValidResolutionWidth());
+ currentState.setCurrentResolutionHeight(config
+ .getValidResolutionHeight());
currentState.setCurrentScale(config.getValidScale());
currentState.setCurrentRotationId();
lcdCanvas = skinComposer.compose(displayCanvasStyle);
/* */
- //TODO: move
+ // TODO: move
if (config.getArgBoolean(ArgsConstants.INPUT_MOUSE, false) == true) {
prev_x = lcdCanvas.getSize().x / 2;
prev_y = lcdCanvas.getSize().y / 2;
shellGrabPosition.y = y;
if (SwtUtil.isWindowsPlatform() == true) {
- final BooleanData dataGrabbing = new BooleanData(
- true, SendCommand.SEND_SKIN_GRABBED.toString());
- communicator.sendToQEMU(SendCommand.SEND_SKIN_GRABBED, dataGrabbing, false);
+ final BooleanData dataGrabbing = new BooleanData(true,
+ SendCommand.SEND_SKIN_GRABBED.toString());
+ communicator.sendToQEMU(SendCommand.SEND_SKIN_GRABBED,
+ dataGrabbing, false);
}
}
shellGrabPosition.y = -1;
if (SwtUtil.isWindowsPlatform() == true) {
- final BooleanData dataGrabbing = new BooleanData(
- false, SendCommand.SEND_SKIN_GRABBED.toString());
- communicator.sendToQEMU(SendCommand.SEND_SKIN_GRABBED, dataGrabbing, false);
+ final BooleanData dataGrabbing = new BooleanData(false,
+ SendCommand.SEND_SKIN_GRABBED.toString());
+ communicator.sendToQEMU(SendCommand.SEND_SKIN_GRABBED,
+ dataGrabbing, false);
}
}
}
/* save config only for emulator close */
- config.setSkinProperty(
- SkinPropertiesConstants.WINDOW_X,
+ config.setSkinProperty(SkinPropertiesConstants.WINDOW_X,
shell.getLocation().x);
- config.setSkinProperty(
- SkinPropertiesConstants.WINDOW_Y,
+ config.setSkinProperty(SkinPropertiesConstants.WINDOW_Y,
shell.getLocation().y);
config.setSkinProperty(
SkinPropertiesConstants.WINDOW_SCALE,
skinFinalize();
} else {
- /* Skin have to be alive until receiving shutdown request from qemu */
+ /*
+ * Skin have to be alive until receiving shutdown request
+ * from qemu
+ */
event.doit = false;
if (pressedKeyEventList.isEmpty() == true
&& demanderFlag.compareAndSet(false, true)) {
if (null != communicator) {
- communicator.sendToQEMU(
- SendCommand.SEND_CLOSE_REQ, null, false);
+ communicator.sendToQEMU(SendCommand.SEND_CLOSE_REQ,
+ null, false);
}
/* block for a while */
try {
- /* In Close emulation,
- * 1000ms parameter was used for sleep function.
- * So, we need a bigger value than that.*/
+ /*
+ * In Close emulation, 1000ms parameter was used for
+ * sleep function. So, we need a bigger value than
+ * that.
+ */
new Timer().schedule(new TimerTask() {
@Override
public void run() {
@Override
public void keyReleased(KeyEvent e) {
if (logger.isLoggable(Level.INFO)) {
- String character =
- (e.character == '\0') ? "\\0" :
- (e.character == '\n') ? "\\n" :
- (e.character == '\r') ? "\\r" :
- ("" + e.character);
-
- logger.info("'" + character + "':"
- + e.keyCode + ":"
- + e.stateMask + ":"
- + e.keyLocation);
+ String character = (e.character == '\0') ? "\\0"
+ : (e.character == '\n') ? "\\n"
+ : (e.character == '\r') ? "\\r"
+ : ("" + e.character);
+
+ logger.info("'" + character + "':" + e.keyCode + ":"
+ + e.stateMask + ":" + e.keyLocation);
} else if (logger.isLoggable(Level.FINE)) {
logger.fine(e.toString());
}
KeyEventType.RELEASED.value(),
disappearKeycode, disappearStateMask,
disappearKeyLocation);
- communicator.sendToQEMU(SendCommand.SEND_KEYBOARD_KEY_EVENT,
+ communicator.sendToQEMU(
+ SendCommand.SEND_KEYBOARD_KEY_EVENT,
keyEventData, false);
removePressedKeyFromList(keyEventData);
KeyEventData keyEventData = null;
/* separate a merged release event */
- if (previous.keyCode == SWT.CR &&
- (keyCode & SWT.KEYCODE_BIT) != 0 && e.character == SWT.CR) {
- logger.info("send upon release : keycode=" + (int)SWT.CR);
+ if (previous.keyCode == SWT.CR
+ && (keyCode & SWT.KEYCODE_BIT) != 0
+ && e.character == SWT.CR) {
+ logger.info("send upon release : keycode="
+ + (int) SWT.CR);
keyEventData = new KeyEventData(
- KeyEventType.RELEASED.value(),
- SWT.CR, 0, 0);
- } else if (previous.keyCode == SWT.SPACE &&
- (keyCode & SWT.KEYCODE_BIT) != 0 &&
- (e.character == SWT.SPACE)) {
- logger.info("send upon release : keycode=" + (int)SWT.SPACE);
+ KeyEventType.RELEASED.value(), SWT.CR, 0, 0);
+ } else if (previous.keyCode == SWT.SPACE
+ && (keyCode & SWT.KEYCODE_BIT) != 0
+ && (e.character == SWT.SPACE)) {
+ logger.info("send upon release : keycode="
+ + (int) SWT.SPACE);
keyEventData = new KeyEventData(
- KeyEventType.RELEASED.value(),
- SWT.SPACE, 0, 0);
- } else if (previous.keyCode == SWT.TAB &&
- (keyCode & SWT.KEYCODE_BIT) != 0 &&
- (e.character == SWT.TAB)) {
- logger.info("send upon release : keycode=" + (int)SWT.TAB);
+ KeyEventType.RELEASED.value(), SWT.SPACE,
+ 0, 0);
+ } else if (previous.keyCode == SWT.TAB
+ && (keyCode & SWT.KEYCODE_BIT) != 0
+ && (e.character == SWT.TAB)) {
+ logger.info("send upon release : keycode="
+ + (int) SWT.TAB);
keyEventData = new KeyEventData(
- KeyEventType.RELEASED.value(),
- SWT.TAB, 0, 0);
- } else if (previous.keyCode == SWT.KEYPAD_CR &&
- (keyCode & SWT.KEYCODE_BIT) != 0 &&
- (e.character == SWT.CR) &&
- (keyCode != SWT.KEYPAD_CR)) {
- logger.info("send upon release : keycode=" + (int)SWT.KEYPAD_CR);
+ KeyEventType.RELEASED.value(), SWT.TAB, 0,
+ 0);
+ } else if (previous.keyCode == SWT.KEYPAD_CR
+ && (keyCode & SWT.KEYCODE_BIT) != 0
+ && (e.character == SWT.CR)
+ && (keyCode != SWT.KEYPAD_CR)) {
+ logger.info("send upon release : keycode="
+ + (int) SWT.KEYPAD_CR);
keyEventData = new KeyEventData(
KeyEventType.RELEASED.value(),
}
if (keyEventData != null) {
- communicator.sendToQEMU(SendCommand.SEND_KEYBOARD_KEY_EVENT,
+ communicator.sendToQEMU(
+ SendCommand.SEND_KEYBOARD_KEY_EVENT,
keyEventData, false);
removePressedKeyFromList(keyEventData);
}
disappearStateMask = stateMask;
disappearKeyLocation = e.keyLocation;
} else {
- /* three or more keys were pressed at the
- * same time */
+ /*
+ * three or more keys were pressed at the same
+ * time
+ */
if (disappearEvent == true) {
logger.info("replace the disappearEvent : "
+ disappearKeycode + "->" + keyCode);
int previousStateMask = previous.stateMask;
if (logger.isLoggable(Level.INFO)) {
- String character =
- (previous.character == '\0') ? "\\0" :
- (previous.character == '\n') ? "\\n" :
- (previous.character == '\r') ? "\\r" :
- ("" + previous.character);
+ String character = (previous.character == '\0') ? "\\0"
+ : (previous.character == '\n') ? "\\n"
+ : (previous.character == '\r') ? "\\r"
+ : ("" + previous.character);
logger.info("send previous release : '"
+ character + "':"
} /* end isWindowsPlatform */
if (logger.isLoggable(Level.INFO)) {
- String character =
- (e.character == '\0') ? "\\0" :
- (e.character == '\n') ? "\\n" :
- (e.character == '\r') ? "\\r" :
- ("" + e.character);
-
- logger.info("'" + character + "':"
- + e.keyCode + ":"
- + e.stateMask + ":"
- + e.keyLocation);
+ String character = (e.character == '\0') ? "\\0"
+ : (e.character == '\n') ? "\\n"
+ : (e.character == '\r') ? "\\r"
+ : ("" + e.character);
+
+ logger.info("'" + character + "':" + e.keyCode + ":"
+ + e.stateMask + ":" + e.keyLocation);
} else if (logger.isLoggable(Level.FINE)) {
logger.fine(e.toString());
}
currentState.getCurrentRotationId());
MouseEventData mouseEventData = new MouseEventData(
- MouseButtonType.LEFT.value(), eventType,
- e.x, e.y, geometry[0], geometry[1], 0);
+ MouseButtonType.LEFT.value(), eventType, e.x, e.y, geometry[0],
+ geometry[1], 0);
- communicator.sendToQEMU(SendCommand.SEND_MOUSE_EVENT,
- mouseEventData, false);
+ communicator.sendToQEMU(SendCommand.SEND_MOUSE_EVENT, mouseEventData,
+ false);
}
protected void mouseUpDelivery(MouseEvent e) {
currentState.getCurrentResolutionHeight(),
currentState.getCurrentScale(),
currentState.getCurrentRotationId());
- logger.info("mouseUp in display" +
- " x:" + geometry[0] + " y:" + geometry[1]);
+ logger.info("mouseUp in display" + " x:" + geometry[0] + " y:"
+ + geometry[1]);
MouseEventData mouseEventData = new MouseEventData(
MouseButtonType.LEFT.value(), MouseEventType.RELEASE.value(),
e.x, e.y, geometry[0], geometry[1], 0);
- communicator.sendToQEMU(SendCommand.SEND_MOUSE_EVENT,
- mouseEventData, false);
+ communicator.sendToQEMU(SendCommand.SEND_MOUSE_EVENT, mouseEventData,
+ false);
}
protected void mouseDownDelivery(MouseEvent e) {
currentState.getCurrentResolutionHeight(),
currentState.getCurrentScale(),
currentState.getCurrentRotationId());
- logger.info("mouseDown in display" +
- " x:" + geometry[0] + " y:" + geometry[1]);
+ logger.info("mouseDown in display" + " x:" + geometry[0] + " y:"
+ + geometry[1]);
MouseEventData mouseEventData = new MouseEventData(
MouseButtonType.LEFT.value(), MouseEventType.PRESS.value(),
e.x, e.y, geometry[0], geometry[1], 0);
- communicator.sendToQEMU(SendCommand.SEND_MOUSE_EVENT,
- mouseEventData, false);
+ communicator.sendToQEMU(SendCommand.SEND_MOUSE_EVENT, mouseEventData,
+ false);
}
- protected void keyReleasedDelivery(int keyCode,
- int stateMask, int keyLocation, boolean remove) {
+ protected void keyReleasedDelivery(int keyCode, int stateMask,
+ int keyLocation, boolean remove) {
KeyEventData keyEventData = new KeyEventData(
KeyEventType.RELEASED.value(), keyCode, stateMask, keyLocation);
- communicator.sendToQEMU(
- SendCommand.SEND_KEYBOARD_KEY_EVENT, keyEventData, false);
+ communicator.sendToQEMU(SendCommand.SEND_KEYBOARD_KEY_EVENT,
+ keyEventData, false);
if (remove == true) {
removePressedKeyFromList(keyEventData);
}
}
- protected void keyPressedDelivery(int keyCode,
- int stateMask, int keyLocation, boolean add) {
+ protected void keyPressedDelivery(int keyCode, int stateMask,
+ int keyLocation, boolean add) {
KeyEventData keyEventData = new KeyEventData(
KeyEventType.PRESSED.value(), keyCode, stateMask, keyLocation);
- communicator.sendToQEMU(
- SendCommand.SEND_KEYBOARD_KEY_EVENT, keyEventData, false);
+ communicator.sendToQEMU(SendCommand.SEND_KEYBOARD_KEY_EVENT,
+ keyEventData, false);
if (add == true) {
addPressedKeyToList(keyEventData);
}
protected void rearrangeSkin() {
- skinComposer.arrangeSkin(
- currentState.getCurrentScale(),
+ skinComposer.arrangeSkin(currentState.getCurrentScale(),
currentState.getCurrentRotationId());
}
if (rotationId == SkinRotations.LANDSCAPE_ID) {
/* landscape */
- displayTransform.translate(
- lcdCanvas.getSize().y * -1, 0);
+ displayTransform.translate(lcdCanvas.getSize().y * -1, 0);
} else if (rotationId == SkinRotations.REVERSE_PORTRAIT_ID) {
/* reverse-portrait */
- displayTransform.translate(
- lcdCanvas.getSize().x * -1,
+ displayTransform.translate(lcdCanvas.getSize().x * -1,
lcdCanvas.getSize().y * -1);
} else if (rotationId == SkinRotations.REVERSE_LANDSCAPE_ID) {
/* reverse-landscape */
- displayTransform.translate(
- 0, lcdCanvas.getSize().x * -1);
+ displayTransform.translate(0, lcdCanvas.getSize().x * -1);
}
}
if (isDisplayDragging == true) {
logger.info("auto release : mouseEvent");
- MouseEventData mouseEventData = new MouseEventData(
- 0, MouseEventType.RELEASE.value(),
- 0, 0, 0, 0, 0);
+ MouseEventData mouseEventData = new MouseEventData(0,
+ MouseEventType.RELEASE.value(), 0, 0, 0, 0, 0);
- communicator.sendToQEMU(
- SendCommand.SEND_MOUSE_EVENT, mouseEventData, false);
+ communicator.sendToQEMU(SendCommand.SEND_MOUSE_EVENT,
+ mouseEventData, false);
}
}
logger.fine("Open detail info");
}
- DetailInfoDialog detailInfoDialog = new DetailInfoDialog(
- shell, communicator, config, skinInfo);
+ DetailInfoDialog detailInfoDialog = new DetailInfoDialog(shell,
+ communicator, config, skinInfo);
detailInfoDialog.open();
}
};
final List<MenuItem> rotationList = new ArrayList<MenuItem>();
- Iterator<Entry<Short, Rotation>> iterator =
- SkinRotations.getRotationIterator();
+ Iterator<Entry<Short, Rotation>> iterator = SkinRotations
+ .getRotationIterator();
while (iterator.hasNext()) {
Entry<Short, Rotation> entry = iterator.next();
}
/* temp : swap rotation menu names */
- if (currentState.getCurrentResolutionWidth() >
- currentState.getCurrentResolutionHeight()) {
+ if (currentState.getCurrentResolutionWidth() > currentState
+ .getCurrentResolutionHeight()) {
for (MenuItem m : rotationList) {
short rotationId = (Short) m.getData();
if (rotationId == SkinRotations.PORTRAIT_ID) {
- String landscape = SkinRotations.getRotation(
- SkinRotations.LANDSCAPE_ID).getName().value();
+ String landscape = SkinRotations
+ .getRotation(SkinRotations.LANDSCAPE_ID).getName()
+ .value();
m.setText(landscape);
} else if (rotationId == SkinRotations.LANDSCAPE_ID) {
- String portrait = SkinRotations.getRotation(
- SkinRotations.PORTRAIT_ID).getName().value();
+ String portrait = SkinRotations
+ .getRotation(SkinRotations.PORTRAIT_ID).getName()
+ .value();
m.setText(portrait);
} else if (rotationId == SkinRotations.REVERSE_PORTRAIT_ID) {
- String landscapeReverse = SkinRotations.getRotation(
- SkinRotations.REVERSE_LANDSCAPE_ID).getName().value();
+ String landscapeReverse = SkinRotations
+ .getRotation(SkinRotations.REVERSE_LANDSCAPE_ID)
+ .getName().value();
m.setText(landscapeReverse);
} else if (rotationId == SkinRotations.REVERSE_LANDSCAPE_ID) {
- String portraitReverse = SkinRotations.getRotation(
- SkinRotations.REVERSE_PORTRAIT_ID).getName().value();
+ String portraitReverse = SkinRotations
+ .getRotation(SkinRotations.REVERSE_PORTRAIT_ID)
+ .getName().value();
m.setText(portraitReverse);
}
}
currentState.getCurrentScale(), rotationId);
/* location correction */
- Rectangle monitorBounds = Display.getDefault().getBounds();
+ Rectangle monitorBounds = Display.getDefault()
+ .getBounds();
Rectangle emulatorBounds = shell.getBounds();
shell.setLocation(
Math.max(emulatorBounds.x, monitorBounds.x),
return;
}
- final int scale = (Integer)item.getData(); /* percentage */
+ final int scale = (Integer) item.getData(); /* percentage */
shell.getDisplay().syncExec(new Runnable() {
@Override
currentState.getCurrentRotationId());
/* location correction */
- Rectangle monitorBounds = Display.getDefault().getBounds();
+ Rectangle monitorBounds = Display.getDefault()
+ .getBounds();
Rectangle emulatorBounds = shell.getBounds();
shell.setLocation(
Math.max(emulatorBounds.x, monitorBounds.x),
boolean on = item.equals(popupMenu.interpolationHighItem);
isOnInterpolation = on;
- logger.info("Select scale interpolation : " + isOnInterpolation);
+ logger.info("Select scale interpolation : "
+ + isOnInterpolation);
- communicator.sendToQEMU(SendCommand.SEND_INTERPOLATION_STATE,
- new BooleanData(on, SendCommand.SEND_INTERPOLATION_STATE.toString()),
- false);
+ communicator.sendToQEMU(
+ SendCommand.SEND_INTERPOLATION_STATE,
+ new BooleanData(on,
+ SendCommand.SEND_INTERPOLATION_STATE
+ .toString()), false);
}
}
};
MenuItem layoutSelected = (MenuItem) e.widget;
if (layoutSelected.getSelection() == true) {
- for (MenuItem layout : layoutSelected.getParent().getItems()) {
+ for (MenuItem layout : layoutSelected.getParent()
+ .getItems()) {
if (layout != layoutSelected) {
/* uncheck other menu items */
layout.setSelection(false);
} else {
- int layoutIndex = getKeyWindowKeeper().getLayoutIndex();
+ int layoutIndex = getKeyWindowKeeper()
+ .getLayoutIndex();
if (getKeyWindowKeeper().determineLayout() != layoutIndex) {
/* switch */
getKeyWindowKeeper().closeKeyWindow();
if (getKeyWindowKeeper().getKeyWindow() == null) {
if (getKeyWindowKeeper().getRecentlyDocked() != SWT.NONE) {
getKeyWindowKeeper().openKeyWindow(
- getKeyWindowKeeper().getRecentlyDocked(), false);
+ getKeyWindowKeeper().getRecentlyDocked(),
+ false);
getKeyWindowKeeper().setRecentlyDocked(SWT.NONE);
} else {
/* opening for first time */
getKeyWindowKeeper().openKeyWindow(
- KeyWindowKeeper.DEFAULT_DOCK_POSITION, false);
+ KeyWindowKeeper.DEFAULT_DOCK_POSITION,
+ false);
}
} else {
getKeyWindowKeeper().openKeyWindow(
@Override
public void widgetSelected(SelectionEvent e) {
// TODO:
- /* if (!communicator.isSensorDaemonStarted()) {
- SkinUtil.openMessage(shell, null,
- "Host Keyboard is not ready.\n"
- + "Please wait until the emulator is completely boot up.",
- SWT.ICON_WARNING, config);
- popupMenu.hostKbdOnItem.setSelection(isOnKbd);
- popupMenu.hostKbdOffItem.setSelection(!isOnKbd);
-
- return;
- } */
+ /*
+ * if (!communicator.isSensorDaemonStarted()) {
+ * SkinUtil.openMessage(shell, null,
+ * "Host Keyboard is not ready.\n" +
+ * "Please wait until the emulator is completely boot up.",
+ * SWT.ICON_WARNING, config);
+ * popupMenu.hostKbdOnItem.setSelection(isOnKbd);
+ * popupMenu.hostKbdOffItem.setSelection(!isOnKbd);
+ *
+ * return; }
+ */
MenuItem item = (MenuItem) e.getSource();
if (item.getSelection()) {
logger.info("Select host keyboard : " + isOnKbd);
- communicator.sendToQEMU(SendCommand.SEND_HOST_KBD_STATE,
- new BooleanData(on, SendCommand.SEND_HOST_KBD_STATE.toString()), false);
+ communicator.sendToQEMU(
+ SendCommand.SEND_HOST_KBD_STATE,
+ new BooleanData(on, SendCommand.SEND_HOST_KBD_STATE
+ .toString()), false);
}
}
};
public void widgetSelected(SelectionEvent e) {
logger.info("Open the about dialog");
- AboutDialog dialog = new AboutDialog(shell, config, imageRegistry);
+ AboutDialog dialog = new AboutDialog(shell, config,
+ imageRegistry);
dialog.open();
}
};
if (communicator.isSdbDaemonStarted() == false) {
logger.warning("SDB is not ready.");
- SkinUtil.openMessage(shell, null,
+ SkinUtil.openMessage(
+ shell,
+ null,
"SDB is not ready.\n"
+ "Please wait until the emulator is completely boot up.",
SWT.ICON_WARNING, config);
File sdbFile = new File(sdbPath);
if (sdbFile.exists() == false) {
- logger.info("SDB file does not exist : " + sdbFile.getAbsolutePath());
+ logger.info("SDB file does not exist : "
+ + sdbFile.getAbsolutePath());
try {
SkinUtil.openMessage(shell, null,
"-s", "emulator-" + portSdb, "shell");
} else if (SwtUtil.isMacPlatform()) {
procSdb.command("./sdbscript", "emulator-" + portSdb);
- /* procSdb.command( "/usr/X11/bin/uxterm", "-T",
- "emulator-" + portSdb, "-e", sdbPath,"shell"); */
+ /*
+ * procSdb.command( "/usr/X11/bin/uxterm", "-T", "emulator-"
+ * + portSdb, "-e", sdbPath,"shell");
+ */
} else { /* Linux */
- procSdb.command("/usr/bin/gnome-terminal",
- "--title=" + SkinUtil.makeEmulatorName(config),
- "-x", sdbPath, "-s", "emulator-" + portSdb, "shell");
+ procSdb.command("/usr/bin/gnome-terminal", "--title="
+ + SkinUtil.makeEmulatorName(config), "-x", sdbPath,
+ "-s", "emulator-" + portSdb, "shell");
}
logger.info(procSdb.command().toString());
procSdb.start(); /* open the sdb shell */
} catch (Exception ee) {
logger.log(Level.SEVERE, ee.getMessage(), ee);
- SkinUtil.openMessage(shell, null,
- "Fail to open Shell : \n" + ee.getMessage(),
- SWT.ICON_ERROR, config);
+ SkinUtil.openMessage(shell, null, "Fail to open Shell : \n"
+ + ee.getMessage(), SWT.ICON_ERROR, config);
}
- communicator.sendToQEMU(SendCommand.SEND_OPEN_SHELL, null, false);
+ communicator.sendToQEMU(SendCommand.SEND_OPEN_SHELL, null,
+ false);
}
};
}
String emulName = SkinUtil.getVmName(config);
- int portSdb = config.getArgInt(ArgsConstants.VM_BASE_PORT);
+ int basePort = config.getArgInt(ArgsConstants.VM_BASE_PORT);
+ String proxyAddr = config.getArg(ArgsConstants.PROXY_ADDR);
+ String proxyPort = config.getArg(ArgsConstants.PROXY_PORT);
ProcessBuilder procEcp = new ProcessBuilder();
procEcp.redirectErrorStream(true);
// FIXME: appropriate running binary setting is necessary.
if (SwtUtil.isWindowsPlatform()) {
- procEcp.command("java.exe", "-jar", ecpPath, "vmname="
- + emulName, "base.port=" + portSdb);
+ if (proxyAddr != null && proxyPort != null) {
+ procEcp.command("java.exe", "-Dhttp.proxyHost="
+ + proxyAddr, "-Dhttp.proxyPort=" + proxyPort,
+ "-jar", ecpPath, "vmname=" + emulName,
+ "base.port=" + basePort);
+ } else {
+ procEcp.command("java.exe", "-jar", ecpPath, "vmname="
+ + emulName, "base.port=" + basePort);
+ }
} else if (SwtUtil.isMacPlatform()) {
- procEcp.command("java", "-jar", "-XstartOnFirstThread",
- ecpPath, "vmname=" + emulName, "base.port="
- + portSdb);
+ if (proxyAddr != null && proxyPort != null) {
+ procEcp.command("java",
+ "-Dhttp.proxyHost=" + proxyAddr,
+ "-Dhttp.proxyPort=" + proxyPort, "-jar",
+ "-XstartOnFirstThread", ecpPath, "vmname="
+ + emulName, "base.port=" + basePort);
+ } else {
+ procEcp.command("java", "-jar", "-XstartOnFirstThread",
+ ecpPath, "vmname=" + emulName, "base.port="
+ + basePort);
+ }
} else { /* Linux */
- procEcp.command("java", "-jar", ecpPath, "vmname="
- + emulName, "base.port=" + portSdb);
+ if (proxyAddr != null && proxyPort != null) {
+ procEcp.command("java",
+ "-Dhttp.proxyHost=" + proxyAddr,
+ "-Dhttp.proxyPort=" + proxyPort, "-jar",
+ ecpPath, "vmname=" + emulName, "base.port="
+ + basePort);
+ } else {
+ procEcp.command("java", "-jar", ecpPath, "vmname="
+ + emulName, "base.port=" + basePort);
+ }
}
logger.info(procEcp.command().toString());
public void widgetSelected(SelectionEvent e) {
logger.info("Close menu is selected");
- communicator.sendToQEMU(SendCommand.SEND_CLOSE_REQ, null, false);
+ communicator
+ .sendToQEMU(SendCommand.SEND_CLOSE_REQ, null, false);
}
};
}
}
- keyReleasedDelivery(data.keycode,
- data.stateMask, data.keyLocation, false);
+ keyReleasedDelivery(data.keycode, data.stateMask,
+ data.keyLocation, false);
logger.info("auto release : keycode=" + data.keycode
- + ", stateMask=" + data.stateMask
- + ", keyLocation=" + data.keyLocation);
+ + ", stateMask=" + data.stateMask + ", keyLocation="
+ + data.keyLocation);
}
}