INTERNAL: remove startTrace() and stopTrace() in toolbar 59/36759/3
authorgreatim <jaewon81.lim@samsung.com>
Fri, 13 Mar 2015 06:23:24 +0000 (15:23 +0900)
committerwoojin jung <woojin2.jung@samsung.com>
Mon, 16 Mar 2015 13:14:07 +0000 (06:14 -0700)
Remove startTrace() and stopTrace() function in toolbar
Instead, use startTrace() and stopTrace() in CommandAction
change dispose() function name to close() in Project.java

Change-Id: I25bd65eb5b2739a4606bef34b9210942155329c0
Signed-off-by: greatim <jaewon81.lim@samsung.com>
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/common/AutoStartManager.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/communicator/IDECommunicator.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/CommandAction.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/handlers/CommonAction.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/project/Project.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/shortcut/ShortCutKeyBindingHandler.java
org.tizen.dynamicanalyzer/src/org/tizen/dynamicanalyzer/ui/toolbar/Toolbar.java

index d003153..a17d293 100644 (file)
@@ -26,9 +26,9 @@
 
 package org.tizen.dynamicanalyzer.common;
 
-import org.eclipse.swt.widgets.Display;
 import org.tizen.dynamicanalyzer.communicator.DACommunicator;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.handlers.CommandAction;
 import org.tizen.dynamicanalyzer.handlers.UIAction;
 import org.tizen.dynamicanalyzer.model.DeviceInfo;
 import org.tizen.dynamicanalyzer.nl.UserErrorWarningLabels;
