Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Wagiaalla2012-10-18 14:54:33 +0000
committerAlexander Kurtakov2012-10-29 19:42:55 +0000
commit0fd6bb7ee8977cb1952d4e101ea36d944bccf949 (patch)
treefec82a5436a4a0f903f5ee2b09b5c284a718584e
parent2d44c904b18acec1a8dc54b859cbc8314f226521 (diff)
downloadorg.eclipse.linuxtools-0fd6bb7ee8977cb1952d4e101ea36d944bccf949.tar.gz
org.eclipse.linuxtools-0fd6bb7ee8977cb1952d4e101ea36d944bccf949.tar.xz
org.eclipse.linuxtools-0fd6bb7ee8977cb1952d4e101ea36d944bccf949.zip
Implement launching of the Systemtap Script launch configuration
Change-Id: I9034630416bbf24b27525763f1a9d806a21a6e9b Reviewed-on: https://git.eclipse.org/r/8293 Tested-by: Hudson CI Reviewed-by: Alexander Kurtakov <akurtako@redhat.com> IP-Clean: Alexander Kurtakov <akurtako@redhat.com> Tested-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/RunScriptByPathAction.java5
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchConfigurationDelegate.java31
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchConfigurationTab.java12
3 files changed, 42 insertions, 6 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/RunScriptByPathAction.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/RunScriptByPathAction.java
index 22586bea00..64edefd738 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/RunScriptByPathAction.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/actions/RunScriptByPathAction.java
@@ -11,6 +11,7 @@
package org.eclipse.linuxtools.internal.systemtap.ui.ide.actions;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import org.eclipse.linuxtools.internal.systemtap.ui.ide.launcher.SystemTapScriptTester;
import org.eclipse.linuxtools.systemtap.ui.ide.actions.RunScriptAction;
import org.eclipse.linuxtools.systemtap.ui.ide.actions.RunScriptBaseAction;
@@ -33,6 +34,10 @@ public class RunScriptByPathAction extends RunScriptBaseAction {
this.path = path;
}
+ public void init(IWorkbenchWindow window, String path) {
+ init(window, new Path(path));
+ }
+
@Override
protected boolean isValid() {
return this.getFilePath().endsWith(SystemTapScriptTester.STP_SUFFIX)
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchConfigurationDelegate.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchConfigurationDelegate.java
index d69386b3e2..865da18b72 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchConfigurationDelegate.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchConfigurationDelegate.java
@@ -16,12 +16,43 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.linuxtools.internal.systemtap.ui.ide.actions.RunScriptByPathAction;
+import org.eclipse.linuxtools.systemtap.ui.consolelog.internal.ConsoleLogPlugin;
+import org.eclipse.linuxtools.systemtap.ui.consolelog.preferences.ConsoleLogPreferenceConstants;
+import org.eclipse.ui.PlatformUI;
public class SystemTapScriptLaunchConfigurationDelegate implements
ILaunchConfigurationDelegate {
public void launch(ILaunchConfiguration configuration, String mode,
ILaunch launch, IProgressMonitor monitor) throws CoreException {
+
+ RunScriptByPathAction action = new RunScriptByPathAction();
+ IPreferenceStore preferenceStore = ConsoleLogPlugin.getDefault().getPreferenceStore();
+
+ // Path
+ String path = configuration.getAttribute(SystemTapScriptLaunchConfigurationTab.SCRIPT_PATH_ATTR, ""); //$NON-NLS-1$
+ action.init(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), path);
+
+ // User Name
+ String userName = configuration.getAttribute(SystemTapScriptLaunchConfigurationTab.USER_NAME_ATTR, ""); //$NON-NLS-1$
+ preferenceStore.setValue(ConsoleLogPreferenceConstants.SCP_USER, userName);
+
+ // User Password
+ String password = configuration.getAttribute(SystemTapScriptLaunchConfigurationTab.USER_PASS_ATTR, ""); //$NON-NLS-1$
+ preferenceStore.setValue(ConsoleLogPreferenceConstants.SCP_PASSWORD, password);
+
+ // Run locally and/or as current user.
+ boolean runAsCurrentUser = configuration.getAttribute(SystemTapScriptLaunchConfigurationTab.CURRENT_USER_ATTR, true);
+ boolean runLocal = configuration.getAttribute(SystemTapScriptLaunchConfigurationTab.LOCAL_HOST_ATTR, true);
+ action.setLocalScript(runLocal && runAsCurrentUser);
+
+ // Host Name.
+ String hostName = configuration.getAttribute(SystemTapScriptLaunchConfigurationTab.HOST_NAME_ATTR, "localhost"); //$NON-NLS-1$
+ preferenceStore.setValue(ConsoleLogPreferenceConstants.HOST_NAME, hostName);
+
+ action.run();
}
}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchConfigurationTab.java b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchConfigurationTab.java
index f16eac5584..d75060f060 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchConfigurationTab.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.ui.ide/src/org/eclipse/linuxtools/internal/systemtap/ui/ide/launcher/SystemTapScriptLaunchConfigurationTab.java
@@ -41,12 +41,12 @@ import org.eclipse.ui.ide.ResourceUtil;
public class SystemTapScriptLaunchConfigurationTab extends
AbstractLaunchConfigurationTab {
- private static final String SCRIPT_PATH_ATTR = "ScriptPath"; //$NON-NLS-1$
- private static final String CURRENT_USER_ATTR = "executeAsCurrentUser"; //$NON-NLS-1$
- private static final String USER_NAME_ATTR = "userName"; //$NON-NLS-1$
- private static final String USER_PASS_ATTR = "userPassword"; //$NON-NLS-1$
- private static final String LOCAL_HOST_ATTR = "executeOnLocalHost"; //$NON-NLS-1$
- private static final String HOST_NAME_ATTR = "hostName"; //$NON-NLS-1$
+ static final String SCRIPT_PATH_ATTR = "ScriptPath"; //$NON-NLS-1$
+ static final String CURRENT_USER_ATTR = "executeAsCurrentUser"; //$NON-NLS-1$
+ static final String USER_NAME_ATTR = "userName"; //$NON-NLS-1$
+ static final String USER_PASS_ATTR = "userPassword"; //$NON-NLS-1$
+ static final String LOCAL_HOST_ATTR = "executeOnLocalHost"; //$NON-NLS-1$
+ static final String HOST_NAME_ATTR = "hostName"; //$NON-NLS-1$
private Text scriptPathText;
private Button currentUserCheckButton;

Back to the top