+ configuration.setAttribute(IPDELauncherConstants.CONFIG_CLEAR_AREA,
+ true);
+ String defaultVmArgs = configuration.getAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, "");
+ StringBuffer vmArgs = new StringBuffer(defaultVmArgs);
+ vmArgs.append(" -Xmx256m");
+
+ // Add locations of JVMs
+ addVmSysProperty(vmArgs, "default", JavaRuntime
+ .getDefaultVMInstall());
+ IVMInstallType[] vmTypes = JavaRuntime.getVMInstallTypes();
+ for (IVMInstallType vmType : vmTypes) {
+ // System.out.println("vmType: id=" + vmType.getId() + ", name="
+ // + vmType.getName() + ", toString=" + vmType);
+ for (IVMInstall vmInstall : vmType.getVMInstalls()) {
+ // printVm("", vmInstall);
+ // properties based on name
+ addVmSysProperty(vmArgs, vmInstall.getName(), vmInstall);
+ if (vmInstall instanceof IVMInstall2) {
+ // properties based on version
+ IVMInstall2 vmInstall2 = (IVMInstall2) vmInstall;
+ String version = vmInstall2.getJavaVersion();
+ addVmSysProperty(vmArgs, version, vmInstall);
+
+ List<String> tokens = new ArrayList<String>();
+ StringTokenizer st = new StringTokenizer(version, ".");
+ while (st.hasMoreTokens())
+ tokens.add(st.nextToken());
+ if (tokens.size() >= 2)
+ addVmSysProperty(vmArgs, tokens.get(0) + "."
+ + tokens.get(1), vmInstall);
+ }
+ }
+ }
+ configuration.setAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArgs
+ .toString());
+
+ // Choose working directory
+ Shell shell = Display.getCurrent().getActiveShell();
+ DirectoryDialog dirDialog = new DirectoryDialog(shell);
+ dirDialog.setText("Working Directory");
+ dirDialog.setMessage("Choose the working directory");
+ String dir = dirDialog.open();
+ if (dir != null)
+ configuration
+ .setAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
+ dir);