Merged trunk r7931 into this branch.

Fixes a couple of issues with the RemoteUI and GPE DevMode view interaction.

svn merge -c7931 --ignore-ancestry https://google-web-toolkit.googlecode.com/svn/trunk



git-svn-id: https://google-web-toolkit.googlecode.com/svn/releases/2.0@7975 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/src/com/google/gwt/dev/shell/remoteui/DevModeServiceRequestProcessor.java b/dev/core/src/com/google/gwt/dev/shell/remoteui/DevModeServiceRequestProcessor.java
index 36e1a16..b1f0378 100644
--- a/dev/core/src/com/google/gwt/dev/shell/remoteui/DevModeServiceRequestProcessor.java
+++ b/dev/core/src/com/google/gwt/dev/shell/remoteui/DevModeServiceRequestProcessor.java
@@ -18,6 +18,7 @@
 import com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request;
 import com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Response;
 import com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.DevModeRequest;
+import com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.DevModeRequest.RequestType;
 import com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Response.DevModeResponse;
 import com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Response.DevModeResponse.CapabilityExchange;
 
@@ -48,21 +49,24 @@
               + request.getServiceType().name());
     }
 
-    switch (request.getDevModeRequest().getRequestType()) {
-      case CAPABILITY_EXCHANGE:
-        return processCapabilityExchange();
+    RequestType requestType = request.getDevModeRequest().getRequestType();
+    if (requestType != null) {
+      switch (requestType) {
+        case CAPABILITY_EXCHANGE:
+          return processCapabilityExchange();
 
-      case RESTART_WEB_SERVER:
-        return processRestartServer();
+        case RESTART_WEB_SERVER:
+          return processRestartServer();
 
-      default: {
-        break;
+        default: {
+          break;
+        }
       }
     }
 
     throw new IllegalArgumentException(
         "Unknown DevModeService Request: The DevModeService cannot handle requests of type "
-            + request.getDevModeRequest().getRequestType().name());
+            + requestType == null ? "(unknown)" : requestType.name());
   }
 
   private Response processCapabilityExchange() {
diff --git a/dev/core/src/com/google/gwt/dev/shell/remoteui/MessageTransport.java b/dev/core/src/com/google/gwt/dev/shell/remoteui/MessageTransport.java
index f6ef21b..2b60808 100644
--- a/dev/core/src/com/google/gwt/dev/shell/remoteui/MessageTransport.java
+++ b/dev/core/src/com/google/gwt/dev/shell/remoteui/MessageTransport.java
@@ -374,7 +374,14 @@
 
   private void processMessage(final Message message)
       throws InterruptedException {
-    switch (message.getMessageType()) {
+
+    MessageType messageType = message.getMessageType();
+    if (messageType == null) {
+      processUnknownMessageType(message.getMessageId(), "unknown");
+      return;
+    }
+
+    switch (messageType) {
       case RESPONSE: {
         processServerResponse(message.getMessageId(), message.getResponse());
         break;
@@ -392,7 +399,7 @@
 
       default: {
         processUnknownMessageType(message.getMessageId(),
-            message.getMessageType().name());
+            messageType.name());
         break;
       }
     }
diff --git a/dev/core/src/com/google/gwt/dev/shell/remoteui/RemoteMessageProto.java b/dev/core/src/com/google/gwt/dev/shell/remoteui/RemoteMessageProto.java
index d782bfd..d3fd08e 100644
--- a/dev/core/src/com/google/gwt/dev/shell/remoteui/RemoteMessageProto.java
+++ b/dev/core/src/com/google/gwt/dev/shell/remoteui/RemoteMessageProto.java
@@ -1667,7 +1667,7 @@
             }
           }
           
-          // required .com.google.gwt.dev.shell.remoteui.Message.Request.ViewerRequest.AddLog.LogType type = 1;
+          // optional .com.google.gwt.dev.shell.remoteui.Message.Request.ViewerRequest.AddLog.LogType type = 1;
           public static final int TYPE_FIELD_NUMBER = 1;
           private boolean hasType;
           private com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.ViewerRequest.AddLog.LogType type_ = com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.ViewerRequest.AddLog.LogType.MAIN;
@@ -1696,7 +1696,6 @@
           public com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.ViewerRequest.AddLog.MainLog getMainLog() { return mainLog_; }
           
           public final boolean isInitialized() {
-            if (!hasType) return false;
             if (hasModuleLog()) {
               if (!getModuleLog().isInitialized()) return false;
             }
@@ -1973,7 +1972,7 @@
             }
             
             
-            // required .com.google.gwt.dev.shell.remoteui.Message.Request.ViewerRequest.AddLog.LogType type = 1;
+            // optional .com.google.gwt.dev.shell.remoteui.Message.Request.ViewerRequest.AddLog.LogType type = 1;
             public boolean hasType() {
               return result.hasType();
             }
@@ -4246,7 +4245,7 @@
           }
         }
         
