Remove GWT UI

This change allows the plugin to build and run with PolyGerrit.
Configuration is available via the config file on the server.

Change-Id: I8e8db97c7649268728712213f12cfcd94f0c0de2
diff --git a/BUILD b/BUILD
index d3014d0..46269f5 100644
--- a/BUILD
+++ b/BUILD
@@ -4,10 +4,8 @@
     name = "menuextender",
     srcs = glob(["src/main/java/**/*.java"]),
     resources = glob(["src/main/**/*"]),
-    gwt_module = "com.googlesource.gerrit.plugins.menuextender.MenuExtenderPlugin",
     manifest_entries = [
         "Gerrit-PluginName: menuextender",
         "Gerrit-Module: com.googlesource.gerrit.plugins.menuextender.Module",
-        "Gerrit-HttpModule: com.googlesource.gerrit.plugins.menuextender.HttpModule",
     ],
 )
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/GetMenus.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/GetMenus.java
index 4812faf..cf1e8ed 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/menuextender/GetMenus.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/GetMenus.java
@@ -19,7 +19,6 @@
 import com.google.gerrit.extensions.annotations.PluginName;
 import com.google.gerrit.extensions.annotations.RequiresCapability;
 import com.google.gerrit.extensions.client.MenuItem;
-import com.google.gerrit.extensions.restapi.RestReadView;
 import com.google.gerrit.extensions.webui.TopMenu;
 import com.google.gerrit.server.config.ConfigResource;
 import com.google.gerrit.server.config.SitePaths;
@@ -37,7 +36,7 @@
 import java.util.List;
 
 @RequiresCapability(GlobalCapability.ADMINISTRATE_SERVER)
