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
10 Klaus Hartlage - www.eclipseproject.de
11 **********************************************************************/
12 package net.sourceforge.phpeclipse.actions;
14 import java.text.MessageFormat;
16 import net.sourceforge.phpdt.externaltools.launchConfigurations.ExternalToolsUtil;
17 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
18 import net.sourceforge.phpeclipse.views.PHPConsole;
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 PHPStartApacheAction implements IWorkbenchWindowActionDelegate {
27 protected IWorkbenchWindow activeWindow = null;
29 public void run(IAction action) {
30 final IPreferenceStore store =
31 PHPeclipsePlugin.getDefault().getPreferenceStore();
32 String documentRoot = store.getString(PHPeclipsePlugin.DOCUMENTROOT_PREF);
33 // replace backslash with slash in the DocumentRoot under Windows
34 documentRoot = documentRoot.replace('\\', '/');
35 String[] arguments = { documentRoot };
37 new MessageFormat(store.getString(PHPeclipsePlugin.APACHE_START_PREF));
40 store.getString(PHPeclipsePlugin.APACHE_RUN_PREF),
41 form.format(arguments),
42 store.getBoolean(PHPeclipsePlugin.APACHE_START_BACKGROUND));
46 * Executes an external progam and saves the LaunchConfiguration under external tools
47 * @param command external tools command name
48 * @param executable executable path i.e.c:\apache\apache.exe
49 * @param arguments arguments for this configuration
50 * @param background run this configuration in background mode
52 public static void execute(
57 PHPConsole console = PHPConsole.getInstance();
58 String consoleMessage;
61 "run in background mode-"
69 "run in foreground mode-"
76 console.write(consoleMessage + "\n");
78 ExternalToolsUtil.execute(command, executable, arguments, background);
81 public void selectionChanged(IAction action, ISelection selection) {
85 public void init(IWorkbenchWindow window) {
86 this.activeWindow = window;
89 public void dispose() {