99import org .eclipse .core .resources .ResourcesPlugin ;
1010import org .eclipse .core .runtime .CoreException ;
1111import org .eclipse .core .runtime .IProgressMonitor ;
12+ import org .eclipse .core .runtime .Platform ;
1213import org .eclipse .debug .core .DebugPlugin ;
1314import org .eclipse .debug .core .ILaunch ;
1415import org .eclipse .debug .core .ILaunchConfiguration ;
2526import org .nodeclipse .vertx .VertxConstants ;
2627
2728/**
28- * Launching `jjs` from Java 8 .<br>
29+ * Launching `vertx run rhino:path` .<br>
2930 * see LaunchConfigurationDelegate in .debug and .phantomjs module for comparison.
3031 *
31- * @since 0.7
32+ * @since 0.11
3233 * @author Paul Verest
3334 */
3435public class LaunchConfigurationDelegate implements ILaunchConfigurationDelegate {
3536
37+ boolean isWindows = Platform .getOS ().startsWith ("win" );
38+ private boolean warned = false ;
39+
3640 @ Override
3741 public void launch (ILaunchConfiguration configuration , String mode ,
3842 ILaunch launch , IProgressMonitor monitor ) throws CoreException {
@@ -43,15 +47,16 @@ public void launch(ILaunchConfiguration configuration, String mode,
4347 // Using configuration to build command line
4448 List <String > cmdLine = new ArrayList <String >();
4549
46- String executablePath = preferenceStore .getString (VertxConstants .VERTX_PATH );
47- // Check if the node location is correctly configured
50+ String vertxHomeToUse = preferenceStore .getString (VertxConstants .VERTX_HOME_TO_USE );
51+ String executablePath = vertxHomeToUse + (isWindows ?"\\ bin\\ vertx.bat" :"/bin/vertx" );
52+ // Check if the vertx location is correctly configured
4853 File executableFile = new File (executablePath );
49- if (!executableFile .exists ()){
54+ if ( ( "" . equals ( vertxHomeToUse )) || ( !executableFile .exists ()) ){
5055 // If the location is not valid than show a dialog which prompts the user to goto the preferences page
5156// Dialogs.showPreferencesDialog("path to jjs util from Java 8 runtime is not correctly configured.\n\n"
5257// + "Please goto Window -> Prefrences -> Nodeclipse and configure the correct location under 'JJS path:'");
5358 CommonDialogs .showPreferencesDialog (VertxConstants .PREFERENCES_PAGE ,
54- "Vert.x `vertx` location is not correctly configured.\n \n "
59+ "Vert.x installation is not correctly configured.\n \n "
5560 + "Please goto Window -> Preferences -> " +VertxConstants .PREFERENCE_PAGE_NAME
5661 +" and configure the correct location" );
5762 return ;
@@ -63,7 +68,7 @@ public void launch(ILaunchConfiguration configuration, String mode,
6368 String file = configuration .getAttribute (VertxConstants .KEY_FILE_PATH , "" );
6469 String filePath = ResourcesPlugin .getWorkspace ().getRoot ().findMember (file ).getLocation ().toOSString ();
6570 // path is relative, so cannot find it, unless get absolute path
66- cmdLine .add (filePath );
71+ cmdLine .add ("rhino:" + filePath );
6772
6873 File workingPath = null ;
6974 String workingDirectory = configuration .getAttribute (Constants .ATTR_WORKING_DIRECTORY , "" );
@@ -94,8 +99,6 @@ public void launch(ILaunchConfiguration configuration, String mode,
9499
95100 }
96101
97- private boolean warned = false ;
98-
99102 /** Get EnvironmentVariables from ILaunchConfiguration
100103 * and adds JAVA_HOME, GRADLE_HOME, PATH, TEMP, SystemDrive, HOME
101104 * @param configuration ILaunchConfiguration
0 commit comments