table viewer: make table viewer name variable
authorjihye424.kim <jihye424.kim@samsung.com>
Fri, 4 Dec 2015 05:51:28 +0000 (14:51 +0900)
committerSeokYeon Hwang <syeon.hwang@samsung.com>
Fri, 4 Dec 2015 11:16:26 +0000 (20:16 +0900)
Change-Id: I173fc5b7ce291d94fbdec17f5b316fcf39abad83
Signed-off-by: jihye424.kim <jihye424.kim@samsung.com>
src/org/tizen/emulator/manager/ui/renewal/MainDialog.java
src/org/tizen/emulator/manager/ui/renewal/tableviewer/BaseImageTableViewer.java
src/org/tizen/emulator/manager/ui/renewal/tableviewer/CreateVMTableViewer.java
src/org/tizen/emulator/manager/ui/renewal/tableviewer/DeviceTemplateTableViewer.java
src/org/tizen/emulator/manager/ui/renewal/tableviewer/VMListTableViewer.java

index 9b1b59e..52e0349 100644 (file)
@@ -51,6 +51,11 @@ import org.tizen.emulator.manager.vms.helper.CheckingRunningEmulator;
 
 public class MainDialog {
        private static final String ICON_FILE_NAME = "res/em.ico"; //$NON-NLS-1$
+       // table viewer name
+       public static final String VM_LIST = "vmList";
+       public static final String CREATE_VM = "createVM";
+       public static final String BASE_IMAGE_LIST = "baseimageList";
+       public static final String TEMPLATE_LIST = "templateList";
 
        public static final int DEFALUT_WIDTH  = 842;
        public static final int DEFAULT_HEIGHT = 580;
index 986b6be..823dea1 100644 (file)
@@ -120,14 +120,12 @@ public class BaseImageTableViewer extends AbstractTableViewer {
                        public void handleEvent(Event event) {
                                if (event.type == SWT.Selection) {
                                        MainDialog mainDialog = EmulatorManager.getNewMainDialog();
-                                       AbstractTableViewer viewer = mainDialog.findViewer("templateList");
+                                       AbstractTableViewer viewer = mainDialog.findViewer(MainDialog.TEMPLATE_LIST);
                                        if (viewer == null) {
-                                               DeviceTemplateTableViewer tViewer = new DeviceTemplateTableViewer(MainDialog.getShell(), "templateList");
-                                               mainDialog.addViewer(tViewer);
-                                               mainDialog.setStackTop(tViewer);
-                                       } else {
-                                               mainDialog.setStackTop(viewer);
+                                               viewer = new DeviceTemplateTableViewer(MainDialog.getShell(), MainDialog.TEMPLATE_LIST);
+                                               mainDialog.addViewer(viewer);
                                        }
+                                       mainDialog.setStackTop(viewer);
                                }
                        }
                });