-public class GetMenus implements RestReadView<ConfigResource>, TopMenu {
+public class GetMenus implements TopMenu {
   public final static String SECTION_MENU_ITEM = "menuItem";
   public final static String KEY_TOP_MENU = "topMenu";
   public final static String KEY_NAME = "name";
@@ -57,11 +56,6 @@
   }
 
   @Override
-  public List<TopMenu.MenuEntry> apply(ConfigResource rsrc) {
-    return getEntries();
-  }
-
-  @Override
   public List<MenuEntry> getEntries() {
     if (cfg == null || cfgSnapshot.isModified(cfgFile)) {
       cfgSnapshot = FileSnapshot.save(cfgFile);
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/HttpModule.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/HttpModule.java
deleted file mode 100644
index 5abb283..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/menuextender/HttpModule.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) 2014 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.googlesource.gerrit.plugins.menuextender;
-
-import com.google.gerrit.extensions.registration.DynamicSet;
-import com.google.gerrit.extensions.webui.GwtPlugin;
-import com.google.gerrit.extensions.webui.WebUiPlugin;
-import com.google.gerrit.httpd.plugins.HttpPluginModule;
-
-public class HttpModule extends HttpPluginModule {
-
-  @Override
-  protected void configureServlets() {
-    DynamicSet.bind(binder(), WebUiPlugin.class)
-        .toInstance(new GwtPlugin("menuextender_plugin"));
-  }
-}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/MenuExtenderPlugin.gwt.xml b/src/main/java/com/googlesource/gerrit/plugins/menuextender/MenuExtenderPlugin.gwt.xml
deleted file mode 100644
index fa082cc..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/menuextender/MenuExtenderPlugin.gwt.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (C) 2014 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-<module rename-to="menuextender_plugin">
-  <!-- Inherit the core Web Toolkit stuff.                        -->
-  <inherits name="com.google.gwt.user.User"/>
-  <!-- Other module inherits                                      -->
-  <inherits name="com.google.gerrit.Plugin"/>
-  <inherits name="com.google.gwt.http.HTTP"/>
-  <inherits name="com.google.gwt.json.JSON"/>
-  <inherits name='com.google.gwtexpui.clippy.Clippy'/>
-  <inherits name='com.google.gwtexpui.globalkey.GlobalKey'/>
-  <!-- Using GWT built-in themes adds a number of static          -->
-  <!-- resources to the plugin. No theme inherits lines were      -->
-  <!-- added in order to make this plugin as simple as possible   -->
-  <!-- Specify the app entry point class.                         -->
-  <entry-point class="com.googlesource.gerrit.plugins.menuextender.client.MenuExtenderPlugin"/>
-  <stylesheet src="menuextender.css"/>
-</module>
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/Module.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/Module.java
index e8c17d9..459e505 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/menuextender/Module.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/menuextender/Module.java
@@ -14,10 +14,7 @@
 
 package com.googlesource.gerrit.plugins.menuextender;
 
-import static com.google.gerrit.server.config.ConfigResource.CONFIG_KIND;
-
 import com.google.gerrit.extensions.registration.DynamicSet;
-import com.google.gerrit.extensions.restapi.RestApiModule;
 import com.google.gerrit.extensions.webui.TopMenu;
 import com.google.inject.AbstractModule;
 
@@ -26,13 +23,5 @@
   @Override
   protected void configure() {
     DynamicSet.bind(binder(), TopMenu.class).to(GetMenus.class);
-
-    install(new RestApiModule() {
-      @Override
-      protected void configure() {
-        get(CONFIG_KIND, "menus").to(GetMenus.class);
-        put(CONFIG_KIND, "menus").to(PutMenus.class);
-      }
-    });
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/PutMenus.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/PutMenus.java
deleted file mode 100644
index f852bbc..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/menuextender/PutMenus.java
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (C) 2014 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.googlesource.gerrit.plugins.menuextender;
-
-import static com.googlesource.gerrit.plugins.menuextender.GetMenus.KEY_ID;
-import static com.googlesource.gerrit.plugins.menuextender.GetMenus.KEY_NAME;
-import static com.googlesource.gerrit.plugins.menuextender.GetMenus.KEY_TARGET;
-import static com.googlesource.gerrit.plugins.menuextender.GetMenus.KEY_TOP_MENU;
-import static com.googlesource.gerrit.plugins.menuextender.GetMenus.SECTION_MENU_ITEM;
-
-import com.google.common.base.Strings;
-import com.google.gerrit.common.data.GlobalCapability;
-import com.google.gerrit.extensions.annotations.PluginName;
-import com.google.gerrit.extensions.annotations.RequiresCapability;
-import com.google.gerrit.extensions.client.MenuItem;
-import com.google.gerrit.extensions.restapi.RestModifyView;
-import com.google.gerrit.extensions.webui.TopMenu;
-import com.google.gerrit.server.config.ConfigResource;
-import com.google.gerrit.server.config.SitePaths;
-import com.google.inject.Inject;
-
-import com.googlesource.gerrit.plugins.menuextender.PutMenus.Input;
-
-import org.eclipse.jgit.errors.ConfigInvalidException;
-import org.eclipse.jgit.storage.file.FileBasedConfig;
-import org.eclipse.jgit.util.FS;
-
-import java.io.IOException;
-import java.util.List;
-
-@RequiresCapability(GlobalCapability.ADMINISTRATE_SERVER)
-public class PutMenus implements RestModifyView<ConfigResource, Input> {
-  public static class Input {
-    List<TopMenu.MenuEntry> menus;
-  }
-
-  private final String pluginName;
-  private final SitePaths sitePaths;
-  private final GetMenus getMenus;
-
-  @Inject
-  public PutMenus(@PluginName String pluginName, SitePaths sitePaths,
-      GetMenus getMenus) {
-    this.pluginName = pluginName;
-    this.sitePaths = sitePaths;
-    this.getMenus = getMenus;
-  }
-
-  @Override
-  public List<TopMenu.MenuEntry> apply(ConfigResource rsrc, Input input)
-      throws IOException, ConfigInvalidException {
-    FileBasedConfig cfg =
-        new FileBasedConfig(
-            sitePaths.etc_dir.resolve(pluginName + ".config").toFile(),
-            FS.DETECTED);
-    cfg.load();
-    cfg.clear();
-    if (input.menus != null) {
-      for (TopMenu.MenuEntry menuEntry : input.menus) {
-        for (MenuItem menuItem : menuEntry.items) {
-          if (menuItem.name == null) {
-            continue;
-          }
-          cfg.setString(SECTION_MENU_ITEM, menuItem.url, KEY_NAME, menuItem.name);
-          cfg.setString(SECTION_MENU_ITEM, menuItem.url, KEY_TOP_MENU, menuEntry.name);
-
-          if (!Strings.isNullOrEmpty(menuItem.target)) {
-            cfg.setString(SECTION_MENU_ITEM, menuItem.url, KEY_TARGET, menuItem.target);
-          }
-
-          if (!Strings.isNullOrEmpty(menuItem.id)) {
-            cfg.setString(SECTION_MENU_ITEM, menuItem.url, KEY_ID, menuItem.id);
-          }
-        }
-      }
-    }
-    cfg.save();
-    return getMenus.getEntries();
-  }
-}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/MenuConfigurationScreen.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/MenuConfigurationScreen.java
deleted file mode 100644
index c5b601e..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/MenuConfigurationScreen.java
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright (C) 2014 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.googlesource.gerrit.plugins.menuextender.client;
-
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.plugin.client.Plugin;
-import com.google.gerrit.plugin.client.rpc.RestApi;
-import com.google.gerrit.plugin.client.screen.Screen;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.VerticalPanel;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-public class MenuConfigurationScreen extends VerticalPanel {
-
-  static class Factory implements Screen.EntryPoint {
-    @Override
-    public void onLoad(Screen screen) {
-      screen.setPageTitle("Menu Configuration");
-      screen.show(new MenuConfigurationScreen());
-    }
-  }
-
-  private final StringListPanel menusPanel;
-
-  MenuConfigurationScreen() {
-    setStyleName("menuextender-panel");
-
-    Button save = new Button("Save");
-    menusPanel = new StringListPanel("Menu Extensions", Arrays.asList(
-        "Top Menu*", "Menu Item*", "URL*", "Target", "ID Tag"), save, false);
-    add(menusPanel);
-    add(save);
-
-    save.setEnabled(false);
-    save.addClickHandler(new ClickHandler() {
-      @Override
-      public void onClick(ClickEvent event) {
-        doSave();
-      }
-    });
-
-    new RestApi("config").id("server")
-        .view(Plugin.get().getPluginName(), "menus")
-        .get(new AsyncCallback<TopMenuList>() {
-          @Override
-          public void onSuccess(TopMenuList menuList) {
-            Plugin.get().refreshMenuBar();
-            display(menuList);
-          }
-
-          @Override
-          public void onFailure(Throwable caught) {
-            // never invoked
-          }
-        });
-  }
-
-  private void display(TopMenuList menuList) {
-    List<List<String>> valueList = new ArrayList<>();
-    for (TopMenu menu : Natives.asList(menuList)) {
-      for (TopMenuItem item : Natives.asList(menu.getItems())) {
-        List<String> values = new ArrayList<>();
-        values.add(menu.getName());
-        values.add(item.getName());
-        values.add(item.getUrl());
-        values.add(item.getTarget());
-        values.add(item.getId());
-        valueList.add(values);
-      }
-    }
-
-    menusPanel.display(valueList);
-  }
-
-  private void doSave() {
-    List<TopMenu> menus = new ArrayList<>();
-    for (List<String> v : menusPanel.getValues()) {
-      TopMenuItem item = TopMenuItem.create(v.get(1), v.get(2), v.get(3), v.get(4));
-      menus.add(TopMenu.create(v.get(0), Arrays.asList(item)));
-    }
-    MenusInput input = MenusInput.create(menus);
-    new RestApi("config").id("server")
-        .view(Plugin.get().getPluginName(), "menus")
-        .put(input, new AsyncCallback<TopMenuList>() {
-          @Override
-          public void onSuccess(TopMenuList menuList) {
-            Plugin.get().refresh();
-          }
-
-          @Override
-          public void onFailure(Throwable caught) {
-            // never invoked
-          }
-        });
-  }
-}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/MenuExtenderPlugin.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/MenuExtenderPlugin.java
deleted file mode 100644
index be80617..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/MenuExtenderPlugin.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (C) 2014 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.googlesource.gerrit.plugins.menuextender.client;
-
-import com.google.gerrit.plugin.client.Plugin;
-import com.google.gerrit.plugin.client.PluginEntryPoint;
-import com.google.gwt.core.client.GWT;
-
-public class MenuExtenderPlugin extends PluginEntryPoint {
-  public static final Resources RESOURCES = GWT.create(Resources.class);
-
-  @Override
-  public void onPluginLoad() {
-    Plugin.get().screen("settings", new MenuConfigurationScreen.Factory());
-  }
-}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/MenusInput.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/MenusInput.java
deleted file mode 100644
index 6ffe23f..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/MenusInput.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (C) 2014 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.googlesource.gerrit.plugins.menuextender.client;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-import java.util.List;
-
-public class MenusInput extends JavaScriptObject {
-  public static MenusInput create(List<TopMenu> menus) {
-    MenusInput i = createObject().cast();
-    i.setMenus(menus);
-    return i;
-  }
-
-  protected MenusInput() {
-  }
-
-  final void setMenus(List<TopMenu> menus) {
-    initMenus();
-    for (TopMenu m : menus) {
-      addMenu(m);
-    }
-
-  }
-  final native void initMenus() /*-{ this.menus = []; }-*/;
-  final native void addMenu(TopMenu m) /*-{ this.menus.push(m); }-*/;
-}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/OnEditEnabler.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/OnEditEnabler.java
deleted file mode 100644
index 608c94f..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/OnEditEnabler.java
+++ /dev/null
@@ -1,184 +0,0 @@
-// Copyright (C) 2010 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.googlesource.gerrit.plugins.menuextender.client;
-
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.core.client.Scheduler.ScheduledCommand;
-import com.google.gwt.event.dom.client.ChangeEvent;
-import com.google.gwt.event.dom.client.ChangeHandler;
-import com.google.gwt.event.dom.client.FocusEvent;
-import com.google.gwt.event.dom.client.FocusHandler;
-import com.google.gwt.event.dom.client.KeyDownEvent;
-import com.google.gwt.event.dom.client.KeyDownHandler;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.event.dom.client.KeyPressHandler;
-import com.google.gwt.event.dom.client.MouseUpEvent;
-import com.google.gwt.event.dom.client.MouseUpHandler;
-import com.google.gwt.event.logical.shared.ValueChangeEvent;
-import com.google.gwt.event.logical.shared.ValueChangeHandler;
-import com.google.gwt.event.shared.GwtEvent;
-import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.user.client.ui.FocusWidget;
-import com.google.gwt.user.client.ui.ListBox;
-import com.google.gwt.user.client.ui.TextBoxBase;
-import com.google.gwt.user.client.ui.ValueBoxBase;
-
-import java.util.HashMap;
-import java.util.Map;
-
-
-/** Enables a FocusWidget (e.g. a Button) if an edit is detected from any
- *  registered input widget.
- */
-public class OnEditEnabler implements KeyPressHandler, KeyDownHandler,
-   MouseUpHandler, ChangeHandler, ValueChangeHandler<Object> {
-
-  private final FocusWidget widget;
-  private Map<TextBoxBase, String> strings = new HashMap<>();
-  private String originalValue;
-
-
-  // The first parameter to the contructors must be the FocusWidget to enable,
-  // subsequent parameters are widgets to listenTo.
-
-  public OnEditEnabler(final FocusWidget w, final TextBoxBase tb) {
-    this(w);
-    originalValue = tb.getValue().trim();
-    listenTo(tb);
-  }
-
-  public OnEditEnabler(final FocusWidget w, final ListBox lb) {
-    this(w);
-    listenTo(lb);
-  }
-
-  public OnEditEnabler(final FocusWidget w, final CheckBox cb) {
-    this(w);
-    listenTo(cb);
-  }
-
-  public OnEditEnabler(final FocusWidget w) {
-    widget = w;
-  }
-
-
-  // Register input widgets to be listened to
-
-  public void listenTo(final TextBoxBase tb) {
-    strings.put(tb, tb.getText().trim());
-    tb.addKeyPressHandler(this);
-
-    // Is there another way to capture middle button X11 pastes in browsers
-    // which do not yet support ONPASTE events (Firefox)?
-    tb.addMouseUpHandler(this);
-
-    // Resetting the "original text" on focus ensures that we are
-    // up to date with non-user updates of the text (calls to
-    // setText()...) and also up to date with user changes which
-    // occured after enabling "widget".
-    tb.addFocusHandler(new FocusHandler() {
-        @Override
-        public void onFocus(FocusEvent event) {
-          strings.put(tb, tb.getText().trim());
-        }
-      });
-
-    // CTRL-V Pastes in Chrome seem only detectable via BrowserEvents or
-    // KeyDownEvents, the latter is better.
-    tb.addKeyDownHandler(this);
-  }
-
-  public void listenTo(final ListBox lb) {
-    lb.addChangeHandler(this);
-  }
-
-  @SuppressWarnings({"unchecked", "rawtypes"})
-  public void listenTo(final CheckBox cb) {
-    cb.addValueChangeHandler((ValueChangeHandler) this);
-  }
-
-
-  // Handlers
-
-  @Override
-  public void onKeyPress(final KeyPressEvent e) {
-    on(e);
-  }
-
-  @Override
-  public void onKeyDown(final KeyDownEvent e) {
-    on(e);
-  }
-
-  @Override
-  public void onMouseUp(final MouseUpEvent e) {
-    on(e);
-  }
-
-  @Override
-  public void onChange(final ChangeEvent e) {
-    on(e);
-  }
-
-  @SuppressWarnings("rawtypes")
-  @Override
-  public void onValueChange(final ValueChangeEvent e) {
-    on(e);
-  }
-
-  private void on(final GwtEvent<?> e) {
-    if (widget.isEnabled() ||
-        ! (e.getSource() instanceof FocusWidget) ||
-        ! ((FocusWidget) e.getSource()).isEnabled() ) {
-      if (e.getSource() instanceof ValueBoxBase) {
-        final TextBoxBase box = ((TextBoxBase) e.getSource());
-        Scheduler.get().scheduleDeferred(new ScheduledCommand() {
-          @Override
-          public void execute() {
-            if (box.getValue().trim().equals(originalValue)) {
-              widget.setEnabled(false);
-            }
-          }
-        });
-      }
-      return;
-    }
-
-    if (e.getSource() instanceof TextBoxBase) {
-      onTextBoxBase((TextBoxBase) e.getSource());
-    } else {
-      // For many widgets, we can assume that a change is an edit. If
-      // a widget does not work that way, it should be special cased
-      // above.
-      widget.setEnabled(true);
-    }
-  }
-
-  private void onTextBoxBase(final TextBoxBase tb) {
-    // The text appears to not get updated until the handlers complete.
-    Scheduler.get().scheduleDeferred(new ScheduledCommand() {
-      @Override
-      public void execute() {
-        String orig = strings.get(tb);
-        if (orig == null) {
-          orig = "";
-        }
-        if (! orig.equals(tb.getText().trim())) {
-          widget.setEnabled(true);
-        }
-      }
-    });
-  }
-}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/Resources.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/Resources.java
deleted file mode 100644
index dd9a4ee..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/Resources.java
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (C) 2014 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.googlesource.gerrit.plugins.menuextender.client;
-
-import com.google.gwt.resources.client.ClientBundle;
-import com.google.gwt.resources.client.ImageResource;
-
-public interface Resources extends ClientBundle {
-
-  @Source("arrowUp.png")
-  public ImageResource arrowUp();
-
-  @Source("arrowDown.png")
-  public ImageResource arrowDown();
-
-  @Source("info.png")
-  public ImageResource info();
-
-  @Source("listAdd.png")
-  public ImageResource listAdd();
-}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/StringListPanel.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/StringListPanel.java
deleted file mode 100644
index 174adc2..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/StringListPanel.java
+++ /dev/null
@@ -1,295 +0,0 @@
-// Copyright (C) 2014 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.googlesource.gerrit.plugins.menuextender.client;
-
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.KeyCodes;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.event.dom.client.KeyPressHandler;
-import com.google.gwt.event.logical.shared.ValueChangeEvent;
-import com.google.gwt.event.logical.shared.ValueChangeHandler;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.user.client.ui.FlexTable;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.FocusWidget;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.ImageResourceRenderer;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwtexpui.globalkey.client.NpTextBox;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class StringListPanel extends FlowPanel {
-  private final StringListTable t;
-  private final HorizontalPanel titlePanel;
-  protected final HorizontalPanel buttonPanel;
-  private final Button deleteButton;
-  private Image info;
-  protected FocusWidget widget;
-
-  public StringListPanel(String title, List<String> fieldNames, FocusWidget w,
-      boolean autoSort) {
-    widget = w;
-    titlePanel = new HorizontalPanel();
-    Label titleLabel = new Label(title);
-    titleLabel.setStyleName("menuextender-smallHeading");
-    titlePanel.add(titleLabel);
-    add(titlePanel);
-
-    t = new StringListTable(fieldNames, autoSort);
-    add(t);
-
-    buttonPanel = new HorizontalPanel();
-    buttonPanel.setStyleName("menuextender-stringListPanelButtons");
-    deleteButton = new Button("Delete");
-    deleteButton.setEnabled(false);
-    deleteButton.addClickHandler(new ClickHandler() {
-      @Override
-      public void onClick(ClickEvent event) {
-        widget.setEnabled(true);
-        t.deleteChecked();
-      }
-    });
-    buttonPanel.add(deleteButton);
-    add(buttonPanel);
-  }
-
-  public void display(List<List<String>> values) {
-    t.display(values);
-  }
-
-  public void setInfo(String msg) {
-    if (info == null) {
-      info = new Image(MenuExtenderPlugin.RESOURCES.info());
-      titlePanel.add(info);
-    }
-    info.setTitle(msg);
-  }
-
-  public List<List<String>> getValues() {
-    return t.getValues();
-  }
-
-  private class StringListTable extends FlexTable {
-    private final List<NpTextBox> inputs;
-    private final boolean autoSort;
-
-    StringListTable(List<String> names, boolean autoSort) {
-      this.autoSort = autoSort;
-
-      Button addButton =
-          new Button(new ImageResourceRenderer().render(MenuExtenderPlugin.RESOURCES.listAdd()));
-      addButton.setTitle("Add");
-      OnEditEnabler e = new OnEditEnabler(addButton);
-      inputs = new ArrayList<>();
-
-      setStyleName("menuextender-stringListTable");
-      FlexCellFormatter fmt = getFlexCellFormatter();
-      fmt.addStyleName(0, 0, "iconHeader");
-      fmt.addStyleName(0, 0, "leftMostCell");
-      for (int i = 0; i < names.size(); i++) {
-        fmt.addStyleName(0, i + 1, "dataHeader");
-        setText(0, i + 1, names.get(i));
-
-        NpTextBox input = new NpTextBox();
-        input.setVisibleLength(35);
-        input.addKeyPressHandler(new KeyPressHandler() {
-          @Override
-          public void onKeyPress(KeyPressEvent event) {
-            if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
-              widget.setEnabled(true);
-              add();
-            }
-          }
-        });
-        inputs.add(input);
-        fmt.addStyleName(1, i + 1, "dataHeader");
-        setWidget(1, i + 1, input);
-        e.listenTo(input);
-      }
-      addButton.setEnabled(false);
-
-      addButton.addClickHandler(new ClickHandler() {
-        @Override
-        public void onClick(ClickEvent event) {
-          widget.setEnabled(true);
-          add();
-        }
-      });
-      fmt.addStyleName(1, 0, "iconHeader");
-      fmt.addStyleName(1, 0, "leftMostCell");
-      setWidget(1, 0, addButton);
-
-      if (!autoSort) {
-        fmt.addStyleName(0, names.size() + 1, "iconHeader");
-        fmt.addStyleName(0, names.size() + 2, "iconHeader");
-        fmt.addStyleName(1, names.size() + 1, "iconHeader");
-        fmt.addStyleName(1, names.size() + 2, "iconHeader");
-      }
-    }
-
-    void display(List<List<String>> values) {
-      for (int row = 2; row < getRowCount(); row++) {
-        removeRow(row--);
-      }
-      int row = 2;
-      for (List<String> v : values) {
-        populate(row, v);
-        row++;
-      }
-      updateNavigationLinks();
-    }
-
-    List<List<String>> getValues() {
-      List<List<String>> values = new ArrayList<>();
-      for (int row = 2; row < getRowCount(); row++) {
-        values.add(getRowItem(row));
-      }
-      return values;
-    }
-
-    protected List<String> getRowItem(int row) {
-      List<String> v = new ArrayList<>();
-      for (int i = 0; i < inputs.size(); i++) {
-        v.add(getText(row, i + 1));
-      }
-      return v;
-    }
-
-    private void populate(final int row, List<String> values) {
-      FlexCellFormatter fmt = getFlexCellFormatter();
-      fmt.addStyleName(row, 0, "leftMostCell");
-      fmt.addStyleName(row, 0, "iconCell");
-      CheckBox checkBox = new CheckBox();
-      checkBox.addValueChangeHandler(new ValueChangeHandler<Boolean>() {
-        @Override
-        public void onValueChange(ValueChangeEvent<Boolean> event) {
-          enableDelete();
-        }
-      });
-      setWidget(row, 0, checkBox);
-      for (int i = 0; i < values.size(); i++) {
-        fmt.addStyleName(row, i + 1, "dataCell");
-        setText(row, i + 1, values.get(i));
-      }
-      if (!autoSort) {
-        fmt.addStyleName(row, values.size() + 1, "iconCell");
-        fmt.addStyleName(row, values.size() + 2, "dataCell");
-
-        Image down = new Image(MenuExtenderPlugin.RESOURCES.arrowDown());
-        down.setTitle("Down");
-        down.addClickHandler(new ClickHandler() {
-          @Override
-          public void onClick(ClickEvent event) {
-            moveDown(row);
-          }
-        });
-        setWidget(row, values.size() + 1, down);
-
-        Image up = new Image(MenuExtenderPlugin.RESOURCES.arrowUp());
-        up.setTitle("Up");
-        up.addClickHandler(new ClickHandler() {
-          @Override
-          public void onClick(ClickEvent event) {
-            moveUp(row);
-          }
-        });
-        setWidget(row, values.size() + 2, up);
-      }
-    }
-
-    void moveDown(int row) {
-      if (row < getRowCount() - 1) {
-        swap(row, row + 1);
-      }
-    }
-
-    void moveUp(int row) {
-      if (row > 2) {
-        swap(row - 1, row);
-      }
-    }
-
-    void swap(int row1, int row2) {
-      List<String> value = getRowItem(row1);
-      List<String> nextValue = getRowItem(row2);
-      populate(row1, nextValue);
-      populate(row2, value);
-      updateNavigationLinks();
-      widget.setEnabled(true);
-    }
-
-    private void updateNavigationLinks() {
-      if (!autoSort) {
-        for (int row = 2; row < getRowCount(); row++) {
-          getWidget(row, inputs.size() + 1).setVisible(
-              row < getRowCount() - 1);
-          getWidget(row, inputs.size() + 2).setVisible(row > 2);
-        }
-      }
-    }
-
-    void add() {
-      List<String> values = new ArrayList<>();
-      for (NpTextBox input : inputs) {
-        values.add(input.getValue().trim());
-        input.setValue("");
-      }
-      insert(values);
-    }
-
-    void insert(List<String> v) {
-      int insertPos = getRowCount();
-      if (autoSort) {
-        for (int row = 1; row < getRowCount(); row++) {
-          int compareResult = v.get(0).compareTo(getText(row, 1));
-          if (compareResult < 0)  {
-            insertPos = row;
-            break;
-          } else if (compareResult == 0) {
-            return;
-          }
-        }
-      }
-      insertRow(insertPos);
-      populate(insertPos, v);
-      updateNavigationLinks();
-    }
-
-    void enableDelete() {
-      for (int row = 2; row < getRowCount(); row++) {
-        if (((CheckBox) getWidget(row, 0)).getValue()) {
-          deleteButton.setEnabled(true);
-          return;
-        }
-      }
-      deleteButton.setEnabled(false);
-    }
-
-    void deleteChecked() {
-      deleteButton.setEnabled(false);
-      for (int row = 2; row < getRowCount(); row++) {
-        if (((CheckBox) getWidget(row, 0)).getValue()) {
-          removeRow(row--);
-        }
-      }
-      updateNavigationLinks();
-    }
-  }
-}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/TopMenu.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/TopMenu.java
deleted file mode 100644
index d686cfd..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/TopMenu.java
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (C) 2014 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.googlesource.gerrit.plugins.menuextender.client;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-
-import java.util.List;
-
-public class TopMenu extends JavaScriptObject {
-  public static TopMenu create(String name, List<TopMenuItem> items) {
-    TopMenu m = createObject().cast();
-    m.name(name);
-    m.setItems(items);
-    return m;
-  }
-
-  protected TopMenu() {
-  }
-
-  public final native String getName() /*-{ return this.name; }-*/;
-  public final native JsArray<TopMenuItem> getItems() /*-{ return this.items; }-*/;
-
-  public final native void name(String n) /*-{ this.name = n }-*/;
-
-  final void setItems(List<TopMenuItem> items) {
-    initItems();
-    for (TopMenuItem i : items) {
-      addItem(i);
-    }
-
-  }
-  final native void initItems() /*-{ this.items = []; }-*/;
-  final native void addItem(TopMenuItem i) /*-{ this.items.push(i); }-*/;
-}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/TopMenuItem.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/TopMenuItem.java
deleted file mode 100644
index 4e90572..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/TopMenuItem.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (C) 2014 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.googlesource.gerrit.plugins.menuextender.client;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class TopMenuItem extends JavaScriptObject {
-  public static TopMenuItem create(String name, String url, String target,
-      String id) {
-    TopMenuItem i = createObject().cast();
-    i.name(name);
-    i.url(url);
-    i.target(target);
-    i.id(id);
-    return i;
-  }
-
-  public final native String getName() /*-{ return this.name; }-*/;
-  public final native String getUrl() /*-{ return this.url; }-*/;
-  public final native String getTarget() /*-{ return this.target; }-*/;
-  public final native String getId() /*-{ return this.id; }-*/;
-
-  public final native void name(String n) /*-{ this.name = n }-*/;
-  public final native void url(String u) /*-{ this.url = u }-*/;
-  public final native void target(String t) /*-{ this.target = t }-*/;
-  public final native void id(String i) /*-{ this.id = i }-*/;
-
-  protected TopMenuItem() {
-  }
-}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/TopMenuList.java b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/TopMenuList.java
deleted file mode 100644
index 7d46c98..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/TopMenuList.java
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (C) 2014 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.googlesource.gerrit.plugins.menuextender.client;
-
-import com.google.gwt.core.client.JsArray;
-
-public class TopMenuList extends JsArray<TopMenu> {
-
-  protected TopMenuList() {
-  }
-}
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/arrowDown.png b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/arrowDown.png
deleted file mode 100644
index ba67de7..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/arrowDown.png
+++ /dev/null
Binary files differ
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/arrowUp.png b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/arrowUp.png
deleted file mode 100644
index 5674d6c..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/arrowUp.png
+++ /dev/null
Binary files differ
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/info.png b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/info.png
deleted file mode 100644
index 8851b99..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/info.png
+++ /dev/null
Binary files differ
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/listAdd.png b/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/listAdd.png
deleted file mode 100644
index 1aa7f09..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/menuextender/client/listAdd.png
+++ /dev/null
Binary files differ
diff --git a/src/main/java/com/googlesource/gerrit/plugins/menuextender/public/menuextender.css b/src/main/java/com/googlesource/gerrit/plugins/menuextender/public/menuextender.css
deleted file mode 100644
index bcdd84f..0000000
--- a/src/main/java/com/googlesource/gerrit/plugins/menuextender/public/menuextender.css
+++ /dev/null
@@ -1,61 +0,0 @@
-.menuextender-panel {
-  border-spacing: 0px 5px;
-}
-
-.menuextender-stringListTable {
-  border-collapse: separate;
-  border-spacing: 0;
-}
-
-.menuextender-stringListTable .leftMostCell {
-  border-left: 1px solid #EEE;
-}
-
-.menuextender-stringListTable .topMostCell {
-  border-top: 1px solid #EEE;
-}
-
-.menuextender-stringListTable .dataHeader {
-  border: 1px solid #FFF;
-  padding: 2px 6px 1px;
-  background-color: #EEE;
-  font-style: italic;
-  white-space: nowrap;
-  color: textColor;
-}
-
-.menuextender-stringListTable .iconHeader {
-  border-top: 1px solid #FFF;
-  border-bottom: 1px solid #FFF;
-  background-color: #EEE;
-}
-
-.menuextender-stringListTable .dataCell {
-  padding-left: 5px;
-  padding-right: 5px;
-  border-right: 1px solid #EEE;
-  border-bottom: 1px solid #EEE;
-  vertical-align: middle;
-  height: 20px;
-}
-
-.menuextender-stringListTable .iconCell {
-  width: 1px;
-  padding: 0px;
-  vertical-align: middle;
-  border-bottom: 1px solid #EEE;
-}
-
-.menuextender-smallHeading {
-  margin-top: 5px;
-  font-weight: bold;
-}
-
-.menuextender-stringListPanelButtons {
-  margin-left: 0.5em;
-}
-.menuextender-stringListPanelButtons .gwt-Button {
-  margin-right: 2em;
-  font-size: 7pt;
-  padding: 1px;
-}
\ No newline at end of file
diff --git a/src/main/resources/Documentation/rest-api-config.md b/src/main/resources/Documentation/rest-api-config.md
deleted file mode 100644
index 78802f7..0000000
--- a/src/main/resources/Documentation/rest-api-config.md
+++ /dev/null
@@ -1,109 +0,0 @@
-@PLUGIN@ - /config/ REST API
-============================
-
-This page describes the REST endpoints that are added by the @PLUGIN@
-plugin.
-
-Please also take note of the general information on the
-[REST API](../../../Documentation/rest-api.html).
-
-<a id="config-endpoints"> Config Endpoints
-------------------------------------------
-
-### <a id="get-menus"> Get Menus
-_GET /config/\{server\}/@PLUGIN@~menus/_
-
-Gets the additional menus entries.
-
-#### Request
-
-```
-  GET /config/server/@PLUGIN@~menus/ HTTP/1.0
-```
-
-As response a list of [TopMenuEntryInfo](../../../Documentation/rest-api-config.html#top-menu-entry-info)
-entities is returned that describe the additional menu entries.
-
-#### Response
-
-```
-  HTTP/1.1 200 OK
-  Content-Disposition: attachment
-  Content-Type: application/json;charset=UTF-8
-
-  )]}'
-  [
-    {
-      "name": "Gerrit",
-      "items": [
-        {
-          "url": "http://code.google.com/p/gerrit/",
-          "name": "Homepage"
-        }
-      ]
-    }
-  ]
-```
-
-### <a id="set-menus"> Set Menus
-_PUT /config/\{server\}/@PLUGIN@~menus/_
-
-Sets the additional menus entries. Any additional menu entries which
-have been set before are overwritten.
-
-The additional menu entries must be provided in the request body as a
-[MenusInput](#menus-input) entity.
-
-#### Request
-
-```
-  PUT /config/server/@PLUGIN@~menus/ HTTP/1.0
-  Content-Type: application/json;charset=UTF-8
-
-  {
-    "menus": [
-      {
-        "name": "Gerrit",
-        "items": [
-          {
-            "url": "http://code.google.com/p/gerrit/",
-            "name": "Homepage"
-          }
-        ]
-      }
-    ]
-  }
-```
-
-As response a list of [TopMenuEntryInfo](../../../Documentation/rest-api-config.html#top-menu-entry-info)
-entities is returned that describe the additional menu entries.
-
-#### Response
-
-```
-  HTTP/1.1 200 OK
-  Content-Disposition: attachment
-  Content-Type: application/json;charset=UTF-8
-
-  )]}'
-  [
-    {
-      "name": "Gerrit",
-      "items": [
-        {
-          "url": "http://code.google.com/p/gerrit/",
-          "name": "Homepage"
-        }
-      ]
-    }
-  ]
-```
-
-<a id="json-entities">JSON Entities
------------------------------------
-
-### <a id="menus-input"></a>MenusInput
-
-The `MenusInput` entity contains information about additional menu entries.
-
-* _menus_: List of [TopMenuEntryInfo](../../../Documentation/rest-api-config.html#top-menu-entry-info) entities.