[SRADA-854][SRADA-862] Add a Save popup window and adjust UX guide on DADialog
authordongkyu6 lee <dongkyu6.lee@samsung.com>
Tue, 5 Jul 2016 07:19:22 +0000 (16:19 +0900)
committerdongkyu6 lee <dongkyu6.lee@samsung.com>
Fri, 8 Jul 2016 02:12:03 +0000 (11:12 +0900)
 - Refactoring DADialog
 - Change icon, size, color on DADialog
 - Add a dailog when there is unsaved data

Change-Id: Iec991ea9f26b00b921f80a7fcd5d8eac63e4081e

20 files changed:
org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/appearance/DesignConstants.java
org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/nl/WidgetLabels.java
org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/nl/WidgetLabels.properties
org.tizen.dynamicanalyzer.appearance/src/org/tizen/dynamicanalyzer/widgets/da/base/DADialog.java
org.tizen.dynamicanalyzer.appearance/theme/flat/img/dialog_error.png
org.tizen.dynamicanalyzer.appearance/theme/flat/img/dialog_warning.png
org.tizen.dynamicanalyzer.workbench/src/org/tizen/dynamicanalyzer/workbench/Application.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/DALogExport.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/UIAction.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/ConfigureLabels.properties
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/Project.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/common/explorer/FileExplorerDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/hierarchy/tree/HierarchyTreeView.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/hierarchy/tree/tool/HierarchyTreeExporter.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/page/MenuBar.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/timeline/dlog/DlogTable.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/opentrace/OpenTraceProgressManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/setting/SettingDialog.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/widgets/FilterDialog.java

