--- /dev/null
+package org.tizen.emulator.manager.ui;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.tizen.emulator.manager.vms.VMsProperty.Architecture;
+
+public class ArchitectureGroup {
+ MainDialog dialog;
+ Group group;
+ Button x86RadioButton;
+ Button armRadioButton;
+
+
+ public ArchitectureGroup(final MainDialog dialog, Composite archComposite) {
+ this.dialog = dialog;
+
+ group = new Group(archComposite, SWT.NONE);
+
+ group.setText("Emulator Architecture");
+ group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ group.setLayout(new GridLayout(2, false));
+
+ x86RadioButton = new Button(group, SWT.RADIO);
+ x86RadioButton.setData(Architecture.x86);
+ x86RadioButton.setText("X86");
+ x86RadioButton.setSelection(true);
+
+ armRadioButton = new Button(group, SWT.RADIO);
+ armRadioButton.setData(Architecture.ARM);
+ armRadioButton.setText("ARM");
+ armRadioButton.setSelection(false);
+ // TODO : not support ARM
+ armRadioButton.setEnabled(false);
+
+ SelectionListener archSelectionListener = new SelectionListener() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ dialog.refreshVMsTable();
+ }
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ dialog.refreshVMsTable();
+ }
+
+ };
+
+ x86RadioButton.addSelectionListener(archSelectionListener);
+ armRadioButton.addSelectionListener(archSelectionListener);
+ }
+}
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
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.tool.Launcher;
import org.tizen.emulator.manager.ui.ResourceRegistry.ImageName;
import org.tizen.emulator.manager.ui.detail.DetailTableView;
-import org.tizen.emulator.manager.ui.vmstree.VMsTable;
+import org.tizen.emulator.manager.ui.vmstree.VMsTree;
import org.tizen.emulator.manager.vms.EmulatorVMs;
import org.tizen.emulator.manager.vms.VMProcess;
import org.tizen.emulator.manager.vms.VMsProperty;
-import org.tizen.emulator.manager.vms.VMsProperty.Architecture;
public class MainDialog {
private static String Launch = "Launch";
private static String Cancel = "Cancel";
private static String Confirm = "Confirm";
- public Button x86RadioButton;
- public Button armRadioButton;
-
private SashForm sashForm;
+ private ArchitectureGroup archGroup;
// LEFT VIEW
- private VMsTable imageListTable;
+ private VMsTree vmsTree;
private Button deleteButton;
private Button resetButton;
Composite archComposite = new Composite(mainComposite, SWT.NONE);
archComposite.setLayout(new GridLayout(1, false));
archComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- Group architectureGroup = new Group(archComposite, SWT.NONE);
- architectureGroup.setText("Emulator Architecture");
- architectureGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
- architectureGroup.setLayout(new GridLayout(2, false));
-
- x86RadioButton = new Button(architectureGroup, SWT.RADIO);
- x86RadioButton.setData(Architecture.x86);
- x86RadioButton.setText("X86");
- x86RadioButton.setSelection(true);
-
- armRadioButton = new Button(architectureGroup, SWT.RADIO);
- armRadioButton.setData(Architecture.ARM);
- armRadioButton.setText("ARM");
- armRadioButton.setSelection(false);
- // TODO : not support ARM
- armRadioButton.setEnabled(false);
+
+ archGroup = new ArchitectureGroup(this, archComposite);
sashForm = new SashForm(mainComposite, SWT.HORIZONTAL);
sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
sashForm.setLayout(new FillLayout());
- // Left : VMs Table
+ // Left : VMs tree
{
final Composite leftView = new Composite(sashForm, SWT.FILL);
GridLayout layout = getNopaddedGridLayout();
leftView.setLayout(layout);
- imageListTable = new VMsTable(this, leftView);
- SelectionListener archSelectionListener = new SelectionListener() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- imageListTable.refreshTableList();
- }
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- imageListTable.refreshTableList();
- }
-
- };
- x86RadioButton.addSelectionListener(archSelectionListener);
- armRadioButton.addSelectionListener(archSelectionListener);
+ vmsTree = new VMsTree(this, leftView);
Composite buttonComposite = new Composite(leftView, SWT.NONE);
buttonComposite.setLayoutData(new GridData(SWT.FILL, SWT.BOTTOM, true, false));
}
public void resetVirtualMachine() {
- ArrayList<VMsProperty> list = imageListTable.getSelectionItem();
+ ArrayList<VMsProperty> list = vmsTree.getSelectionItem();
MessageBox msg = new MessageBox(shell, SWT.ICON_WARNING | SWT.OK | SWT.CANCEL);
msg.setText("Warning");
msg.setMessage("This virtual machine will be formatting.\nAre you sure to conitnue?");
// TOOD : error checking
public void deleteVirtualMachine() {
- ArrayList<VMsProperty> list = imageListTable.getSelectionItem();
+ ArrayList<VMsProperty> list = vmsTree.getSelectionItem();
MessageBox msg = new MessageBox(shell, SWT.ICON_INFORMATION | SWT.OK | SWT.CANCEL);
msg.setText("INFO");
msg.setMessage("Are you sure delete selected virtual machines?");
}
}
+ public void refreshVMsTable() {
+ vmsTree.refreshContents();
+ }
+
public void refreshProperties() {
EmulatorVMs.getInstance().refreshProperties();
- imageListTable.refreshTableList();
+ vmsTree.refreshContents();
}
public int[] getSashFormWeight() {
}
public void closeDetailView() {
- if (imageListTable.getSelectionContentCount() > 1) {
+ if (vmsTree.getSelectionContentCount() > 1) {
deleteButton.setEnabled(true);
} else {
deleteButton.setEnabled(false);
return layout;
}
+
+ public boolean isX86Selected() {
+ return archGroup.x86RadioButton.getSelection();
+ }
}
import org.tizen.emulator.manager.ui.MainDialog;
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.VMsProperty.FSImageType;
-public class VMsTable {
+public class VMsTree {
MainDialog mainDialog;
Tree vmsTree;
EmulatorVMs fsImage = EmulatorVMs.getInstance();
- public VMsTable(MainDialog mainDialog, Composite parent) {
+ public VMsTree(MainDialog mainDialog, Composite parent) {
this.mainDialog = mainDialog;
this.vmsTree = new Tree(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
}
}
- refreshTableList();
+ refreshContents();
pack();
contextMenu.prepare(vmsTree);
return;
if(vmsTree.getSelectionCount() > 1) {
- VMsTable.this.mainDialog.closeDetailView();
+ VMsTree.this.mainDialog.closeDetailView();
}
else {
Object data = vmsTree.getSelection()[0].getData();
if (vmsTree.getSelection()[0].getData() instanceof CreateMarker) {
if (vmsTree.getSelection()[0].getParentItem().getText().equals("Custom")) {
- VMsTable.this.mainDialog.openCreateDetailView(false);
+ VMsTree.this.mainDialog.openCreateDetailView(false);
} else {
- VMsTable.this.mainDialog.openCreateDetailView(true);
+ VMsTree.this.mainDialog.openCreateDetailView(true);
}
return;
}
if(vmsTree.getSelection()[0].getData() instanceof TreeMarker) {
- VMsTable.this.mainDialog.closeDetailView();
+ VMsTree.this.mainDialog.closeDetailView();
return;
}
PropertyContent content = (PropertyContent)data;
- VMsTable.this.mainDialog.openDetailView(content.property);
+ VMsTree.this.mainDialog.openDetailView(content.property);
}
}
vmsTree.pack();
}
- public void refreshTableList() {
- refreshTableList(null);
+ public void refreshContents() {
+ refreshContents(null);
}
- private void refreshTableList(String text) {
- boolean x86Selected = mainDialog.x86RadioButton.getSelection();
- boolean armSelected = mainDialog.armRadioButton.getSelection();
+ private void refreshContents(String text) {
+// boolean x86Selected = mainDialog.isX86Selected();
vmsTree.removeAll();
//
//
for(int i = 0; i < properties.length; ++i) {
- if((properties[i].getArch() == Architecture.x86 && x86Selected) ||
- (properties[i].getArch() == Architecture.ARM && armSelected)){
- if(text != null && !properties[i].getName().startsWith(text)) {
- continue;
- }
+ if(text != null && !properties[i].getName().startsWith(text)) {
+ continue;
+ }
- TreeItem propertyItem = null;
+ TreeItem propertyItem = null;
- if(FSImageType.standard == properties[i].getImageType()) {
- String version = properties[i].getConfiguration().getBaseInformation().getDiskImage().getVersion();
- propertyItem = itemsMap.get(version);
- if(propertyItem == null) {
- propertyItem = new TreeItem(vmsTree, SWT.NONE);
- rowItem = new StandardVMsMarker(version, propertyItem);
- propertyItem.setData(rowItem);
+ if(FSImageType.standard == properties[i].getImageType()) {
+ String version = properties[i].getConfiguration().getBaseInformation().getDiskImage().getVersion();
+ propertyItem = itemsMap.get(version);
+ if(propertyItem == null) {
+ propertyItem = new TreeItem(vmsTree, SWT.NONE);
+ rowItem = new StandardVMsMarker(version, propertyItem);
+ propertyItem.setData(rowItem);
- itemsMap.put(version, propertyItem);
+ itemsMap.put(version, propertyItem);
- createItem = new TreeItem(propertyItem, SWT.NONE);
- rowItem = new CreateMarker(createItem);
- createItem.setData(rowItem);
- }
- propertyItem = new TreeItem(propertyItem, SWT.NONE);
- }
- else {
- propertyItem = new TreeItem(customItem, SWT.NONE);
+ createItem = new TreeItem(propertyItem, SWT.NONE);
+ rowItem = new CreateMarker(createItem);
+ createItem.setData(rowItem);
}
-
- rowItem = new PropertyContent(properties[i], propertyItem);
- propertyItem.setData(rowItem);
+ propertyItem = new TreeItem(propertyItem, SWT.NONE);
}
+ else {
+ propertyItem = new TreeItem(customItem, SWT.NONE);
+ }
+
+ rowItem = new PropertyContent(properties[i], propertyItem);
+ propertyItem.setData(rowItem);
}
createItem.setExpanded(true);