1 /**********************************************************************
2 Copyright (c) 2000, 2002 IBM Corp. and others.
3 All rights reserved. This program and the accompanying materials
4 are made available under the terms of the Common Public License v1.0
5 which accompanies this distribution, and is available at
6 http://www.eclipse.org/legal/cpl-v10.html
9 IBM Corporation - Initial implementation
11 **********************************************************************/
12 package net.sourceforge.phpeclipse.actions;
16 import net.sourceforge.phpdt.externaltools.launchConfigurations.ExternalToolsUtil;
17 import net.sourceforge.phpeclipse.PHPConsole;
18 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
20 import org.eclipse.jface.action.IAction;
21 import org.eclipse.jface.preference.IPreferenceStore;
22 import org.eclipse.jface.viewers.ISelection;
23 import org.eclipse.ui.IWorkbenchWindow;
24 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
26 public class PHPStopXAMPPAction implements IWorkbenchWindowActionDelegate {
27 protected IWorkbenchWindow activeWindow = null;
29 public void run(IAction action) {
30 final IPreferenceStore store =
31 PHPeclipsePlugin.getDefault().getPreferenceStore();
32 String executable = store.getString(PHPeclipsePlugin.XAMPP_STOP_PREF);
33 String workingDirectory = null;
34 if (executable!=null && executable.length()>0) {
35 int index = executable.lastIndexOf(File.separatorChar);
37 workingDirectory = executable.substring(0, index);
48 * Executes an external progam and saves the LaunchConfiguration under external tools
49 * @param command external tools command name
50 * @param executable executable path i.e.c:\apache\apache.exe
51 * @param background run this configuration in background mode
53 public static void execute(
56 String workingDirectory,
58 PHPConsole console = new PHPConsole();
59 String consoleMessage;
62 "run in background mode-"
68 "run in foreground mode-"
73 console.println(consoleMessage);
75 ExternalToolsUtil.execute(command, executable, workingDirectory, null, background);
78 public void selectionChanged(IAction action, ISelection selection) {
82 public void init(IWorkbenchWindow window) {
83 this.activeWindow = window;
86 public void dispose() {