-        // required .com.google.gwt.dev.shell.remoteui.Message.Request.ViewerRequest.RequestType requestType = 1;
+        // optional .com.google.gwt.dev.shell.remoteui.Message.Request.ViewerRequest.RequestType requestType = 1;
         public static final int REQUESTTYPE_FIELD_NUMBER = 1;
         private boolean hasRequestType;
         private com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.ViewerRequest.RequestType requestType_ = com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.ViewerRequest.RequestType.CAPABILITY_EXCHANGE;
@@ -4296,7 +4295,6 @@
         public com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.ViewerRequest.Initialize getInitialize() { return initialize_; }
         
         public final boolean isInitialized() {
-          if (!hasRequestType) return false;
           if (hasAddLog()) {
             if (!getAddLog().isInitialized()) return false;
           }
@@ -4636,7 +4634,7 @@
           }
           
           
-          // required .com.google.gwt.dev.shell.remoteui.Message.Request.ViewerRequest.RequestType requestType = 1;
+          // optional .com.google.gwt.dev.shell.remoteui.Message.Request.ViewerRequest.RequestType requestType = 1;
           public boolean hasRequestType() {
             return result.hasRequestType();
           }
@@ -5434,7 +5432,7 @@
           }
         }
         
-        // required .com.google.gwt.dev.shell.remoteui.Message.Request.DevModeRequest.RequestType requestType = 1;
+        // optional .com.google.gwt.dev.shell.remoteui.Message.Request.DevModeRequest.RequestType requestType = 1;
         public static final int REQUESTTYPE_FIELD_NUMBER = 1;
         private boolean hasRequestType;
         private com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.DevModeRequest.RequestType requestType_ = com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.DevModeRequest.RequestType.CAPABILITY_EXCHANGE;
@@ -5456,7 +5454,6 @@
         public com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.DevModeRequest.RestartWebServer getRestartWebServer() { return restartWebServer_; }
         
         public final boolean isInitialized() {
-          if (!hasRequestType) return false;
           return true;
         }
         
@@ -5708,7 +5705,7 @@
           }
           
           
-          // required .com.google.gwt.dev.shell.remoteui.Message.Request.DevModeRequest.RequestType requestType = 1;
+          // optional .com.google.gwt.dev.shell.remoteui.Message.Request.DevModeRequest.RequestType requestType = 1;
           public boolean hasRequestType() {
             return result.hasRequestType();
           }
@@ -5813,7 +5810,7 @@
         }
       }
       
-      // required .com.google.gwt.dev.shell.remoteui.Message.Request.ServiceType serviceType = 1;
+      // optional .com.google.gwt.dev.shell.remoteui.Message.Request.ServiceType serviceType = 1;
       public static final int SERVICETYPE_FIELD_NUMBER = 1;
       private boolean hasServiceType;
       private com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.ServiceType serviceType_ = com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.ServiceType.VIEWER;
@@ -5835,13 +5832,9 @@
       public com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.DevModeRequest getDevModeRequest() { return devModeRequest_; }
       
       public final boolean isInitialized() {
-        if (!hasServiceType) return false;
         if (hasViewerRequest()) {
           if (!getViewerRequest().isInitialized()) return false;
         }
-        if (hasDevModeRequest()) {
-          if (!getDevModeRequest().isInitialized()) return false;
-        }
         return true;
       }
       
