TableViewer: add VM list table viewer
authorjihye424.kim <jihye424.kim@samsung.com>
Thu, 20 Aug 2015 05:09:16 +0000 (14:09 +0900)
committerJiHye Kim <jihye424.kim@samsung.com>
Thu, 20 Aug 2015 05:53:02 +0000 (14:53 +0900)
Change-Id: If11ae8128baa5e1ce5a08451abcc5179795fadba
Signed-off-by: jihye424.kim <jihye424.kim@samsung.com>
src/org/tizen/emulator/manager/ui/renewal/MainDialog.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/tableviewer/AbstractTableViewer.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/tableviewer/MenuHandling.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/tableviewer/MessageBox.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/tableviewer/ProfileButtonList.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/tableviewer/VMListTable.java [new file with mode: 0644]
src/org/tizen/emulator/manager/ui/renewal/tableviewer/VMListTableViewer.java [new file with mode: 0644]

diff --git a/src/org/tizen/emulator/manager/ui/renewal/MainDialog.java b/src/org/tizen/emulator/manager/ui/renewal/MainDialog.java
new file mode 100644 (file)
index 0000000..67cbaa6
--- /dev/null
@@ -0,0 +1,139 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * Minkee Lee <minkee.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.manager.ui.renewal;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.emulator.manager.Messages;
+import org.tizen.emulator.manager.logging.EMLogger;
+import org.tizen.emulator.manager.resources.StringResources;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.renewal.tableviewer.AbstractTableViewer;
+import org.tizen.emulator.manager.ui.renewal.tableviewer.VMListTableViewer;
+
+public class MainDialog {
+       private static final String ICON_FILE_NAME = "res/em.ico"; //$NON-NLS-1$
+
+       public static final int DEFALUT_WIDTH  = 842;
+       public static final int DEFAULT_HEIGHT = 580;
+       public static int WIDTH  = DEFALUT_WIDTH;
+       public static int HEIGHT = DEFAULT_HEIGHT;
+
+       static Shell shell = null;
+       Image icon;
+
+       private int frameX = 0;
+       private int frameY = 0;
+
+       private final StackLayout stackLayout = new StackLayout();
+       private List<AbstractTableViewer> viewerList = new ArrayList<AbstractTableViewer>();
+
+       public MainDialog() {
+               Display.setAppName(Messages.getString("MainDialog.AppName.0"));
+
+               shell = new Shell(Display.getCurrent(), SWT.CLOSE | SWT.TITLE | SWT.BORDER);
+               shell.setLayout(stackLayout);
+               shell.setBackgroundMode(SWT.INHERIT_FORCE);
+
+               frameX = shell.getSize().x - shell.getClientArea().width;
+               frameY = shell.getSize().y - shell.getClientArea().height;
+
+               shell.setSize(WIDTH + frameX, HEIGHT + frameY);
+
+               shell.setText(StringResources.MAIN_TITLE);
+
+               InputStream is = this.getClass().getClassLoader().getResourceAsStream(ICON_FILE_NAME);
+               if(is != null) {
+                       icon = new Image(Display.getCurrent(), is);
+                       shell.setImage(icon);
+                       try {
+                               is.close();
+                       } catch (IOException e) {
+                               EMLogger.getLogger().info(e.getMessage());
+                       }
+               }
+       }
+
+       public void draw() {
+               VMListTableViewer vmListViewer = new VMListTableViewer(shell, "vmlist");
+               viewerList.add(vmListViewer);
+               this.setStackTop(findViewer("vmlist"));
+       }
+
+       public AbstractTableViewer findViewer (String key) {
+               for (AbstractTableViewer viewer : viewerList) {
+                       if (viewer.getKey().equals(key)) {
+                               return viewer;
+                       }
+               }
+               return null;
+       }
+
+       public void open() {
+               // TODO
+               //CheckingRunningEmulator.startCheckingThread();
+
+               shell.open();
+               while(!shell.isDisposed()) {
+                       if(!Display.getCurrent().readAndDispatch()) {
+                               Display.getCurrent().sleep();
+                       }
+               }
+       }
+
+       public void dispose() {
+               ImageResources.dispose();
+               //ColorResources.dispose();
+               if(icon != null) {
+                       icon.dispose();
+               }
+       }
+
+       public static Shell getShell() {
+               return shell;
+       }
+
+       public void setStackTop(AbstractTableViewer viewer) {
+               stackLayout.topControl = viewer.getMainComposite();
+               // TODO
+               viewer.initTableViewer();
+               viewer.showTableViewer();
+       }
+
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/tableviewer/AbstractTableViewer.java b/src/org/tizen/emulator/manager/ui/renewal/tableviewer/AbstractTableViewer.java
new file mode 100644 (file)
index 0000000..7d97041
--- /dev/null
@@ -0,0 +1,221 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * Minkee Lee <minkee.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.manager.ui.renewal.tableviewer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.emulator.manager.resources.ColorResources;
+import org.tizen.emulator.manager.ui.dialog.AboutDialog;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.table.FontResources;
+import org.tizen.emulator.manager.ui.widgets.ImageButton;
+
+public abstract class AbstractTableViewer {
+       private static final int BUTTON_MENU_WIDTH = 20;
+       private static final int BUTTON_MENU_HEIGHT = 20;
+       private String key;
+       private Composite mainComp;
+
+       private Composite topComp;
+       private Composite tableComp;
+
+       private boolean isInitialize = false;
+
+       private static ImageButton infoButton;
+       private List<ImageButton> buttonMenuList = new ArrayList<ImageButton>();
+
+       private List<Label> linkMenuList = new ArrayList<Label>();
+
+       public AbstractTableViewer(Shell shell, String key) {
+               this.key = key;
+               mainComp = new Composite(shell, SWT.None);
+       }
+
+       public Composite getMainComposite() {
+               return mainComp;
+       }
+
+       public String getKey() {
+               return key;
+       }
+
+       public Composite getTopComp() {
+               return topComp;
+       }
+
+       public Composite getTableComp() {
+               return tableComp;
+       }
+
+       public void initTableViewer() {
+               if (isInitialize) {
+                       return;
+               }
+
+               topComp = new Composite(mainComp, SWT.NONE);
+               topComp.setBackgroundImage(ImageResources.TITLE_IMAGE.getImage());
+               topComp.setLayout(new FormLayout());
+
+               tableComp = new Composite(mainComp, SWT.None);
+               tableComp.setLayout(new FormLayout());
+
+               makeTopComposite();
+               makeTableComposite();
+
+               mainComp.setBackground(ColorResources.CHOCOLATE.getColor());
+               topComp.setBackground(ColorResources.BLUE.getColor());
+               tableComp.setBackground(ColorResources.RED.getColor());
+
+               settingLayout();
+
+               isInitialize = true;
+       }
+
+       private void settingLayout() {
+               mainComp.setLayout(new FormLayout());
+
+               FormData topData = new FormData();
+               topData.left = new FormAttachment(0, 0);
+               topData.top = new FormAttachment(0, 0);
+               topData.right = new FormAttachment(100, 0);
+               topData.height = 84;
+               topComp.setLayoutData(topData);
+
+               FormData tableData = new FormData();
+               tableData.top = new FormAttachment(topComp, 0);
+               tableData.left = new FormAttachment(0, 0);
+               tableData.right = new FormAttachment(100, 0);
+               tableData.bottom = new FormAttachment(100, 0);
+
+               tableComp.setLayoutData(tableData);
+
+               settingTopLayout();
+       }
+
+       private void makeTopComposite() {
+               infoButton = new ImageButton(topComp, SWT.PUSH);
+               infoButton.setImages(ImageResources.BUTTON_INFO_NML.getImage(),
+                               ImageResources.BUTTON_INFO_HOVER.getImage(),
+                               ImageResources.BUTTON_INFO_HOVER.getImage(),
+                               ImageResources.BUTTON_INFO_NML.getImage());
+               infoButton.setBackground(null);
+               infoButton.addSelectionListener(new SelectionListener() {
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent arg0) {
+                       }
+                       @Override
+                       public void widgetSelected(SelectionEvent arg0) {
+                               AboutDialog.open();
+                       }
+               });
+               addIconMenu(infoButton);
+
+               //
+               setTitleImage();
+               setLinkerMenu();
+               setIconMenu();
+               //
+       }
+
+       public void setTtileBackgroundImage(Image image) {
+               if (image != null) {
+                       topComp.setBackgroundImage(image);
+               }
+       }
+
+       public void addLinkMenu(Label menu) {
+               linkMenuList.add(menu);
+       }
+
+       public void addIconMenu(ImageButton menu) {
+               buttonMenuList.add(menu);
+       }
+
+       public void settingTopLayout() {
+               if (!linkMenuList.isEmpty()) {
+                       for (int i = 0; i < linkMenuList.size(); i++){
+                               FormData data = new FormData();
+                               if (i == 0) {
+                                       data.top = new FormAttachment (0, 5);
+                               } else {
+                                       data.top = new FormAttachment(linkMenuList.get(i-1), 5);
+                               }
+                               data.right = new FormAttachment(100, -8);
+                               linkMenuList.get(i).setLayoutData(data);
+                               linkMenuList.get(i).setCursor(Display.getCurrent().getSystemCursor(SWT.CURSOR_HAND));
+                               linkMenuList.get(i).setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE));
+                               linkMenuList.get(i).setFont(FontResources.setSizeDefaultFont(10));
+                       }
+               }
+
+               if (!buttonMenuList.isEmpty()) {
+                       for (int i = 0; i < buttonMenuList.size(); i++) {
+                               FormData data = new FormData();
+                               data.bottom = new FormAttachment(100, -7);
+                               if (i == 0) {
+                                       data.right = new FormAttachment(100, -8);
+                               } else {
+                                       data.right = new FormAttachment(buttonMenuList.get(i-1), -11);
+                               }
+                               data.width = BUTTON_MENU_WIDTH;
+                               data.height = BUTTON_MENU_HEIGHT;
+                               buttonMenuList.get(i).setLayoutData(data);
+                               buttonMenuList.get(i).setBackground(null);
+                       }
+
+               }
+       }
+
+       public void showTableViewer() {
+               showTableComposite();
+       }
+
+       // top composite
+       abstract void setTitleImage();
+       abstract void setLinkerMenu();
+       abstract void setIconMenu();
+
+       // table composite
+       abstract void makeTableComposite();
+       abstract void showTableComposite();
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/tableviewer/MenuHandling.java b/src/org/tizen/emulator/manager/ui/renewal/tableviewer/MenuHandling.java
new file mode 100644 (file)
index 0000000..e045c47
--- /dev/null
@@ -0,0 +1,335 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * Minkee Lee <minkee.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.manager.ui.renewal.tableviewer;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.emulator.manager.logging.EMLogger;
+import org.tizen.emulator.manager.resources.FilePathResources;
+import org.tizen.emulator.manager.resources.StringResources;
+import org.tizen.emulator.manager.ui.renewal.MainDialog;
+import org.tizen.emulator.manager.ui.renewal.tableviewer.MessageBox;
+import org.tizen.emulator.manager.vms.VMProperty;
+import org.tizen.emulator.manager.vms.helper.VMLauncherException;
+import org.tizen.emulator.manager.vms.helper.VMWorkerException;
+
+public class MenuHandling {
+       private static final Shell shell;
+       static {
+               shell = MainDialog.getShell();
+       }
+
+       private static int openMessageBox(String message) {
+               return openMessageBox(message, SWT.OK, true);
+       }
+
+//     private static int openMessageBox(String message, int style) {
+//             return openMessageBox(message, style, true);
+//     }
+//
+//     private static int openMessageBox(String message, boolean printLog) {
+//             return openMessageBox(message, SWT.OK, printLog);
+//     }
+
+       private static int openMessageBox(String message, int style, boolean printLog) {
+               MessageBox msgBox = new MessageBox(shell, style);
+               msgBox.setMessage(message);
+               if (printLog) {
+                       EMLogger.getLogger().warning(message);
+               }
+               return msgBox.open();
+       }
+
+       public static boolean launchEmulator(VMProperty property) throws VMWorkerException {
+               try {
+                       property.getWorker().launchVM();
+               } catch (VMLauncherException le) {
+                       String msg = "Failed to launch [ "
+                                       + property.getPropertyValue().vmsName + " ] virtual machine."
+                                       + StringResources.NEW_LINE
+                                       + le.getMessage();
+
+                       if (le.isCritical()) {
+                               EMLogger.getLogger().warning(msg);
+                               msg +=  StringResources.NEW_LINE + StringResources.NEW_LINE
+                                       + "This virtual machine has problem." + StringResources.NEW_LINE
+                                       + "Do you want to delete this virtual machine?";
+
+                               int response = openMessageBox(msg, SWT.YES | SWT.NO, false);
+                               if (response == SWT.OK) {
+                                       deleteEmulator(property, false);
+                               }
+                       } else {
+                               openMessageBox(msg);
+                       }
+                       return false;
+               } catch (VMWorkerException e) {
+                       String msg = "Failed to launch [ "
+                                       + property.getPropertyValue().vmsName + " ] virtual machine."
+                                       + StringResources.NEW_LINE
+                                       + e.getMessage();
+
+                       openMessageBox(msg);
+                       throw e;
+               }
+               return true;
+       }
+
+       public static boolean resetEmulator(VMProperty property) throws VMWorkerException {
+               if (property == null) {
+                       return false;
+               }
+
+               String msg = "This virtual machine will be formatted."
+                               + StringResources.NEW_LINE
+                               + "Do you want to be continue?";
+               int response = openMessageBox(msg, SWT.OK | SWT.CANCEL, false);
+
+               if (response != SWT.OK) {
+                       return false;
+               }
+
+               try {
+                       property.getWorker().resetVM();
+               } catch(VMWorkerException e) {
+                       String errorMsg = "[Failure]"
+                                               + StringResources.NEW_LINE
+                                               + "Failed to reset [ "
+                                               + property.getName() + " ] virtual machine."
+                                               + StringResources.NEW_LINE
+                                               + e.getMessage();
+                       openMessageBox(errorMsg);
+                       throw e;
+               }
+               return true;
+       }
+
+       public static boolean resetEmulator(VMProperty[] properties) throws VMWorkerException {
+               if (properties == null || properties.length == 0) {
+                       return false; // TODO
+               }
+
+               if (properties.length == 1) {
+                       return resetEmulator(properties[0]);
+               }
+
+               String message = "This virtual machine will be formatted.";
+
+               String isRunning = "";
+               for (VMProperty prop : properties) {
+                       if (prop.isRunning()) {
+                               isRunning += " [" + prop.getName() + "] ";
+                       }
+               }
+               if (!isRunning.isEmpty()) {
+                       message = message + StringResources.NEW_LINE
+                                       + isRunning + StringResources.NEW_LINE
+                                       + "virtual machines are already running. So, these will be not reset.";
+               }
+               message += StringResources.NEW_LINE
+                               + "Do you want to be continue?";
+
+               int response = openMessageBox(message, SWT.OK | SWT.CANCEL, false);
+
+               if (response != SWT.OK) {
+                       return false;
+               }
+
+               return reset(properties);
+       }
+
+       private static boolean reset(VMProperty[] properties) throws VMWorkerException {
+               MessageBox dialog = new MessageBox(shell, SWT.OK, false);
+               if (properties.length < 6) {
+                       dialog.setSize(490, 50 * properties.length);
+               } else {
+                       dialog.setSize(490, 300);
+               }
+
+               dialog.open();
+
+               boolean isNeedRefresh = false;
+               String errorMessage = "";
+               for (VMProperty prop : properties) {
+                       try {
+                               prop.getWorker().resetVM();
+
+                               dialog.addMessage("[Success]"
+                                               + StringResources.NEW_LINE
+                                               + "'" + prop.getName() + "' virtual machine has been reset."
+                                               + StringResources.NEW_LINE);
+
+                       } catch(VMWorkerException e) {
+                               dialog.addMessage("[Failure]" + StringResources.NEW_LINE
+                                               + "'" + prop.getName() + "' virtual machine has been failed to reset."
+                                               + StringResources.NEW_LINE);
+                               dialog.addMessage(e.getMessage() + StringResources.NEW_LINE);
+
+                               errorMessage += e.getMessage() + StringResources.NEW_LINE;
+                               if (!isNeedRefresh) {
+                                       isNeedRefresh = e.isNeedRefresh();
+                               }
+                       }
+               }
+
+               if (!errorMessage.isEmpty()) {
+                       EMLogger.getLogger().warning(errorMessage);
+                       throw new VMWorkerException(errorMessage, isNeedRefresh);
+               }
+
+               return true;
+       }
+
+       public static boolean deleteEmulator(VMProperty property, boolean needCheck) throws VMWorkerException {
+               if (property == null) {
+                       return false;
+               }
+
+               if (needCheck) {
+                       String msg = "Do you want to delete selected virtual machine?";
+                       int response = openMessageBox(msg, SWT.OK | SWT.CANCEL, false);
+
+                       if (response != SWT.OK) {
+                               return false;
+                       }
+               }
+
+               try {
+                       property.getWorker().deleteVM();
+               } catch(VMWorkerException e) {
+                       String errorMsg = "[Failure]"
+                                               + StringResources.NEW_LINE
+                                               + "Failed to reset [ "
+                                               + property.getName() + " ] virtual machine."
+                                               + StringResources.NEW_LINE
+                                               + e.getMessage();
+                       openMessageBox(errorMsg);
+                       throw e;
+               }
+               return true;
+       }
+
+       public static boolean deleteEmulator(VMProperty[] properties) throws VMWorkerException {
+               if (properties == null || properties.length == 0) {
+                       return false; // TODO
+               }
+
+               if (properties.length == 1) {
+                       return deleteEmulator(properties[0], true);
+               }
+
+               String message = "Do you want to delete selected virtual machines?";
+               String isRunning = "";
+               for (VMProperty prop : properties) {
+                       if (prop.isRunning()) {
+                               isRunning += " [" + prop.getName() + "] ";
+                       }
+               }
+               if (!isRunning.isEmpty()) {
+                       message = message + StringResources.NEW_LINE
+                                       + isRunning + StringResources.NEW_LINE
+                                       + "virtual machines are already running. So, these will be not deleted."
+                                       + StringResources.NEW_LINE
+                                       + "Do you want to be continue?";
+               }
+
+               int response = openMessageBox(message, SWT.OK | SWT.CANCEL, false);
+
+               if (response != SWT.OK) {
+                       return false;
+               }
+
+               boolean isNeedRefresh = false;
+               MessageBox dialog = new MessageBox(shell, SWT.OK, false);
+               if (properties.length < 6) {
+                       dialog.setSize(490, 50 * properties.length);
+               } else {
+                       dialog.setSize(490, 300);
+               }
+
+               dialog.open();
+               String errorMessage = "";
+               for (VMProperty prop : properties) {
+                       try {
+                               prop.getWorker().deleteVM();
+                               dialog.addMessage("[Success]" + StringResources.NEW_LINE
+                                        + "'" + prop.getName() + "' vm image has been deleted."
+                                        + StringResources.NEW_LINE);
+                       } catch(VMWorkerException e) {
+                               dialog.addMessage("[Failure]" + StringResources.NEW_LINE
+                                               + "'" + prop.getName() + "' vm image has been failed to delete."
+                                               + StringResources.NEW_LINE);
+                               dialog.addMessage(e.getMessage() + StringResources.NEW_LINE);
+
+                               errorMessage += e.getMessage() + StringResources.NEW_LINE;
+                               if (!isNeedRefresh) {
+                                       isNeedRefresh = e.isNeedRefresh();
+                               }
+                       }
+               }
+
+               if (!errorMessage.isEmpty()) {
+                       EMLogger.getLogger().warning(errorMessage);
+                       throw new VMWorkerException(errorMessage, isNeedRefresh);
+               }
+
+               return true;
+       }
+
+       public static boolean createBaseImage(VMProperty property) throws VMWorkerException {
+               FileDialog fd = new FileDialog(shell, SWT.SAVE);
+               fd.setText("Export 'Base Image' as");
+               String[] filter = {"*."+ property.getArchInternal().toString()};
+               String[] filterName = {"Image Files(*." + property.getArchInternal().toString() + ")"};
+               fd.setFilterExtensions(filter);
+               fd.setFilterNames(filterName);
+               fd.setFileName("emulimg-" + property.getName()); //$NON-NLS-1$
+               fd.setFilterPath(FilePathResources.getTizenSdkDataEmulatorPath());
+
+               String path = null;
+               path = fd.open();
+               if (path == null) {
+                       return false;
+               }
+               try {
+                       property.getWorker().createNewBaseImage(property, path);
+               } catch (VMWorkerException e) {
+                       String error = "Faile to export as [ "
+                                       + property.getName() + " ] base image."
+                                       + StringResources.NEW_LINE
+                                       + e.getMessage();
+                       openMessageBox(error);
+                       throw e;
+               }
+               return true;
+       }
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/tableviewer/MessageBox.java b/src/org/tizen/emulator/manager/ui/renewal/tableviewer/MessageBox.java
new file mode 100644 (file)
index 0000000..3dae3ce
--- /dev/null
@@ -0,0 +1,306 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * Minkee Lee <minkee.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.manager.ui.renewal.tableviewer;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.emulator.manager.renewal.resources.ColorResources;
+import org.tizen.emulator.manager.ui.table.CustomScrolledComposite;
+import org.tizen.emulator.manager.ui.table.FontResources;
+
+public class MessageBox {
+       private final int MIN_WIDTH     = 300;
+       private final int MIN_HEIGHT    = 140;
+       private final int MAX_WIDTH     = 750;
+       private final int MAX_HEIGHT    = 400;
+
+       private final int TITLE_HEIGHT  = 30;
+       private final int BOTTOM_HEIGHT = 40;
+       private final int BUTTON_WIDTH  = 80;
+       private final int BUTTON_HEIGHT = 26;
+       private final int SPACING = 15;
+
+       private Shell parent;
+       private Shell dialog;
+       private int width = MIN_WIDTH;
+       private int height = MIN_HEIGHT;
+
+       private String title = "Emulator Manager";
+       private String message = "";
+
+       private int style;
+       private boolean isModal;
+       private boolean isOpen = false;
+       private int returnValue = SWT.OK;
+
+       private StyledText titleLabel = null;
+       private CustomScrolledComposite scrolledList = null;
+       private StyledText contentsBox = null;
+
+       // TODO: Icon SWT.ICON_ERROR ...
+
+       /**
+        * style = SWT.OK
+        * isModal = true
+        * @param parent
+        */
+       public MessageBox(Shell parent) {
+               this(parent, SWT.OK, true);
+       }
+
+       /**
+        * isModal = true
+        * @param parent
+        * @param style OK, OK | CANCEL, YES | NO, YES | NO | CANCEL
+        */
+       public MessageBox(Shell parent, int style) {
+               this(parent, style, true);
+       }
+
+       public MessageBox(Shell parent, int style, boolean isModal) {
+               this.parent = parent;
+               this.style = checkStyle(style);
+               this.isModal = isModal;
+       }
+
+       private static int checkStyle(int style) {
+               int chkStyle = 0;
+               int mask = SWT.YES | SWT.NO | SWT.OK | SWT.CANCEL;
+               int bits = style & mask;
+               if (bits == SWT.OK
+                               || bits == (SWT.OK | SWT.CANCEL)) {
+                       chkStyle = style;
+               } else if (bits == (SWT.YES | SWT.NO)
+                               || bits == (SWT.YES | SWT.NO | SWT.CANCEL)) {
+                       chkStyle = style;
+               } else {
+                       chkStyle = (style & ~mask) | SWT.OK;
+               }
+               return chkStyle;
+       }
+
+       public int open() {
+               if (isOpen) {
+                       return SWT.NONE;
+               }
+
+               isOpen = true;
+
+               makeDialog();
+
+               dialog.open();
+
+               if (isModal) {
+                       while(!dialog.isDisposed()) {
+                               if(!Display.getCurrent().readAndDispatch()) {
+                                       Display.getCurrent().sleep();
+                               }
+                       }
+               }
+
+               return returnValue;
+       }
+
+       private void makeDialog () {
+               if (isModal) {
+                       dialog = new Shell(parent, SWT.NO_TRIM | SWT.APPLICATION_MODAL);
+               } else {
+                       dialog = new Shell(parent, SWT.NO_TRIM);
+               }
+
+               makeTitleLabel();
+               makeContentsBox();
+
+               // need contentsBox size
+               dialog.setBounds(computeDialogBounds());
+
+               // need dialog size
+               makeButtons();
+
+               titleLabel.setBounds(0, 0, width, TITLE_HEIGHT);
+               scrolledList.setBounds(0, TITLE_HEIGHT, width, height - TITLE_HEIGHT - BOTTOM_HEIGHT);
+
+               dialog.addPaintListener(painter);
+       }
+
+       private void makeTitleLabel() {
+               titleLabel = new StyledText(dialog, SWT.NONE);
+               titleLabel.setText(this.title);
+               titleLabel.setBackground(ColorResources.MESSAGE_BOX_TITLE_BG.getColor());
+               titleLabel.setForeground(ColorResources.MESSAGE_BOX_TITLE_FONT.getColor());
+               titleLabel.setFont(FontResources.setSizeDefaultFont(9));
+               titleLabel.setLeftMargin(SPACING);
+               titleLabel.setTopMargin(10);
+       }
+
+       private void makeContentsBox() {
+               scrolledList = new CustomScrolledComposite(dialog, SWT.V_SCROLL | SWT.H_SCROLL);
+               contentsBox = new StyledText(scrolledList, SWT.NONE);
+
+               scrolledList.setContent(contentsBox);
+               scrolledList.setBackground(ColorResources.MESSAGE_BOX_CONTENTS_BG.getColor());
+
+               contentsBox.setText(message);
+               contentsBox.setBackground(ColorResources.MESSAGE_BOX_CONTENTS_BG.getColor());
+               contentsBox.setForeground(ColorResources.MESSAGE_BOX_CONTENTS_FONT.getColor());
+               contentsBox.setFont(FontResources.setSizeDefaultFont(9));
+               contentsBox.setLeftMargin(SPACING);
+               contentsBox.setTopMargin(SPACING);
+               contentsBox.setEnabled(false);
+               contentsBox.pack();
+       }
+
+       private int buttonCount = 1;
+       private void makeButton(String text, final int buttonType) {
+               if ((style & buttonType) == buttonType) {
+                       Button button = new Button(dialog, SWT.PUSH);
+                       button.setFont(FontResources.setSizeDefaultFont(10));
+                       button.setText(text);
+                       button.addListener(SWT.Selection, new Listener(){
+                               @Override
+                               public void handleEvent(Event event) {
+                                       if (event.type == SWT.Selection) {
+                                               returnValue = SWT.OK;
+                                               dispose();
+                                       }
+                               }
+                       });
+
+                       button.setBounds(width - (BUTTON_WIDTH + SPACING) * buttonCount,
+                                                       height - (BOTTOM_HEIGHT + BUTTON_HEIGHT)/2,
+                                                       BUTTON_WIDTH, BUTTON_HEIGHT);
+                       buttonCount++;
+               }
+       }
+
+       private void makeButtons() {
+               buttonCount = 1;
+               makeButton("Yes", SWT.YES);
+               makeButton("Ok", SWT.OK);
+               makeButton("Cancel", SWT.CANCEL);
+               makeButton("No", SWT.NO);
+       }
+
+       private Rectangle computeDialogBounds() {
+               Rectangle result = new Rectangle(0, 0, 0, 0);
+               Rectangle parentRect = parent.getBounds();
+               width  = Math.max(width, contentsBox.getSize().x + 6); // add scroll bar spacing
+               height = Math.max(height, contentsBox.getSize().y + TITLE_HEIGHT + BOTTOM_HEIGHT + 6);
+
+               result.width  = width = Math.min(width, MAX_WIDTH);
+               result.height = height = Math.min(height, MAX_HEIGHT);
+               result.x = (parentRect.width - width) / 2 + parentRect.x;
+               result.y = (parentRect.height - height) / 2 + parentRect.y;
+               return result;
+       }
+
+       private PaintListener painter = new PaintListener() {
+               @Override
+               public void paintControl(PaintEvent e) {
+                       GC gc = e.gc;
+                       Rectangle rect = ((Composite)e.widget).getClientArea();
+
+                       // Bottom
+                       Rectangle buttonRect = new Rectangle(0, rect.height - BOTTOM_HEIGHT,
+                                       rect.width, BOTTOM_HEIGHT);
+                       gc.setClipping(buttonRect);
+                       gc.setBackground(ColorResources.MESSAGE_BOX_BOTTOM_BG.getColor());
+                       gc.fillRectangle(buttonRect);
+               }
+       };
+
+       public void setTitle(final String title) {
+               if (title == null) {
+                       SWT.error(SWT.ERROR_NULL_ARGUMENT);
+               }
+
+               this.title = title;
+       }
+
+       public String getMessage() {
+               return message;
+       }
+
+       public void setMessage(final String message) {
+               if (message == null) {
+                       SWT.error(SWT.ERROR_NULL_ARGUMENT);
+               }
+
+               this.message = message;
+
+               if (isOpen) {
+                       contentsBox.setText(message);
+                       contentsBox.setTopMargin(SPACING);
+                       contentsBox.pack();
+                       if (scrolledList.getSize().y <= contentsBox.getSize().y) {
+                               scrolledList.setOrigin(0, contentsBox.getSize().y);
+                       } else {
+                               scrolledList.setOrigin(0, 0);
+                       }
+               }
+       }
+
+       public void addMessage(String message) {
+               if (message == null) {
+                       SWT.error(SWT.ERROR_NULL_ARGUMENT);
+               }
+
+               setMessage(this.message + message);
+       }
+
+       public void setSize(int width, int height) {
+               if (width <= 0) {
+                       width = MIN_WIDTH;
+               }
+               if (height <= 0) {
+                       height = MIN_HEIGHT;
+               }
+
+               this.width = width;
+               this.height = height + BOTTOM_HEIGHT + TITLE_HEIGHT;;
+       }
+
+       public void dispose() {
+               dialog.close();
+               dialog.dispose();
+               isOpen = false;
+       }
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/tableviewer/ProfileButtonList.java b/src/org/tizen/emulator/manager/ui/renewal/tableviewer/ProfileButtonList.java
new file mode 100644 (file)
index 0000000..9cad783
--- /dev/null
@@ -0,0 +1,197 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * Minkee Lee <minkee.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.manager.ui.renewal.tableviewer;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.tizen.emulator.manager.platform.Platform;
+import org.tizen.emulator.manager.platform.Profile;
+import org.tizen.emulator.manager.platform.ProfileList;
+import org.tizen.emulator.manager.plugin.PluginImageResources;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.widgets.ImageButton;
+
+class ProfileButton {
+       private String profileName;
+       private Profile profile;
+       private ImageButton button;
+       private Image icon;
+       private Image selectedIcon;
+
+       public ProfileButton(String name, ImageButton button) {
+               this.profileName = name;
+               this.button = button;
+       }
+
+       public Profile getProfile() {
+               return profile;
+       }
+
+       public void setProfile(Profile profile) {
+               if (profile == null) {
+                       return;
+               }
+
+               if (profile.getName().equals(profileName)) {
+                       this.profile = profile;
+               }
+       }
+
+       public ImageButton getButton() {
+               return button;
+       }
+
+       public String getProfileName() {
+               return profileName;
+       }
+
+       public Image getIcon() {
+               return icon;
+       }
+
+       public void setIcon(Image icon) {
+               this.icon = icon;
+       }
+
+       public Image getSelectedIcon() {
+               return selectedIcon;
+       }
+
+       public void setSelectedIcon(Image selectedIcon) {
+               this.selectedIcon = selectedIcon;
+       }
+}
+
+public class ProfileButtonList {
+       private final static int WIDTH = 32;
+       private final static int HEIGHT = 26;
+
+       public static ProfileButton getProfileButton(String name, Composite comp) {
+               ProfileButton profileButton = null;
+               ImageButton button = null;
+               if (name.equals("mobile")) {
+                       button = makeMobileButton(comp);
+                       if (button != null) {
+                               profileButton = new ProfileButton(name, button);
+                               profileButton.setIcon(ImageResources.ICON_TYPE_MOBILE.getImage());
+                               profileButton.setSelectedIcon(ImageResources.ICON_SELECTED_MOBILE.getImage());
+                       }
+               } else if (name.equals("tv")){
+                       button = makeTVButton(comp);
+                       if (button != null) {
+                               profileButton = new ProfileButton(name, button);
+                               profileButton.setIcon(ImageResources.ICON_TYPE_TV.getImage());
+                               profileButton.setSelectedIcon(ImageResources.ICON_SELECTED_TV.getImage());
+                       }
+               } else if (name.equals("wearable")) {
+                       button = makeWearableButton(comp);
+                       if (button != null) {
+                               profileButton = new ProfileButton(name, button);
+                               profileButton.setIcon(ImageResources.ICON_TYPE_WEARABLE.getImage());
+                               profileButton.setSelectedIcon(ImageResources.ICON_SELECTED_WEARABLE_SQUARE.getImage());
+                       }
+               } else {
+                       Profile profile = ProfileList.getProfile(name);
+                       if (profile != null) {
+                               Platform p = profile.getPlatformByLatestVersion();;
+                               if (p != null) {
+                                       button = makeProfileButton(p.getName(), comp);
+                               }
+                               if (button != null) {
+                                       profileButton = new ProfileButton(name, button);
+                                       profileButton.setIcon(PluginImageResources.ICON_TYPE.getImage(p.getName()));
+                                       profileButton.setSelectedIcon(PluginImageResources.ICON_SELECTED_TYPE.getImage(p.getName()));
+                               }
+                       }
+               }
+
+               if (button != null) {
+                       button.setSize(WIDTH, HEIGHT);
+                       button.setBackground(null);
+                       button.setEnabled(false);
+               }
+
+               return profileButton;
+       }
+
+       private static ImageButton makeMobileButton(Composite comp) {
+               ImageButton button = new ImageButton(comp, SWT.TOGGLE);
+               button.setImages(ImageResources.BUTTON_FILTER_MOBILE_SELECTED_NORMAL.getImage(),
+                               ImageResources.BUTTON_FILTER_MOBILE_SELECTED_HOVER.getImage(),
+                               ImageResources.BUTTON_FILTER_MOBILE_SELECTED_HOVER.getImage(),
+                               ImageResources.BUTTON_FILTER_MOBILE_UNSELECTED_NOMAL.getImage(),
+                               ImageResources.BUTTON_FILTER_MOBILE_UNSELECTED_HOVER.getImage(),
+                               ImageResources.BUTTON_FILTER_MOBILE_UNSELECTED_HOVER.getImage(),
+                               ImageResources.BUTTON_FILTER_MOBILE_UNSELECTED_NOMAL.getImage()); // disable
+
+               return button;
+       }
+
+       private static ImageButton makeTVButton(Composite comp) {
+               ImageButton button = new ImageButton(comp, SWT.TOGGLE);
+               button.setImages(ImageResources.BUTTON_FILTER_TV_SELECTED_NORMAL.getImage(),
+                               ImageResources.BUTTON_FILTER_TV_SELECTED_HOVER.getImage(),
+                               ImageResources.BUTTON_FILTER_TV_SELECTED_HOVER.getImage(),
+                               ImageResources.BUTTON_FILTER_TV_UNSELECTED_NOMAL.getImage(),
+                               ImageResources.BUTTON_FILTER_TV_UNSELECTED_HOVER.getImage(),
+                               ImageResources.BUTTON_FILTER_TV_UNSELECTED_HOVER.getImage(),
+                               ImageResources.BUTTON_FILTER_TV_UNSELECTED_NOMAL.getImage());
+
+               return button;
+       }
+
+       private static ImageButton makeWearableButton(Composite comp) {
+               ImageButton button = new ImageButton(comp, SWT.TOGGLE);
+               button.setImages(ImageResources.BUTTON_FILTER_WEARABLE_SELECTED_NOMAL.getImage(),
+                               ImageResources.BUTTON_FILTER_WEARABLE_SELECTED_HOVER.getImage(),
+                               ImageResources.BUTTON_FILTER_WEARABLE_SELECTED_HOVER.getImage(),
+                               ImageResources.BUTTON_FILTER_WEARABLE_UNSELECTED_NOMAL.getImage(),
+                               ImageResources.BUTTON_FILTER_WEARABLE_UNSELECTED_HOVER.getImage(),
+                               ImageResources.BUTTON_FILTER_WEARABLE_UNSELECTED_HOVER.getImage(),
+                               ImageResources.BUTTON_FILTER_WEARABLE_UNSELECTED_NOMAL.getImage());
+
+               return button;
+       }
+
+       private static ImageButton makeProfileButton(String platform, Composite comp) {
+               ImageButton button = new ImageButton(comp, SWT.TOGGLE);
+               button.setImages(PluginImageResources.BUTTON_FILTER_SELECTED_NOMAL.getImage(platform),
+                               PluginImageResources.BUTTON_FILTER_SELECTED_HOVER.getImage(platform),
+                               PluginImageResources.BUTTON_FILTER_SELECTED_HOVER.getImage(platform),
+                               PluginImageResources.BUTTON_FILTER_UNSELECTED_NOMAL.getImage(platform),
+                               PluginImageResources.BUTTON_FILTER_UNSELECTED_HOVER.getImage(platform),
+                               PluginImageResources.BUTTON_FILTER_UNSELECTED_HOVER.getImage(platform),
+                               PluginImageResources.BUTTON_FILTER_UNSELECTED_NOMAL.getImage(platform));
+
+               return button;
+       }
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/tableviewer/VMListTable.java b/src/org/tizen/emulator/manager/ui/renewal/tableviewer/VMListTable.java
new file mode 100644 (file)
index 0000000..af567ba
--- /dev/null
@@ -0,0 +1,484 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * Minkee Lee <minkee.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.manager.ui.renewal.tableviewer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.tizen.emulator.manager.platform.Profile;
+import org.tizen.emulator.manager.platform.ProfileList;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.table.Table;
+import org.tizen.emulator.manager.ui.table.TableColumn;
+import org.tizen.emulator.manager.ui.table.TableItem;
+import org.tizen.emulator.manager.ui.widgets.ImageButton;
+import org.tizen.emulator.manager.vms.SKIN_SHAPE;
+import org.tizen.emulator.manager.vms.VMProperty;
+import org.tizen.emulator.manager.vms.VMPropertyValue;
+import org.tizen.emulator.manager.vms.helper.VMWorkerException;
+
+public class VMListTable {
+       private static final int BUTTON_WIDTH = 32;
+       private static final int BUTTON_HEIGHT = 26;
+
+       private Composite comp;
+       private Table table;
+
+       private List<ProfileButton> profileButtonList;
+
+       private ImageButton resetButton;
+       private ImageButton exportButton;
+       private ImageButton deleteButton;
+       private ImageButton modifyButton;
+       private ImageButton launchButton;
+
+       public VMListTable(Composite comp) {
+               this.setComp(comp);
+       }
+
+       public void initialize() {
+               if (table != null) {
+                       return;
+               }
+
+               makeTable();
+               makeProfileButton();
+               makeVMButton();
+               setLayout();
+       }
+
+       public Composite getComp() {
+               return comp;
+       }
+
+       public void setComp(Composite comp) {
+               this.comp = comp;
+       }
+
+       public void setVMList() {
+               for (ProfileButton pButton : profileButtonList) {
+                       if (pButton.getProfile() == null) {
+                               continue;
+                       }
+                       makeTableItem(pButton);
+               }
+
+               table.getColumn(0).setWidth(30);
+               table.getColumn(1).setWidth(100);
+               for (int i = 2; i < titles.length; i++) {
+                       table.getColumn(i).pack();
+               }
+       }
+
+       String[] titles = {"", "Type", "Name", "Device", "Platform", "Resolution", "File Sharing"};
+       private void makeTable() {
+               table = new Table(comp, SWT.MULTI | SWT.CHECK | SWT.BORDER);
+
+               for (String t : titles) {
+                       TableColumn column = new TableColumn(table, SWT.None);
+                       column.setText(t);
+                       column.setAlignment(SWT.CENTER);
+               }
+               table.getColumn(0).setResizable(false);
+               table.getColumn(1).setResizable(false);
+               table.addSelectionListener(tableSelectionListener);
+       }
+
+       private void makeProfileButton() {
+               profileButtonList = new ArrayList<ProfileButton>();
+               profileButtonList.add(ProfileButtonList.getProfileButton("mobile", comp));
+               profileButtonList.add(ProfileButtonList.getProfileButton("tv", comp));
+               profileButtonList.add(ProfileButtonList.getProfileButton("wearable", comp));
+
+               for (Profile profile : ProfileList.getProfileList()) {
+                       for (ProfileButton pButton : profileButtonList) {
+                               if (pButton.getProfileName().equals(profile.getName())) {
+                                       pButton.setProfile(profile);
+                                       pButton.getButton().setEnabled(true);
+                                       pButton.getButton().addSelectionListener(profileButtonSelectionListener);
+                                       break;
+                               }
+                       }
+               }
+       }
+
+       private final SelectionListener profileButtonSelectionListener = new SelectionListener() {
+               @Override
+               public void widgetSelected(SelectionEvent e) {
+                       ImageButton b = (ImageButton)e.widget;
+                       for (ProfileButton pButton : profileButtonList) {
+                               if (pButton.getButton() != b) {
+                                       continue;
+                               }
+
+                               if (!b.isSelection()) {
+                                       makeTableItem(pButton);
+                               } else {
+                                       for (VMProperty property : pButton.getProfile().getEmulatorList()) {
+                                               for (TableItem item : table.getItems()) {
+                                                       if (item.getData() == property) {
+                                                               int index = table.indexOf(item);
+                                                               table.remove(index);
+                                                               break;
+                                                       }
+                                               }
+                                       }
+                               }
+                       }
+
+               }
+
+               @Override
+               public void widgetDefaultSelected(SelectionEvent e) {
+               }
+       };
+
+       private void makeTableItem(ProfileButton pButton) {
+               for (VMProperty property : pButton.getProfile().getEmulatorList()) {
+                       VMPropertyValue value = property.getPropertyValue();
+                       TableItem item = new TableItem(table, SWT.NULL);
+                       item.setImage(1, pButton.getIcon());
+                       item.setSelectedImage(1, pButton.getSelectedIcon());
+                       if (pButton.getProfileName().equals("wearable")
+                                       && value.baseImage.getSkinShape().equals(SKIN_SHAPE.CIRCLE)) {
+                               item.setSelectedImage(1, ImageResources.ICON_SELECTED_WEARABLE_ROUND.getImage());
+                       }
+
+                       item.setText(2, value.vmsName);
+                       item.setText(3, "Samsung Z3");
+                       item.setText(4, value.baseImage.getPlatformName());
+                       item.setText(5, value.resolution.getStrTypeValue());
+                       if (value.fileSharePath == null ||  value.fileSharePath.isEmpty()) {
+                               item.setImage(6, ImageResources.ICON_FILE_SHARE_OFF.getImage());
+                       } else {
+                               item.setImage(6, ImageResources.ICON_FILE_SHARE_ON.getImage());
+                       }
+                       item.setData(property);
+               }
+       }
+
+       private void makeVMButton() {
+               resetButton = new ImageButton(comp, SWT.PUSH);
+               resetButton.setBackground(null);
+               resetButton.setImages(ImageResources.BUTTON_RESET_NOMAL.getImage(),
+                               ImageResources.BUTTON_RESET_HOVER.getImage(),
+                               ImageResources.BUTTON_RESET_HOVER.getImage(),
+                               ImageResources.BUTTON_RESET_DISABLE.getImage());
+               resetButton.addListener(SWT.Selection, new Listener() {
+                       @Override
+                       public void handleEvent(Event event) {
+                               if (event.type == SWT.Selection) {
+                                       resetVMList();
+                               }
+                       }
+               });
+
+               exportButton = new ImageButton(comp, SWT.PUSH);
+               exportButton.setBackground(null);
+               exportButton.setImages(ImageResources.BUTTON_EXPORT_NOMAL.getImage(),
+                               ImageResources.BUTTON_EXPORT_HOVER.getImage(),
+                               ImageResources.BUTTON_EXPORT_HOVER.getImage(),
+                               ImageResources.BUTTON_EXPORT_DISABLE.getImage());
+               exportButton.addListener(SWT.Selection, new Listener() {
+                       @Override
+                       public void handleEvent(Event event) {
+                               if (event.type == SWT.Selection) {
+                                       exportEmulatorImage();
+                               }
+                       }
+               });
+
+               deleteButton = new ImageButton(comp, SWT.PUSH);
+               deleteButton.setBackground(null);
+               deleteButton.setImages(ImageResources.BUTTON_DELETE_NOMAL.getImage(),
+                               ImageResources.BUTTON_DELETE_HOVER.getImage(),
+                               ImageResources.BUTTON_DELETE_HOVER.getImage(),
+                               ImageResources.BUTTON_DELETE_DISABLE.getImage());
+               deleteButton.addListener(SWT.Selection, new Listener() {
+                       @Override
+                       public void handleEvent(Event event) {
+                               if (event.type == SWT.Selection) {
+                                       deleteVMList();
+                               }
+                       }
+               });
+
+               modifyButton = new ImageButton(comp, SWT.PUSH);
+               modifyButton.setBackground(null);
+               modifyButton.setImages(ImageResources.BUTTON_MODIFY_NOMAL.getImage(),
+                               ImageResources.BUTTON_MODIFY_HOVER.getImage(),
+                               ImageResources.BUTTON_MODIFY_HOVER.getImage(),
+                               ImageResources.BUTTON_MODIFY_DISABLE.getImage());
+               modifyButton.addListener(SWT.Selection, new Listener() {
+                       @Override
+                       public void handleEvent(Event event) {
+                               if (event.type == SWT.Selection) {
+                                       modifyEmulator();
+                               }
+                       }
+               });
+
+               launchButton = new ImageButton(comp, SWT.PUSH);
+               launchButton.setBackground(null);
+               launchButton.setImages(ImageResources.BUTTON_RUN_NOMAL.getImage(),
+                               ImageResources.BUTTON_RUN_HOVER.getImage(),
+                               ImageResources.BUTTON_RUN_HOVER.getImage(),
+                               ImageResources.BUTTON_RUN_DISABLE.getImage());
+               launchButton.addListener(SWT.Selection, new Listener() {
+                       @Override
+                       public void handleEvent(Event event) {
+                               if (event.type == SWT.Selection) {
+                                       launchEmulator();
+                               }
+                       }
+               });
+
+               resetButton.setEnabled(false);
+               exportButton.setEnabled(false);
+               deleteButton.setEnabled(false);
+               modifyButton.setEnabled(false);
+               launchButton.setEnabled(false);
+       }
+
+       public void modifyEmulator() {
+               // TODO: open modify view
+       }
+
+       public void launchEmulator() {
+               int count = table.getSelectionCount();
+               if (count != 1) {
+                       return;
+               }
+               VMProperty property = (VMProperty)table.getSelection()[0].getData();
+               try {
+                       if (MenuHandling.launchEmulator(property)) {
+                               //
+                       }
+               } catch (VMWorkerException e) {
+                       if (e.isNeedRefresh()) {
+                       }
+               }
+               //reloadProperty();
+               //redraw();
+       }
+
+       public void exportEmulatorImage() {
+               if (table.getSelectionCount() != 1) {
+                       return;
+               }
+
+               VMProperty property = (VMProperty)table.getSelection()[0].getData();
+               try {
+                       if (MenuHandling.createBaseImage(property)) {
+                               //reloadProperty();
+                       }
+               } catch (VMWorkerException e) {
+                       if (e.isNeedRefresh()) {
+                               //MainDialog.refreshVMPropertyList(false);
+                       }
+               }
+       }
+
+       private VMProperty[] getSelectionVMList() {
+               int count = table.getSelectionCount();
+               if (count == 0) {
+                       return null;
+               }
+
+               TableItem[] items = table.getSelection();
+               VMProperty[] properties = new VMProperty[count];
+               int i = 0;
+               for (TableItem item : items) {
+                       VMProperty prop = (VMProperty)item.getData();
+                       properties[i++] = prop;
+               }
+               return properties;
+       }
+
+       public void resetVMList() {
+               VMProperty[] properties = getSelectionVMList();
+
+               if (properties == null) {
+                       return;
+               }
+
+               try {
+                       if (MenuHandling.resetEmulator(properties)) {
+                       }
+               } catch (VMWorkerException e) {
+                       if (e.isNeedRefresh()) {
+                               //
+                       }
+               }
+       }
+
+       public void deleteVMList() {
+               VMProperty[] properties = getSelectionVMList();
+
+               if (properties == null) {
+                       return;
+               }
+
+               try {
+                       if (MenuHandling.deleteEmulator(properties)) {
+
+                       }
+               } catch (VMWorkerException e) {
+                       if (e.isNeedRefresh()) {
+                               //
+                       }
+               }
+       }
+
+       private void setLayout() {
+               // composite is form layout
+               FormData profileButtonData;
+               for (int i = 0; i < profileButtonList.size(); i++) {
+                       ProfileButton button = profileButtonList.get(i);
+                       profileButtonData = new FormData();
+                       if (i == 0) {
+                               profileButtonData.left = new FormAttachment(0, 372);
+                       } else {
+                               profileButtonData.left = new FormAttachment(profileButtonList.get(i-1).getButton(), 2);
+                       }
+                       profileButtonData.top = new FormAttachment(0, 13);
+                       profileButtonData.width = button.getButton().getSize().x;
+                       profileButtonData.height = button.getButton().getSize().y;
+                       button.getButton().setLayoutData(profileButtonData);
+               }
+
+               FormData workerButtonData = new FormData();
+               workerButtonData.right = new FormAttachment(100, -10);
+               workerButtonData.top = new FormAttachment(0, 13);
+               workerButtonData.width = BUTTON_WIDTH;
+               workerButtonData.height = BUTTON_HEIGHT;
+               launchButton.setLayoutData(workerButtonData);
+
+               workerButtonData = new FormData();
+               workerButtonData.right = new FormAttachment(launchButton, -17);
+               workerButtonData.top = new FormAttachment(0, 13);
+               workerButtonData.width = BUTTON_WIDTH;
+               workerButtonData.height = BUTTON_HEIGHT;
+               modifyButton.setLayoutData(workerButtonData);
+
+               workerButtonData = new FormData();
+               workerButtonData.right = new FormAttachment(modifyButton, -5);
+               workerButtonData.top = new FormAttachment(0, 13);
+               workerButtonData.width = BUTTON_WIDTH;
+               workerButtonData.height = BUTTON_HEIGHT;
+               deleteButton.setLayoutData(workerButtonData);
+
+               workerButtonData = new FormData();
+               workerButtonData.right = new FormAttachment(deleteButton, -17);
+               workerButtonData.top = new FormAttachment(0, 13);
+               workerButtonData.width = BUTTON_WIDTH;
+               workerButtonData.height = BUTTON_HEIGHT;
+               exportButton.setLayoutData(workerButtonData);
+
+               workerButtonData = new FormData();
+               workerButtonData.right = new FormAttachment(exportButton, -5);
+               workerButtonData.top = new FormAttachment(0, 13);
+               workerButtonData.width = BUTTON_WIDTH;
+               workerButtonData.height = BUTTON_HEIGHT;
+               resetButton.setLayoutData(workerButtonData);
+
+               workerButtonData = new FormData();
+               workerButtonData.top = new FormAttachment(0, 45);
+               workerButtonData.left = new FormAttachment(0, 10);
+               workerButtonData.right = new FormAttachment(100, -10);
+               workerButtonData.bottom = new FormAttachment(100, -10);
+               table.setLayoutData(workerButtonData);
+       }
+
+       private final SelectionListener tableSelectionListener = new SelectionListener() {
+               @Override
+               public void widgetSelected(SelectionEvent e) {
+                       int count = table.getSelectionCount();
+                       if (count == 0) {
+                               resetButton.setEnabled(false);
+                               exportButton.setEnabled(false);
+                               deleteButton.setEnabled(false);
+                               modifyButton.setEnabled(false);
+                               launchButton.setEnabled(false);
+                       } else if (count == 1) {
+                               VMProperty prop = (VMProperty)table.getSelection()[0].getData();
+                               if (prop.isRunning()) {
+                                       resetButton.setEnabled(false);
+                                       exportButton.setEnabled(false);
+                                       deleteButton.setEnabled(false);
+                                       modifyButton.setEnabled(false);
+                                       launchButton.setEnabled(false);
+                               } else {
+                                       resetButton.setEnabled(true);
+                                       exportButton.setEnabled(true);
+                                       deleteButton.setEnabled(true);
+                                       modifyButton.setEnabled(true);
+                                       launchButton.setEnabled(true);
+                               }
+                       } else {
+                               boolean isRunning = false;
+                               for (TableItem item : table.getSelection()) {
+                                       VMProperty prop = (VMProperty)item.getData();
+                                       if (prop.isRunning()) {
+                                               isRunning = true;
+                                       } else {
+                                               isRunning = false;
+                                       }
+                               }
+                               if (isRunning) {
+                                       resetButton.setEnabled(false);
+                                       exportButton.setEnabled(false);
+                                       deleteButton.setEnabled(false);
+                                       modifyButton.setEnabled(false);
+                                       launchButton.setEnabled(false);
+                               } else {
+                                       resetButton.setEnabled(true);
+                                       exportButton.setEnabled(false);
+                                       deleteButton.setEnabled(true);
+                                       modifyButton.setEnabled(false);
+                                       launchButton.setEnabled(false);
+                               }
+                       }
+               }
+
+               @Override
+               public void widgetDefaultSelected(SelectionEvent e) {
+               }
+       };
+}
diff --git a/src/org/tizen/emulator/manager/ui/renewal/tableviewer/VMListTableViewer.java b/src/org/tizen/emulator/manager/ui/renewal/tableviewer/VMListTableViewer.java
new file mode 100644 (file)
index 0000000..66f98fe
--- /dev/null
@@ -0,0 +1,115 @@
+/*
+ * Emulator Manager
+ *
+ * Copyright (C) 2015 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Contact:
+ * JiHye Kim <jihye424.kim@samsung.com>
+ * Minkee Lee <minkee.lee@samsung.com>
+ * SeokYeon Hwang <syeon.hwang@samsung.com>
+ * Sangho Park <sangho1206.park@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ * Contributors:
+ * - S-Core Co., Ltd
+ *
+ */
+
+package org.tizen.emulator.manager.ui.renewal.tableviewer;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.tizen.emulator.manager.renewal.resources.ImageResources;
+import org.tizen.emulator.manager.ui.widgets.ImageButton;
+
+public class VMListTableViewer extends AbstractTableViewer {
+       Label templateList;
+       Label baseImageList;
+       ImageButton refreshButton;
+
+       VMListTable table;
+       public VMListTableViewer(Shell shell, String key) {
+               super(shell, key);
+       }
+
+       @Override
+       void makeTableComposite() {
+               // TODO: create new vm button
+
+               table = new VMListTable(getTableComp());
+               table.initialize();
+       }
+
+       @Override
+       void showTableComposite() {
+               table.setVMList();
+       }
+
+       @Override
+       void setTitleImage() {
+               setTtileBackgroundImage(ImageResources.VMLIST_TITLE_IMAGE.getImage());
+       }
+
+       @Override
+       void setLinkerMenu() {
+               // add linker
+               templateList = new Label(getTopComp(), SWT.None);
+               templateList.setText("Templates");
+//             templateList.addSelectionListener(new SelectionListener(){
+//
+//                     @Override
+//                     public void widgetDefaultSelected(SelectionEvent arg0) {
+//                             // TODO Auto-generated method stub
+//                     }
+//
+//                     @Override
+//                     public void widgetSelected(SelectionEvent arg0) {
+//                             // TODO Auto-generated method stub
+//                     }
+//             });
+               baseImageList = new Label(getTopComp(), SWT.None);
+               baseImageList.setText("Base Images");
+
+               addLinkMenu(templateList);
+               addLinkMenu(baseImageList);
+
+       }
+
+       @Override
+       void setIconMenu() {
+               refreshButton = new ImageButton(getTopComp(), SWT.PUSH);
+               refreshButton.setImages(ImageResources.BUTTON_REFRESH_NML.getImage(),
+                               ImageResources.BUTTON_REFRESH_HOVER.getImage(),
+                               ImageResources.BUTTON_REFRESH_HOVER.getImage(),
+                               ImageResources.BUTTON_REFRESH_HOVER.getImage());
+
+               refreshButton.addSelectionListener(new SelectionListener() {
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent arg0) {
+                       }
+
+                       @Override
+                       public void widgetSelected(SelectionEvent arg0) {
+                       }
+               });
+
+               addIconMenu(refreshButton);
+       }
+
+}