This patch fixes issue 1816 and a similar bug with applicationCreator on Mac. 

Patch by: amitmanjhi
Review by: jat (TBR)



git-svn-id: https://google-web-toolkit.googlecode.com/svn/releases/1.6@4222 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/junit/tools/JUnit-hosted.launchsrc b/user/src/com/google/gwt/junit/tools/JUnit-hosted.launchsrc
index 49a8345..eea3a6b 100644
--- a/user/src/com/google/gwt/junit/tools/JUnit-hosted.launchsrc
+++ b/user/src/com/google/gwt/junit/tools/JUnit-hosted.launchsrc
@@ -13,6 +13,6 @@
 @eclipseExtraLaunchPaths
 </listAttribute>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="@projectName"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dgwt.args=&quot;-out www-test&quot; -Xmx256M"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dgwt.args=&quot;-out www-test&quot; -Xmx256M @vmargs"/>
 <booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
 </launchConfiguration>
diff --git a/user/src/com/google/gwt/junit/tools/JUnit-web.launchsrc b/user/src/com/google/gwt/junit/tools/JUnit-web.launchsrc
index 56f35ad..97eff72 100644
--- a/user/src/com/google/gwt/junit/tools/JUnit-web.launchsrc
+++ b/user/src/com/google/gwt/junit/tools/JUnit-web.launchsrc
@@ -13,6 +13,6 @@
 @eclipseExtraLaunchPaths
 </listAttribute>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="@projectName"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dgwt.args=&quot;-web -out www-test&quot; -Xmx256M"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dgwt.args=&quot;-web -out www-test&quot; -Xmx256M @vmargs"/>
 <booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
 </launchConfiguration>
diff --git a/user/src/com/google/gwt/user/tools/App.launchsrc b/user/src/com/google/gwt/user/tools/App.launchsrc
index 1f9e95c..4ab2b0d 100644
--- a/user/src/com/google/gwt/user/tools/App.launchsrc
+++ b/user/src/com/google/gwt/user/tools/App.launchsrc
@@ -9,7 +9,7 @@
 <listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry externalArchive=&quot;@gwtDevPath&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
 @eclipseExtraLaunchPaths
 </listAttribute>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="@vmargs -Xmx256M"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="@eclipseVmargs -Xmx256M"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-out
   war -startupUrl @startupUrl @moduleName"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="@projectName"/>
diff --git a/user/src/com/google/gwt/user/tools/ApplicationCreator.java b/user/src/com/google/gwt/user/tools/ApplicationCreator.java
index 9126cd5..d1cced9 100644
--- a/user/src/com/google/gwt/user/tools/ApplicationCreator.java
+++ b/user/src/com/google/gwt/user/tools/ApplicationCreator.java
@@ -309,6 +309,7 @@
     replacements.put("@startupUrl", startupUrl);
     replacements.put("@vmargs", isMacOsX
         ? "<jvmarg value=\"-XstartOnFirstThread\"/>" : "");
+    replacements.put("@eclipseVmargs", isMacOsX ? "-XstartOnFirstThread" : "");
     replacements.put("@eclipseExtraLaunchPaths",
         CreatorUtilities.createEclipseExtraLaunchPaths(extraClassPaths));
     replacements.put("@extraModuleInherits",
diff --git a/user/src/com/google/gwt/user/tools/project.ant.xmlsrc b/user/src/com/google/gwt/user/tools/project.ant.xmlsrc
index de75dc9..848a72c 100644
--- a/user/src/com/google/gwt/user/tools/project.ant.xmlsrc
+++ b/user/src/com/google/gwt/user/tools/project.ant.xmlsrc
@@ -50,6 +50,7 @@
         <pathelement path="${java.class.path}/"/>
         <pathelement path="@gwtUserPath"/>
       </classpath>
+      <jvmarg value="-Xmx256M"/>
       @vmargs
       <arg value="-out"/>
       <arg file="${outdir}"/>
@@ -63,13 +64,13 @@
   <target name="shell" depends="javac" description="Run the deployed app in GWT hosted mode">
     <java failonerror="true" fork="true"
           classname="@shellClass">
-      <jvmarg value="-Xmx256M"/>
       <classpath>
         <pathelement location="src"/>
         <pathelement location="@gwtDevPath"/>
         <pathelement path="${java.class.path}/"/>
         <pathelement path="@gwtUserPath"/>
       </classpath>
+      <jvmarg value="-Xmx256M"/>
       @vmargs
       <arg value="-out"/>
       <arg file="${outdir}"/>