Working on updated app creation.

git-svn-id: https://google-web-toolkit.googlecode.com/svn/releases/1.6@4430 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/user/src/com/google/gwt/user/tools/.classpathsrc b/user/src/com/google/gwt/user/tools/.classpathsrc
index 19b3e77..3f02e5c 100644
--- a/user/src/com/google/gwt/user/tools/.classpathsrc
+++ b/user/src/com/google/gwt/user/tools/.classpathsrc
@@ -1,9 +1,8 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <classpath>
    <classpathentry kind="src" path="src"/>
-   <classpathentry kind="src" path="test"/>
-   <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="lib" path="@gwtUserPath"/>
+   <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
    <classpathentry kind="output" path="war/WEB-INF/classes"/>
 @eclipseClassPathEntries
diff --git a/user/src/com/google/gwt/user/tools/App.launchsrc b/user/src/com/google/gwt/user/tools/App.launchsrc
index 1f9e95c..227ac01 100644
--- a/user/src/com/google/gwt/user/tools/App.launchsrc
+++ b/user/src/com/google/gwt/user/tools/App.launchsrc
@@ -3,15 +3,14 @@
 <booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
 <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="@shellClass"/>
 <listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
-<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; javaProject=&quot;@projectName&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#13;&#10;"/>
-<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/@projectName/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#13;&#10;"/>
-<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#13;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#13;&#10;&lt;memento project=&quot;@projectName&quot;/&gt;&#13;&#10;&lt;/runtimeClasspathEntry&gt;&#13;&#10;"/>
-<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;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry containerPath=&quot;org.eclipse.jdt.launching.JRE_CONTAINER&quot; javaProject=&quot;@projectName&quot; path=&quot;1&quot; type=&quot;4&quot;/&gt;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry internalArchive=&quot;/@projectName/src&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry id=&quot;org.eclipse.jdt.launching.classpathentry.defaultClasspath&quot;&gt;&#10;&lt;memento project=&quot;@projectName&quot;/&gt;&#10;&lt;/runtimeClasspathEntry&gt;&#10;"/>
+<listEntry value="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;&#10;&lt;runtimeClasspathEntry externalArchive=&quot;@gwtDevPath&quot; path=&quot;3&quot; type=&quot;2&quot;/&gt;&#10;"/>
 @eclipseExtraLaunchPaths
 </listAttribute>
-<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="@vmargs -Xmx256M"/>
-<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-out
-  war -startupUrl @startupUrl @moduleName"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx256M@vmargs"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-startupUrl&#10;@startupUrl @moduleName"/>
 <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="@projectName"/>
 <booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
 </launchConfiguration>
