1) Fixed issue #764: Ignore strings when looking for single line comments.
[phpeclipse.git] / net.sourceforge.phpeclipse.externaltools / src / net / sourceforge / phpdt / externaltools / launchConfigurations / ExternalToolsUtil.java
index 3d4a295..d666703 100644 (file)
@@ -11,11 +11,11 @@ package net.sourceforge.phpdt.externaltools.launchConfigurations;
 
 import java.io.File;
 import java.text.MessageFormat;
-import java.util.Map;
+//import java.util.Map;
 
 import net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsModelMessages;
 import net.sourceforge.phpdt.externaltools.internal.model.VariableContextManager;
-import net.sourceforge.phpdt.externaltools.internal.registry.ExternalToolMigration;
+//import net.sourceforge.phpdt.externaltools.internal.registry.ExternalToolMigration;
 import net.sourceforge.phpdt.externaltools.internal.registry.RefreshScopeVariable;
 import net.sourceforge.phpdt.externaltools.internal.registry.RefreshScopeVariableRegistry;
 import net.sourceforge.phpdt.externaltools.model.IExternalToolConstants;
@@ -23,6 +23,9 @@ import net.sourceforge.phpdt.externaltools.model.ToolUtil;
 import net.sourceforge.phpdt.externaltools.variable.ExpandVariableContext;
 import net.sourceforge.phpeclipse.externaltools.ExternalToolsPlugin;
 
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
 import org.eclipse.core.resources.IResource;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
@@ -45,7 +48,7 @@ import org.eclipse.debug.core.ILaunchManager;
  */
 public class ExternalToolsUtil {
 
-       private static final String LAUNCH_CONFIG_HANDLE = "LaunchConfigHandle"; //$NON-NLS-1$
+       //private static final String LAUNCH_CONFIG_HANDLE = "LaunchConfigHandle"; //$NON-NLS-1$
 
        /**
         * Not to be instantiated.
@@ -363,20 +366,20 @@ public class ExternalToolsUtil {
         * @return a launch configuration, a launch configuration working copy, or
         *         <code>null</code> if not possible.
         */
-       public static ILaunchConfiguration configFromBuildCommandArgs(
-                       Map commandArgs) {
-               String configHandle = (String) commandArgs.get(LAUNCH_CONFIG_HANDLE);
-               if (configHandle == null) {
-                       // Probably an old-style external tool. Try to migrate.
-                       return ExternalToolMigration.configFromArgumentMap(commandArgs);
-               }
-               try {
-                       return DebugPlugin.getDefault().getLaunchManager()
-                                       .getLaunchConfiguration(configHandle);
-               } catch (CoreException e) {
-                       return null;
-               }
-       }
+//     public static ILaunchConfiguration configFromBuildCommandArgs(
+//                     Map commandArgs) {
+//             String configHandle = (String) commandArgs.get(LAUNCH_CONFIG_HANDLE);
+//             if (configHandle == null) {
+//                     // Probably an old-style external tool. Try to migrate.
+//                     return ExternalToolMigration.configFromArgumentMap(commandArgs);
+//             }
+//             try {
+//                     return DebugPlugin.getDefault().getLaunchManager()
+//                                     .getLaunchConfiguration(configHandle);
+//             } catch (CoreException e) {
+//                     return null;
+//             }
+//     }
 
        /**
         * Executes an external progam and saves the LaunchConfiguration under
@@ -427,7 +430,20 @@ public class ExternalToolsUtil {
                        config = wc.doSave();
                        config.launch(ILaunchManager.RUN_MODE, null);
                } catch (CoreException e) {
+                       alertDialog(executable);
                }
 
        }
-}
\ No newline at end of file
+
+       /**
+        * Shows an alert dialog with a warning message
+        * 
+        * @param executable external tools command name
+        */
+       private static void alertDialog(String executable) {
+               IWorkbenchWindow window = PlatformUI.getWorkbench()
+                               .getActiveWorkbenchWindow();
+               MessageDialog.openWarning(window.getShell(), "Launch Error",
+                               "Could not execute external app" + executable);
+       }
+}