char* strInstalledPath;\r
char strLocalAppDataPath[MAX] = {0};\r
\r
+ // Get a "tizensdkpath" file path\r
+ //strLocalAppDataPath = getenv("LOCALAPPDATA");\r
+\r
DWORD dwBufLen = MAX;\r
RegOpenKeyEx(HKEY_CURRENT_USER, \r
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders",\r
0, KEY_QUERY_VALUE, &hKey);\r
RegQueryValueEx(hKey, "Local AppData", NULL, NULL, (LPBYTE)strLocalAppDataPath, &dwBufLen);\r
RegCloseKey(hKey);\r
- printf("%s\n", strLocalAppDataPath);\r
- // Get a "tizensdkpath" file path\r
- //strLocalAppDataPath = getenv("LOCALAPPDATA");\r
+ //printf("%s\n", strLocalAppDataPath);\r
+ \r
strcpy(strPropertyFilePath, strLocalAppDataPath);\r
strcat(strPropertyFilePath, "\\.TizenSDK\\tizensdkpath");\r
- printf("%s\n", strPropertyFilePath);\r
+ //printf("%s\n", strPropertyFilePath);\r
+\r
// get a line of installed path\r
if ((propertyFile = fopen(strPropertyFilePath, "rt")) == NULL) {\r
fputs("Cannot open input file...\n", stderr);\r
{
cd $SRCDIR
ant -buildfile build.xml windows-jar
- gcc emulator-manager.c -o emulator-manager.exe
}
# install
install()
{
BIN_DIR=$SRCDIR/package/emulator-manager.package.windows/data/Emulator
- VTM_DIR=$BIN_DIR/Emulator/bin/emulator-manager.exe
mkdir -p $BIN_DIR/bin
# editbin.exe /SUBSYSTEM:WINDOWS $VTM_DIR
private final static String icon_suffix = File.separator +"skins"+ File.separator +"icons" + File.separator +"vtm.ico";
private final static String data_suffix = File.separator +"data";
private final static String conf_suffix = File.separator +"conf";
- private final static String vms_suffix = File.separator +".tizen_vms";
private final static String baseimg_suffix = File.separator +"emulimg-1.0.x86";
private final static String bios_suffix = File.separator + "pc-bios";
private final static String etc_suffix = File.separator +"etc";
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.MessageBox;
import org.eclipse.swt.widgets.Shell;
import org.tizen.emulator.manager.EmulatorManager;
import org.tizen.emulator.manager.tool.Launcher;
@Override
public void widgetDefaultSelected(SelectionEvent e) {}
});
-
+
deleteButton = new Button(buttonComposite, SWT.PUSH);
deleteButton.setText("Delete");
deleteButton.addSelectionListener(new SelectionListener() {
public void widgetDefaultSelected(SelectionEvent e) {
}
});
-
- }
+
+ }
sashForm.setWeights(new int[] { 100, 0 });
}
// TOOD : error checking
public void deleteVirtualTarget() {
ArrayList<VMsProperty> list = imageListTable.getSelectionItem();
- for (VMsProperty property : list) {
- String path = EmulatorVMs.getInstance().getVMsBaseDirectory()
- + File.separator + property.getArch().toString()
- + File.separator + property.getName();
- File vtFolder = new File(path);
- if (vtFolder.exists()) {
- for (File dir : vtFolder.listFiles()) {
- if (dir.isFile()) {
- dir.delete();
- } else { // directory
- for (File sub : dir.listFiles()) {
- if (sub.isFile()) {
- sub.delete();
+ MessageBox msg = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK | SWT.CANCEL);
+ msg.setText("INFO");
+ msg.setMessage("Are you sure delete selected virtual machines?");
+ int response = msg.open();
+ if (response == SWT.OK) {
+ for (VMsProperty property : list) {
+ String path = EmulatorVMs.getInstance().getVMsBaseDirectory()
+ + File.separator + property.getArch().toString()
+ + File.separator + property.getName();
+ File vtFolder = new File(path);
+ if (vtFolder.exists()) {
+ for (File dir : vtFolder.listFiles()) {
+ if (dir.isFile()) {
+ dir.delete();
+ } else { // directory
+ for (File sub : dir.listFiles()) {
+ if (sub.isFile()) {
+ sub.delete();
+ }
}
+ dir.delete();
}
- dir.delete();
}
+ vtFolder.delete();
}
- vtFolder.delete();
}
+ refreshProperties();
+ msg = new MessageBox(shell, SWT.ICON_INFORMATION);
+ msg.setText("INFO");
+ msg.setMessage("Delete completed!");
+ msg.open();
}
- refreshProperties();
}
public void refreshProperties() {
deleteButton.setEnabled(true);
// TODO
//resetButton.setEnabled(true);
-
+
leftButton.setText(Launch);
rightButton.setText(Modify);
leftButton.setEnabled(true);
}
public void closeDetailView() {
- deleteButton.setEnabled(false);
+ if (imageListTable.getCountSelectionItem() > 1) {
+ deleteButton.setEnabled(true);
+ } else {
+ deleteButton.setEnabled(false);
+ }
// TODO
//resetButton.setEnabled(false);
detailView.closeDetailView();
deleteButton.setEnabled(false);
// TODO
//resetButton.setEnabled(false);
-
+
leftButton.setText(Launch);
rightButton.setText(Create);
leftButton.setEnabled(false);
deleteButton.setEnabled(false);
// TODO
//resetButton.setEnabled(false);
-
+
leftButton.setText(Launch);
rightButton.setText(Create);
deleteButton.setEnabled(false);
// TODO
//resetButton.setEnabled(false);
-
+
leftButton.setText(Confirm);
rightButton.setText(Cancel);
import org.tizen.emulator.manager.vms.VMsProperty;
enum CItem{
- ImageName("Image Name"), ImageNameInfo(""), BaseImage("BaseImage"),
+ ImageName("Name"), ImageNameInfo(""), BaseImage("BaseImage"),
Resolution("Display Resolution"), Density("Display Density"),
SDType("SDCard"), SDPath("SDCard Path"), RAMSize("RAM Size"),
ShareType("File Sharing"), SharePath("File Sharing Path");
if (isCreateMode) {
// add Image Name Info
widget.nameinfoLabel = new Label(table, SWT.WRAP);
- widget.nameinfoLabel.setText("Input image name");
+ widget.nameinfoLabel.setText("Input name");
createNameListener();
}
}
return;
}
- widget.nameinfoLabel.setText("Input image name");
+ widget.nameinfoLabel.setText("Input name");
if (newValue.imageName.isEmpty()) {
widget.confirmButton.setEnabled(false);
} else {
String path = widget.SDImageFD.open();
if(path != null) {
newValue.SDCardPath = path;
+ newValue.SDCardPathName = path.substring(path.lastIndexOf(SEFARATOR) + 1, path.length());
widget.SDCardPathCombo.remove(0);
- widget.SDCardPathCombo.add(path.substring(path.lastIndexOf(SEFARATOR) + 1, path.length()), 0);
+ widget.SDCardPathCombo.add(newValue.SDCardPathName, 0);
widget.SDCardPathCombo.select(0);
}
} else if (i != 0) {
newValue.SDCardPath = widget.SDCardPathCombo.getItem(i);
+ newValue.SDCardPathName = widget.SDCardPathCombo.getItem(i);
}
}
@Override
}
+ public int getCountSelectionItem() {
+ int count = 0;
+ Object data;
+ for (int i = 0; i < vmsTree.getSelectionCount(); i++) {
+ data = vmsTree.getSelection()[i].getData();
+ if(!(data instanceof RowItem))
+ continue;
+
+ if (data instanceof CreateMarker || data instanceof TreeMarker) {
+ return 0;
+ }
+
+ count++;
+ }
+ return count;
+ }
+
public ArrayList<VMsProperty> getSelectionItem() {
ArrayList<VMsProperty> list = new ArrayList<VMsProperty>();
import org.tizen.emulator.manager.vms.EmulatorVMs;
import org.tizen.emulator.manager.vms.VMsProperty;
import org.tizen.emulator.manager.vms.VMsProperty.Architecture;
+import org.tizen.emulator.manager.vms.xml.DisplayType.Resolution;
import org.tizen.emulator.manager.vms.xml.EmulatorConfiguration;
import org.tizen.emulator.manager.vms.xml.ObjectFactory;
} else {
property.getConfiguration().getDevice().getStorage().getSDCard().setDiskImage(null);
}
- } else if (newVM.isSDCardSupport && !newVM.SDCardPath.equals(oldVM.SDCardPath)) {
+ } else if (newVM.isSDCardSupport && !newVM.SDCardPathName.equals(oldVM.SDCardPathName)) {
if (!modifySDCard(newVM)) {
return null;
}
if (newVM.isFileShareSupport != oldVM.isFileShareSupport) {
isModify = true;
- if (newVM.isFileShareSupport || !newVM.fileSharePath.isEmpty()) {
+ if (newVM.isFileShareSupport && !newVM.fileSharePath.isEmpty()) {
property.getConfiguration().getUsability().getFileSharing().setPath(newVM.fileSharePath);
} else {
property.getConfiguration().getUsability().getFileSharing().setPath(null);
return property;
}
+
public VMsProperty create(VMsProperty property, VMPropertyValue oldVM, VMPropertyValue newVM) {
this.newVM = newVM;
this.property = EmulatorVMs.getInstance().getNewProperty
folderPath = folder.getAbsolutePath() + SEFARATOR;
File log = new File(filePath.getVirtualTargetLogPath(newVM.imageName));
- settingProperty();
folder.mkdirs();
}
log.mkdir();
+
+ settingProperty();
EmulatorVMs.getInstance().storeXML(this.property);
return this.property;
}
ec.getBaseInformation().setName(newVM.imageName);
ec.getBaseInformation().setArchitecture(Architecture.x86.toString());
- }
-
- private boolean createDiskImage() {
+
ec.getBaseInformation().setDiskImage(factory.createBaseInformationTypeDiskImage());
if (newVM.isDefaultImage) {
ec.getBaseInformation().getDiskImage().setType("standard");
//
ec.getBaseInformation().getDiskImage().setBaseDiskImage(factory.createDiskImageFormatType());
ec.getBaseInformation().getDiskImage().setCurrentDiskImage(factory.createDiskImageFormatType());
+
+ // TODO :
+ ec.getBaseInformation().getDiskImage().getBaseDiskImage().setFormat("qcow2");
+ ec.getBaseInformation().getDiskImage().getBaseDiskImage().setValue(newVM.baseImagePath);
+ ec.getBaseInformation().getDiskImage().getCurrentDiskImage().setFormat("qcow2");
+ ec.getBaseInformation().getDiskImage().getCurrentDiskImage().setValue(
+ String.format("%semulimg-%s.%s", folderPath, newVM.imageName, Architecture.x86.toString()));
+
+ ec.getUsability().setLogging(factory.createUsabilityTypeLogging());
+ ec.getUsability().getLogging().setLevel("NONE");
+ ec.getUsability().setHwVirtualization(true);
+
+ ec.getUsability().setFileSharing(factory.createUsabilityTypeFileSharing());
+ if (!newVM.fileSharePath.isEmpty()) {
+ ec.getUsability().getFileSharing().setPath(newVM.fileSharePath);
+ }
+
+ ec.getDevice().setDisplay(factory.createDisplayType());
+ ec.getDevice().getDisplay().setResolution(factory.createDisplayTypeResolution());
+ ec.getDevice().getDisplay().getResolution().setWidth(newVM.resolutionType.getWidth());
+ ec.getDevice().getDisplay().getResolution().setHeight(newVM.resolutionType.getHeight());
+
+ ec.getDevice().getDisplay().setDensity(factory.createDisplayTypeDensity());
+ ec.getDevice().getDisplay().getDensity().setUnit("dpi");
+ ec.getDevice().getDisplay().getDensity().setValue(newVM.dpi);
+
+ ec.getDevice().setRAM(factory.createRamType());
+ ec.getDevice().getRAM().setSize(factory.createRamTypeSize());
+ ec.getDevice().getRAM().getSize().setUnit("MiB");
+ ec.getDevice().getRAM().getSize().setValue(newVM.ramSize);
+
+ ec.getDevice().setStorage(factory.createStorageType());
+ ec.getDevice().getStorage().setSDCard(factory.createStorageTypeSDCard());
+ if (newVM.isSDCardSupport) {
+ ec.getDevice().getStorage().getSDCard().setDiskImage(newVM.SDCardPath);
+ }
+ }
+ private boolean createDiskImage() {
if (newVM.baseImagePath == null || newVM.baseImagePath.isEmpty()) {
newVM.baseImagePath = filePath.getBaseimgPath();
}
-
+
if (!new File(newVM.baseImagePath).exists()) {
setErrorMessage("Base image does not exist.");
return false;
}
-
+
String exe_path = filePath.getBinPath() + SEFARATOR + "qemu-img";
-
List<String> cmd = new ArrayList<String>();
cmd.add(exe_path);
return false;
}
- // TODO :
- ec.getBaseInformation().getDiskImage().getBaseDiskImage().setFormat("qcow2");
- ec.getBaseInformation().getDiskImage().getBaseDiskImage().setValue(newVM.baseImagePath);
- ec.getBaseInformation().getDiskImage().getCurrentDiskImage().setFormat("qcow2");
- ec.getBaseInformation().getDiskImage().getCurrentDiskImage().setValue(
- String.format("%semulimg-%s.%s", folderPath, newVM.imageName, Architecture.x86.toString()));
return true;
}
// usability
private boolean createFileShare() {
- ec.getUsability().setLogging(factory.createUsabilityTypeLogging());
- ec.getUsability().getLogging().setLevel("NONE");
- ec.getUsability().setHwVirtualization(true);
-
if (newVM.isFileShareSupport) {
if (newVM.fileSharePath == null || newVM.fileSharePath.isEmpty()) {
setErrorMessage("Select sharing file path");
return false;
}
}
- ec.getUsability().setFileSharing(factory.createUsabilityTypeFileSharing());
- if (!newVM.fileSharePath.isEmpty()) {
- ec.getUsability().getFileSharing().setPath(newVM.fileSharePath);
- }
return true;
}
// Device
private boolean createDisplay() {
- ec.getDevice().setDisplay(factory.createDisplayType());
-
int i = newVM.resolution.indexOf('x');
- ec.getDevice().getDisplay().setResolution(factory.createDisplayTypeResolution());
- ec.getDevice().getDisplay().getResolution().setWidth(Integer.valueOf(newVM.resolution.substring(0,i)));
- ec.getDevice().getDisplay().getResolution().setHeight(Integer.valueOf(newVM.resolution.substring(i+1,newVM.resolution.length())));
-
- ec.getDevice().getDisplay().setDensity(factory.createDisplayTypeDensity());
- ec.getDevice().getDisplay().getDensity().setUnit("dpi");
- ec.getDevice().getDisplay().getDensity().setValue(newVM.dpi);
+ newVM.resolutionType = new Resolution();
+ newVM.resolutionType.setWidth(Integer.valueOf(newVM.resolution.substring(0,i)));
+ newVM.resolutionType.setHeight(Integer.valueOf(newVM.resolution.substring(i+1,newVM.resolution.length())));
+
return true;
}
private boolean createRam() {
- ec.getDevice().setRAM(factory.createRamType());
- ec.getDevice().getRAM().setSize(factory.createRamTypeSize());
- ec.getDevice().getRAM().getSize().setUnit("MiB");
- ec.getDevice().getRAM().getSize().setValue(newVM.ramSize);
return true;
}
private boolean createSDCard() {
- ec.getDevice().setStorage(factory.createStorageType());
-
if (newVM.isSDCardSupport) {
if (! modifySDCard(newVM)) {
return false;
}
}
-
- ec.getDevice().getStorage().setSDCard(factory.createStorageTypeSDCard());
- if (newVM.isSDCardSupport) {
- ec.getDevice().getStorage().getSDCard().setDiskImage(newVM.SDCardPath);
- }
return true;
}
isSDCardSupport = oldTarget.isSDCardSupport;
SDCardPath = oldTarget.SDCardPath;
- SDCardPath = oldTarget.SDCardPathName;
+ SDCardPathName = oldTarget.SDCardPathName;
ramSize = oldTarget.ramSize;
}
}
- String vmsBaseDirectoryName = System.getProperty("user.dir") +
- File.separator + "test" + File.separator + "tizen_vms";
+ static String vmsBaseDirectoryName = System.getProperty("user.home")
+ + File.separator + ".tizen_vms";
List<VMsProperty> propertiesList = new ArrayList<VMsProperty>();
ObjectFactory objectFactory = new ObjectFactory();
-
+
public static EmulatorVMs getInstance() {
return instance;
}
}
public String getVMsBaseDirectory() {
- return this.vmsBaseDirectoryName;
+ return vmsBaseDirectoryName;
}
public ObjectFactory getObjectFactory() {