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 {
public void createWindowContents(Shell shell) {
final IWorkbenchWindowConfigurer configurer = getWindowConfigurer();
-
final FormLayout layout = new FormLayout();
layout.marginWidth = 0;
layout.marginHeight = 0;
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);
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);
moreButton.setLayoutData(data);
}
-// private String getState() {
-// return AnalyzerUtil
-// .getRecordState(RecordStateSourceProvider.RECORD_STATE);
-// }
-
private void createPerspective(Composite composite) {
// Label realtimeLabel = new Label(composite, SWT.BORDER);
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,
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
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
\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
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
}
}
- 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;
}
}