@@ -6093,7 +6086,7 @@
         }
         
         
-        // required .com.google.gwt.dev.shell.remoteui.Message.Request.ServiceType serviceType = 1;
+        // optional .com.google.gwt.dev.shell.remoteui.Message.Request.ServiceType serviceType = 1;
         public boolean hasServiceType() {
           return result.hasServiceType();
         }
@@ -6361,7 +6354,7 @@
               return com.google.gwt.dev.shell.remoteui.RemoteMessageProto.internal_static_com_google_gwt_dev_shell_remoteui_Message_Response_ViewerResponse_CapabilityExchange_Capability_fieldAccessorTable;
             }
             
-            // required .com.google.gwt.dev.shell.remoteui.Message.Request.ViewerRequest.RequestType capability = 1;
+            // optional .com.google.gwt.dev.shell.remoteui.Message.Request.ViewerRequest.RequestType capability = 1;
             public static final int CAPABILITY_FIELD_NUMBER = 1;
             private boolean hasCapability;
             private com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.ViewerRequest.RequestType capability_ = com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.ViewerRequest.RequestType.CAPABILITY_EXCHANGE;
@@ -6369,7 +6362,6 @@
             public com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.ViewerRequest.RequestType getCapability() { return capability_; }
             
             public final boolean isInitialized() {
-              if (!hasCapability) return false;
               return true;
             }
             
@@ -6583,7 +6575,7 @@
               }
               
               
-              // required .com.google.gwt.dev.shell.remoteui.Message.Request.ViewerRequest.RequestType capability = 1;
+              // optional .com.google.gwt.dev.shell.remoteui.Message.Request.ViewerRequest.RequestType capability = 1;
               public boolean hasCapability() {
                 return result.hasCapability();
               }
@@ -6627,9 +6619,6 @@
           }
           
           public final boolean isInitialized() {
-            for (com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Response.ViewerResponse.CapabilityExchange.Capability element : getCapabilitiesList()) {
-              if (!element.isInitialized()) return false;
-            }
             return true;
           }
           
@@ -7443,7 +7432,7 @@
           }
         }
         
-        // required .com.google.gwt.dev.shell.remoteui.Message.Response.ViewerResponse.ResponseType responseType = 1;
+        // optional .com.google.gwt.dev.shell.remoteui.Message.Response.ViewerResponse.ResponseType responseType = 1;
         public static final int RESPONSETYPE_FIELD_NUMBER = 1;
         private boolean hasResponseType;
         private com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Response.ViewerResponse.ResponseType responseType_ = com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Response.ViewerResponse.ResponseType.CAPABILITY_EXCHANGE;
@@ -7472,10 +7461,6 @@
         public com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Response.ViewerResponse.AddLogBranch getAddLogBranch() { return addLogBranch_; }
         
         public final boolean isInitialized() {
-          if (!hasResponseType) return false;
-          if (hasCapabilityExchange()) {
-            if (!getCapabilityExchange().isInitialized()) return false;
-          }
           if (hasAddLog()) {
             if (!getAddLog().isInitialized()) return false;
           }
@@ -7752,7 +7737,7 @@
           }
           
           
-          // required .com.google.gwt.dev.shell.remoteui.Message.Response.ViewerResponse.ResponseType responseType = 1;
+          // optional .com.google.gwt.dev.shell.remoteui.Message.Response.ViewerResponse.ResponseType responseType = 1;
           public boolean hasResponseType() {
             return result.hasResponseType();
           }
@@ -8031,7 +8016,7 @@
               return com.google.gwt.dev.shell.remoteui.RemoteMessageProto.internal_static_com_google_gwt_dev_shell_remoteui_Message_Response_DevModeResponse_CapabilityExchange_Capability_fieldAccessorTable;
             }
             
-            // required .com.google.gwt.dev.shell.remoteui.Message.Request.DevModeRequest.RequestType capability = 1;
+            // optional .com.google.gwt.dev.shell.remoteui.Message.Request.DevModeRequest.RequestType capability = 1;
             public static final int CAPABILITY_FIELD_NUMBER = 1;
             private boolean hasCapability;
             private com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.DevModeRequest.RequestType capability_ = com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.DevModeRequest.RequestType.CAPABILITY_EXCHANGE;
