1 /***********************************************************************************************************************************
2 * Copyright (c) 2000, 2002 IBM Corp. and others. All rights reserved. This program and the accompanying materials are made
3 * available under the terms of the Common Public License v1.0 which accompanies this distribution, and is available at
4 * http://www.eclipse.org/legal/cpl-v10.html
6 * Contributors: IBM Corporation - Initial implementation www.phpeclipse.de
7 **********************************************************************************************************************************/
8 package net.sourceforge.phpdt.externaltools.actions;
12 import net.sourceforge.phpdt.externaltools.launchConfigurations.ExternalToolsUtil;
13 import net.sourceforge.phpeclipse.externaltools.ExternalToolsPlugin;
15 import org.eclipse.jface.action.IAction;
16 import org.eclipse.jface.preference.IPreferenceStore;
17 import org.eclipse.jface.viewers.ISelection;
18 import org.eclipse.ui.IWorkbenchWindow;
19 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
21 public class PHPStartXAMPPAction implements IWorkbenchWindowActionDelegate {
22 protected IWorkbenchWindow activeWindow = null;
24 public void run(IAction action) {
25 final IPreferenceStore store = ExternalToolsPlugin.getDefault().getPreferenceStore();
26 String executable = store.getString(ExternalToolsPlugin.XAMPP_START_PREF);
27 String workingDirectory = null;
28 if (executable != null && executable.length() > 0) {
29 int index = executable.lastIndexOf(File.separatorChar);
31 workingDirectory = executable.substring(0, index);
34 execute("xampp_start", executable, workingDirectory, true);
38 * Executes an external progam and saves the LaunchConfiguration under external tools
41 * external tools command name
43 * executable path i.e.c:\apache\apache.exe
45 * run this configuration in background mode
47 public static void execute(String command, String executable, String workingDirectory, boolean background) {
48 // PHPConsole console = new PHPConsole();
49 // String consoleMessage;
51 // consoleMessage = "run in background mode-" + command + ": " + executable;
53 // consoleMessage = "run in foreground mode-" + command + ": " + executable;
55 // console.println(consoleMessage);
57 ExternalToolsUtil.execute(command, executable, workingDirectory, null, background);
60 public void selectionChanged(IAction action, ISelection selection) {
64 public void init(IWorkbenchWindow window) {
65 this.activeWindow = window;
68 public void dispose() {