diff --git a/user/src/com/google/gwt/user/tools/AppClassTemplate.javasrc b/user/src/com/google/gwt/user/tools/AppClassTemplate.javasrc
index f2cd244..9e344af 100644
--- a/user/src/com/google/gwt/user/tools/AppClassTemplate.javasrc
+++ b/user/src/com/google/gwt/user/tools/AppClassTemplate.javasrc
@@ -2,16 +2,15 @@
 
 import com.google.gwt.core.client.EntryPoint;
 import com.google.gwt.core.client.GWT;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
 import com.google.gwt.user.client.Window;
 import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.rpc.ServiceDefTarget;
 import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.ClickListener;
 import com.google.gwt.user.client.ui.DialogBox;
 import com.google.gwt.user.client.ui.Image;
 import com.google.gwt.user.client.ui.RootPanel;
 import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
 
 /**
  * Entry point classes define <code>onModuleLoad()</code>.
@@ -19,17 +18,22 @@
 public class @className implements EntryPoint {
 
   /**
+   * Create a remote service proxy to talk to the server-side Echo service.
+   */
+  private final EchoServiceAsync echoService = GWT.create(EchoService.class);
+
+  /**
    * This is the entry point method.
    */
   public void onModuleLoad() {
     Image img = new Image("http://code.google.com/webtoolkit/logo-185x175.png");
     Button button = new Button("Click me");
-    
+
     // We can add style names
     button.addStyleName("pc-template-btn");
     // or we can set an id on a specific element for styling
     img.getElement().setId("pc-template-img");
-    
+
     VerticalPanel vPanel = new VerticalPanel();
     vPanel.setWidth("100%");
     vPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
@@ -48,28 +52,18 @@
     dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
     dialogVPanel.add(closeButton);
 
-    closeButton.addClickListener(new ClickListener() {
-      public void onClick(Widget sender) {
+    closeButton.addClickHandler(new ClickHandler() {
+      public void onClick(ClickEvent event) {
         dialogBox.hide();
       }
     });
-    
+
     // Set the contents of the Widget
     dialogBox.setWidget(dialogVPanel);
- 
-    final EchoServiceAsync echoService = GWT.create(EchoService.class);
-    ServiceDefTarget target = (ServiceDefTarget) echoService;
 
-    // Use a module-relative URLs to ensure that this client code can find
-    // its way home, even when the URL changes (as might happen when you
-    // deploy this as a webapp under an external servlet container).
-    String moduleRelativeURL = GWT.getModuleBaseURL() + "echo";
-    target.setServiceEntryPoint(moduleRelativeURL);
-    
-    final String textToServer = "Hello GWT World!";
-    
-    button.addClickListener(new ClickListener() {
-      public void onClick(Widget sender) {
+    button.addClickHandler(new ClickHandler() {
+      public void onClick(ClickEvent event) {
+        final String textToServer = "Hello GWT World!";
         final String dialogBoxText = "Sending to the server: " + textToServer;
         dialogBox.setText(dialogBoxText);
         dialogBox.center();
diff --git a/user/src/com/google/gwt/user/tools/ApplicationCreator.java b/user/src/com/google/gwt/user/tools/ApplicationCreator.java
index 8ea80bb..8a82145 100644
--- a/user/src/com/google/gwt/user/tools/ApplicationCreator.java
+++ b/user/src/com/google/gwt/user/tools/ApplicationCreator.java
@@ -15,6 +15,8 @@
  */
 package com.google.gwt.user.tools;
 
+import com.google.gwt.dev.Compiler;
+import com.google.gwt.dev.HostedMode;
 import com.google.gwt.dev.cfg.ModuleDefLoader;
 import com.google.gwt.user.tools.util.ArgHandlerAddToClassPath;
 import com.google.gwt.user.tools.util.ArgHandlerEclipse;
@@ -274,7 +276,6 @@
     String moduleName;
     String serverPackageName = null;
     File javaDir = Utility.getDirectory(outDir, "src", true);
-    Utility.getDirectory(outDir, "test", true);
     File warDir = Utility.getDirectory(outDir, "war", true);
     File webInfDir = Utility.getDirectory(warDir, "WEB-INF", true);
     if (pos >= 0) {
@@ -301,12 +302,12 @@
     replacements.put("@serverPackage", serverPackageName);
     replacements.put("@gwtUserPath", basePathEnv + gwtUserPath);
     replacements.put("@gwtDevPath", basePathEnv + gwtDevPath);
-    replacements.put("@shellClass", "com.google.gwt.dev.GWTHosted");
-    replacements.put("@compileClass", "com.google.gwt.dev.GWTCompiler");
+    replacements.put("@shellClass", HostedMode.class.getName());
+    replacements.put("@compileClass", Compiler.class.getName());
     replacements.put("@startupUrl", startupUrl);
     replacements.put("@antVmargs", isMacOsX
-        ? "<jvmarg value=\"-XstartOnFirstThread\"/>" : "");
-    replacements.put("@vmargs", isMacOsX ? "-XstartOnFirstThread" : "");
+        ? "\n<jvmarg value=\"-XstartOnFirstThread\"/>" : "");
+    replacements.put("@vmargs", isMacOsX ? "&#10;-XstartOnFirstThread" : "");
     replacements.put("@eclipseExtraLaunchPaths",
         CreatorUtilities.createEclipseExtraLaunchPaths(extraClassPaths));
     replacements.put("@extraModuleInherits",
diff --git a/user/src/com/google/gwt/user/tools/RpcAsyncClientTemplate.javasrc b/user/src/com/google/gwt/user/tools/RpcAsyncClientTemplate.javasrc
index 52eef3e..c15d89b 100644
--- a/user/src/com/google/gwt/user/tools/RpcAsyncClientTemplate.javasrc
+++ b/user/src/com/google/gwt/user/tools/RpcAsyncClientTemplate.javasrc
@@ -6,5 +6,5 @@
  * The async counterpart of <code>EchoService</code>. 
  */
 public interface EchoServiceAsync {
-  void echo (String input, AsyncCallback<String> callback);
+  void echo(String input, AsyncCallback<String> callback);
 }
diff --git a/user/src/com/google/gwt/user/tools/RpcClientTemplate.javasrc b/user/src/com/google/gwt/user/tools/RpcClientTemplate.javasrc
index 419660c..aeeeff7 100644
--- a/user/src/com/google/gwt/user/tools/RpcClientTemplate.javasrc
+++ b/user/src/com/google/gwt/user/tools/RpcClientTemplate.javasrc
@@ -1,10 +1,12 @@
 package @clientPackage;
 
 import com.google.gwt.user.client.rpc.RemoteService;
+import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
 
 /**
  * The client side stub for the Rpc service.
  */
+@RemoteServiceRelativePath("echo")
 public interface EchoService extends RemoteService {
-  String echo (String input);
+  String echo(String input);
 }
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 a9d8e3a..f130c69 100644
--- a/user/src/com/google/gwt/user/tools/project.ant.xmlsrc
+++ b/user/src/com/google/gwt/user/tools/project.ant.xmlsrc
@@ -1,84 +1,65 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <project name="@projectName" default="build" basedir=".">
-  <description>
-    @projectName build file.  This is used to package up your project as a jar,
-    if you want to distribute it.  This isn't needed for normal operation.
-  </description>
-  <property name="outdir" location="war" />
 
-  <!-- set classpath -->
   <path id="project.class.path">
-    <pathelement path="${java.class.path}/"/>
+    <pathelement location="war/WEB-INF/classes"/>
     <pathelement path="@gwtUserPath"/>
 @extraAntPathElements
-    <!-- Additional dependencies (such as junit) go here -->
+    <!-- Add any additional non-server libs (such as JUnit) -->
+    <fileset dir="war/WEB-INF/lib">
+      <include name="**/*.jar"/>
+    </fileset>
   </path>
 
-  <!-- TODO:  
-   1. revisit this once GWT supports shared dir as a first-clas citizen
-   2. For a 1.4 server, split this so that the server side code is compiled
-   with a target=1.4 build rule -->
-  <target name="javac" description="Compile project to WEB-INF/classes">
+  <target name="libs" description="Copy libs to the war folder">
+    <mkdir dir="war/WEB-INF/lib" />
+    <copy todir="war/WEB-INF/lib" file="@gwtServletPath" />
+    <!-- Add any additional server libs that need to be copied -->
+  </target>
+
+  <target name="javac" depends="libs" description="Compile project to WEB-INF/classes">
     <mkdir dir="war/WEB-INF/classes"/>
-    <javac srcdir="src:test"
-      destdir="war/WEB-INF/classes"
-      includes="**"
-      debug="true"
-      debuglevel="lines,vars,source"
-      source="1.5"
-      target="1.5"
-      nowarn="true"
-      encoding="utf-8">
+    <javac srcdir="src" includes="**" encoding="utf-8"
+        destdir="war/WEB-INF/classes"
+        source="1.5" target="1.5" nowarn="true"
+        debug="true" debuglevel="lines,vars,source">
       <classpath refid="project.class.path"/>
     </javac>
   </target>
 
-  <target name="deploy" depends="gwtc" description="Copy output to the war folder">
-    <mkdir dir="war/WEB-INF/lib" />
-    <copy todir="war/WEB-INF/lib" file="@gwtServletPath" />
-  </target>
-
   <!-- can add additional arguments like -logLevel INFO or -style PRETTY -->
   <target name="gwtc" depends="javac" description="Compile to JavaScript">
-    <java failonerror="true" fork="true"
-          classname="@compileClass">
+    <java failonerror="true" fork="true" classname="@compileClass">
       <classpath>
         <pathelement location="src"/>
-        <pathelement location="war/WEB-INF/classes"/>
-        <pathelement path="${project.class.path}/"/>
+        <path refid="project.class.path"/>
         <pathelement location="@gwtDevPath"/>
       </classpath>
-     <!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
-      <jvmarg value="-Xmx256M"/>
-      @antVmargs
+      <!-- add jvmarg -Xss16M or similar if you see a StackOverflowError -->
+      <jvmarg value="-Xmx256M"/>@antVmargs
       <arg value="@moduleName"/>
     </java>
   </target>
 
-  <!-- can add additional arguments like -logLevel INFO -->
-  <target name="shell" depends="javac" description="Run the deployed app in GWT hosted mode">
-    <java failonerror="true" fork="true"
-          classname="@shellClass">
+  <target name="hosted" depends="javac" description="Run the app hosted mode">
+    <java failonerror="true" fork="true" classname="@shellClass">
       <classpath>
         <pathelement location="src"/>
+        <path refid="project.class.path"/>
         <pathelement location="@gwtDevPath"/>
-        <pathelement path="${java.class.path}/"/>
-        <pathelement path="@gwtUserPath"/>
       </classpath>
-      <jvmarg value="-Xmx256M"/>
-      @antVmargs
+      <jvmarg value="-Xmx256M"/>@antVmargs
       <arg value="-startupUrl"/>
       <arg value="@startupUrl"/>
       <arg value="@moduleName"/>
+      <!-- Additional arguments like -style PRETTY or -logLevel DEBUG -->
     </java>
   </target>
 
-  <target name="build" depends="javac, gwtc, deploy" description="Build this project" />
+  <target name="build" depends="gwtc" description="Build this project" />
 
-  <target name="clean" description="Cleans this project's intermediate and
-    output files">
-    <!-- uncomment if the WEB-INF/classes dir only contains GWT output --> 
-    <!-- <delete dir="war/WEB-INF/classes" failonerror="false" /> -->
+  <target name="clean" description="Cleans this project">
+    <delete dir="war/WEB-INF/classes" failonerror="false" />
     <delete dir="war/@newModuleName" failonerror="false" />
   </target>