import org.tizen.emulator.manager.Messages;
import org.tizen.emulator.manager.logging.EMLogger;
import org.tizen.emulator.manager.resources.StringResources;
-import org.tizen.emulator.manager.ui.VMsMainView;
import org.tizen.emulator.manager.ui.dialog.MessageDialog;
import org.tizen.emulator.manager.vms.EmulatorVMList;
import org.tizen.emulator.manager.vms.VMProperty;
// Decide whether popup-message display or not.
private static List<String> LAUNCHED_VM_LIST = new ArrayList<String>();
+ private static List<EmulatorStatusListener> listenerList = new ArrayList<EmulatorStatusListener>();
public static void addLaunchedVMList(String vmName) {
synchronized(LAUNCHED_VM_LIST) {
}
}
+ public static void addRunningEmulatorListener(EmulatorStatusListener listener) {
+ listenerList.add(listener);
+ }
+
+ public static void removeRunnignEmulatorListener(EmulatorStatusListener listener) {
+ listenerList.remove(listener);
+ }
+
public static boolean needPopupMessage(VMSocket vms) {
if (vms.getProperty() != null) {
String vmName = vms.getProperty().getName();
emList.add(prop.getName());
}
}
- prop.setRunning(true);
+ setRunning(prop, true);
}
public static void removeEmulator(VMProperty prop, boolean isSuccess) {
emList.remove(prop.getName());
}
if (!isSuccess) {
- prop.setRunning(false);
+ setRunning(prop, false);
} else {
addLaunchedVMList(prop.getName());
boolean checkFinished;
}
} else {
- setRunning(prop.getName(), false);
+ setRunning(prop, false);
EMLogger.getLogger().info("No response from VM (" + prop.getName() + ")."); //$NON-NLS-1$ //$NON-NLS-2$
- if (!EmulatorManager.isConsoleMode()) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- VMsMainView.getInstance().redraw();
- }
- });
- }
}
-
}
}
}
if (isVMFound) {
- setRunning(vm.getName(), true);
+ setRunning(vm, true);
CheckingRunningEmulator.removeEmulator(vm);
result = VMSocket.ResultType.LAUNCHED_VM_DETECTED;
// Check remote option.
}
if (!isHeartBeat){
- // this is not need for console mode
- if (!EmulatorManager.isConsoleMode()) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- VMsMainView.getInstance().redraw();
- }
- });
- }
+ // TODO
}
return result;
public static void setRunning(String vmName, boolean isRunning) {
VMProperty prop = EmulatorVMList.getInstance().getProperty(vmName);
- if (prop != null) {
- prop.setRunning(isRunning);
+ setRunning(prop, isRunning);
+ }
+
+ public static void setRunning(VMProperty prop, boolean isRunning) {
+ if (prop == null) {
+ return;
+ }
+
+ prop.setRunning(isRunning);
+
+ for (EmulatorStatusListener listener : listenerList ) {
+ listener.changeEmulatorRunningStatus(prop);
}
}
// disconnect
if (vms != null) {
if (vms.getProperty() != null) {
- CheckingRunningEmulator.setRunning(vms.getProperty().getName(), false);
+ CheckingRunningEmulator.setRunning(vms.getProperty(), false);
}
vms.disconnect();
}
-
- // this is not need for console mode
- if (!EmulatorManager.isConsoleMode()) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- VMsMainView.getInstance().redraw();
- }
- });
- }
}
private void settingProperty(String path, VMSocket vms) {
vms.setProperty(prop);
RefreshWorker.addToFinishedSet(vms.getEcs_port());
}
- CheckingRunningEmulator.setRunning(prop.getName(), true);
+ CheckingRunningEmulator.setRunning(prop, true);
CheckingRunningEmulator.removeEmulator(prop);
// Check remote option.
showInfoDialog(vms);
}
- // this is not need for console mode
- if (!EmulatorManager.isConsoleMode()) {
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- VMsMainView.getInstance().redraw();
- }
- });
- }
-
break;
}
}