@@ -575,7 +573,7 @@ public class BaseImageTableViewer extends AbstractTableViewer {
                        public void handleEvent(Event event) {
                                if (event.type == SWT.Selection) {
                                        MainDialog mainDialog = EmulatorManager.getNewMainDialog();
-                                       AbstractTableViewer viewer = mainDialog.findViewer("vmList");
+                                       AbstractTableViewer viewer = mainDialog.findViewer(MainDialog.VM_LIST);
                                        if (viewer != null) {
                                                viewer.setNeedRedraw(isModified);
                                                mainDialog.setStackTop(viewer);
index 12415f3..7b5ab5d 100644 (file)
@@ -329,7 +329,7 @@ public class CreateVMTableViewer extends AbstractTableViewer {
                        public void handleEvent(Event event) {
                                if (event.type == SWT.Selection) {
                                        MainDialog mainDialog = EmulatorManager.getNewMainDialog();
-                                       AbstractTableViewer viewer = mainDialog.findViewer("vmList");
+                                       AbstractTableViewer viewer = mainDialog.findViewer(MainDialog.VM_LIST);
                                        if (viewer != null) {
                                                mainDialog.setStackTop(viewer);
                                        }
@@ -411,7 +411,7 @@ public class CreateVMTableViewer extends AbstractTableViewer {
                }
 
                MainDialog mainDialog = EmulatorManager.getNewMainDialog();
-               AbstractTableViewer viewer = mainDialog.findViewer("vmList");
+               AbstractTableViewer viewer = mainDialog.findViewer(MainDialog.VM_LIST);
                if (viewer != null) {
                        viewer.setNeedRedraw(true);
                        viewer.setData(prop);
index 7dbfe11..ef010e9 100644 (file)
@@ -104,14 +104,12 @@ public class DeviceTemplateTableViewer extends AbstractTableViewer {
                        public void handleEvent(Event event) {
                                if (event.type == SWT.Selection) {
                                        MainDialog mainDialog = EmulatorManager.getNewMainDialog();
-                                       AbstractTableViewer viewer = mainDialog.findViewer("baseimageList");
+                                       AbstractTableViewer viewer = mainDialog.findViewer(MainDialog.BASE_IMAGE_LIST);
                                        if (viewer == null) {
-                                               BaseImageTableViewer tViewer = new BaseImageTableViewer(MainDialog.getShell(), "baseimageList");
-                                               mainDialog.addViewer(tViewer);
-                                               mainDialog.setStackTop(tViewer);
-                                       } else {
-                                               mainDialog.setStackTop(viewer);
+                                               viewer = new BaseImageTableViewer(MainDialog.getShell(), MainDialog.BASE_IMAGE_LIST);
+                                               mainDialog.addViewer(viewer);
                                        }
+                                       mainDialog.setStackTop(viewer);
                                }
                        }
                });
index 7a874dc..85e5164 100644 (file)
@@ -179,14 +179,12 @@ public class VMListTableViewer extends AbstractTableViewer {
                        public void handleEvent(Event event) {
                                if (event.type == SWT.Selection) {
                                        MainDialog mainDialog = EmulatorManager.getNewMainDialog();
-                                       AbstractTableViewer viewer = mainDialog.findViewer("templateList");
+                                       AbstractTableViewer viewer = mainDialog.findViewer(MainDialog.TEMPLATE_LIST);
                                        if (viewer == null) {
-                                               DeviceTemplateTableViewer tViewer = new DeviceTemplateTableViewer(MainDialog.getShell(), "templateList");
-                                               mainDialog.addViewer(tViewer);
-                                               mainDialog.setStackTop(tViewer);
-                                       } else {
-                                               mainDialog.setStackTop(viewer);
+                                               viewer = new DeviceTemplateTableViewer(MainDialog.getShell(), MainDialog.TEMPLATE_LIST);
+                                               mainDialog.addViewer(viewer);
                                        }
+                                       mainDialog.setStackTop(viewer);
                                }
                        }
 
@@ -199,14 +197,12 @@ public class VMListTableViewer extends AbstractTableViewer {
                        public void handleEvent(Event event) {
                                if (event.type == SWT.Selection) {
                                        MainDialog mainDialog = EmulatorManager.getNewMainDialog();
-                                       AbstractTableViewer viewer = mainDialog.findViewer("baseimageList");
+                                       AbstractTableViewer viewer = mainDialog.findViewer(MainDialog.BASE_IMAGE_LIST);
                                        if (viewer == null) {
-                                               BaseImageTableViewer tViewer = new BaseImageTableViewer(MainDialog.getShell(), "baseimageList");
-                                               mainDialog.addViewer(tViewer);
-                                               mainDialog.setStackTop(tViewer);
-                                       } else {
-                                               mainDialog.setStackTop(viewer);
+                                               viewer = new BaseImageTableViewer(MainDialog.getShell(), MainDialog.BASE_IMAGE_LIST);
+                                               mainDialog.addViewer(viewer);
                                        }
+                                       mainDialog.setStackTop(viewer);
                                }
                        }
                });
@@ -288,9 +284,9 @@ public class VMListTableViewer extends AbstractTableViewer {
                public void widgetSelected(SelectionEvent e) {
                        ProfileButton pButton = (ProfileButton)e.data;
                        MainDialog mainDialog = EmulatorManager.getNewMainDialog();
-                       AbstractTableViewer viewer = mainDialog.findViewer("createVM");
+                       AbstractTableViewer viewer = mainDialog.findViewer(MainDialog.CREATE_VM);
                        if (viewer == null) {
-                               viewer = new CreateVMTableViewer(MainDialog.getShell(), "createVM");
+                               viewer = new CreateVMTableViewer(MainDialog.getShell(), MainDialog.CREATE_VM);
                                mainDialog.addViewer(viewer);
                        }
                        viewer.setData(pButton.getProfile());