@@ -8039,7 +8024,6 @@
             public com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.DevModeRequest.RequestType getCapability() { return capability_; }
             
             public final boolean isInitialized() {
-              if (!hasCapability) return false;
               return true;
             }
             
@@ -8253,7 +8237,7 @@
               }
               
               
-              // required .com.google.gwt.dev.shell.remoteui.Message.Request.DevModeRequest.RequestType capability = 1;
+              // optional .com.google.gwt.dev.shell.remoteui.Message.Request.DevModeRequest.RequestType capability = 1;
               public boolean hasCapability() {
                 return result.hasCapability();
               }
@@ -8297,9 +8281,6 @@
           }
           
           public final boolean isInitialized() {
-            for (com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Response.DevModeResponse.CapabilityExchange.Capability element : getCapabilitiesList()) {
-              if (!element.isInitialized()) return false;
-            }
             return true;
           }
           
@@ -8805,7 +8786,7 @@
           }
         }
         
-        // required .com.google.gwt.dev.shell.remoteui.Message.Response.DevModeResponse.ResponseType responseType = 1;
+        // optional .com.google.gwt.dev.shell.remoteui.Message.Response.DevModeResponse.ResponseType responseType = 1;
         public static final int RESPONSETYPE_FIELD_NUMBER = 1;
         private boolean hasResponseType;
         private com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Response.DevModeResponse.ResponseType responseType_ = com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Response.DevModeResponse.ResponseType.CAPABILITY_EXCHANGE;
@@ -8827,10 +8808,6 @@
         public com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Response.DevModeResponse.RestartWebServer getRestartWebServer() { return restartWebServer_; }
         
         public final boolean isInitialized() {
-          if (!hasResponseType) return false;
-          if (hasCapabilityExchange()) {
-            if (!getCapabilityExchange().isInitialized()) return false;
-          }
           return true;
         }
         
@@ -9082,7 +9059,7 @@
           }
           
           
-          // required .com.google.gwt.dev.shell.remoteui.Message.Response.DevModeResponse.ResponseType responseType = 1;
+          // optional .com.google.gwt.dev.shell.remoteui.Message.Response.DevModeResponse.ResponseType responseType = 1;
           public boolean hasResponseType() {
             return result.hasResponseType();
           }
@@ -9205,9 +9182,6 @@
         if (hasViewerResponse()) {
           if (!getViewerResponse().isInitialized()) return false;
         }
-        if (hasDevModeResponse()) {
-          if (!getDevModeResponse().isInitialized()) return false;
-        }
         return true;
       }
       
@@ -9842,7 +9816,7 @@
     public boolean hasProtocolVersion() { return hasProtocolVersion; }
     public java.lang.String getProtocolVersion() { return protocolVersion_; }
     
-    // required .com.google.gwt.dev.shell.remoteui.Message.MessageType messageType = 2;
+    // optional .com.google.gwt.dev.shell.remoteui.Message.MessageType messageType = 2;
     public static final int MESSAGETYPE_FIELD_NUMBER = 2;
     private boolean hasMessageType;
     private com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.MessageType messageType_ = com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.MessageType.REQUEST;
