[Title]test handle added
authorjy.exe.lee <jy.exe.lee@samsung.com>
Thu, 3 Nov 2011 12:05:40 +0000 (21:05 +0900)
committerjy.exe.lee <jy.exe.lee@samsung.com>
Thu, 3 Nov 2011 12:05:40 +0000 (21:05 +0900)
[Type]
[Module]
[Priority]
[CQ#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

com.samsung.dynamicanalyzer.workbench/src/com/samsung/dynamicanalyzer/workbench/ApplicationWorkbenchWindowAdvisor.java
com.samsung.dynamicanalyzer/META-INF/MANIFEST.MF
com.samsung.dynamicanalyzer/plugin.xml
com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/OpenTraceHandler.java
com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/handlers/StartStopTraceHandler.java
com.samsung.dynamicanalyzer/src/com/samsung/dynamicanalyzer/utils/AnalyzerUtil.java

index 7c5f977..e230a74 100644 (file)
@@ -21,6 +21,8 @@ import org.eclipse.ui.application.IWorkbenchWindowConfigurer;
 import org.eclipse.ui.application.WorkbenchWindowAdvisor;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
 
+import com.samsung.dynamicanalyzer.AnalyzerManager;
+import com.samsung.dynamicanalyzer.services.RecordStateSourceProvider;
 import com.samsung.dynamicanalyzer.utils.AnalyzerUtil;
 
 public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
@@ -77,7 +79,6 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
        public void createWindowContents(Shell shell) {
 
                final IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
-
                final FormLayout layout = new FormLayout();
                layout.marginWidth = 0;
                layout.marginHeight = 0;
@@ -142,18 +143,22 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
 
                                AnalyzerUtil
                                                .executeCommand("com.samsung.dynamicanalyzer.commands.startStopTrace");
-//                             String state = getState();
-//                             if (state.equals(RecordStateSourceProvider.RECORD_READY)) {
+                               String state = AnalyzerUtil.getRecordState();
+                               if (state.equals(RecordStateSourceProvider.RECORD_READY)) {
 //                                     AnalyzerUtil.setRecordState(
 //                                                     RecordStateSourceProvider.RECORD_STATE,
 //                                                     RecordStateSourceProvider.RECORD_RECORDING);
-//                                     startButton.setImage(stopImage);
-//                             } else {
+                                       AnalyzerUtil.setRecordState(
+                                                       RecordStateSourceProvider.RECORD_RECORDING);
+                                       startButton.setImage(stopImage);
+                               } else {
 //                                     AnalyzerUtil.setRecordState(
 //                                                     RecordStateSourceProvider.RECORD_STATE,
 //                                                     RecordStateSourceProvider.RECORD_READY);
-//                                     startButton.setImage(startImage);
-//                             }
+                                       AnalyzerUtil.setRecordState(
+                                                       RecordStateSourceProvider.RECORD_READY);
+                                       startButton.setImage(startImage);
+                               }
 
                                if (recording) {
                                        startButton.setImage(startImage);
@@ -219,6 +224,15 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
 
                Button moreButton = new Button(composite, SWT.FLAT | SWT.NO_FOCUS);
                moreButton.setImage(moreImage);
+               moreButton.addSelectionListener(new SelectionAdapter() {
+                       @Override
+                       public void widgetSelected(SelectionEvent e) {
+
+                               AnalyzerUtil
+                                               .executeCommand("com.samsung.dynamicanalyzer.commands.testInput");
+
+                       }
+               });
                moreButton.setBackground(new Color(null, 51, 51, 51));
                data = new FormData();
                data.left = new FormAttachment(loadRecordButton, 0, SWT.RIGHT);
@@ -227,11 +241,6 @@ public class ApplicationWorkbenchWindowAdvisor extends WorkbenchWindowAdvisor {
                moreButton.setLayoutData(data);
        }
 
-//     private String getState() {
-//             return AnalyzerUtil
-//                             .getRecordState(RecordStateSourceProvider.RECORD_STATE);
-//     }
-
        private void createPerspective(Composite composite) {
 
 //             Label realtimeLabel = new Label(composite, SWT.BORDER);
index 75dcb07..63157d2 100644 (file)
@@ -16,8 +16,8 @@ Export-Package: com.samsung.dynamicanalyzer;uses:="org.eclipse.ui.plugin,org.osg
  com.samsung.dynamicanalyzer.services,
  com.samsung.dynamicanalyzer.ui.views;uses:="org.eclipse.ui.part,org.eclipse.swt.widgets",
  com.samsung.dynamicanalyzer.utils
-Bundle-ClassPath: lib/sqlitejdbc-v056.jar,
.,
+Bundle-ClassPath: .,
lib/sqlitejdbc-v056.jar,
  lib/jcommon-1.0.16.jar,
  lib/jfreechart-1.0.13-experimental.jar,
  lib/jfreechart-1.0.13-swt.jar,
index e3d73da..4aad533 100644 (file)
             id="com.samsung.dynamicanalyzer.commands.openBottleNeckTab"\r
             name="%BottleNeck">\r
       </command>\r
+      <command\r
+            categoryId="com.samsung.dynamicanalyzer.commands"\r
+            id="com.samsung.dynamicanalyzer.commands.testInput"\r
+            name="testInput">\r
+      </command>\r
    </extension>\r
    <extension\r
          point="org.eclipse.ui.handlers">\r
             class="com.samsung.dynamicanalyzer.handlers.OpenBottleNeckTabHandler"\r
             commandId="com.samsung.dynamicanalyzer.commands.openBottleNeckTab">\r
       </handler>\r
+      <handler\r
+            class="com.samsung.dynamicanalyzer.handlers.TestInputHandler"\r
+            commandId="com.samsung.dynamicanalyzer.commands.testInput">\r
+      </handler>\r
    </extension>\r
    <extension\r
          point="org.eclipse.ui.perspectiveExtensions">\r
index fc5af26..4914647 100644 (file)
@@ -1,30 +1,13 @@
 package com.samsung.dynamicanalyzer.handlers;\r
 \r
-import java.util.ArrayList;\r
-import java.util.List;\r
-\r
 import org.eclipse.core.commands.AbstractHandler;\r
 import org.eclipse.core.commands.ExecutionEvent;\r
 import org.eclipse.core.commands.ExecutionException;\r
 \r
-import com.samsung.dynamicanalyzer.LogSpliter;\r
-\r
 public class OpenTraceHandler extends AbstractHandler {\r
 \r
        @Override\r
        public Object execute(ExecutionEvent event) throws ExecutionException {\r
-               List<String> input = new ArrayList<String>();\r
-               input.add("5`,0`,open`,390`,/dev/log_main,1`,5`,0`,0`,`,5`,0`,0`,");\r
-               input.add("5`,1`,open`,523`,/dev/log_radio,1`,7`,0`,0`,`,7`,0`,0`,");\r
-               input.add("5`,2`,open`,589`,/dev/log_system,1`,8`,0`,0`,`,8`,0`,0`,");\r
-               input.add("5`,4`,open`,17766`,/root/.Xdefaults-10.0.2.16,0`,-1`,0`,2`,`,-1`,0`,0`,");\r
-               input.add("5`,5`,open`,45735`,/proc/12669/cmdline,0`,18`,0`,0`,`,18`,0`,0`,");\r
-               input.add("5`,6`,close`,45808`,18`,0`,0`,0`,`,0`,0`,0`,");\r
-               input.add("5`,7`,open`,57269`,/opt/var/kdb/db/menu_widget/language,0`,19`,0`,2`,`,19`,0`,0`,");\r
-               input.add("5`,8`,close`,58741`,19`,0`,0`,0`,`,0`,0`,0`,");\r
-               input.add("5`,9`,close`,59342`,19`,0`,0`,2`,`,0`,0`,0`,");\r
-               input.add("5`,10`,open`,59904`,/opt/var/kdb/db/menu_widget/language,0`,19`,0`,2`,`,19`,0`,0`,");\r
-               LogSpliter.logSlicing(input);\r
                return null;\r
        }\r
 \r
index e77ddac..4a52c9c 100644 (file)
@@ -6,18 +6,28 @@ import org.eclipse.core.commands.ExecutionException;
 \r
 import com.samsung.dynamicanalyzer.LogSpliter;\r
 import com.samsung.dynamicanalyzer.SDBManager;\r
+import com.samsung.dynamicanalyzer.services.RecordStateSourceProvider;\r
+import com.samsung.dynamicanalyzer.utils.AnalyzerUtil;\r
 \r
 public class StartStopTraceHandler extends AbstractHandler {\r
 \r
        @Override\r
        public Object execute(ExecutionEvent event) throws ExecutionException {\r
-               SDBManager.setSerial("emulator-26100");\r
-               SDBManager.setAppName("com.samsung.calculator");\r
-        SDBManager.runApplication();\r
-        SDBManager.forward();\r
-        SDBManager.createSocket();\r
-        SDBManager.createReceiveThread();\r
-        LogSpliter.startLogQueueObservingThread();\r
+               String state = AnalyzerUtil.getRecordState();\r
+               if (state.equals(RecordStateSourceProvider.RECORD_READY)) {\r
+                       // record start\r
+                       SDBManager.setSerial("emulator-26100");\r
+                       SDBManager.setAppName("com.samsung.calculator");\r
+                       SDBManager.runApplication();\r
+                       SDBManager.forward();\r
+                       SDBManager.createSocket();\r
+                       SDBManager.createReceiveThread();\r
+                       LogSpliter.startLogQueueObservingThread();\r
+               }\r
+               else\r
+               {\r
+                       // record stop\r
+               }\r
 \r
                return null;\r
        }\r
index e4dc093..d4ea341 100644 (file)
@@ -9,12 +9,25 @@ import org.eclipse.swt.widgets.Event;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.handlers.IHandlerService;
-import org.eclipse.ui.services.ISourceProviderService;
 
 import com.samsung.dynamicanalyzer.services.RecordStateSourceProvider;
 
 public class AnalyzerUtil {
-       private static String state;
+       private static IWorkbenchWindow window = null;
+       private static String recordState = RecordStateSourceProvider.RECORD_READY;
+
+       public static IWorkbenchWindow getWorkbenchWindow() {
+               if (null == window) {
+                       Display.getDefault().syncExec(new Runnable() {
+                               @Override
+                               public void run() {
+                                       window = PlatformUI.getWorkbench()
+                                                       .getActiveWorkbenchWindow();
+                               }
+                       });
+               }
+               return window;
+       }
 
        public static void executeCommand(String commandId) {
                IHandlerService handlerService = (IHandlerService) PlatformUI
@@ -32,35 +45,26 @@ public class AnalyzerUtil {
                }
        }
        
-       public static String getRecordState(final String key) {
-               Display.getDefault().syncExec(new Runnable() {
-                       @Override
-                       public void run() {
-                               IWorkbenchWindow window = PlatformUI.getWorkbench()
-                                               .getActiveWorkbenchWindow();
-                               ISourceProviderService service = (ISourceProviderService) window
-                                               .getService(ISourceProviderService.class);
-                               RecordStateSourceProvider provider = (RecordStateSourceProvider) service
-                                               .getSourceProvider(key);
-                               state = provider.getCurrentState().get(key);
-                       }
-               });
-
-               return state;
+       public static String getRecordState() {
+//                             IWorkbenchWindow window = getWorkbenchWindow();
+//                             ISourceProviderService service = (ISourceProviderService) window
+//                                             .getService(ISourceProviderService.class);
+//                             RecordStateSourceProvider provider = (RecordStateSourceProvider) service
+//                                             .getSourceProvider(RecordStateSourceProvider.RECORD_STATE);
+//                             return provider.getCurrentState().get(RecordStateSourceProvider.RECORD_STATE);
+               return recordState;
        }
 
-       public static void setRecordState(final String key, final String state) {
-               Display.getDefault().syncExec(new Runnable() {
-                       @Override
-                       public void run() {
-                               IWorkbenchWindow window = PlatformUI.getWorkbench()
-                                               .getActiveWorkbenchWindow();
-                               ISourceProviderService service = (ISourceProviderService) window
-                                               .getService(ISourceProviderService.class);
-                               RecordStateSourceProvider provider = (RecordStateSourceProvider) service
-                                               .getSourceProvider(key);
-                               provider.setState(key, state);
-                       }
-               });
+//     public static void setRecordState(final String key, final String state) {
+//                             IWorkbenchWindow window = getWorkbenchWindow();
+//                             ISourceProviderService service = (ISourceProviderService) window
+//                                             .getService(ISourceProviderService.class);
+//                             RecordStateSourceProvider provider = (RecordStateSourceProvider) service
+//                                             .getSourceProvider(key);
+//                             provider.setState(key, state);
+//     }
+       public static void setRecordState(final String state)
+       {
+               recordState = state;
        }
 }