and --vms option apply to liunx..
[Type] work
[Module] emulator manager
[Priority] major
[Jira#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]
}
} catch (Exception e) {
+ e.printStackTrace();
+
if (EMLogger.getLogger() != null) {
EMLogger.getLogger().log(Level.WARNING, e.getMessage());
}
}
public void cloneVM() {
- CloneDialog cloneDialog = new CloneDialog(this, detailView.getCurrentPoperty());
- cloneDialog.open();
+ handling.cloneVirtualMachine(detailView.getCurrentPoperty());
}
// TOOD : error checking
package org.tizen.emulator.manager.ui;
+import java.util.ArrayList;
+
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
+import org.tizen.emulator.manager.EmulatorManager;
import org.tizen.emulator.manager.tool.FilePath;
import org.tizen.emulator.manager.ui.vmstree.VMsTree;
import org.tizen.emulator.manager.vms.VMsProperty;
public class MenuHandling {
private Shell shell;
private VMsTree vmsTree;
+ private static ArrayList<String> baseImagePaths = new ArrayList<String>();
public MenuHandling(Shell shell, VMsTree vmsTree) {
this.shell = shell;
MessageDialog msg = new MessageDialog();
VMsProperty property = prop;
if(prop.getWorker().isRunningNow()) {
- msg.openWarningDialog("Can not 'Create Base Image' while source VM is running.");
+ msg.openWarningDialog("Not allowed to 'Create Base Image' while source VM is running.");
return ;
}
-
+
FileDialog fd = new FileDialog(shell, SWT.SAVE);
fd.setText("Create 'Base Image' As");
String[] filter = {"*."+ property.getArch().toString()};
String returnMSG = "";
try {
+ MenuHandling.addBaseImagePath(path);
property.getWorker().createNewBaseImage(property, path);
//returnMSG = "Succeeded to create 'Base Image'!\nPath: " + path;
} catch (VMsWorkerException e) {
msg.openInfoDialog(returnMSG);
}
}
+
+ public void cloneVirtualMachine(VMsProperty currentPoperty) {
+ MessageDialog msg = new MessageDialog();
+ if(currentPoperty.getWorker().isRunningNow()) {
+ msg.openWarningDialog("Not allowed to 'Clone' while source VM is running.");
+ return ;
+ }
+
+ CloneDialog cloneDialog = new CloneDialog(EmulatorManager.getInstance().getMainDialog(), currentPoperty);
+ cloneDialog.open();
+ }
+
+ public static boolean isPathAvaliable(String path) {
+ if (path != null) {
+ for(String p : baseImagePaths) {
+ if (p.equals(path)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ public static void addBaseImagePath(String path) {
+ if (path != null) {
+ baseImagePaths.add(path);
+ }
+ }
+
+ public static void removeBaseImagePath(String path) {
+ if (path != null) {
+ baseImagePaths.remove(path);
+ }
+ }
}
import org.tizen.emulator.manager.EmulatorManager;
import org.tizen.emulator.manager.tool.CheckVirtualization;
import org.tizen.emulator.manager.tool.StringResource;
+import org.tizen.emulator.manager.ui.MenuHandling;
+import org.tizen.emulator.manager.ui.MessageDialog;
import org.tizen.emulator.manager.ui.ResourceRegistry;
import org.tizen.emulator.manager.ui.ResourceRegistry.ImageName;
import org.tizen.emulator.manager.vms.RESOLUTION;
String path = baseImageFD.open();
if(path != null) {
+ if (!MenuHandling.isPathAvaliable(path)) {
+ new MessageDialog().openWarningDialog("This base image not ready yet.\n" +
+ "Please select again in a few seconds.");
+ return;
+ }
newPath = path;
newPathName = path.substring(path.lastIndexOf(File.separator) + 1, path.length());
baseImageButton.setText(newPathName);
import javax.xml.bind.Unmarshaller;
import javax.xml.transform.stream.StreamSource;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
import org.tizen.emulator.manager.EmulatorManager;
import org.tizen.emulator.manager.logging.EMLogger;
import org.tizen.emulator.manager.tool.FilePath;
import org.tizen.emulator.manager.tool.StringResource;
+import org.tizen.emulator.manager.ui.MessageDialog;
import org.tizen.emulator.manager.vms.xml.EmulatorConfiguration;
import org.tizen.emulator.manager.vms.xml.ObjectFactory;
static String vmsBaseDirectoryName = "";
static String vmsConfigDirectory = "";
static {
- if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) {
- if (EmulatorManager.getEmulatorVMsPath() != null
- && !EmulatorManager.getEmulatorVMsPath().isEmpty()) {
- tizenSdkDataPath = EmulatorManager.getEmulatorVMsPath()
- + File.separator + "tizen-sdk-data";
- } else {
- tizenSdkDataPath = "tizen-sdk-data";
- }
+ if (EmulatorManager.getEmulatorVMsPath() != null
+ && !EmulatorManager.getEmulatorVMsPath().isEmpty()) {
+ tizenSdkDataPath = EmulatorManager.getEmulatorVMsPath()
+ + File.separator + "tizen-sdk-data";
} else {
+ if (System.getProperty("os.name").toLowerCase().indexOf("windows") > -1) {
+ String error = "Start EmulatorManager without emulator-manager.exe\n" +
+ "EmulatorManager's workspace be changed. Please check workspace path.\n";
+ if (!EmulatorManager.isConsoleMode()) {
+ new MessageDialog(new Shell(Display.getCurrent()))
+ .openInfoDialog(error + "Click about menu!");
+ }
+ EMLogger.getLogger().warning(error);
+ }
tizenSdkDataPath = System.getProperty("user.home")
- + File.separator + "tizen-sdk-data";
+ + File.separator + "tizen-sdk-data";
}
vmsBaseDirectoryName = tizenSdkDataPath
import org.tizen.emulator.manager.logging.EMLogger;
import org.tizen.emulator.manager.tool.FilePath;
import org.tizen.emulator.manager.tool.StringResource;
+import org.tizen.emulator.manager.ui.MenuHandling;
import org.tizen.emulator.manager.ui.MessageDialog;
public class VMsWorker {
VMsProperty property;
Launcher launcher;
+ WorkerThread worker = null;
+ String baseImagePath = null;
+
public VMsWorker(VMsProperty property) {
this.property = property;
launcher = new Launcher();
}
public void createNewBaseImage(VMsProperty property, String dest) throws VMsWorkerException {
+ baseImagePath = dest;
File childImage = new File(property.getConfiguration().getBaseInformation().getDiskImage().getCurrentDiskImage().getValue());
File baseImage = new File(property.getConfiguration().getBaseInformation().getDiskImage().getBaseDiskImage().getValue());
if(!childImage.exists()) {
*/
- workerThread worker = new workerThread(proc);
+ worker = new WorkerThread(proc);
worker.start();
if (EmulatorManager.isConsoleMode()) {
System.out.println("Wait....while creating base image.\n"
} else {
synchronized(worker) {
try {
- worker.wait(3000);
+ worker.wait(2000);
} catch (InterruptedException e) {
e.printStackTrace();
} finally {
*/
}
- class workerThread extends Thread {
+ class WorkerThread extends Thread {
QemuImgProc proc;
boolean isError;
- public workerThread(QemuImgProc proc) {
+ public WorkerThread(QemuImgProc proc) {
this.proc = proc;
isError = false;
}
isError = true;
}
synchronized(this) {
+ MenuHandling.removeBaseImagePath(baseImagePath);
notifyAll();
}
}
// check if the emulator instance with the same name is running now.
public boolean isRunningNow()
{
+ if (worker != null) {
+ if (worker.isAlive()) {
+ return true;
+ }
+ }
Logger logger = EMLogger.getLogger();
boolean result = false;
MessageDialog msg = new MessageDialog(new Shell(Display.getCurrent()));