@@ -9878,7 +9852,6 @@
     public com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Failure getFailure() { return failure_; }
     
     public final boolean isInitialized() {
-      if (!hasMessageType) return false;
       if (!hasMessageId) return false;
       if (hasRequest()) {
         if (!getRequest().isInitialized()) return false;
@@ -10205,7 +10178,7 @@
         return this;
       }
       
-      // required .com.google.gwt.dev.shell.remoteui.Message.MessageType messageType = 2;
+      // optional .com.google.gwt.dev.shell.remoteui.Message.MessageType messageType = 2;
       public boolean hasMessageType() {
         return result.hasMessageType();
       }
@@ -10517,7 +10490,7 @@
       "\n>core/src/com/google/gwt/dev/shell/remo" +
       "teui/remotemessage.proto\022!com.google.gwt" +
       ".dev.shell.remoteui\"\271\'\n\007Message\022\027\n\017proto" +
-      "colVersion\030\001 \001(\t\022K\n\013messageType\030\002 \002(\01626." +
+      "colVersion\030\001 \001(\t\022K\n\013messageType\030\002 \001(\01626." +
       "com.google.gwt.dev.shell.remoteui.Messag" +
       "e.MessageType\022\021\n\tmessageId\030\003 \002(\r\022C\n\007requ" +
       "est\030\004 \001(\01322.com.google.gwt.dev.shell.rem" +
@@ -10525,14 +10498,14 @@
       "3.com.google.gwt.dev.shell.remoteui.Mess" +
       "age.Response\022C\n\007failure\030\006 \001(\01322.com.goog",
       "le.gwt.dev.shell.remoteui.Message.Failur" +
-      "e\032\307\026\n\007Request\022S\n\013serviceType\030\001 \002(\0162>.com" +
+      "e\032\307\026\n\007Request\022S\n\013serviceType\030\001 \001(\0162>.com" +
       ".google.gwt.dev.shell.remoteui.Message.R" +
       "equest.ServiceType\022W\n\rviewerRequest\030\002 \001(" +
       "\0132@.com.google.gwt.dev.shell.remoteui.Me" +
       "ssage.Request.ViewerRequest\022Y\n\016devModeRe" +
       "quest\030\003 \001(\0132A.com.google.gwt.dev.shell.r" +
       "emoteui.Message.Request.DevModeRequest\032\310" +
-      "\020\n\rViewerRequest\022a\n\013requestType\030\001 \002(\0162L." +
+      "\020\n\rViewerRequest\022a\n\013requestType\030\001 \001(\0162L." +
       "com.google.gwt.dev.shell.remoteui.Messag",
       "e.Request.ViewerRequest.RequestType\022o\n\022c" +
       "apabilityExchange\030\002 \001(\0132S.com.google.gwt" +
@@ -10551,7 +10524,7 @@
       "2K.com.google.gwt.dev.shell.remoteui.Mes" +
       "sage.Request.ViewerRequest.Initialize\032\024\n" +
       "\022CapabilityExchange\032\373\004\n\006AddLog\022]\n\004type\030\001" +
-      " \002(\0162O.com.google.gwt.dev.shell.remoteui" +
+      " \001(\0162O.com.google.gwt.dev.shell.remoteui" +
       ".Message.Request.ViewerRequest.AddLog.Lo" +
       "gType\022d\n\tmoduleLog\030\002 \001(\0132Q.com.google.gw",
       "t.dev.shell.remoteui.Message.Request.Vie" +
@@ -10585,7 +10558,7 @@
       "uestType\022\027\n\023CAPABILITY_EXCHANGE\020\000\022\013\n\007ADD" +
       "_LOG\020\001\022\022\n\016ADD_LOG_BRANCH\020\002\022\021\n\rADD_LOG_EN",
       "TRY\020\003\022\022\n\016DISCONNECT_LOG\020\004\022\016\n\nINITIALIZE\020" +
-      "\005\032\276\003\n\016DevModeRequest\022b\n\013requestType\030\001 \002(" +
+      "\005\032\276\003\n\016DevModeRequest\022b\n\013requestType\030\001 \001(" +
       "\0162M.com.google.gwt.dev.shell.remoteui.Me" +
       "ssage.Request.DevModeRequest.RequestType" +
       "\022p\n\022capabilityExchange\030\002 \001(\0132T.com.googl" +
@@ -10603,7 +10576,7 @@
       "devModeResponse\030\002 \001(\0132C.com.google.gwt.d" +
       "ev.shell.remoteui.Message.Response.DevMo" +
       "deResponse\032\265\006\n\016ViewerResponse\022e\n\014respons" +
-      "eType\030\001 \002(\0162O.com.google.gwt.dev.shell.r",
+      "eType\030\001 \001(\0162O.com.google.gwt.dev.shell.r",
       "emoteui.Message.Response.ViewerResponse." +
       "ResponseType\022q\n\022capabilityExchange\030\002 \001(\013" +
       "2U.com.google.gwt.dev.shell.remoteui.Mes" +
@@ -10617,13 +10590,13 @@
       "\030\002 \003(\0132`.com.google.gwt.dev.shell.remote" +
       "ui.Message.Response.ViewerResponse.Capab" +
       "ilityExchange.Capability\032n\n\nCapability\022`" +
-      "\n\ncapability\030\001 \002(\0162L.com.google.gwt.dev." +
+      "\n\ncapability\030\001 \001(\0162L.com.google.gwt.dev." +
       "shell.remoteui.Message.Request.ViewerReq" +
       "uest.RequestType\032\033\n\006AddLog\022\021\n\tlogHandle\030" +
       "\001 \002(\r\032!\n\014AddLogBranch\022\021\n\tlogHandle\030\001 \002(\r" +
       "\"H\n\014ResponseType\022\027\n\023CAPABILITY_EXCHANGE\020" +
       "\000\022\013\n\007ADD_LOG\020\001\022\022\n\016ADD_LOG_BRANCH\020\002\032\263\005\n\017D" +
-      "evModeResponse\022f\n\014responseType\030\001 \002(\0162P.c",
+      "evModeResponse\022f\n\014responseType\030\001 \001(\0162P.c",
       "om.google.gwt.dev.shell.remoteui.Message" +
       ".Response.DevModeResponse.ResponseType\022r" +
       "\n\022capabilityExchange\030\002 \001(\0132V.com.google." +
@@ -10636,7 +10609,7 @@
       "ogle.gwt.dev.shell.remoteui.Message.Resp",
       "onse.DevModeResponse.CapabilityExchange." +
       "Capability\032o\n\nCapability\022a\n\ncapability\030\001" +
-      " \002(\0162M.com.google.gwt.dev.shell.remoteui" +
+      " \001(\0162M.com.google.gwt.dev.shell.remoteui" +
       ".Message.Request.DevModeRequest.RequestT" +
       "ype\032\022\n\020RestartWebServer\"?\n\014ResponseType\022" +
       "\027\n\023CAPABILITY_EXCHANGE\020\000\022\026\n\022RESTART_WEB_" +
diff --git a/dev/core/src/com/google/gwt/dev/shell/remoteui/RemoteUI.java b/dev/core/src/com/google/gwt/dev/shell/remoteui/RemoteUI.java
index 3c1a943..450319c 100644
--- a/dev/core/src/com/google/gwt/dev/shell/remoteui/RemoteUI.java
+++ b/dev/core/src/com/google/gwt/dev/shell/remoteui/RemoteUI.java
@@ -48,7 +48,8 @@
   private final Socket transportSocket;
   private final MessageTransport transport;
   private ViewerServiceClient viewerServiceClient = null;
-
+  private final List<String> cachedStartupUrls = new ArrayList<String>();
+  
   public RemoteUI(String host, int port, String clientId) {
     try {
       this.clientId = clientId;
@@ -128,10 +129,13 @@
 
   @Override
   public void moduleLoadComplete(boolean success) {
-    /*
-     * TODO: Send a message to the server indicating that the URLs are
-     * launchable.
-     */
+    // Until the RemoteMessage protobuf's backwards compatibility issues are
+    // resolved, we send the startup URLs as part of the moduleLoadComplete so
+    // they are not displayed before the server is ready to serve the modules at
+    // the URLs.
+    viewerServiceClient = new ViewerServiceClient(transport);
+    viewerServiceClient.initialize(clientId, cachedStartupUrls);
+    viewerServiceClient.checkCapabilities();
   }
 
   public void onTermination(Exception e) {
@@ -167,14 +171,10 @@
 
   @Override
   public void setStartupUrls(Map<String, URL> urls) {
-    viewerServiceClient = new ViewerServiceClient(transport);
-    List<String> stringURLs = new ArrayList<String>();
     for (URL url : urls.values()) {
-      stringURLs.add(url.toExternalForm());
+      cachedStartupUrls.add(url.toExternalForm());
     }
 
-    viewerServiceClient.initialize(clientId, stringURLs);
-    viewerServiceClient.checkCapabilities();
     super.setStartupUrls(urls);
   }
 }
diff --git a/dev/core/src/com/google/gwt/dev/shell/remoteui/ViewerServiceClient.java b/dev/core/src/com/google/gwt/dev/shell/remoteui/ViewerServiceClient.java
index 92a5f92..cc987de 100644
--- a/dev/core/src/com/google/gwt/dev/shell/remoteui/ViewerServiceClient.java
+++ b/dev/core/src/com/google/gwt/dev/shell/remoteui/ViewerServiceClient.java
@@ -18,6 +18,7 @@
 import com.google.gwt.core.ext.TreeLogger.HelpInfo;
 import com.google.gwt.core.ext.TreeLogger.Type;
 import com.google.gwt.dev.protobuf.ByteString;
+import com.google.gwt.dev.shell.remoteui.MessageTransport.RequestException;
 import com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request;
 import com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Response;
 import com.google.gwt.dev.shell.remoteui.RemoteMessageProto.Message.Request.ViewerRequest;
@@ -86,7 +87,7 @@
 
     Future<Response> responseFuture = transport.executeRequestAsync(requestMessage);
 
-    return waitForResponse(responseFuture).getViewerResponse().getAddLogBranch().getLogHandle();
+    return waitForResponseOrThrowUncheckedException(responseFuture).getViewerResponse().getAddLogBranch().getLogHandle();
   }
 
   /**
@@ -119,7 +120,7 @@
         viewerRequestBuilder).build();
 
     Future<Response> responseFuture = transport.executeRequestAsync(requestMessage);
-    waitForResponse(responseFuture);
+    waitForResponseOrThrowUncheckedException(responseFuture);
   }
 
   /**
@@ -186,7 +187,7 @@
     Request.Builder request = buildRequestMessageFromViewerRequest(viewerRequestBuilder);
 
     Future<Response> responseFuture = transport.executeRequestAsync(request.build());
-    Response response = waitForResponse(responseFuture);
+    Response response = waitForResponseOrThrowUncheckedException(responseFuture);
 
     ViewerResponse.CapabilityExchange capabilityExchangeResponse = response.getViewerResponse().getCapabilityExchange();
     List<Capability> capabilityList = capabilityExchangeResponse.getCapabilitiesList();
@@ -222,7 +223,7 @@
 
     Request.Builder request = buildRequestMessageFromViewerRequest(viewerRequestBuilder);
     Future<Response> responseFuture = transport.executeRequestAsync(request.build());
-    waitForResponse(responseFuture);
+    waitForResponseOrThrowUncheckedException(responseFuture);
   }
 
   public void initialize(String clientId, List<String> startupURLs) {
@@ -237,7 +238,7 @@
     Request.Builder request = buildRequestMessageFromViewerRequest(viewerRequestBuilder);
 
     Future<Response> responseFuture = transport.executeRequestAsync(request.build());
-    waitForResponse(responseFuture);
+    waitForResponseOrThrowUncheckedException(responseFuture);
   }
 
   private Request.Builder buildRequestMessageFromViewerRequest(
@@ -265,7 +266,7 @@
     Request.Builder request = buildRequestMessageFromViewerRequest(viewerRequestBuilder);
 
     Future<Response> responseFuture = transport.executeRequestAsync(request.build());
-    return waitForResponse(responseFuture).getViewerResponse().getAddLog().getLogHandle();
+    return waitForResponseOrThrowUncheckedException(responseFuture).getViewerResponse().getAddLog().getLogHandle();
   }
 
   private LogData.Builder generateLogData(Type type, String msg,
@@ -302,13 +303,37 @@
     return logBuilder;
   }
 
-  private Response waitForResponse(Future<Response> future) {
+  /**
+   * Waits for response and throws a checked exception if the request failed.
+   * 
+   * Requests can fail if the other side does not understand the message -- for
+   * example, if it is running an older version.
+   * 
+   * @throws RequestException if the request failed
+   */
+  private Response waitForResponse(Future<Response> future) throws RequestException {
     try {
       return future.get();
     } catch (ExecutionException e) {
-      throw new RuntimeException(e);
+      Throwable cause = e.getCause();
+      if (cause instanceof RequestException) {
+        throw (RequestException) cause;
+      } else {
+        throw new RuntimeException(e);
+      }
     } catch (InterruptedException e) {
       throw new RuntimeException(e);
     }
   }
+
+  /**
+   * Waits for response and throws an unchecked exception if the request failed.
+   */
+  private Response waitForResponseOrThrowUncheckedException(Future<Response> future) {
+    try {
+      return waitForResponse(future);
+    } catch (RequestException e) {
+      throw new RuntimeException(e);
+    }
+  }
 }
diff --git a/dev/core/src/com/google/gwt/dev/shell/remoteui/remotemessage.proto b/dev/core/src/com/google/gwt/dev/shell/remoteui/remotemessage.proto
index 71e243b..31ba92b 100644
--- a/dev/core/src/com/google/gwt/dev/shell/remoteui/remotemessage.proto
+++ b/dev/core/src/com/google/gwt/dev/shell/remoteui/remotemessage.proto
@@ -15,6 +15,14 @@
  */
 package com.google.gwt.dev.shell.remoteui;
 
+/*
+ * Notes:
+ * - GWT 2.0.3 and earlier set the enum fields as "required" (such as requestType, which is
+ *   of type RequestType, which is an enum).  This ended up preventing new values to be
+ *   added to the enums.  Those enum fields are now set as "optional", allowing future versions
+ *   of GPE and GWT to add new values to the enums.
+ */
+
 option java_outer_classname = "RemoteMessageProto";
 
 // Outer envelope for all messages
@@ -90,7 +98,7 @@
         message MainLog {
         }
         
-        required LogType type = 1;
+        optional LogType type = 1;
         optional ModuleLog moduleLog = 2;
         optional ServerLog serverLog = 3;
         optional MainLog mainLog = 4;
@@ -137,7 +145,7 @@
         repeated string startupURLs = 2;       
       }
       
