Added TestCase for PHP with Comment and
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / actions / PHPStartApacheAction.java
index 2928345..4082d14 100644 (file)
@@ -11,25 +11,18 @@ Contributors:
 **********************************************************************/
 package net.sourceforge.phpeclipse.actions;
 
-import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.InputStreamReader;
 import java.text.MessageFormat;
 
 import net.sourceforge.phpeclipse.PHPeclipsePlugin;
 import net.sourceforge.phpeclipse.views.PHPConsole;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
+
 import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.jface.preference.IPreferenceStore;
 import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
 
 public class PHPStartApacheAction implements IWorkbenchWindowActionDelegate {
   protected IWorkbenchWindow activeWindow = null;
@@ -104,7 +97,9 @@ public class PHPStartApacheAction implements IWorkbenchWindowActionDelegate {
     //    MessageDialog.openInformation(activeWindow.getShell(), "Exec command: ", command);
     try {
       PHPConsole console = PHPConsole.getInstance();
-      console.write(consoleMessage + command + "\n");
+      if (console!=null) {
+        console.write(consoleMessage + command + "\n");
+      }
       Runtime runtime = Runtime.getRuntime();
 
       // runs the command
@@ -117,7 +112,9 @@ public class PHPStartApacheAction implements IWorkbenchWindowActionDelegate {
       String consoleOutput = PHPConsole.getStringFromStream(stream);
 
       // prints out the information
-      console.write(consoleOutput);
+         if (console!=null) {
+        console.write(consoleOutput);
+         }
       return consoleOutput;
 
     } catch (IOException e) {