/*
 * SuperDevMode.java
 *
 * Copyright (C) 2009-12 by RStudio, Inc.
 *
 * Unless you have received this program directly from RStudio pursuant
 * to the terms of a commercial license agreement with RStudio, then
 * this program is licensed to you under the terms of version 3 of the
 * GNU Affero General Public License. This program is distributed WITHOUT
 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT,
 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the
 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details.
 *
 */

package org.rstudio.studio.client.common;

import com.google.gwt.core.client.GWT;

public class SuperDevMode
{
   public final static native void reload() /*-{
      $wnd.__gwt_bookmarklet_params = {
         server_url:'http://localhost:9876/',
         module_name:'rstudio'
      }; 
      
      var s = $doc.createElement('script'); 
      s.src = 'http://localhost:9876/dev_mode_on.js'; 
      void($doc.getElementsByTagName('head')[0].appendChild(s));
   }-*/ ;
   
   
   public static boolean isActive()
   {
      return 
        GWT.getModuleBaseURL() == "http://localhost:8787/rstudio/" &&
        GWT.getModuleBaseForStaticFiles() == "http://localhost:9876/rstudio/";
   }
}

@@ -624,48 +624,8 @@
 n;%0A%0A
-import com.google.gwt.core.client.GWT;%0A%0A
 publ
@@ -1031,16 +1031,29 @@
  static 
+final native 
 boolean 
@@ -1066,24 +1066,27 @@
 ve()%0A   
+/*-
 %7B%0A      
 return %0A
@@ -1081,168 +1081,141 @@
     
-return %0A        GWT.getModuleBaseURL() == %22http://localhost:8787/rstudio/%22 &&%0A        GWT.getModuleBaseForStaticFiles() == %22http://localhost:9876/rstudio/%22
+var modules = $wnd.__gwt_activeModules %7C%7C %7B%7D;%0A      var rstudio = modules.rstudio %7C%7C %7B%7D;%0A      return !!rstudio.superdevmode
 ;%0A   %7D
+-*/;
 %0A%7D%0A

fix check for SuperDevMode active