-      required RequestType requestType = 1;
+      optional RequestType requestType = 1;
       optional CapabilityExchange capabilityExchange = 2;
       optional AddLog addLog = 3;
       optional AddLogBranch addLogBranch = 4;
@@ -164,12 +172,12 @@
       message RestartWebServer {
       }
                
-      required RequestType requestType = 1;
+      optional RequestType requestType = 1;
       optional CapabilityExchange capabilityExchange = 2;
       optional RestartWebServer restartWebServer = 3;      
     }
     
-    required ServiceType serviceType = 1;
+    optional ServiceType serviceType = 1;
     optional ViewerRequest viewerRequest = 2;
     optional DevModeRequest devModeRequest = 3;
   }
@@ -192,7 +200,7 @@
       // Response for the capabilities of the ViewerService
       message CapabilityExchange {
         message Capability {
-          required Message.Request.ViewerRequest.RequestType capability = 1;
+          optional Message.Request.ViewerRequest.RequestType capability = 1;
         }
         
         repeated Capability capabilities = 2; 
@@ -208,7 +216,7 @@
         required uint32 logHandle = 1;
       }
       
-      required ResponseType responseType = 1;
+      optional ResponseType responseType = 1;
       optional CapabilityExchange capabilityExchange = 2;
       optional AddLog addLog = 3;
       optional AddLogBranch addLogBranch = 4;      
@@ -226,7 +234,7 @@
       // Response for the capabilities of the DevModeService
       message CapabilityExchange {
         message Capability {
-          required Message.Request.DevModeRequest.RequestType capability = 1;
+          optional Message.Request.DevModeRequest.RequestType capability = 1;
         }
         
         repeated Capability capabilities = 2;  
@@ -237,7 +245,7 @@
       message RestartWebServer {
       }
       
-      required ResponseType responseType = 1;
+      optional ResponseType responseType = 1;
       optional CapabilityExchange capabilityExchange = 2;      
       optional RestartWebServer restartWebServer = 3;     
     }
@@ -255,7 +263,7 @@
   // we can make use of it to detect protocol incompatibilities
   optional string protocolVersion = 1;
   
-  required MessageType messageType = 2;
+  optional MessageType messageType = 2;
   required uint32 messageId = 3;
   optional Request request = 4;
   optional Response response = 5;