import org.eclipse.swt.widgets.Shell;
import org.tizen.emulator.manager.EmulatorManager;
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.vms.EmulatorVMs;
import org.tizen.emulator.manager.vms.VMsProperty;
import org.tizen.emulator.manager.vms.VMsProperty.Architecture;
-import org.tizen.emulator.manager.ui.detail.DetailTableView;
public class MainDialog {
private static String Launch = "Launch";
Button refreshButton = new Button(buttonComposite, SWT.PUSH);
refreshButton.setText("Refresh");
+ refreshButton.setImage(ResourceRegistry.getImage(ImageName.REFRESH));
refreshButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
deleteButton = new Button(buttonComposite, SWT.PUSH);
deleteButton.setText("Delete");
+ deleteButton.setImage(ResourceRegistry.getImage(ImageName.DELETE));
deleteButton.addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
resetButton = new Button(buttonComposite, SWT.PUSH);
resetButton.setText("Reset");
+ resetButton.setImage(ResourceRegistry.getImage(ImageName.RESET));
//TODO
resetButton.setEnabled(false);
}
//resetButton.setEnabled(true);
leftButton.setText(Launch);
+ leftButton.setImage(ResourceRegistry.getImage(ImageName.LAUNCH));
rightButton.setText(Modify);
+ rightButton.setImage(ResourceRegistry.getImage(ImageName.MODIFY));
leftButton.setEnabled(true);
rightButton.setEnabled(true);
//resetButton.setEnabled(false);
leftButton.setText(Confirm);
+ leftButton.setImage(ResourceRegistry.getImage(ImageName.CONFIRM));
+
rightButton.setText(Cancel);
+ rightButton.setImage(ResourceRegistry.getImage(ImageName.CANCEL));
detailView.openModifyView(property);
}
//resetButton.setEnabled(false);
leftButton.setText(Launch);
+ leftButton.setImage(ResourceRegistry.getImage(ImageName.LAUNCH));
rightButton.setText(Create);
+ rightButton.setImage(ResourceRegistry.getImage(ImageName.CREATE));
+
leftButton.setEnabled(false);
rightButton.setEnabled(true);
//resetButton.setEnabled(false);
leftButton.setText(Launch);
+ leftButton.setImage(ResourceRegistry.getImage(ImageName.LAUNCH));
rightButton.setText(Create);
+ rightButton.setImage(ResourceRegistry.getImage(ImageName.CREATE));
detailView.openCreateDetailView();
}
//resetButton.setEnabled(false);
leftButton.setText(Confirm);
+ leftButton.setImage(ResourceRegistry.getImage(ImageName.CONFIRM));
rightButton.setText(Cancel);
+ rightButton.setImage(ResourceRegistry.getImage(ImageName.CANCEL));
detailView.openCreateView(rightButton, leftButton);
}
+
+ public void dispose() {
+ ResourceRegistry.dispose();
+ }
}
--- /dev/null
+package org.tizen.emulator.manager.ui;
+
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.swt.graphics.Image;
+import org.tizen.emulator.manager.EmulatorManager;
+
+public class ResourceRegistry {
+ public enum ImageName {
+ CANCEL("cancel"), CONFIRM("confirm"), CREATE("create"), DELETE("delete"), DETAILS("details"),
+ FOLDER("folder"), MODIFY("modify"), REFRESH("refresh"), RESET("reset"), LAUNCH("launch");
+
+ String name;
+
+ ImageName(String name) {
+ this.name = name;
+ }
+
+ @Override
+ public String toString() {
+ return name;
+ }
+ }
+
+ private static ResourceRegistry instance;
+
+ Map<ImageName, Image> imagesMap = new HashMap<ImageName, Image>();
+
+ static {
+ synchronized(ResourceRegistry.class) {
+ instance = new ResourceRegistry();
+
+ ClassLoader loader = ResourceRegistry.class.getClassLoader();
+
+ InputStream is = null;
+
+ for(ImageName imageName : ImageName.values()) {
+ is = loader.getResourceAsStream("res/" + imageName.toString() + ".png");
+ if(is != null)
+ instance.imagesMap.put(imageName, new Image(EmulatorManager.getInstance().getDisplay(), is));
+ }
+ }
+ }
+
+ public static Image getImage(ImageName imageName) {
+ return instance.imagesMap.get(imageName);
+ }
+
+ public static void dispose() {
+ for(Image image : instance.imagesMap.values()) {
+ image.dispose();
+ }
+ }
+
+ private ResourceRegistry() {}
+}
package org.tizen.emulator.manager.ui.detail;
import java.io.File;
-import java.io.InputStream;
import java.util.ArrayList;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
-import org.tizen.emulator.manager.EmulatorManager;
+import org.tizen.emulator.manager.ui.ResourceRegistry;
+import org.tizen.emulator.manager.ui.ResourceRegistry.ImageName;
import org.tizen.emulator.manager.vm.VMCreateHelper;
import org.tizen.emulator.manager.vm.VMProcess;
import org.tizen.emulator.manager.vm.VMPropertyValue;
this.widget = new VMViewWidget();
this.table = table;
- InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream("res/folder.gif");
- if(resourceAsStream != null)
- this.image = new Image(EmulatorManager.getInstance().getDisplay(), resourceAsStream);
+// InputStream resourceAsStream = this.getClass().getClassLoader().getResourceAsStream("res/folder.png");
+// if(resourceAsStream != null)
+// this.image = new Image(EmulatorManager.getInstance().getDisplay(), resourceAsStream);
+ this.image = ResourceRegistry.getImage(ImageName.FOLDER);
makeItemList();
}