Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnithra P Janakiraman2010-01-29 02:19:45 -0500
committerAnithra P Janakiraman2010-01-29 02:19:45 -0500
commit0d32419fa59de317451a1663af30e308ff1a2f94 (patch)
tree00464c9c45a975d5a685816461ec2ecbbc54a816 /systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun
parent9adbd0c1b70d3a5ab00338ddfae6f6204861bd12 (diff)
downloadorg.eclipse.linuxtools-0d32419fa59de317451a1663af30e308ff1a2f94.tar.gz
org.eclipse.linuxtools-0d32419fa59de317451a1663af30e308ff1a2f94.tar.xz
org.eclipse.linuxtools-0d32419fa59de317451a1663af30e308ff1a2f94.zip
Initial Checkin of Dashboard
Diffstat (limited to 'systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun')
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/META-INF/MANIFEST.MF20
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/bin/org/eclipse/linuxtools/systemtap/ui/graphicalrun/actions/ModifyParsingAction.classbin0 -> 5569 bytes
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/bin/org/eclipse/linuxtools/systemtap/ui/graphicalrun/actions/RunScriptChartAction.classbin0 -> 6594 bytes
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/bin/org/eclipse/linuxtools/systemtap/ui/graphicalrun/internal/GraphicalRunPlugin.classbin0 -> 1401 bytes
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/bin/org/eclipse/linuxtools/systemtap/ui/graphicalrun/structures/ChartStreamDaemon2.classbin0 -> 1998 bytes
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/build.properties7
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/icons/actions/regEx.gifbin0 -> 294 bytes
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/icons/actions/run_chart.gifbin0 -> 612 bytes
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/plugin.properties15
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/plugin.xml95
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/src/org/eclipse/linuxtools/systemtap/ui/graphicalrun/actions/ModifyParsingAction.java104
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/src/org/eclipse/linuxtools/systemtap/ui/graphicalrun/actions/RunScriptChartAction.java158
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/src/org/eclipse/linuxtools/systemtap/ui/graphicalrun/internal/GraphicalRunPlugin.java67
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/src/org/eclipse/linuxtools/systemtap/ui/graphicalrun/structures/ChartStreamDaemon2.java54
14 files changed, 520 insertions, 0 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/META-INF/MANIFEST.MF b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..0891342b2b
--- /dev/null
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/META-INF/MANIFEST.MF
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: GraphicalRun Plug-in
+Bundle-SymbolicName: org.eclipse.linuxtools.systemtap.ui.graphicalrun;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.eclipse.linuxtools.systemtap.ui.graphicalrun.internal.GraphicalRunPlugin
+Bundle-Vendor: IBM
+Bundle-Localization: plugin
+Export-Package: org.eclipse.linuxtools.systemtap.ui.graphicalrun.structures
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.linuxtools.systemtap.ui.consolelog,
+ org.eclipse.linuxtools.systemtap.ui.editor,
+ org.eclipse.linuxtools.systemtap.ui.logging,
+ org.eclipse.linuxtools.systemtap.ui.graphing,
+ org.eclipse.linuxtools.systemtap.ui.structures,
+ org.eclipse.linuxtools.systemtap.ui.ide,
+ org.eclipse.linuxtools.systemtap.ui.systemtapgui,
+ org.eclipse.linuxtools.systemtap.ui.graphingapi.ui
+Eclipse-AutoStart: true
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/bin/org/eclipse/linuxtools/systemtap/ui/graphicalrun/actions/ModifyParsingAction.class b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/bin/org/eclipse/linuxtools/systemtap/ui/graphicalrun/actions/ModifyParsingAction.class
new file mode 100644
index 0000000000..a410817e4d
--- /dev/null
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/bin/org/eclipse/linuxtools/systemtap/ui/graphicalrun/actions/ModifyParsingAction.class
Binary files differ
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/bin/org/eclipse/linuxtools/systemtap/ui/graphicalrun/actions/RunScriptChartAction.class b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/bin/org/eclipse/linuxtools/systemtap/ui/graphicalrun/actions/RunScriptChartAction.class
new file mode 100644
index 0000000000..ce31a775a1
--- /dev/null
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/bin/org/eclipse/linuxtools/systemtap/ui/graphicalrun/actions/RunScriptChartAction.class
Binary files differ
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/bin/org/eclipse/linuxtools/systemtap/ui/graphicalrun/internal/GraphicalRunPlugin.class b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/bin/org/eclipse/linuxtools/systemtap/ui/graphicalrun/internal/GraphicalRunPlugin.class
new file mode 100644
index 0000000000..0da7546d85
--- /dev/null
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/bin/org/eclipse/linuxtools/systemtap/ui/graphicalrun/internal/GraphicalRunPlugin.class
Binary files differ
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/bin/org/eclipse/linuxtools/systemtap/ui/graphicalrun/structures/ChartStreamDaemon2.class b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/bin/org/eclipse/linuxtools/systemtap/ui/graphicalrun/structures/ChartStreamDaemon2.class
new file mode 100644
index 0000000000..f76b0c2e2d
--- /dev/null
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/bin/org/eclipse/linuxtools/systemtap/ui/graphicalrun/structures/ChartStreamDaemon2.class
Binary files differ
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/build.properties b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/build.properties
new file mode 100644
index 0000000000..c88359b87e
--- /dev/null
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/,\
+ plugin.properties
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/icons/actions/regEx.gif b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/icons/actions/regEx.gif
new file mode 100644
index 0000000000..fc4c9fadd3
--- /dev/null
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/icons/actions/regEx.gif
Binary files differ
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/icons/actions/run_chart.gif b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/icons/actions/run_chart.gif
new file mode 100644
index 0000000000..b7f03d5679
--- /dev/null
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/icons/actions/run_chart.gif
Binary files differ
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/plugin.properties b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/plugin.properties
new file mode 100644
index 0000000000..c044a09879
--- /dev/null
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/plugin.properties
@@ -0,0 +1,15 @@
+command.runChart.name=Run w/C&hart
+command.runChart.desc=Run the Script w/Chart
+command.modifyParsing.name=Modify &Parsing Expression
+command.modifyParsing.desc=Modify Parsing Expression
+
+category.edit.name=Edit
+category.edit.desc=Edit
+
+actionset.graphicalRun.name=Graphical Run Action Set
+action.runChart.name=Run w/C&hart
+action.runChart.desc=Run the Script w/Chart
+
+actionset.parsing.name=Parsing Action Set
+action.modifyParsing.name=Modify &Parsing Expression
+action.modifyParsing.desc=Modify Parsing Expression
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/plugin.xml b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/plugin.xml
new file mode 100644
index 0000000000..01cd39da09
--- /dev/null
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/plugin.xml
@@ -0,0 +1,95 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.startup">
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ name="%command.runChart.name"
+ description="%command.runChart.desc"
+ categoryId="org.eclipse.linuxtools.systemtap.ui.ide.category.run"
+ id="org.eclipse.linuxtools.systemtap.ui.graphicalrun.commands.RunScriptChart"/>
+ <command
+ name="%command.modifyParsing.name"
+ description="%command.modifyParsing.desc"
+ categoryId="org.eclipse.linuxtools.systemtap.ui.graphing.category.edit"
+ id="org.eclipse.linuxtools.systemtap.ui.graphicalrun.commands.ModifyParsing"/>
+
+ <category
+ name="%category.edit.name"
+ description="%category.edit.desc"
+ id="org.eclipse.linuxtools.systemtap.ui.graphing.category.edit"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.bindings">
+ <key
+ commandId="org.eclipse.linuxtools.systemtap.ui.graphicalrun.commands.RunScriptChart"
+ contextId="org.eclipse.ui.contexts.window"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+M3+F5"/>
+ <key
+ commandId="org.eclipse.linuxtools.systemtap.ui.graphicalrun.commands.ModifyParsing"
+ contextId="org.eclipse.ui.contexts.window"
+ schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
+ sequence="M1+P"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.actionSets">
+ <actionSet
+ label="%actionset.graphicalRun.name"
+ visible="false"
+ id="org.eclipse.linuxtools.systemtap.ui.graphicalrun.GraphicalRunActionSet">
+ <action
+ label="%action.runChart.name"
+ tooltip="%action.runChart.desc"
+ id="org.eclipse.linuxtools.systemtap.ui.graphicalrun.actions.RunScriptChartAction"
+ icon="icons/actions/run_chart.gif"
+ toolbarPath="org.eclipse.ui.workbench.file/build.ext"
+ menubarPath="launch/build.ext"
+ class="org.eclipse.linuxtools.systemtap.ui.graphicalrun.actions.RunScriptChartAction"
+ definitionId="org.eclipse.linuxtools.systemtap.ui.graphicalrun.commands.RunScriptChart"
+ style="push"
+ state="false"/>
+ </actionSet>
+ <actionSet
+ label="%actionset.modifyParsing.name"
+ visible="false"
+ id="org.eclipse.linuxtools.systemtap.ui.graphicalrun.ParsingActionSet">
+ <action
+ label="%action.modifyParsing.name"
+ tooltip="%action.modifyParsing.name"
+ id="org.eclipse.linuxtools.systemtap.ui.graphicalrun.actions.ModifyParsingAction"
+ icon="icons/actions/regEx.gif"
+ toolbarPath="org.eclipse.ui.workbench.file/build.ext"
+ menubarPath="edit/edit.ext"
+ class="org.eclipse.linuxtools.systemtap.ui.graphicalrun.actions.ModifyParsingAction"
+ definitionId="org.eclipse.linuxtools.systemtap.ui.graphicalrun.commands.ModifyParsing"
+ style="push"
+ state="false"/>
+ </actionSet>
+ </extension>
+
+ <extension
+ point="org.eclipse.ui.perspectiveExtensions">
+ <perspectiveExtension
+ targetID="org.eclipse.linuxtools.systemtap.ui.ide.IDEPerspective">
+ <actionSet id="org.eclipse.linuxtools.systemtap.ui.graphicalrun.GraphicalRunActionSet"/>
+ </perspectiveExtension>
+ <perspectiveExtension
+ targetID="org.eclipse.linuxtools.systemtap.ui.graphing.GraphingPerspective">
+ <actionSet id="org.eclipse.linuxtools.systemtap.ui.consolelog.StopActionSet"/>
+ <actionSet id="org.eclipse.linuxtools.systemtap.ui.graphicalrun.ParsingActionSet"/>
+ <view
+ ratio="0.60f"
+ relative="org.eclipse.linuxtools.systemtap.ui.graphing.views.GraphSelectorView"
+ relationship="bottom"
+ id="org.eclipse.ui.console.ConsoleView"/>
+ <viewShortcut id="org.eclipse.ui.console.ConsoleView"/>
+ </perspectiveExtension>
+ </extension>
+</plugin>
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/src/org/eclipse/linuxtools/systemtap/ui/graphicalrun/actions/ModifyParsingAction.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/src/org/eclipse/linuxtools/systemtap/ui/graphicalrun/actions/ModifyParsingAction.java
new file mode 100644
index 0000000000..c0f8551f4f
--- /dev/null
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/src/org/eclipse/linuxtools/systemtap/ui/graphicalrun/actions/ModifyParsingAction.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse, Anithra P J
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.systemtap.ui.graphicalrun.actions;
+
+import java.util.ArrayList;
+
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.linuxtools.systemtap.ui.graphicalrun.structures.ChartStreamDaemon2;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.WorkbenchException;
+
+import org.eclipse.linuxtools.systemtap.ui.consolelog.LoggedCommand2;
+import org.eclipse.linuxtools.systemtap.ui.consolelog.actions.ConsoleAction;
+import org.eclipse.linuxtools.systemtap.ui.consolelog.structures.ScriptConsole;
+import org.eclipse.linuxtools.systemtap.ui.editor.PathEditorInput;
+import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.datasets.IDataSet;
+import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.datasets.IDataSetParser;
+import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.structures.ChartStreamDaemon;
+import org.eclipse.linuxtools.systemtap.ui.graphingapi.ui.wizards.dataset.DataSetWizard;
+import org.eclipse.linuxtools.systemtap.ui.graphing.GraphingConstants;
+import org.eclipse.linuxtools.systemtap.ui.graphing.GraphingPerspective;
+import org.eclipse.linuxtools.systemtap.ui.graphing.views.GraphSelectorView;
+import org.eclipse.linuxtools.systemtap.ui.ide.IDEPerspective;
+
+/**
+ * The action to allow users to change the parsing expression while a script is activly running.
+ * @author Ryan Morse
+ */
+public class ModifyParsingAction extends ConsoleAction implements IWorkbenchWindowActionDelegate {
+ /**
+ * Prompts the user for a new regular expression to use in parsing the stap output for
+ * the <code>DataSet</code>. If the user enters a new parsing expression then it will
+ * get the active <code>ScriptConsole</code> and from that the active <code>LoggedCommand</code>.
+ * Finally, it will dispose of the old <code>ChartStreamDaemon2</code> and add an new
+ * one in its place.
+ */
+ public void run() {
+ DataSetWizard wizard = new DataSetWizard(GraphingConstants.DataSetMetaData, getFilePath());
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ wizard.init(workbench, null);
+ WizardDialog dialog = new WizardDialog(workbench.getActiveWorkbenchWindow().getShell(), wizard);
+ dialog.create();
+ dialog.open();
+
+ IDataSetParser parser = wizard.getParser();
+ IDataSet dataSet = wizard.getDataSet();
+
+ if(null != parser && null != dataSet) {
+ ScriptConsole console = super.getActive();
+ LoggedCommand2 cmd = console.getCommand();
+
+ ArrayList listeners = cmd.getInputStreamListeners();
+ ChartStreamDaemon2 daemon = null;
+ if(null != listeners) {
+ for(int i=0; i<listeners.size(); i++) {
+ if(listeners.get(i) instanceof ChartStreamDaemon) {
+ daemon = (ChartStreamDaemon2)listeners.get(i);
+ break;
+ }
+ }
+ }
+ if(null == daemon) {
+ daemon = new ChartStreamDaemon2(console, dataSet, parser);
+ cmd.addInputStreamListener(daemon);
+ } else
+ daemon.setParser(dataSet, parser);
+
+ IViewPart ivp = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(GraphSelectorView.ID);
+ GraphSelectorView graphSelector = ((GraphSelectorView)ivp);
+ String name = console.getName();
+ graphSelector.createScriptSet(name.substring(name.lastIndexOf('/')+1), dataSet);
+ }
+
+ wizard.dispose();
+ }
+
+ /**
+ * Gets the file location of the file open in the editor window.
+ * @return The path of the file in the active editor window.
+ */
+ private String getFilePath() {
+ try {
+ IWorkbenchPage p = PlatformUI.getWorkbench().showPerspective(IDEPerspective.ID, PlatformUI.getWorkbench().getActiveWorkbenchWindow());
+ IEditorPart ed = p.getActiveEditor();
+ PlatformUI.getWorkbench().showPerspective(GraphingPerspective.ID, PlatformUI.getWorkbench().getActiveWorkbenchWindow());
+ return ((PathEditorInput)ed.getEditorInput()).getPath().toString();
+ } catch(WorkbenchException we) {}
+ return null;
+ }
+} \ No newline at end of file
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/src/org/eclipse/linuxtools/systemtap/ui/graphicalrun/actions/RunScriptChartAction.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/src/org/eclipse/linuxtools/systemtap/ui/graphicalrun/actions/RunScriptChartAction.java
new file mode 100644
index 0000000000..443d6a2b43
--- /dev/null
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/src/org/eclipse/linuxtools/systemtap/ui/graphicalrun/actions/RunScriptChartAction.java
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse, Anithra P J
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.systemtap.ui.graphicalrun.actions;
+
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.linuxtools.systemtap.ui.graphicalrun.structures.ChartStreamDaemon2;
+
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.WorkbenchException;
+
+
+import org.eclipse.linuxtools.systemtap.ui.consolelog.ScpClient;
+import org.eclipse.linuxtools.systemtap.ui.consolelog.dialogs.SelectServerDialog;
+import org.eclipse.linuxtools.systemtap.ui.consolelog.internal.ConsoleLogPlugin;
+import org.eclipse.linuxtools.systemtap.ui.consolelog.preferences.ConsoleLogPreferenceConstants;
+import org.eclipse.linuxtools.systemtap.ui.consolelog.structures.ScriptConsole;
+import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.datasets.IDataSet;
+import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.datasets.IDataSetParser;
+import org.eclipse.linuxtools.systemtap.ui.graphingapi.ui.wizards.dataset.DataSetWizard;
+import org.eclipse.linuxtools.systemtap.ui.logging.LogManager;
+import org.eclipse.linuxtools.systemtap.ui.structures.PasswordPrompt;
+import org.eclipse.linuxtools.systemtap.ui.graphing.GraphingConstants;
+import org.eclipse.linuxtools.systemtap.ui.graphing.GraphingPerspective;
+import org.eclipse.linuxtools.systemtap.ui.graphing.views.GraphSelectorView;
+import org.eclipse.linuxtools.systemtap.ui.ide.IDESessionSettings;
+import org.eclipse.linuxtools.systemtap.ui.ide.actions.RunScriptAction;
+import org.eclipse.linuxtools.systemtap.ui.ide.structures.StapErrorParser;
+
+/**
+ * Action used to run the systemTap script in the active editor. This action will start stap
+ * and send the output to both the <code>ScriptConsole</code> window and a <code>DataSet</code>.
+ * @author Ryan Morse
+ */
+public class RunScriptChartAction extends RunScriptAction implements IWorkbenchWindowActionDelegate {
+ public RunScriptChartAction() {
+ super();
+ LogManager.logDebug("initialized", this);
+ }
+
+ public void dispose() {
+ LogManager.logDebug("disposed", this);
+ super.dispose();
+ }
+
+ /**
+ * The main body of this event. Starts by making sure the current editor is valid to run,
+ * then builds the command line arguments for stap and retrieves the environment variables.
+ * Next, it gets an instance of <code>ScriptConsole</code> to run the script. Finally, it
+ * Registers a new <code>ChartStreamDaemon2</code> to handle formating the script output
+ * for a <code>DataSet</code>. Once everything is setup, it will attempt to switch to the
+ * Graphing Perspective.
+ */
+ public void run() {
+ LogManager.logDebug("Start run:", this);
+ continueRun = true;
+ if(ConsoleLogPlugin.getDefault().getPluginPreferences().getBoolean(ConsoleLogPreferenceConstants.REMEMBER_SERVER)!=true)
+
+ {
+ new SelectServerDialog(fWindow.getShell()).open();
+ }
+
+ if(isValid()) {
+ try{
+
+ ScpClient scpclient = new ScpClient();
+ serverfileName = fileName.substring(fileName.lastIndexOf('/')+1);
+ tmpfileName="/tmp/"+ serverfileName;
+ scpclient.transfer(fileName,tmpfileName);
+ }catch(Exception e){e.printStackTrace();}
+
+ String[] script = buildScript();
+
+ String[] envVars = getEnvironmentVariables();
+
+
+ if(continueRun) {
+ //createClientSession();
+ ScriptConsole console = ScriptConsole.getInstance(serverfileName);
+ console.run(script, envVars, new PasswordPrompt(IDESessionSettings.password), new StapErrorParser());
+
+ // subscription.addInputStreamListener(new ChartStreamDaemon2(console, dataSet, parser));
+ console.getCommand().addInputStreamListener(new ChartStreamDaemon2(console, dataSet, parser));
+
+ //Change to the graphing perspective
+ try {
+ IWorkbenchPage p = PlatformUI.getWorkbench().showPerspective(GraphingPerspective.ID, PlatformUI.getWorkbench().getActiveWorkbenchWindow());
+ IViewPart ivp = p.findView(GraphSelectorView.ID);
+ String name = console.getName();
+ ((GraphSelectorView)ivp).createScriptSet(name.substring(name.lastIndexOf('/')+1), dataSet);
+ } catch(WorkbenchException we) {
+
+ }
+ }
+ }
+
+ LogManager.logDebug("End run:", this);
+ }
+
+ /**
+ * The <code>buildScript</code> method in this class replaces the one in the superclass and calls
+ * <code>buildOptionsScript</code> or <code>buildStandardScript</code> depending on the users
+ * selection of whether to use script options.
+ * @return String[] representing the entire command that needs to be run.
+ */
+ protected String[] buildScript() {
+ String[] script;
+ getChartingOptions();
+
+ // if(useOptions)
+ // script = buildOptionsScript();
+ //else
+ script = buildStandardScript();
+
+ return script;
+ }
+
+ /**
+ * This method is used to prompt the user for the parsing expression to be used in generating
+ * the <code>DataSet</code> from the scripts output.
+ */
+ protected void getChartingOptions() {
+ DataSetWizard wizard = new DataSetWizard(GraphingConstants.DataSetMetaData, getFilePath());
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ wizard.init(workbench, null);
+ WizardDialog dialog = new WizardDialog(workbench.getActiveWorkbenchWindow().getShell(), wizard);
+ dialog.create();
+ dialog.open();
+ parser = wizard.getParser();
+
+ dataSet = wizard.getDataSet();
+
+
+ if(null == parser || null == dataSet)
+ {
+ continueRun = false;
+ }
+ wizard.dispose();
+
+ }
+
+ private boolean useOptions = false;
+ private IDataSet dataSet = null;
+ private IDataSetParser parser = null;
+
+}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/src/org/eclipse/linuxtools/systemtap/ui/graphicalrun/internal/GraphicalRunPlugin.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/src/org/eclipse/linuxtools/systemtap/ui/graphicalrun/internal/GraphicalRunPlugin.java
new file mode 100644
index 0000000000..43565a65f5
--- /dev/null
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/src/org/eclipse/linuxtools/systemtap/ui/graphicalrun/internal/GraphicalRunPlugin.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse, Anithra P J
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.systemtap.ui.graphicalrun.internal;
+
+import org.eclipse.ui.IStartup;
+import org.eclipse.ui.plugin.*;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class GraphicalRunPlugin extends AbstractUIPlugin implements IStartup {
+ //The shared instance.
+ private static GraphicalRunPlugin plugin;
+
+ /**
+ * The constructor.
+ */
+ public GraphicalRunPlugin() {
+ plugin = this;
+ }
+
+ /**
+ * This method is called upon plug-in activation
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ plugin = null;
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static GraphicalRunPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.linuxtools.systemtap.ui.graphicalrun", path);
+ }
+
+ public void earlyStartup() {}
+}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/src/org/eclipse/linuxtools/systemtap/ui/graphicalrun/structures/ChartStreamDaemon2.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/src/org/eclipse/linuxtools/systemtap/ui/graphicalrun/structures/ChartStreamDaemon2.java
new file mode 100644
index 0000000000..a2e4b11310
--- /dev/null
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.graphicalrun/src/org/eclipse/linuxtools/systemtap/ui/graphicalrun/structures/ChartStreamDaemon2.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2006 IBM Corporation.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - Jeff Briggs, Henry Hughes, Ryan Morse, Anithra P J
+ *******************************************************************************/
+
+package org.eclipse.linuxtools.systemtap.ui.graphicalrun.structures;
+
+import org.eclipse.linuxtools.systemtap.ui.consolelog.structures.ScriptConsole;
+import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.datasets.IDataSet;
+import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.datasets.IDataSetParser;
+import org.eclipse.linuxtools.systemtap.ui.graphingapi.nonui.structures.ChartStreamDaemon;
+
+/**
+ * Listens for data events and populates the internal <code>DataSet</code> with the data
+ * that was received and matched the regExpr
+ * @author Ryan Morse
+ */
+public class ChartStreamDaemon2 extends ChartStreamDaemon {
+ public ChartStreamDaemon2(ScriptConsole console, IDataSet d, IDataSetParser p) {
+ super(d, p);
+ }
+
+ /**
+ * Changes the internal <code>DataSet</code> and parsing expression.
+ * @param d The new <code>DataSet</code> to store the parsed output.
+ * @param regExpr String[] containing the RegEx patterns to match against.
+ */
+ public void setParser(IDataSet d, IDataSetParser p) {
+ data = d;
+ parser = p;
+ if(0 != outputData.length())
+ outputData.delete(0, outputData.length()-1);
+ //outputData.append(console.);
+ outputData.append(console.getCommand().getOutput());
+ }
+
+ /**
+ * Disposes of all the internal data.
+ */
+ public void dispose() {
+ if(!isDisposed()) {
+ super.dispose();
+ console = null;
+ }
+ }
+
+ private ScriptConsole console;
+}

Back to the top