@@ -114,18 +114,14 @@ public class AutoStartManager implements Runnable {
 
                PackageInfo pkgInfo = DACommunicator.getPkgInfoByMainAppID(appid);
                if (null == pkgInfo) {
-                       Display.getDefault().syncExec(new Runnable() {
-                               public void run() {
-                                       String name = appName;
-                                       if (name.length() > APPNAME_LENGTH) {
-                                               name = appName.substring(0, APPNAME_LENGTH - 1) + "...";//$NON-NLS-1$ 
-                                       }
-                                       UIAction.showWarning(name + CommonConstants.SPACE
-                                                       + UserErrorWarningLabels.ERROR_NONEXIST_APPLICATION);
-
-                                       Toolbar.INSTANCE.setAllControlState(true);
-                               }
-                       });
+                       String name = appName;
+                       if (name.length() > APPNAME_LENGTH) {
+                               name = appName.substring(0, APPNAME_LENGTH - 1) + "...";//$NON-NLS-1$ 
+                       }
+                       UIAction.showWarning(name + CommonConstants.SPACE
+                                       + UserErrorWarningLabels.ERROR_NONEXIST_APPLICATION);
+
+                       Toolbar.INSTANCE.setAllControlState(true);
                        Logger.debug("invalid application name :" + appid);
                        return;
                }
@@ -134,12 +130,7 @@ public class AutoStartManager implements Runnable {
 
                Toolbar.INSTANCE.setDeviceComboText(deviceName);
                Toolbar.INSTANCE.setAppComboText(appLabel);
-               Display.getDefault().syncExec(new Runnable() {
-                       @Override
-                       public void run() {
-                               Toolbar.INSTANCE.startTrace();
-                       }
-               });
+               CommandAction.startTrace();
 
                SingletonFocusManager.setFocusToDA();
        }
index ec8316c..25e5778 100644 (file)
@@ -44,12 +44,12 @@ import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 
-import org.eclipse.swt.widgets.Display;
 import org.tizen.dynamicanalyzer.common.AnalyzerConstants;
 import org.tizen.dynamicanalyzer.common.Global;
 import org.tizen.dynamicanalyzer.common.DAState;
 import org.tizen.dynamicanalyzer.common.path.PathManager;
 import org.tizen.dynamicanalyzer.constant.CommonConstants;
+import org.tizen.dynamicanalyzer.handlers.CommandAction;
 import org.tizen.dynamicanalyzer.handlers.UIAction;
 import org.tizen.dynamicanalyzer.model.DeviceInfo;
 import org.tizen.dynamicanalyzer.nl.AnalyzerLabels;
@@ -452,13 +452,9 @@ public class IDECommunicator implements Runnable {
                        final String appLabel = pkgInfo.getMainApp().getLabel();
                        Logger.debug("IDE recv - deviceName: " + deviceName + " appName : " + appLabel);
 
-                       Display.getDefault().syncExec(new Runnable() {
-                               public void run() {
-                                       Toolbar.INSTANCE.setDeviceComboText(deviceName);
-                                       Toolbar.INSTANCE.setAppComboText(appLabel);
-                                       Toolbar.INSTANCE.startTrace();
-                               }
-                       });
+                       Toolbar.INSTANCE.setDeviceComboText(deviceName);
+                       Toolbar.INSTANCE.setAppComboText(appLabel);
+                       CommandAction.startTrace();
 
                        SingletonFocusManager.setFocusToDA();
                }
index a5d1d33..308ae74 100644 (file)
@@ -98,6 +98,7 @@ public class CommandAction {
                }
 
                // change UI state
+               Toolbar.INSTANCE.resetProcessCombo();
                Toolbar.INSTANCE.changeUIState(DAState.PREPARE_START);
                ShortCutManager.getInstance().setEnabled(false);
 
index ada16b3..2a9d67d 100644 (file)
@@ -158,7 +158,7 @@ public class CommonAction {
                Project project = Global.getProject();
                if (null != project) {
                        synchronized (project) {
-                               project.dispose();
+                               project.close();
                                Global.setProject(null);
                        }
                }
index 0067ec4..24044ae 100755 (executable)
@@ -513,7 +513,7 @@ public class Project {
                progress.setStageComplete(STAGE.CREATE_DBTABLE);
        }
 
-       public void dispose() {
+       public void close() {
                // close previous database connection
                SqlConnectionManager.closeConnection();
 
index a1c6401..593f8d0 100644 (file)
@@ -31,7 +31,9 @@ import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Event;
 import org.eclipse.swt.widgets.Shell;
+import org.tizen.dynamicanalyzer.common.DAResult;
 import org.tizen.dynamicanalyzer.common.DAState;
+import org.tizen.dynamicanalyzer.handlers.CommandAction;
 import org.tizen.dynamicanalyzer.handlers.ReplayManager;
 import org.tizen.dynamicanalyzer.ui.file.FilePage;
 import org.tizen.dynamicanalyzer.ui.kernel.KernelPage;
@@ -127,9 +129,9 @@ public class ShortCutKeyBindingHandler extends AbstractHandler {
                // 103 -> g
                else if (e.stateMask == CTRL_STATE_MASK && e.keyCode == 103) {
                        if (DAState.isStartable()) {
-                               Toolbar.INSTANCE.startTrace();
+                               CommandAction.startTrace();
                        } else if (DAState.isRunning()) {
-                               Toolbar.INSTANCE.stopTrace();
+                               CommandAction.stopTrace(DAResult.SUCCESS, false);
                        } else {
                                Logger.error("Wrong shortcut action for starting trace");
                        }
@@ -161,7 +163,7 @@ public class ShortCutKeyBindingHandler extends AbstractHandler {
                        if (DAState.isStartable()) {
                                if (Toolbar.INSTANCE.getButtonEnabled(Toolbar.REPLAY_BUTTON)) {
                                        if (ReplayManager.init()) {
-                                               Toolbar.INSTANCE.startTrace();
+                                               CommandAction.startTrace();
                                        }
                                }
                        }
index 08e9ed3..fa3e4f3 100755 (executable)
@@ -347,9 +347,9 @@ public enum Toolbar {
                        @Override
                        public void handleClickEvent(DACustomButton button) {
                                if (DAState.isStartable()) {
-                                       startTrace();
+                                       CommandAction.startTrace();
                                } else if (DAState.isRunning()) {
-                                       stopTrace();
+                                       CommandAction.stopTrace(DAResult.SUCCESS, false);
                                } else {
                                        Logger.error("Wrong action for start button");
                                }
@@ -389,7 +389,7 @@ public enum Toolbar {
                        public void handleClickEvent(DACustomButton button) {
                                if (DAState.isStartable()) {
                                        if (ReplayManager.init()) {
-                                               startTrace();
+                                               CommandAction.startTrace();
                                        }
                                }
                        }
@@ -443,15 +443,6 @@ public enum Toolbar {
                });
        }
 
-       public void startTrace() {
-               resetProcessCombo();
-               CommandAction.startTrace();
-       }
-
-       public void stopTrace() {
-               CommandAction.stopTrace(DAResult.SUCCESS, false);
-       }
-
        private void createToolbar(Composite parent) {
 
                /** Creates control composite **/
@@ -958,12 +949,17 @@ public enum Toolbar {
        }
 
        public void setAppComboTextByAppId(String id) {
-               PackageInfo pkgInfo = DACommunicator.getPkgInfoByMainAppID(id);
+               final PackageInfo pkgInfo = DACommunicator.getPkgInfoByMainAppID(id);
                if (null != pkgInfo) {
                        Global.setCurrentApplication(pkgInfo);
                        Global.getCurrentDeviceInfo().getCommunicator().onAppSelected(pkgInfo);
                        Global.getCurrentDeviceInfo().setSelectedPackageID(pkgInfo.getPackageId());
-                       appCombo.setText(pkgInfo.getMainApp().getLabel());
+                       Display.getDefault().syncExec(new Runnable() {
+                               @Override
+                               public void run() {
+                                       appCombo.setText(pkgInfo.getMainApp().getLabel());
+                               }
+                       });
                }
        }
 
@@ -976,7 +972,6 @@ public enum Toolbar {
                                initAppCombo();
                        }
                });
-
        }
 
        // ============================================================================================
@@ -1175,10 +1170,15 @@ public enum Toolbar {
                aboutButton.setButtonEnabled(enabled);
        }
 
-       private void resetProcessCombo() {
-               processCombo.initCombo();
-               processCombo.add(ALL_PROCESS);
-               processCombo.select(0);
+       public void resetProcessCombo() {
+               Display.getDefault().syncExec(new Runnable() {
+                       @Override
+                       public void run() {
+                               processCombo.initCombo();
+                               processCombo.add(ALL_PROCESS);
+                               processCombo.select(0);
+                       }
+               });
        }
 
        public boolean isSourceViewEnabled() {