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()
 
  26                                 .getPreferenceStore();
 
  27                 String executable = store
 
  28                                 .getString(ExternalToolsPlugin.XAMPP_START_PREF);
 
  29                 String workingDirectory = null;
 
  30                 if (executable != null && executable.length() > 0) {
 
  31                         int index = executable.lastIndexOf(File.separatorChar);
 
  33                                 workingDirectory = executable.substring(0, index);
 
  36                 execute("xampp_start", executable, workingDirectory, true);
 
  40          * Executes an external progam and saves the LaunchConfiguration under
 
  44          *            external tools command name
 
  46          *            executable path i.e.c:\apache\apache.exe
 
  48          *            run this configuration in background mode
 
  50         public static void execute(String command, String executable,
 
  51                         String workingDirectory, boolean background) {
 
  52                 // PHPConsole console = new PHPConsole();
 
  53                 // String consoleMessage;
 
  55                 // consoleMessage = "run in background mode-" + command + ": " +
 
  58                 // consoleMessage = "run in foreground mode-" + command + ": " +
 
  61                 // console.println(consoleMessage);
 
  63                 ExternalToolsUtil.execute(command, executable, workingDirectory, null,
 
  67         public void selectionChanged(IAction action, ISelection selection) {
 
  71         public void init(IWorkbenchWindow window) {
 
  72                 this.activeWindow = window;
 
  75         public void dispose() {