[SRADA-171] Add progress dialog to toolbar
authorjoon.c.baek <joon.c.baek@samsung.com>
Tue, 8 Mar 2016 08:20:06 +0000 (17:20 +0900)
committerjoon.c.baek <joon.c.baek@samsung.com>
Tue, 8 Mar 2016 08:37:00 +0000 (17:37 +0900)
Add progress dialog to toolbar.
This dialog show progress of getting binary from device.
Dialog location, Appcombo toolip and severa thing will be change later.

Change-Id: I8c9cf6b6771f81afea6e69d86899bcfbc7e7d729
Signed-off-by: joon.c.baek <joon.c.baek@samsung.com>
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/AnalyzerLabels.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/nl/AnalyzerLabels.properties
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/Toolbar.java

index 3707d0d..422e6a7 100755 (executable)
@@ -206,6 +206,7 @@ public class AnalyzerLabels extends NLS {
        public static String DLG_PLEASE_WAIT;
        public static String DLG_SUMMARIZING_DATA;
        public static String DLG_DEVICE_DISCONNECTED;
+       public static String DLG_COPYING_BINARY;
 
        public static String TABLE_COLUMN_LIBNAME;
        public static String TABLE_COLUMN_PARAMETERS;
index 54566f0..dbdffd5 100755 (executable)
@@ -171,6 +171,7 @@ DLG_PREPARE_TRACE=Preparing to trace
 DLG_PLEASE_WAIT=Please wait
 DLG_SUMMARIZING_DATA=Summarizing collected data
 DLG_DEVICE_DISCONNECTED=Device disconnected
+DLG_COPYING_BINARY=Copying binary
 
 TABLE_COLUMN_LIBNAME=Library
 TABLE_COLUMN_PARAMETERS=Parameters
index 9d9715f..2e8cea5 100755 (executable)
@@ -81,6 +81,7 @@ import org.tizen.dynamicanalyzer.ui.toolbar.replayEditor.ReplayEditDialog;
 import org.tizen.dynamicanalyzer.ui.toolbar.setting.SettingDialog;
 import org.tizen.dynamicanalyzer.util.Logger;
 import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
+import org.tizen.dynamicanalyzer.workbench.LayoutManager;
 import org.tizen.dynamicanalyzer.widgets.button.DACustomButton;
 import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonClickEventListener;
 import org.tizen.dynamicanalyzer.widgets.button.DACustomButtonRenderer;
@@ -88,6 +89,7 @@ import org.tizen.dynamicanalyzer.widgets.button.toggle.DACustomToggleButton;
 import org.tizen.dynamicanalyzer.widgets.combo.DACustomCombo;
 import org.tizen.dynamicanalyzer.widgets.combo.DACustomComboSelectionListener;
 import org.tizen.dynamicanalyzer.widgets.combo.DACustomComboTooltip;
+import org.tizen.dynamicanalyzer.widgets.da.base.ProgressDialog;
 import org.tizen.dynamicanalyzer.widgets.timer.IAlarm;
 import org.tizen.dynamicanalyzer.widgets.timer.TimerClock;
 import org.tizen.sdblib.service.FileEntry;
@@ -128,6 +130,9 @@ public enum Toolbar {
        // toolbar buttons by id
        private Map<Integer, DACustomButton> buttons = new HashMap<Integer, DACustomButton>();
 
+       // Progress dialog used by appcombo
+       private ProgressDialog progressDlg = null;
+
        private static final int TIMER_WIDTH = 122;
 
        public void create(Composite parent) {
@@ -1104,6 +1109,25 @@ public enum Toolbar {
        }
 
        private void onAppSelected(PackageInfo pkg) {
+               Display.getDefault().syncExec(new Runnable() {
+                       @Override
+                       public void run() {
+                               Shell shell = WorkbenchUtil.getWorkbenchWindow().getShell();
+                               progressDlg = new ProgressDialog(shell, LayoutManager.getBaseComposite());
+                               progressDlg.setProgressStyle(ProgressDialog.PROGRESS_STYLE_CANCEL);
+                               progressDlg.setProgressMessage(AnalyzerLabels.DLG_COPYING_BINARY);
+                               progressDlg.setProgressInfo(AnalyzerLabels.DLG_PLEASE_WAIT);
+                               progressDlg.setCancelListener(new DACustomButtonClickEventListener() {
+                                       @Override
+                                       public void handleClickEvent(DACustomButton button) {
+                                               Logger.warning("Progress dialog canceled");
+                                       }
+                               });
+                               progressDlg.open();
+                       }
+               });
+
+               progressDlg.setValues("Getting process information", 30);
                if (pkg != null) {
                        List<String> binPaths = new ArrayList<String>();
 
@@ -1144,6 +1168,7 @@ public enum Toolbar {
                                }
                        }
 
+                       progressDlg.setValues("Getting binary from device", 70);
                        if (!binPaths.isEmpty()) {
                                DAResult hr = new DAResult(ErrorCode.ERR_BIN_INFO_GET_FAIL);
                                try {
@@ -1167,6 +1192,15 @@ public enum Toolbar {
                                }
                        }
                }
+               progressDlg.setValues("Done", 100);
+               if (progressDlg != null) {
+                       Display.getDefault().syncExec(new Runnable() {
+                               @Override
+                               public void run() {
+                                       progressDlg.close();
+                               }
+                       });
+               }
        }
 
        /**********************************************************************************************