Revision: 6700
Author: [email protected]
Date: Thu Nov  5 10:42:40 2009
Log: Removing lots of old, unneeded code from DevMode hierarchy.

Review by: bobv
http://code.google.com/p/google-web-toolkit/source/detail?r=6700

Modified:
  /trunk/dev/core/src/com/google/gwt/dev/DevMode.java
  /trunk/dev/core/src/com/google/gwt/dev/DevModeBase.java
  /trunk/dev/core/src/com/google/gwt/dev/GWTCompiler.java
  /trunk/dev/core/src/com/google/gwt/dev/GWTShell.java
  /trunk/dev/core/src/com/google/gwt/dev/shell/BrowserWidgetHost.java
  /trunk/user/src/com/google/gwt/junit/JUnitShell.java

=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/DevMode.java Wed Nov  4 08:32:00  
2009
+++ /trunk/dev/core/src/com/google/gwt/dev/DevMode.java Thu Nov  5 10:42:40  
2009
@@ -21,7 +21,6 @@
  import com.google.gwt.core.ext.UnableToCompleteException;
  import com.google.gwt.core.ext.linker.ArtifactSet;
  import com.google.gwt.core.ext.linker.impl.StandardLinkerContext;
-import com.google.gwt.dev.Compiler.CompilerOptionsImpl;
  import com.google.gwt.dev.cfg.ModuleDef;
  import com.google.gwt.dev.shell.ArtifactAcceptor;
  import com.google.gwt.dev.shell.jetty.JettyLauncher;
@@ -296,20 +295,6 @@
        // ignore, problem already logged
      }
    }
