import org.tizen.emulator.manager.ui.renewal.item.modify.common.SensorItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.vm.DeviceTemplateItem;
import org.tizen.emulator.manager.vms.VMProperty;
+import org.tizen.emulator.manager.vms.VMPropertyValue;
public class VMModifyHandler {
- public static void modify(VMProperty property) {
+ public static VMPropertyValue modify(VMProperty property) {
// open modify dialog
VMModifyDialog dialog = new VMModifyDialog(MainDialog.getShell());
dialog.setDialogMode(DIALOG_MODE.MODIFY);
- dialog.create(property.getPropertyValue(), getItemList(property));
+ VMPropertyValue newValue = property.getPropertyValue().clone();
+ dialog.create(newValue, getItemList(property));
// TODO set display value to dialog
int retValue = dialog.open();
if (retValue == SWT.OK) {
- // TODO do modify
+ dialog.saveDataInto(newValue);
+ return newValue;
}
+ return null;
}
private static List<ModifyDialogItem> getItemList(VMProperty property) {
import java.util.HashMap;
import java.util.Map;
+import org.tizen.emulator.manager.devices.DeviceTemplate;
import org.tizen.emulator.manager.devices.DeviceTemplateValue;
import org.tizen.emulator.manager.devices.SubDevice;
import org.tizen.emulator.manager.devices.SubDeviceItem;
return templateValue != null;
}
+ public DeviceTemplate getDeivceTemplate() {
+ if (isVMValue()) {
+ return vmValue.device;
+ } else if (isTemplateValue()) {
+ return templateValue.getTemplate();
+ }
+ return null;
+ }
+
+ public void setDeviceTemplate(DeviceTemplate template) {
+ if (isVMValue()) {
+ vmValue.device = template;
+ }
+ }
public String getName() {
if (isVMValue()) {
package org.tizen.emulator.manager.ui.renewal.item.modify.vm;
import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.devices.DeviceTemplate;
+import org.tizen.emulator.manager.platform.Profile;
+import org.tizen.emulator.manager.platform.ProfileList;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.ComboItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.common.ModifyDialogItem;
import org.tizen.emulator.manager.ui.renewal.item.modify.comp.PropertyValue;
private final int COMBO_WIDTH = 200;
+ private Profile profile;
+ private DeviceTemplate template;
public TreeModifyItem getTreeRoot() {
return (TreeModifyItem)item;
}
treeModifyItem.setModifyDialogItem(this);
createCombo(treeModifyItem, COMBO_WIDTH);
+
+ if (profile != null) {
+ // TODO
+ for (DeviceTemplate temp : profile.getTemplateList()) {
+ comboBox.addItem(temp.getValue().getName(), temp);
+ }
+ }
}
@Override
@Override
public void setInitialValue(PropertyValue value) {
- // TODO Auto-generated method stub
-
+ // TODO
+ template = null;
+ profile = ProfileList.getProfile(value.getProfile());
}
@Override
public void itemSelected(ComboBox comboBox) {
// TODO change item list for selected template.
System.out.println("item selected:" + comboBox.getSelectedItem());
+ template = (DeviceTemplate)comboBox.getSelectedData();
}
@Override
public void setValue(PropertyValue value) {
- // TODO Auto-generated method stub
-
+ value.setDeviceTemplate(template);
}
@Override
item.setImage(0, null);
}
item.setText(2, value.vmsName);
- item.setText(3, "Samsung Z3");
+ item.setText(3, value.device != null
+ ? value.device.getValue().getName()
+ : "");
item.setText(4, value.baseImage.getName());
item.setText(5, value.resolution.getStrTypeValue());
if (value.fileSharePath == null || value.fileSharePath.isEmpty()) {
if (table.getSelectionCount() != 1) {
return;
}
- VMModifyHandler.modify((VMProperty)table.getSelection()[0].getData());
+ TableItem item = table.getSelection()[0];
+ VMProperty property = (VMProperty)item.getData();
+ VMPropertyValue newValue = VMModifyHandler.modify(property);
+
+ if (newValue != null) {
+ try {
+ property.getWorker().modifyVM(newValue);
+ property.setPropertyValue(newValue);
+ setTableItemProperty(item, property);
+ table.redraw();
+ } catch (VMWorkerException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
}
public void launchEmulator() {