index 85e773d..70ceadb 100644 (file)
@@ -45,8 +45,8 @@ public class DesignConstants {
        
        public static final int TABLE_VIEW_HEIGHT = 204;
        
-       public static final int DA_BUTTON_HEIGHT = 28;
-       public static final int DA_BUTTON_WIDTH = 100;
+       public static final int DA_BUTTON_HEIGHT = 24;
+       public static final int DA_BUTTON_WIDTH = 86;
        public static final int DA_BUTTON_TOP = 11;
        
        public static final int COMBO_ARROW_HEIGHT = 24;
index fe25951..77b6607 100644 (file)
@@ -44,11 +44,17 @@ public class WidgetLabels extends NLS {
        
        public static String YES;
        public static String NO;
+       
+       public static String SAVE;
+       public static String DISCARD;
 
        public static String OPEN;
        public static String CLOSE;
 
        public static String DA_WARNING;
+       
+       public static String EXPORT_LOGS;
+       public static String TITLE;
 
        static {
                NLS.initializeMessages(BUNDLE_NAME, WidgetLabels.class);
index 0716f7d..2418973 100644 (file)
@@ -1,3 +1,5 @@
+TITLE=Dynamic Analyzer
+
 ON=On
 OFF=Off
 
@@ -13,7 +15,11 @@ NEXT=Next
 YES=Yes
 NO=No
 
+SAVE=Save
+DISCARD=Discard
+
 OPEN=Open
 CLOSE=Close
 
 DA_WARNING=Warning
+EXPORT_LOGS=Export Logs
\ No newline at end of file
index 17fb67e..961a902 100644 (file)
 package org.tizen.dynamicanalyzer.widgets.da.base;
 
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
 import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
 import org.eclipse.swt.layout.FormAttachment;
 import org.eclipse.swt.layout.FormData;
 import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Label;
@@ -43,149 +43,315 @@ import org.tizen.dynamicanalyzer.nl.WidgetLabels;
 import org.tizen.dynamicanalyzer.resources.ColorResources;
 import org.tizen.dynamicanalyzer.resources.FontResources;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
-import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
 
 public class DADialog {
 
+       public static enum DIALOGTYPE {
+               ERROR_WITH_EXPORT,
+               ERROR,
+               SAVE,
+               YES_NO
+       }
+       private final int gapwithbuttons = -8;
+       private final int wideWidth = 480;
+       private final int miniWidth = 320;
+       private final int defaultHeifght = 220;
+       private final int button_top = 18;
+       
        private Shell parent = null;
        private Shell shell = null;
-       private DACustomButton okButton = null;
-       private DACustomButton exportButton = null;
+       private Button okButton = null;
+       private Button exportButton = null;
+       private Button yesButton = null;
+       private Button noButton = null;
+       private Button saveButton = null;
+       private Button discardButton = null;
        private String message = null;
        private boolean returnType = false;
-       private String titleText = WidgetLabels.DA_WARNING;
-       private final int defaultWidth = 446;
-       private final int defaultHeifght = 153;
+       private String titleText = WidgetLabels.TITLE;
        private int width = 0;
        private int height = 0;
        private Image iconImage = ImageResources.DYNANMIC_ANALYZER_ICON;
+       private DIALOGTYPE dialogtype = DIALOGTYPE.ERROR;
 
-       private DACustomButtonClickEventListener okButtonListener = new DACustomButtonClickEventListener() {
-               @Override
-               public void handleClickEvent(DACustomButton button) {
-                       returnType = true;
-                       shell.dispose();
-               }
-       };
-       
-       public DADialog(Shell parent, int style) {
-               this.width = this.defaultWidth;
-               this.height = this.defaultHeifght;
+       public DADialog(Shell parent, DIALOGTYPE type, int style, int width, int height) {
+               this.width = width;
+               this.height = height;
                this.parent = parent;
+               this.dialogtype = type;
        }
 
-       public DADialog(Shell parent, int style, int width, int height) {
-               this(parent, style);
-               this.width = width;
-               this.height = height;
+       public DADialog(Shell parent, DIALOGTYPE type, int style) {
+               this.parent = parent;
+               this.dialogtype = type;
+               this.width = this.wideWidth;
+               this.height = this.defaultHeifght;
+               
+               if(type == DIALOGTYPE.SAVE || type == DIALOGTYPE.YES_NO) {
+                       this.width = this.miniWidth;
+               }
        }
-       
-       public boolean setDialog(boolean isExport) {
+
+       public boolean setDialog() {
+               returnType = false;
+
                shell = new Shell(parent, SWT.APPLICATION_MODAL | SWT.DIALOG_TRIM);
-               int dialogLocationX = shell.getParent().getLocation().x + (shell.getParent().getSize().x - this.width)/2;
-               int dialogLocationY = shell.getParent().getLocation().y + (shell.getParent().getSize().y - this.height)/2;
+               int dialogLocationX = shell.getParent().getLocation().x + (shell.getParent().getSize().x - this.width) / 2;
+               int dialogLocationY = shell.getParent().getLocation().y + (shell.getParent().getSize().y - this.height) / 2;
                shell.setLocation(dialogLocationX, dialogLocationY);
                shell.setSize(width, height);
                shell.setLayout(new FormLayout());
                shell.setText(titleText);
+               shell.setBackground(ColorResources.DIALOG_TOP_LINE_COLOR);
 
                // Base composite
                Composite base = new Composite(shell, SWT.NONE);
                base.setLayout(new FormLayout());
-               FormData baseData = new FormData();
-               baseData.top = new FormAttachment(0, 0);
-               baseData.left = new FormAttachment(0, 0);
-               baseData.right = new FormAttachment(100, 0);
-               baseData.height = 76;
-               base.setLayoutData(baseData);
-               base.setVisible(true);
-               base.setBackground(ColorResources.DIALOG_BG_UPPER);
+               FormData formData = new FormData();
+               formData.top = new FormAttachment(0, 1);
+               formData.left = new FormAttachment(0, 0);
+               formData.right = new FormAttachment(100, 0);
+               formData.height = 128;
+               base.setLayoutData(formData);
+               base.setBackground(ColorResources.WHITE);
 
                // Icon
                Label icon = new Label(base, SWT.TRANSPARENT);
-               icon.setBackground(ColorResources.DIALOG_BG_UPPER);
+               icon.setBackground(ColorResources.WHITE);
                icon.setImage(iconImage);
 
+               formData = new FormData();
+               formData.top = new FormAttachment(0, 50);
+               formData.left = new FormAttachment(0, 35);
+               formData.height = 28;
+               formData.width = 28;
+               icon.setLayoutData(formData);
+
                // Contents
-               Label strMessage = new Label(base, SWT.TRANSPARENT | SWT.WRAP);
-               strMessage.setText(message);
-               strMessage.setBackground(ColorResources.DIALOG_BG_UPPER);
-               strMessage.setAlignment(SWT.LEFT);
-               strMessage.setForeground(ColorResources.DEFAULT_FONT_COLOR);
-               strMessage.setFont(FontResources.ABOUT_TEXT);
-
-               FormData labelData = new FormData();
-               labelData.left = new FormAttachment(0, 15);
-               labelData.top = new FormAttachment(0, 6);
-               labelData.height = 64;
-               labelData.width = 64;
-               icon.setLayoutData(labelData);
-
-               labelData = new FormData();
-               labelData.left = new FormAttachment(0, 90);
-               labelData.right = new FormAttachment(95, 0);
-               labelData.top = new FormAttachment(0, 17);
-               labelData.height = 50;
-               strMessage.setLayoutData(labelData);
+               if(message.contains("\n")) {
+                       Label boldMessage = new Label(base, SWT.TRANSPARENT | SWT.WRAP);
+                       boldMessage.setText(message.substring(0, message.indexOf("\n")));
+                       boldMessage.setBackground(ColorResources.WHITE);
+                       boldMessage.setAlignment(SWT.LEFT);
+                       boldMessage.setForeground(ColorResources.DIALOG_TEXT_FONT_COLOR);
+                       boldMessage.setFont(FontResources.DIALOG_CONTENTS_BOLD_FONT);
+
+                       formData = new FormData();
+                       formData.top = new FormAttachment(0, 45);
+                       formData.height = 20;
+                       formData.left = new FormAttachment(icon, 15);
+                       formData.right = new FormAttachment(95, 0);
+                       boldMessage.setLayoutData(formData);
+                       
+                       Label normalMessage = new Label(base, SWT.TRANSPARENT | SWT.WRAP);
+                       normalMessage.setText(message.substring(message.indexOf("\n") + 1));
+                       normalMessage.setBackground(ColorResources.WHITE);
+                       normalMessage.setAlignment(SWT.LEFT);
+                       normalMessage.setForeground(ColorResources.DIALOG_TEXT_FONT_COLOR);
+                       normalMessage.setFont(FontResources.DIALOG_CONTENTS_NORMAL_FONT);
+
+                       formData = new FormData();
+                       formData.top = new FormAttachment(boldMessage, 1);
+                       formData.bottom = new FormAttachment(100, 0);
+                       formData.left = new FormAttachment(icon, 15);
+                       formData.right = new FormAttachment(95, 0);
+                       normalMessage.setLayoutData(formData);
+               }
+               else {
+                       Label strMessage = new Label(base, SWT.TRANSPARENT | SWT.WRAP);
+                       strMessage.setText(message);
+                       strMessage.setBackground(ColorResources.WHITE);
+                       strMessage.setAlignment(SWT.LEFT);
+                       strMessage.setForeground(ColorResources.DIALOG_CONTENT_BACKGROUND);
+                       strMessage.setFont(FontResources.DIALOG_CONTENTS_NORMAL_FONT);
+
+                       formData = new FormData();
+                       formData.top = new FormAttachment(0, 50 + 5);
+                       formData.bottom = new FormAttachment(100, 0);
+                       formData.left = new FormAttachment(icon, 15);
+                       formData.right = new FormAttachment(95, 0);
+                       strMessage.setLayoutData(formData);
+               }
+
+               // middle line composite
+               Composite middlLinebase = new Composite(shell, SWT.NONE);
+               middlLinebase.setLayout(new FormLayout());
+               formData = new FormData();
+               formData.top = new FormAttachment(base, 0);
+               formData.left = new FormAttachment(0, 0);
+               formData.right = new FormAttachment(100, 0);
+               formData.height = 1;
+               middlLinebase.setLayoutData(formData);
+               middlLinebase.setBackground(ColorResources.DIALOG_MIDDLE_LINE_COLOR);
 
                // Button composite
                Composite buttonComp = new Composite(shell, SWT.NONE);
-               FormLayout compLayout = new FormLayout();
-               buttonComp.setLayout(compLayout);
-               buttonComp.setBackground(ColorResources.DIALOG_BG_LOWER);
+               buttonComp.setLayout(new FormLayout());
+               buttonComp.setBackground(ColorResources.DIALOG_BUTTON_BACKGROUND);
+
+               formData = new FormData();
+               formData.top = new FormAttachment(middlLinebase, 0);
+               formData.left = new FormAttachment(0, 0);
+               formData.right = new FormAttachment(100, 0);
+               formData.bottom = new FormAttachment(100, 0);
+               buttonComp.setLayoutData(formData);
+
+               if (dialogtype == DIALOGTYPE.ERROR_WITH_EXPORT) {
+                       addOKButton(buttonComp);
+                       addExportButton(buttonComp);
+               } else if (dialogtype == DIALOGTYPE.ERROR) {
+                       addOKButton(buttonComp);
+               } else if (dialogtype == DIALOGTYPE.YES_NO) {
+                       addYesNoButton(buttonComp);
+               } else if (dialogtype == DIALOGTYPE.SAVE) {
+                       addSaveButton(buttonComp);
+               }
 
-               buttonComp.addPaintListener(new PaintListener() {
+               return returnType;
+       }
+
+       private void addOKButton(Composite buttonComp) {
+               // OK button
+               okButton = new Button(buttonComp, SWT.NONE);
+               okButton.addSelectionListener(new SelectionListener() {
 
                        @Override
-                       public void paintControl(PaintEvent e) {
-                               Composite comp = (Composite) e.widget;
-                               Rectangle rect = comp.getClientArea();
-                               e.gc.setForeground(ColorResources.DIALOG_SUNKEN_1);
-                               e.gc.drawLine(rect.x, rect.y, rect.x + rect.width, rect.y);
-                               e.gc.setForeground(ColorResources.DIALOG_SUNKEN_2);
-                               e.gc.drawLine(rect.x, rect.y + 1, rect.x + rect.width,
-                                               rect.y + 1);
+                       public void widgetSelected(SelectionEvent e) {
+                               returnType = true;
+                               shell.dispose();
                        }
-               });
 
-               FormData compData = new FormData();
-               compData.top = new FormAttachment(base, 0);
-               compData.left = new FormAttachment(0, 0);
-               compData.right = new FormAttachment(100, 0);
-               compData.bottom = new FormAttachment(100, 0);
-               buttonComp.setLayoutData(compData);
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {
 
-               // OK button
-               okButton = new DAButton(buttonComp, SWT.NONE);
-               okButton.addClickListener(okButtonListener);
+                       }
+               });
+               okButton.setFont(FontResources.DIALOG_BUTTON_FONT);
                okButton.setText(WidgetLabels.OK);
-               okButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
 
                FormData okData = new FormData();
-               okData.top = new FormAttachment(0, 11);
-               okData.right = new FormAttachment(100, -9);
+               okData.top = new FormAttachment(0, button_top);
+               okData.right = new FormAttachment(100, -20);
                okData.width = DesignConstants.DA_BUTTON_WIDTH;
                okData.height = DesignConstants.DA_BUTTON_HEIGHT;
                okButton.setLayoutData(okData);
+       }
+
+       private void addExportButton(Composite buttonComp) {
+               exportButton = new Button(buttonComp, SWT.NONE);
+               exportButton.setText(WidgetLabels.EXPORT_LOGS);
+
+               FormData exportData = new FormData();
+               exportData.top = new FormAttachment(0, button_top);
+               exportData.left = new FormAttachment(0, 20);
+               exportData.width = DesignConstants.DA_BUTTON_WIDTH;
+               exportData.height = DesignConstants.DA_BUTTON_HEIGHT;
+               exportButton.setLayoutData(exportData);
+       }
+       
+       private void addYesNoButton(Composite buttonComp) {
+               noButton = new Button(buttonComp, SWT.NONE);
+               noButton.setFont(FontResources.DIALOG_BUTTON_FONT);
+               noButton.addSelectionListener(new SelectionListener() {
+
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               returnType = false;
+                               shell.dispose();
+                       }
+
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {
+
+                       }
+               });
+               noButton.setText(WidgetLabels.NO);
+
+               FormData fromdata = new FormData();
+               fromdata.top = new FormAttachment(0, button_top);
+               fromdata.right = new FormAttachment(100, 20);
+               fromdata.width = DesignConstants.DA_BUTTON_WIDTH;
+               fromdata.height = DesignConstants.DA_BUTTON_HEIGHT;
+               noButton.setLayoutData(fromdata);
                
-               // Export button
-               if(isExport){
-                       exportButton = new DAButton(buttonComp, SWT.NONE);
-                       exportButton.setText("ExportLogs");
-                       exportButton.setButtonFont(FontResources.DIALOG_BUTTON_FONT);
-                       
-                       FormData exportData = new FormData();
-                       exportData.top = new FormAttachment(0, 11);
-                       exportData.right = new FormAttachment(okButton,-220, SWT.LEFT);
-                       exportData.width = DesignConstants.DA_BUTTON_WIDTH;
-                       exportData.height = DesignConstants.DA_BUTTON_HEIGHT;
-                       exportButton.setLayoutData(exportData);
-               }
-               return returnType;
+               yesButton = new Button(buttonComp, SWT.NONE);
+               yesButton.setFont(FontResources.DIALOG_BUTTON_FONT);
+               yesButton.addSelectionListener(new SelectionListener() {
+
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               returnType = true;
+                               shell.dispose();
+                       }
+
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {
+
+                       }
+               });
+               yesButton.setText(WidgetLabels.YES);
+
+               fromdata = new FormData();
+               fromdata.top = new FormAttachment(0, button_top);
+               fromdata.right = new FormAttachment(noButton, gapwithbuttons);
+               fromdata.width = DesignConstants.DA_BUTTON_WIDTH;
+               fromdata.height = DesignConstants.DA_BUTTON_HEIGHT;
+               yesButton.setLayoutData(fromdata);
+               yesButton.setFocus();
        }
        
-       public void open(){
+       private void addSaveButton(Composite buttonComp) {
+               discardButton = new Button(buttonComp, SWT.NONE);
+               discardButton.setFont(FontResources.DIALOG_BUTTON_FONT);
+               discardButton.addSelectionListener(new SelectionListener() {
+
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               returnType = true;
+                               shell.dispose();
+                       }
+
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {
+
+                       }
+               });
+               discardButton.setText(WidgetLabels.DISCARD);
+
+               FormData fromdata = new FormData();
+               fromdata.top = new FormAttachment(0, button_top);
+               fromdata.right = new FormAttachment(100, -20);
+               fromdata.width = DesignConstants.DA_BUTTON_WIDTH;
+               fromdata.height = DesignConstants.DA_BUTTON_HEIGHT;
+               discardButton.setLayoutData(fromdata);
+               
+               saveButton = new Button(buttonComp, SWT.NONE);
+               saveButton.setFont(FontResources.DIALOG_BUTTON_FONT);
+               saveButton.addSelectionListener(new SelectionListener() {
+
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+                               returnType = true;
+                       }
+
+                       @Override
+                       public void widgetDefaultSelected(SelectionEvent e) {
+
+                       }
+               });
+               saveButton.setText(WidgetLabels.SAVE);
+
+               fromdata = new FormData();
+               fromdata.top = new FormAttachment(0, button_top);
+               fromdata.right = new FormAttachment(discardButton, gapwithbuttons);
+               fromdata.width = DesignConstants.DA_BUTTON_WIDTH;
+               fromdata.height = DesignConstants.DA_BUTTON_HEIGHT;
+               saveButton.setLayoutData(fromdata);
+               
+               saveButton.setFocus();
+       }
+
+       public void open() {
                shell.open();
 
                Display display = Display.getCurrent();
@@ -198,7 +364,7 @@ public class DADialog {
 
                shell.dispose();
        }
-       
+
        public void setMessage(String msg) {
                message = msg;
        }
@@ -211,7 +377,15 @@ public class DADialog {
                titleText = title;
        }
        
-       public DACustomButton getExportButton(){
+       public boolean getResult() {
+               return this.returnType;
+       }
+
+       public Button getExportButton() {
                return exportButton;
        }
+       
+       public Button getSaveButton() {
+               return saveButton;
+       }
 }
index 74c5096..0977ff4 100644 (file)
Binary files a/org.tizen.dynamicanalyzer.appearance/theme/flat/img/dialog_error.png and b/org.tizen.dynamicanalyzer.appearance/theme/flat/img/dialog_error.png differ
index d649383..d317f5e 100644 (file)
Binary files a/org.tizen.dynamicanalyzer.appearance/theme/flat/img/dialog_warning.png and b/org.tizen.dynamicanalyzer.appearance/theme/flat/img/dialog_warning.png differ
index 796ac91..38ebf18 100644 (file)
@@ -83,11 +83,11 @@ private Display m_display;
                // check for tizen sdk installation
                boolean pathValidness = PathManager.checkTizenPathValidation();
                if (pathValidness == false) {
-                       DADialog dialog = new DADialog(new Shell(m_display), SWT.NONE);
+                       DADialog dialog = new DADialog(new Shell(m_display), DADialog.DIALOGTYPE.ERROR, SWT.NONE);
                        dialog.setTitleText(WorkbenchLabels.TIZEN_SDK_PATH_ERROR_TITLE);
                        dialog.setMessage(WorkbenchLabels.TIZEN_SDK_PATH_ERROR);
                        dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
-                       dialog.setDialog(false);
+                       dialog.setDialog();
                        dialog.open();
                        return IApplication.EXIT_OK;
                }
index d70421b..a0c92e3 100644 (file)
@@ -15,6 +15,7 @@ import java.util.zip.ZipOutputStream;
 
 import org.tizen.dynamicanalyzer.common.path.PathManager;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
+import org.tizen.dynamicanalyzer.nl.ConfigureLabels;
 import org.tizen.dynamicanalyzer.ui.common.explorer.FileExplorerDialog;
 import org.tizen.dynamicanalyzer.util.CommonUtil;
 import org.tizen.dynamicanalyzer.util.Logger;
@@ -25,107 +26,110 @@ public class DALogExport {
        private String LogexportPath;
        private String LogZipPath;
        private String ExportLogName;
-       
+
        public DALogExport() {
 
                Boolean result = false;
 
                result = exportPathDialog();
                if (result != true) {
-                       Logger.info("selected export path is wrong");
+                       Logger.debug("selected export path is wrong");
+                       return;
                }
                result = exportDALog();
                if (result != true) {
-                       Logger.info("export DAConsoleLog failed");
+                       Logger.debug("export DAConsoleLog failed");
                }
                result = exportDaemonLog();
                if (result != true) {
-                       Logger.info("export DaemonLog failed");
+                       Logger.debug("export DaemonLog failed");
                }
                result = exportDataLog();
                if (result != true) {
-                       Logger.info("export DataLog failed");
+                       Logger.debug("export DataLog failed");
                }
                result = exportControlLog();
                if (result != true) {
-                       Logger.info("export ControlLog failed");
+                       Logger.debug("export ControlLog failed");
                }
                result = compressLogs();
                if (result != true) {
-                       Logger.info("compress Logs failed");
+                       Logger.debug("compress Logs failed");
                }
                result = removeTemp();
                if (result != true) {
-               Logger.info("remove temp failed");
+                       Logger.debug("remove temp failed");
                }
        }
-       
+
        /// User Select Directory to export Logs
-       public Boolean exportPathDialog(){              
+       private Boolean exportPathDialog() {
                FileExplorerDialog dialog = new FileExplorerDialog(WorkbenchUtil.getWorkbenchWindow().getShell());
-               dialog.setTitle("Select export path");
+               dialog.setTitle(ConfigureLabels.EXPORT_DIALOG_SELECT_EXPORT_PATH);
                dialog.getExplorer().setRoot(CommonUtil.getHomeDirectory());
                Object result = dialog.open();
-               LogexportPath = result.toString();
-               
-               if(LogexportPath==null){
+
+               if (result == null) {
                        return false;
                }
-               
+
+               if (result instanceof Boolean) {
+                       if ((Boolean) result == false) {
+                               return false;
+                       }
+               }
+
+               LogexportPath = result.toString();
+
                int cutStart = LogexportPath.indexOf("[");
                int cutEnd = LogexportPath.indexOf("]");
-               String tmpPath = LogexportPath.substring(cutStart+1, cutEnd);
-               
-               SimpleDateFormat format = new SimpleDateFormat(
-                               "yyyy_MM_dd_HH-mm-ss", Locale.KOREA); //$NON-NLS-1$
+               String tmpPath = LogexportPath.substring(cutStart + 1, cutEnd);
+
+               SimpleDateFormat format = new SimpleDateFormat("yyyy_MM_dd_HH-mm-ss", Locale.KOREA); //$NON-NLS-1$
                Date date = new Date();
                String logPostFix = format.format(date);
-               ExportLogName = "DALogs_"+ logPostFix;
+               ExportLogName = "DALogs_" + logPostFix;
                LogZipPath = tmpPath;
-               LogexportPath = tmpPath+"/"+ExportLogName;
-               
+
+               setLogExportPath(tmpPath + "/" + ExportLogName);
+
                return true;
        }
-       
+
        // / set LogExportPath
-       public void setLogExportPath(String path) {
+       private void setLogExportPath(String path) {
                LogexportPath = path;
        }
 
-       // / get LogExportPath
-       public String getLogExportPath(String path) {
-               return LogexportPath;
-       }
-
        // / Export DA Log
-       public Boolean exportDALog() {
+       private Boolean exportDALog() {
                File src = getLastDALog(PathManager.DA_LOG_PATH);
                File dirCheck = new File(LogexportPath);
                File dest = new File(LogexportPath + "/" + "da_console.log");
-               
-               if(!checkDirectory(dirCheck)){
+
+               if (!checkDirectory(dirCheck)) {
                        return false;
                }
-               
-               if(!copyLogFile(src, dest)){
+
+               if (!copyLogFile(src, dest)) {
                        return false;
                }
-               
+
                return true;
        }
 
        // / Export Daemon Log
-       public Boolean exportDaemonLog() {
+       private Boolean exportDaemonLog() {
                DACommunicator.exportCustomPathDaemonLog(LogexportPath);
                return true;
        }
 
        // / Export DATA Log
-       public Boolean exportDataLog() {
+       private Boolean exportDataLog() {
                File src = new File(PathManager.DA_DEBUG_DATA_CHANNEL_LOG_FILE);
                File dest = new File(LogexportPath + "/" + "da_data.log");
 
-               if(!copyLogFile(src, dest)){
+               if (!copyLogFile(src, dest)) {
                        return false;
                }
 
@@ -133,18 +137,18 @@ public class DALogExport {
        }
 
        // / Export Control Log
-       public Boolean exportControlLog() {
+       private Boolean exportControlLog() {
                File src = new File(PathManager.DA_DEBUG_CONTROL_CHANNEL_LOG_FILE);
                File dest = new File(LogexportPath + "/" + "da_control.log");
 
-               if(!copyLogFile(src, dest)){
+               if (!copyLogFile(src, dest)) {
                        return false;
                }
 
                return true;
        }
 
-       private Boolean copyLogFile(File source, File dest){
+       private Boolean copyLogFile(File source, File dest) {
 
                InputStream input = null;
                OutputStream output = null;
@@ -160,12 +164,10 @@ public class DALogExport {
                                output.write(buf, 0, bytesRead);
                        }
 
-               } 
-               catch(IOException e){
+               } catch (IOException e) {
                        e.printStackTrace();
                        return false;
-               }
-               finally {
+               } finally {
                        try {
                                if (input != null) {
                                        input.close();
@@ -178,11 +180,11 @@ public class DALogExport {
                                e.printStackTrace();
                                return false;
                        }
-               }               
+               }
                return true;
        }
 
-       public File getLastDALog(String dir) {
+       private File getLastDALog(String dir) {
                File fl = new File(dir);
                File[] files = fl.listFiles(new FileFilter() {
                        public boolean accept(File file) {
@@ -203,12 +205,12 @@ public class DALogExport {
        }
 
        /// CompressLogs
-       public Boolean compressLogs(){
+       private Boolean compressLogs() {
                ZipOutputStream zip = null;
                FileOutputStream fileWriter = null;
                String srcFolder = LogexportPath;
                String destZipFile = LogZipPath + "/" + ExportLogName + ".zip";
-               
+
                try {
                        fileWriter = new FileOutputStream(destZipFile);
                        zip = new ZipOutputStream(fileWriter);
@@ -218,8 +220,8 @@ public class DALogExport {
                        e.printStackTrace();
                        return false;
                }
-               
-               if(zip!=null){
+
+               if (zip != null) {
                        try {
                                zip.flush();
                                zip.close();
@@ -228,59 +230,59 @@ public class DALogExport {
                                e.printStackTrace();
                        }
                }
-                               
+
                return true;
        }
 
        /// Make zip from file.
-       private void addFileToZip(String path, String srcFile,ZipOutputStream zip){
+       private void addFileToZip(String path, String srcFile, ZipOutputStream zip) {
                File folder = new File(srcFile);
 
                if (folder.isDirectory()) {
                        addFolderToZip(path, srcFile, zip);
-               } else {                                
-                               byte[] buf = new byte[1024];
-                               int len;
-                               FileInputStream in;                             
-                               try {
-                                       in = new FileInputStream(srcFile);
-                                       zip.putNextEntry(new ZipEntry(path + "/" + folder.getName()));
-                                       while ((len = in.read(buf)) > 0) {
-                                               zip.write(buf, 0, len);
-                                       }                                       
-                               } catch (IOException e) {
-                                       // TODO Auto-generated catch block
-                                       e.printStackTrace();
+               } else {
+                       byte[] buf = new byte[1024];
+                       int len;
+                       FileInputStream in;
+                       try {
+                               in = new FileInputStream(srcFile);
+                               zip.putNextEntry(new ZipEntry(path + "/" + folder.getName()));
+                               while ((len = in.read(buf)) > 0) {
+                                       zip.write(buf, 0, len);
                                }
+                       } catch (IOException e) {
+                               // TODO Auto-generated catch block
+                               e.printStackTrace();
+                       }
                }
-               
+
        }
 
        /// Compress Files in folder
-       private void addFolderToZip(String path, String srcFolder,ZipOutputStream zip){
+       private void addFolderToZip(String path, String srcFolder, ZipOutputStream zip) {
                File folder = new File(srcFolder);
                for (String fileName : folder.list()) {
-                               addFileToZip(folder.getName(), srcFolder + "/" + fileName, zip);
+                       addFileToZip(folder.getName(), srcFolder + "/" + fileName, zip);
                }
        }
-       
-       private boolean checkDirectory(File file){
+
+       private boolean checkDirectory(File file) {
                if (!file.exists()) {
-                       if(!file.mkdirs()){
+                       if (!file.mkdirs()) {
                                return false;
                        }
                } else {
                        File[] destroy = file.listFiles();
                        for (File des : destroy) {
-                               if(!des.delete()){
+                               if (!des.delete()) {
                                        return false;
                                }
                        }
                }
                return true;
        }
-       
-       private boolean removeTemp(){
+
+       private boolean removeTemp() {
                File file = new File(LogexportPath);
                checkDirectory(file);
                file.delete();
index f75bdbc..a322428 100644 (file)
@@ -33,12 +33,14 @@ import java.util.List;
 import java.util.Set;
 
 import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
 import org.tizen.dynamicanalyzer.common.DALogExport;
 import org.tizen.dynamicanalyzer.common.DAResult;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.nl.SummaryLabels;
 import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.setting.SettingConstants;
 import org.tizen.dynamicanalyzer.setting.SettingDataManager;
@@ -54,7 +56,6 @@ import org.tizen.dynamicanalyzer.ui.network.NetworkPage;
 import org.tizen.dynamicanalyzer.ui.opengl.GLPage;
 import org.tizen.dynamicanalyzer.ui.page.BaseView;
 import org.tizen.dynamicanalyzer.ui.summary.SummaryPage;
-import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakView;
 import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfilingView;
 import org.tizen.dynamicanalyzer.ui.thread.ThreadPage;
 import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
@@ -65,8 +66,6 @@ import org.tizen.dynamicanalyzer.ui.userinterface.UIPage;
 import org.tizen.dynamicanalyzer.util.Logger;
 import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
-import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
-import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
 import org.tizen.dynamicanalyzer.widgets.da.base.DADialog;
 import org.tizen.dynamicanalyzer.widgets.da.view.DATabComposite;
 
@@ -126,11 +125,11 @@ public class UIAction {
                        @Override
                        public void run() {
                                Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
-                               DADialog dialog = new DADialog(shell, SWT.NONE, width, height);
-                               dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
+                               DADialog dialog = new DADialog(shell, DADialog.DIALOGTYPE.ERROR_WITH_EXPORT, SWT.NONE, width, height);
+                               dialog.setIcon(ImageResources.DIALOG_ERROR_ICON);
                                dialog.setMessage(message);
-                               dialog.setDialog(true);
-                               dialog.getExportButton().addClickListener(exportListener);
+                               dialog.setDialog();
+                               dialog.getExportButton().addSelectionListener(exportButtonListener);
                                dialog.open();
                        }
                });
@@ -145,25 +144,11 @@ public class UIAction {
                        @Override
                        public void run() {
                                Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
-                               DADialog dialog = new DADialog(shell, SWT.NONE);
-                               dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
+                               DADialog dialog = new DADialog(shell, DADialog.DIALOGTYPE.ERROR_WITH_EXPORT, SWT.NONE);
+                               dialog.setIcon(ImageResources.DIALOG_ERROR_ICON);
                                dialog.setMessage(message);                             
-                               dialog.setDialog(true);
-                               dialog.getExportButton().addClickListener(exportListener);
-                               dialog.open();
-                       }
-               });
-       }
-
-       public static void showWarning(final String title, final String message) {
-               Display.getDefault().asyncExec(new Runnable() {
-                       @Override
-                       public void run() {
-                               Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
-                               DADialog dialog = new DADialog(shell, SWT.NONE);
-                               dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
-                               dialog.setTitleText(title);
-                               dialog.setMessage(message);
+                               dialog.setDialog();
+                               dialog.getExportButton().addSelectionListener(exportButtonListener);
                                dialog.open();
                        }
                });
@@ -178,11 +163,11 @@ public class UIAction {
                Display.getDefault().asyncExec(new Runnable() {
                        @Override
                        public void run() {
-                               DADialog dialog = new DADialog(shell, SWT.NONE);
-                               dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
+                               DADialog dialog = new DADialog(shell, DADialog.DIALOGTYPE.ERROR_WITH_EXPORT, SWT.NONE);
+                               dialog.setIcon(ImageResources.DIALOG_ERROR_ICON);
                                dialog.setMessage(message);
-                               dialog.setDialog(true);
-                               dialog.getExportButton().addClickListener(exportListener);
+                               dialog.setDialog();
+                               dialog.getExportButton().addSelectionListener(exportButtonListener);
                                dialog.open();
                        }
                });
@@ -302,10 +287,19 @@ public class UIAction {
                });
        }
        
-       private static DACustomButtonClickEventListener exportListener = new DACustomButtonClickEventListener() {
+       private static SelectionListener exportButtonListener = new SelectionListener() {
+
+               @Override
+               public void widgetSelected(SelectionEvent e) {
+                       new DALogExport();
+                       if(e.getSource() != null && e.getSource() instanceof Button) {
+                               ((Button)e.getSource()).getParent().getParent().dispose();
+                       }
+               }
+
                @Override
-               public void handleClickEvent(DACustomButton button) {
-                       DALogExport export = new DALogExport();
+               public void widgetDefaultSelected(SelectionEvent e) {
                }
+               
        };
 }
index ec9dd11..b8ec459 100644 (file)
@@ -244,6 +244,8 @@ public class ConfigureLabels extends NLS {
        public static String FEATURE_OVERHEAD_RANKING_MIDDLE;
        public static String FEATURE_OVERHEAD_RANKING_HIGH;
        public static String FEATURE_OVERHEAD_RANKING_INPUT_VALUE;
+       
+       public static String EXPORT_DIALOG_SELECT_EXPORT_PATH;
 
        static {
                NLS.initializeMessages(BUNDLE_NAME, ConfigureLabels.class);
index f4d032c..9b81c72 100644 (file)
@@ -213,3 +213,5 @@ FEATURE_OVERHEAD_RANKING_NORMAL=Overhead level: Normal
 FEATURE_OVERHEAD_RANKING_MIDDLE=Overhead level: Middle
 FEATURE_OVERHEAD_RANKING_HIGH=Overhead level: High
 FEATURE_OVERHEAD_RANKING_INPUT_VALUE=The feature overhead may occur depending on the input value
+
+EXPORT_DIALOG_SELECT_EXPORT_PATH=Select export path
index 6d97d70..02efa6d 100644 (file)
@@ -157,7 +157,9 @@ public class Project {
        
        private boolean availableMemps = false;
        private String daStartTime = "";
-       private boolean isSavedData = false;
+
+       private boolean isLoadedData = false;
+       private boolean isSaved = false;
 
        static {
                // register DB table
@@ -1223,11 +1225,19 @@ public class Project {
                return this.daStartTime;
        }
        
-       public void setSavedProject (boolean save) {
-               this.isSavedData = save;
+       public void setSavedData(boolean saved) {
+               this.isSaved = saved;
+       }
+       
+       public boolean getIsSavedData() {
+               return this.isSaved;
+       }
+       
+       public void setLoadedProject (boolean save) {
+               this.isLoadedData = save;
        }
        
-       public boolean isSaveProject() {
-               return this.isSavedData;
+       public boolean isLoadedProject() {
+               return this.isLoadedData;
        }
 }
index 46895e7..e659ae1 100644 (file)
@@ -128,6 +128,7 @@ public class FileExplorerDialog extends DAMessageBox {
 
                        @Override
                        public void handleClickEvent(DACustomButton button) {
+                               result = (Boolean)false;
                                shell.dispose();
                        }
                });
index 50646d5..fa90c8f 100755 (executable)
@@ -131,10 +131,10 @@ public class HierarchyTreeView extends DAViewComposite {
                                        restructTree();
                                } else {
                                        Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
-                                       DADialog dialog = new DADialog(shell, SWT.NONE);
+                                       DADialog dialog = new DADialog(shell, DADialog.DIALOGTYPE.ERROR, SWT.NONE);
                                        dialog.setIcon(ImageResources.DIALOG_ERROR_ICON);
                                        dialog.setMessage(UIHierarchyPageLabels.UIHIERARCHY_DIALOG_ERROR_GET_HIERARCHY);
-                                       dialog.setDialog(false);
+                                       dialog.setDialog();
                                        dialog.open();
                                }
                        }
index daaf189..8f1db57 100755 (executable)
@@ -106,11 +106,11 @@ public class HierarchyTreeExporter {
 
        private static void showErrorDialog() {
                Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
-               DADialog dialog = new DADialog(shell, SWT.NONE);
+               DADialog dialog = new DADialog(shell, DADialog.DIALOGTYPE.ERROR, SWT.NONE);
                dialog.setTitleText(UIHierarchyPageLabels.UIHIERARCHY_EXPORT_DIALOG_TITLE);
                dialog.setMessage(UIHierarchyPageLabels.UIHIERARCHY_EXPORT_DIALOG_ERROR_MESSAGE);
                dialog.setIcon(ImageResources.DIALOG_ERROR_ICON);
-               dialog.setDialog(false);
+               dialog.setDialog();
                dialog.open();
        }
 
index ed0513b..5b7fb77 100644 (file)
@@ -30,6 +30,7 @@ import java.util.ArrayList;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.events.SelectionEvent;
 import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.FileDialog;
 import org.eclipse.swt.widgets.Menu;
@@ -46,6 +47,7 @@ import org.tizen.dynamicanalyzer.handlers.UIAction;
 import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
 import org.tizen.dynamicanalyzer.nl.MenuBarLabels;
 import org.tizen.dynamicanalyzer.project.Project;
+import org.tizen.dynamicanalyzer.resources.ImageResources;
 import org.tizen.dynamicanalyzer.setting.SettingDataManager;
 import org.tizen.dynamicanalyzer.swap.logparser.DataManagerRegistry;
 import org.tizen.dynamicanalyzer.ui.file.FileChartView;
@@ -78,6 +80,7 @@ import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
 import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoard;
 import org.tizen.dynamicanalyzer.widgets.chartBoard.DAChartBoardManager;
+import org.tizen.dynamicanalyzer.widgets.da.base.DADialog;
 import org.tizen.dynamicanalyzer.widgets.scale.DAScale;
 
 public class MenuBar {
@@ -151,11 +154,6 @@ public class MenuBar {
                analyzePreferences.setText(MenuBarLabels.ANALYZE_PREFENCES);
                analyzePreferences.addSelectionListener(anlysisMenuListener);
 
-               MenuItem analyzeDefault = new MenuItem(analyzeMenu, SWT.PUSH);
-               analyzeDefault.setText(MenuBarLabels.ANALYZE_SET_AS_DEFAULT);
-               analyzeDefault.addSelectionListener(anlysisMenuListener);
-               analyzeDefault.setEnabled(false);
-
                // view menu
                Menu viewMenu = new Menu(currentShell, SWT.DROP_DOWN);
                viewItem.setMenu(viewMenu);
@@ -246,74 +244,60 @@ public class MenuBar {
                        }
 
                        if (menuName.equals(MenuBarLabels.FILE_NEW)) {
-                               CommonAction.clear();
-                               Toolbar.INSTANCE.clearMarkerTimeList();
-                               RangeDataManager.getInstance().clearMarkerTime();
-                               RangeDataManager.getInstance().clearTimelineMarker();
-                               
-                               // change UI state
-                               Toolbar.INSTANCE.changeUIState(DAState.INIT);
-                               Toolbar.INSTANCE.setScaleSelection(DAScale.DEFAULT_SCALE_INDEX);
-                               
-                               FlatFeatureDialog featureDialog = new FlatFeatureDialog(currentShell);
-                               featureDialog.open();
-                               
-                               /// if Feature Select changed and OK, is NewSetting is true.
-                               if(SettingDataManager.INSTANCE.isNewSetting()){
-                                       // reset checks on ReportMenu items 
-                                       resetReportItemCheck();                                 
-                               }
-                               
-                       } else if (menuName.equals(MenuBarLabels.FILE_LOAD)) {
-                               FileDialog dialog = new FileDialog(currentShell, SWT.OPEN);
-                               dialog.setFilterNames(new String[] { "Zip file" });
-                               dialog.setFilterExtensions(new String[] { "*.zip" });
-                               dialog.setText(MenuBarLabels.FILE_LOAD_DIALOG_TITLE);
+                               if (showSaveWarning() == true) {
+                                       setMenuItemEnable(MenuBarLabels.FILE_SAVE, false);
 
-                               final Object result = dialog.open();
-                               if (null != result) {
+                                       CommonAction.clear();
                                        Toolbar.INSTANCE.clearMarkerTimeList();
                                        RangeDataManager.getInstance().clearMarkerTime();
                                        RangeDataManager.getInstance().clearTimelineMarker();
-                                       Thread loadthread = new Thread(new Runnable() {
 
-                                               @Override
-                                               public void run() {
-                                                       String decompresspath = CommandAction.loadFromZip((String) result);
+                                       // change UI state
+                                       Toolbar.INSTANCE.changeUIState(DAState.INIT);
+                                       Toolbar.INSTANCE.setScaleSelection(DAScale.DEFAULT_SCALE_INDEX);
 
-                                                       OpenTraceProgressManager.getInstance().setSavePath(decompresspath);
-                                                       OpenTraceProgressManager.getInstance().startOpenTraceThread();
-                                               }
-                                       });
-
-                                       loadthread.run();
-                               }
-                       } else if (menuName.equals(MenuBarLabels.FILE_SAVE)) {
-                               Project project = Global.getProject();
-                               if (project == null) {
-                                       return;
+                                       FlatFeatureDialog featureDialog = new FlatFeatureDialog(currentShell);
+                                       featureDialog.open();
+                                       
+                                       /// if Feature Select changed and OK, is NewSetting is true.
+                                       if(SettingDataManager.INSTANCE.isNewSetting()){
+                                               // reset checks on ReportMenu items 
+                                               resetReportItemCheck();                                 
+                                       }
                                }
-
-                               project.save();
-                               DataManagerRegistry.saveData();
-
-                               String savefilename = project.getSavePath()
-                                               .substring(project.getSavePath().lastIndexOf(File.separator) + 1);
-
-                               FileDialog dialog = new FileDialog(currentShell, SWT.SAVE);
-                               dialog.setFilterNames(new String[] { "Zip file" });
-                               dialog.setFilterExtensions(new String[] { "*.zip" });
-                               dialog.setFileName(savefilename + ".zip");
-                               dialog.setText(MenuBarLabels.FILE_SAVE_DIALOG_TITLE);
-
-                               Object result = dialog.open();
-                               if (null != result) {
-                                       if (!CommandAction.saveToZip((String) result)) {
-                                               UIAction.showWarning(AnalyzerLabels.SAVE_FAILED);
+                               
+                       } else if (menuName.equals(MenuBarLabels.FILE_LOAD)) {
+                               if (showSaveWarning() == true) {
+                                       FileDialog dialog = new FileDialog(currentShell, SWT.OPEN);
+                                       dialog.setFilterNames(new String[] { "Zip file" });
+                                       dialog.setFilterExtensions(new String[] { "*.zip" });
+                                       dialog.setText(MenuBarLabels.FILE_LOAD_DIALOG_TITLE);
+       
+                                       final Object result = dialog.open();
+                                       if (null != result) {
+                                               Toolbar.INSTANCE.clearMarkerTimeList();
+                                               RangeDataManager.getInstance().clearMarkerTime();
+                                               RangeDataManager.getInstance().clearTimelineMarker();
+                                               Thread loadthread = new Thread(new Runnable() {
+       
+                                                       @Override
+                                                       public void run() {
+                                                               String decompresspath = CommandAction.loadFromZip((String) result);
+       
+                                                               OpenTraceProgressManager.getInstance().setSavePath(decompresspath);
+                                                               OpenTraceProgressManager.getInstance().startOpenTraceThread();
+                                                       }
+                                               });
+       
+                                               loadthread.run();
                                        }
                                }
+                       } else if (menuName.equals(MenuBarLabels.FILE_SAVE)) {
+                               showSaveDialog();
                        } else if (menuName.equals(MenuBarLabels.FILE_EXIT)) {
-                               currentShell.close();
+                               if (showSaveWarning() == true) {
+                                       currentShell.close();
+                               }
                        }
                }
        };
@@ -712,8 +696,6 @@ public class MenuBar {
        }
        
        public boolean resetReportItemCheck() {
-               
-               
                // reset check on Report MENU
                for (int i = 0; i < menubar.getItems().length; i++) {
                        MenuItem menuitem = menubar.getItem(i);
@@ -733,4 +715,67 @@ public class MenuBar {
 
                return false;
        }
+       
+       private boolean showSaveWarning() {
+               boolean clear = true;
+               
+               if (Global.getProject() != null && Global.getProject().getIsSavedData() == false) {
+                       Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
+                       DADialog dialog = new DADialog(shell, DADialog.DIALOGTYPE.SAVE, SWT.NONE);
+                       dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
+                       dialog.setMessage("Tracing data is not saved.\nAre you sure to remove it?");
+                       dialog.setDialog();
+                       dialog.getSaveButton().addSelectionListener(saveButtonListener);
+                       dialog.open();
+                       clear = dialog.getResult();
+               }
+               
+               return clear;
+       }
+       
+       private void showSaveDialog() {
+               Project project = Global.getProject();
+               if (project == null) {
+                       return;
+               }
+
+               project.save();
+               DataManagerRegistry.saveData();
+
+               String savefilename = project.getSavePath()
+                               .substring(project.getSavePath().lastIndexOf(File.separator) + 1);
+
+               FileDialog dialog = new FileDialog(currentShell, SWT.SAVE);
+               dialog.setFilterNames(new String[] { "Zip file" });
+               dialog.setFilterExtensions(new String[] { "*.zip" });
+               dialog.setFileName(savefilename + ".zip");
+               dialog.setText(MenuBarLabels.FILE_SAVE_DIALOG_TITLE);
+
+               Object result = dialog.open();
+               if (null != result) {
+                       if (!CommandAction.saveToZip((String) result)) {
+                               UIAction.showWarning(AnalyzerLabels.SAVE_FAILED);
+                       }
+                       else {
+                               setMenuItemEnable(MenuBarLabels.FILE_SAVE, false);
+                               project.setSavedData(true);
+                       }
+               }
+       }
+       
+       private SelectionListener saveButtonListener = new SelectionListener() {
+
+               @Override
+               public void widgetSelected(SelectionEvent e) {
+                       showSaveDialog();
+                       if(e.getSource() != null && e.getSource() instanceof Button) {
+                               ((Button)e.getSource()).getParent().getParent().dispose();
+                       }
+               }
+
+               @Override
+               public void widgetDefaultSelected(SelectionEvent e) {
+               }
+               
+       };
 }
\ No newline at end of file
index 4b193f4..d31ee34 100644 (file)
@@ -252,7 +252,7 @@ public class DlogTable extends DATableComposite {
                        return output;\r
                }\r
                \r
-               if(Global.getProject().isSaveProject() == false) {\r
+               if(Global.getProject().isLoadedProject() == false) {\r
                        if(!DLogDataManager.getInstance().getDlogKill()){\r
                                return output;\r
                        }       \r
index a22f0e9..f920842 100644 (file)
@@ -210,7 +210,8 @@ public class OpenTraceProgressManager implements Runnable {
                Project project = Project.getProjectFromFile(getInstance().getSavePath());
                if (project != null) {
                        Global.setProject(project);
-                       Global.getProject().setSavedProject(true);
+                       Global.getProject().setLoadedProject(true);
+                       Global.getProject().setSavedData(true);
                        AnalyzerUtil.executeCommand(OpenTraceHandler.ID);
 
                } else {
index b8d4016..55049cc 100644 (file)
@@ -144,8 +144,7 @@ public class SettingDialog extends DAMessageBox {
        }
 
        private void doWarningMessage() {
-               UIAction.showWarning(ConfigureLabels.SETTING_WARNING_MESSAGE_SETTING_INVALID_INPUT_VALUE,
-                               550, 153);
+               UIAction.showWarning(ConfigureLabels.SETTING_WARNING_MESSAGE_SETTING_INVALID_INPUT_VALUE);
        }
 
        protected boolean run() {
index a1b9891..828e5ed 100644 (file)
@@ -354,10 +354,10 @@ public class FilterDialog extends DAMessageBox {
                                String keyWord = filterInputRowList.get(i).getKeyWord();
                                // check for keyword validation about null or empty string value
                                if (keyWord == null || keyWord.isEmpty()) {
-                                       DADialog dialog = new DADialog(shell, SWT.NONE);
-                                       dialog.setTitleText(WidgetLabels.DA_WARNING);
+                                       DADialog dialog = new DADialog(shell, DADialog.DIALOGTYPE.ERROR, SWT.NONE);
                                        dialog.setMessage(AnalyzerLabels.FILTER_DLG_KEYWORD_VERIFICATION_MESSAGE);
                                        dialog.setIcon(ImageResources.DIALOG_WARNING_ICON);
+                                       dialog.setDialog();
                                        dialog.open();
                                        return;
                                } else {