-
-  @Override
-  protected void compile(TreeLogger logger) throws  
UnableToCompleteException {
-    CompilerOptions newOptions = new CompilerOptionsImpl(options);
-    newOptions.setCompilationStateRetained(true);
-    new Compiler(newOptions).run(logger);
-  }
-
-  @Deprecated
-  @Override
-  protected void compile(TreeLogger logger, ModuleDef moduleDef)
-      throws UnableToCompleteException {
-    throw new UnsupportedOperationException();
-  }

    @Override
    protected HostedModeBaseOptions createOptions() {
@@ -418,33 +403,6 @@
    protected String getWebServerName() {
      return options.getServletContainerLauncher().getName();
    }
-
-  @Override
-  protected boolean initModule(String moduleName) {
-    ModuleDef module = modulesByName.get(moduleName);
-    if (module == null) {
-      getTopLogger().log(
-          TreeLogger.WARN,
-          "Unknown module requested '"
-              + moduleName
-              + "'; all active GWT modules must be specified in the  
command line arguments");
-      return false;
-    }
-    try {
-      TreeLogger logger = getTopLogger().branch(TreeLogger.DEBUG,
-          "Initializing module '" + module.getName() + "' for hosted  
mode");
-      boolean shouldRefreshPage = false;
-      if (module.isGwtXmlFileStale()) {
-        shouldRefreshPage = true;
-        module = loadModule(logger, module.getCanonicalName(), false);
-      }
-      link(logger, module);
-      return shouldRefreshPage;
-    } catch (UnableToCompleteException e) {
-      // Already logged.
-      return false;
-    }
-  }

    /*
     * Overridden to keep our map up to date.
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/DevModeBase.java     Thu Nov  5  
08:35:05 2009
+++ /trunk/dev/core/src/com/google/gwt/dev/DevModeBase.java     Thu Nov  5  
10:42:40 2009
@@ -73,25 +73,6 @@
     */
    public class UiBrowserWidgetHostImpl implements BrowserWidgetHost {

-    public void compile() throws UnableToCompleteException {
-      if (isLegacyMode()) {
-        throw new UnsupportedOperationException();
-      }
-      DevModeBase.this.compile(getLogger());
-    }
-
-    @Deprecated
-    public void compile(String[] moduleNames) throws  
UnableToCompleteException {
-      if (!isLegacyMode()) {
-        throw new UnsupportedOperationException();
-      }
-      for (int i = 0; i < moduleNames.length; i++) {
-        String moduleName = moduleNames[i];
-        ModuleDef moduleDef = loadModule(getLogger(), moduleName, true);
-        DevModeBase.this.compile(getLogger(), moduleDef);
-      }
-    }
-
      public ModuleSpaceHost createModuleSpaceHost(TreeLogger mainLogger,
          String moduleName, String userAgent, String url, String tabKey,
          String sessionKey, BrowserChannelServer serverChannel,
@@ -132,19 +113,6 @@
      public TreeLogger getLogger() {
        return getTopLogger();
      }
-
-    public boolean initModule(String moduleName) {
-      return DevModeBase.this.initModule(moduleName);
-    }
-
-    @Deprecated
-    public boolean isLegacyMode() {
-      return DevModeBase.this instanceof GWTShell;
-    }
-
-    public String normalizeURL(String whatTheUserTyped) {
-      return DevModeBase.this.normalizeURL(whatTheUserTyped);
-    }

      public void unloadModule(ModuleSpaceHost moduleSpaceHost) {
        ModuleHandle module = loadedModules.remove(moduleSpaceHost);
@@ -733,7 +701,7 @@
      String startupURL = "";
      try {
        for (String prenormalized : options.getStartupURLs()) {
-        startupURL = normalizeURL(prenormalized);
+        startupURL = normalizeURL(prenormalized, getPort(), getHost());
          logger.log(TreeLogger.INFO, "Starting URL: " + startupURL, null);
          launchURL(startupURL);
        }
@@ -742,10 +710,6 @@
            "Unable to open new window for startup URL: " + startupURL,  
null);
      }
    }
-
-  public final String normalizeURL(String unknownUrlText) {
-    return normalizeURL(unknownUrlText, getPort(), getHost());
-  }

    /**
     * Callback for the UI to indicate it is done.
@@ -790,21 +754,6 @@
    protected long checkForUpdatesInterval() {
      return CheckForUpdates.ONE_MINUTE;
    }
-
-  /**
-   * Compiles all modules.
-   *
-   * @throws UnableToCompleteException
-   */
-  protected abstract void compile(TreeLogger logger)
-      throws UnableToCompleteException;
-
-  /**
-   * Compiles a module (legacy only).
-   */
-  @Deprecated
-  protected abstract void compile(TreeLogger logger, ModuleDef moduleDef)
-      throws UnableToCompleteException;

    protected abstract HostedModeBaseOptions createOptions();

@@ -890,26 +839,6 @@
    protected String getHost() {
      return "localhost";
    }
-
-  /**
-   * Called from a selection script as it begins to load in hosted mode.  
This
-   * triggers a hosted mode link, which might actually update the running
-   * selection script.
-   *
-   * @param moduleName the module to link
-   * @return <code>true</code> if the selection script was overwritten;  
this
-   *         will trigger a full-page refresh by the calling (out of date)
-   *         selection script
-   */
-  protected boolean initModule(String moduleName) {
-    /*
-     * Not used in legacy mode due to GWTShellServlet playing this role.
-     *
-     * TODO: something smarter here and actually make GWTShellServlet less
-     * magic?
-     */
-    return false;
-  }

    /**
     * By default we will open the application window.
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/GWTCompiler.java     Tue Oct 27  
23:15:10 2009
+++ /trunk/dev/core/src/com/google/gwt/dev/GWTCompiler.java     Thu Nov  5  
10:42:40 2009
@@ -66,7 +66,10 @@
      }
    }

-  static class GWTCompilerOptionsImpl extends PrecompileOptionsImpl  
implements
+  /**
+   * Simple implementation of {...@link LegacyCompilerOptions}.
+   */
+  public static class GWTCompilerOptionsImpl extends PrecompileOptionsImpl  
implements
        LegacyCompilerOptions {

      private int localWorkers;
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/GWTShell.java        Mon Oct 26  
14:02:26 2009
+++ /trunk/dev/core/src/com/google/gwt/dev/GWTShell.java        Thu Nov  5  
10:42:40 2009
@@ -19,7 +19,6 @@
  import com.google.gwt.core.ext.UnableToCompleteException;
  import com.google.gwt.core.ext.linker.ArtifactSet;
  import com.google.gwt.core.ext.linker.EmittedArtifact;
-import com.google.gwt.dev.GWTCompiler.GWTCompilerOptionsImpl;
  import com.google.gwt.dev.cfg.ModuleDef;
  import com.google.gwt.dev.shell.ArtifactAcceptor;
  import com.google.gwt.dev.shell.WorkDirs;
@@ -185,26 +184,6 @@
    public void restartServer(TreeLogger logger) throws  
UnableToCompleteException {
      // Unimplemented.
    }
-
-  @Override
-  protected void compile(TreeLogger logger) throws  
UnableToCompleteException {
-    throw new UnsupportedOperationException();
-  }
-
-  /**
-   * Compiles a logical module def. The caller can modify the specified  
module
-   * def programmatically in some cases (this is needed for JUnit support,  
for
-   * example).
-   */
-  @Override
-  protected void compile(TreeLogger logger, ModuleDef moduleDef)
-      throws UnableToCompleteException {
-    LegacyCompilerOptions newOptions = new GWTCompilerOptionsImpl(options);
-    newOptions.setCompilationStateRetained(true);
-    if (!new GWTCompiler(newOptions).run(logger, moduleDef)) {
-      // TODO(jat): error dialog?
-    }
-  }

    @Override
    protected HostedModeBaseOptions createOptions() {
=======================================
--- /trunk/dev/core/src/com/google/gwt/dev/shell/BrowserWidgetHost.java Tue  
Oct 13 16:57:19 2009
+++ /trunk/dev/core/src/com/google/gwt/dev/shell/BrowserWidgetHost.java Thu  
Nov  5 10:42:40 2009
@@ -23,23 +23,6 @@
   * <code>ModuleSpaceHost</code>, and the compiler.
   */
  public interface BrowserWidgetHost {
-  /**
-   * Perform a web-mode compile on the user-specified set of modules. Used  
in
-   * non-legacy mode.
-   *
-   * @throws UnableToCompleteException
-   */
-  void compile() throws UnableToCompleteException;
-
-  /**
-   * Compile the specified set of modules, used in legacy mode.
-   *
-   * @param modules the names of the modules to compile
-   * @throws UnableToCompleteException
-   * @deprecated Will be removed when legacy shell mode is removed
-   */
-  @Deprecated
-  void compile(String[] modules) throws UnableToCompleteException;

    /**
     * For OOPHM.
@@ -62,29 +45,6 @@

    TreeLogger getLogger();

-  /**
-   * Called from a selection script as it begins to load in hosted mode.  
This
-   * triggers a hosted mode link, which might actually update the running
-   * selection script.
-   *
-   * @param moduleName the module to link
-   * @return <code>true</code> if the selection script was overwritten;  
this
-   *         will trigger a full-page refresh by the calling (out of date)
-   *         selection script
-   */
-  boolean initModule(String moduleName);
-
-  /**
-   * Returns <code>true</code> if running in legacy mode.
-   *
-   * @deprecated Will be removed when legacy shell mode is removed
-   */
-  @Deprecated
-  boolean isLegacyMode();
-
-  String normalizeURL(String whatTheUserTyped);
-
-
    /**
     * For OOPHM.
     */
=======================================
--- /trunk/user/src/com/google/gwt/junit/JUnitShell.java        Thu Nov  5  
06:46:58 2009
+++ /trunk/user/src/com/google/gwt/junit/JUnitShell.java        Thu Nov  5  
10:42:40 2009
@@ -20,7 +20,10 @@
  import com.google.gwt.core.ext.TreeLogger.Type;
  import com.google.gwt.core.ext.typeinfo.JClassType;
  import com.google.gwt.core.ext.typeinfo.TypeOracle;
+import com.google.gwt.dev.GWTCompiler;
  import com.google.gwt.dev.GWTShell;
+import com.google.gwt.dev.LegacyCompilerOptions;
+import com.google.gwt.dev.GWTCompiler.GWTCompilerOptionsImpl;
  import com.google.gwt.dev.cfg.BindingProperty;
  import com.google.gwt.dev.cfg.ModuleDef;
  import com.google.gwt.dev.cfg.ModuleDefLoader;
@@ -848,7 +851,11 @@
              userAgents);
        }
      }
-    super.compile(getTopLogger(), module);
+    LegacyCompilerOptions newOptions = new GWTCompilerOptionsImpl(options);
+    newOptions.setCompilationStateRetained(true);
+    if (!new GWTCompiler(newOptions).run(getTopLogger(), module)) {
+      throw new UnableToCompleteException();
+    }
    }

    void maybeCompileForWebMode(String moduleName, String... userAgents)

--~--~---------~--~----~------------~-------~--~----~
http://groups.google.com/group/Google-Web-Toolkit-Contributors
-~----------~----~----~----~------~----~------~--~---

Reply via email to