added a builder to parse files with eclipse's build mechanisms
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpeclipse / actions / PHPStartApacheAction.java
index 5883fbe..f6ab554 100644 (file)
@@ -29,12 +29,14 @@ public class PHPStartApacheAction implements IWorkbenchWindowActionDelegate {
   protected IWorkbenchWindow activeWindow = null;
 
   public void run(IAction action) {
-    final IPreferenceStore store = PHPeclipsePlugin.getDefault().getPreferenceStore();
+    final IPreferenceStore store =
+      PHPeclipsePlugin.getDefault().getPreferenceStore();
     String documentRoot = store.getString(PHPeclipsePlugin.DOCUMENTROOT_PREF);
     // replace backslash with slash in the DocumentRoot under Windows
     documentRoot = documentRoot.replace('\\', '/');
     String[] arguments = { documentRoot };
-    MessageFormat form = new MessageFormat(store.getString(PHPeclipsePlugin.APACHE_START_PREF));
+    MessageFormat form =
+      new MessageFormat(store.getString(PHPeclipsePlugin.APACHE_START_PREF));
     execute(
       "apache_start",
       store.getString(PHPeclipsePlugin.APACHE_RUN_PREF),
@@ -77,13 +79,29 @@ public class PHPStartApacheAction implements IWorkbenchWindowActionDelegate {
         * @param arguments arguments for this configuration
         * @param background run this configuration in background mode
         */
-  public static void execute(String command, String executable, String arguments, boolean background) {
+  public static void execute(
+    String command,
+    String executable,
+    String arguments,
+    boolean background) {
     PHPConsole console = PHPConsole.getInstance();
     String consoleMessage;
     if (background) {
-      consoleMessage = "run in background mode-" + command + ": " + executable + " " + arguments;
+      consoleMessage =
+        "run in background mode-"
+          + command
+          + ": "
+          + executable
+          + " "
+          + arguments;
     } else {
-      consoleMessage = "run in foreground mode-" + command + ": " + executable + " " + arguments;
+      consoleMessage =
+        "run in foreground mode-"
+          + command
+          + ": "
+          + executable
+          + " "
+          + arguments;
     }
     console.write(consoleMessage + "\n");
 
@@ -120,9 +138,14 @@ public class PHPStartApacheAction implements IWorkbenchWindowActionDelegate {
   public static String getParserOutput(String command, String consoleMessage) {
     //    MessageDialog.openInformation(activeWindow.getShell(), "Exec command: ", command);
     try {
-      PHPConsole console = PHPConsole.getInstance();
-      if (console != null) {
-        console.write(consoleMessage + command + "\n");
+      PHPConsole console = null;
+      try {
+        console = PHPConsole.getInstance();
+        if (console != null) {
+          console.write(consoleMessage + command + "\n");
+        }
+      } catch (Throwable th) {
+
       }
 
       Runtime runtime = Runtime.getRuntime();