Remove GWT UI
This change also discontinues this Maven artifact:
<groupId>com.google.gerrit</groupId>
<artifactId>gerrit-plugin-gwtui</artifactId>
Bug: Issue 6908
Change-Id: I767118ba4a70f288b8f56686ab90aefa059912bb
diff --git a/Documentation/dev-plugins.txt b/Documentation/dev-plugins.txt
index fd29bf7..d5ffda2 100644
--- a/Documentation/dev-plugins.txt
+++ b/Documentation/dev-plugins.txt
@@ -1302,7 +1302,7 @@
[[panels]]
=== Panels
-GWT plugins can contribute panels to Gerrit screens.
+UI plugins can contribute panels to Gerrit screens.
Gerrit screens define extension points where plugins can add GWT
panels with custom controls:
@@ -1878,317 +1878,6 @@
----
-[[gwt_ui_extension]]
-== GWT UI Extension
-Plugins can extend the Gerrit UI with own GWT code.
-
-A GWT plugin must contain a GWT module file, e.g. `HelloPlugin.gwt.xml`,
-that bundles together all the configuration settings of the GWT plugin:
-
-[source,xml]
-----
-<?xml version="1.0" encoding="UTF-8"?>
-<module rename-to="hello_gwt_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"/>
- <!-- 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="${package}.client.HelloPlugin"/>
- <stylesheet src="hello.css"/>
-</module>
-----
-
-The GWT module must inherit `com.google.gerrit.Plugin` and
-`com.google.gwt.http.HTTP`.
-
-To register the GWT module a `GwtPlugin` needs to be bound.
-
-If no Guice modules are declared in the manifest, the GWT plugin may
-use auto-registration by using the `@Listen` annotation:
-
-[source,java]
-----
-@Listen
-public class MyExtension extends GwtPlugin {
- public MyExtension() {
- super("hello_gwt_plugin");
- }
-}
-----
-
-Otherwise the binding must be done in an `HttpModule`:
-
-[source,java]
-----
-public class HttpModule extends HttpPluginModule {
-
- @Override
- protected void configureServlets() {
- DynamicSet.bind(binder(), WebUiPlugin.class)
- .toInstance(new GwtPlugin("hello_gwt_plugin"));
- }
-}
-----
-
-The HTTP module above must be declared in the `pom.xml` for Maven
-driven plugins:
-
-[source,xml]
-----
-<manifestEntries>
- <Gerrit-HttpModule>com.googlesource.gerrit.plugins.myplugin.HttpModule</Gerrit-HttpModule>
-</manifestEntries>
-----
-
-The name that is provided to the `GwtPlugin` must match the GWT
-module name compiled into the plugin. The name of the GWT module
-can be explicitly set in the GWT module XML file by specifying
-the `rename-to` attribute on the module. It is important that the
-module name be unique across all plugins installed on the server,
-as the module name determines the JavaScript namespace used by the
-compiled plugin code.
-
-[source,xml]
-----
-<module rename-to="hello_gwt_plugin">
-----
-
-The actual GWT code must be implemented in a class that extends
-`com.google.gerrit.plugin.client.PluginEntryPoint`:
-
-[source,java]
-----
-public class HelloPlugin extends PluginEntryPoint {
-
- @Override
- public void onPluginLoad() {
- // Create the dialog box
- final DialogBox dialogBox = new DialogBox();
-
- // The content of the dialog comes from a User specified Preference
- dialogBox.setText("Hello from GWT Gerrit UI plugin");
- dialogBox.setAnimationEnabled(true);
- Button closeButton = new Button("Close");
- VerticalPanel dialogVPanel = new VerticalPanel();
- dialogVPanel.setWidth("100%");
- dialogVPanel.setHorizontalAlignment(VerticalPanel.ALIGN_CENTER);
- dialogVPanel.add(closeButton);
-
- closeButton.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent event) {
- dialogBox.hide();
- }
- });
-
- // Set the contents of the Widget
- dialogBox.setWidget(dialogVPanel);
-
- RootPanel rootPanel = RootPanel.get(HelloMenu.MENU_ID);
- rootPanel.getElement().removeAttribute("href");
- rootPanel.addDomHandler(new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- dialogBox.center();
- dialogBox.show();
- }
- }, ClickEvent.getType());
- }
-}
-----
-
-This class must be set as entry point in the GWT module:
-
-[source,xml]
-----
-<entry-point class="${package}.client.HelloPlugin"/>
-----
-
-In addition this class must be defined as module in the `pom.xml` for the
-`gwt-maven-plugin` and the `webappDirectory` option of `gwt-maven-plugin`
-must be set to `${project.build.directory}/classes/static`:
-
-[source,xml]
-----
-<plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>gwt-maven-plugin</artifactId>
- <version>2.7.0</version>
- <configuration>
- <module>com.googlesource.gerrit.plugins.myplugin.HelloPlugin</module>
- <disableClassMetadata>true</disableClassMetadata>
- <disableCastChecking>true</disableCastChecking>
- <webappDirectory>${project.build.directory}/classes/static</webappDirectory>
- </configuration>
- <executions>
- <execution>
- <goals>
- <goal>compile</goal>
- </goals>
- </execution>
- </executions>
-</plugin>
-----
-
-To attach a GWT widget defined by the plugin to the Gerrit core UI
-`com.google.gwt.user.client.ui.RootPanel` can be used to manipulate the
-Gerrit core widgets:
-
-[source,java]
-----
-RootPanel rootPanel = RootPanel.get(HelloMenu.MENU_ID);
-rootPanel.getElement().removeAttribute("href");
-rootPanel.addDomHandler(new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- dialogBox.center();
- dialogBox.show();
- }
-}, ClickEvent.getType());
-----
-
-GWT plugins can come with their own css file. This css file must have a
-unique name and must be registered in the GWT module:
-
-[source,xml]
-----
-<stylesheet src="hello.css"/>
-----
-
-If a GWT plugin wants to invoke the Gerrit REST API it can use
-`com.google.gerrit.plugin.client.rpc.RestApi` to construct the URL
-path and to trigger the REST calls.
-
-Example for invoking a Gerrit core REST endpoint:
-
-[source,java]
-----
-new RestApi("projects").id(projectName).view("description")
- .put("new description", new AsyncCallback<JavaScriptObject>() {
-
- @Override
- public void onSuccess(JavaScriptObject result) {
- // TODO
- }
-
- @Override
- public void onFailure(Throwable caught) {
- // never invoked
- }
-});
-----
-
-Example for invoking a REST endpoint defined by a plugin:
-
-[source,java]
-----
-new RestApi("projects").id(projectName).view("myplugin", "myview")
- .get(new AsyncCallback<JavaScriptObject>() {
-
- @Override
- public void onSuccess(JavaScriptObject result) {
- // TODO
- }
-
- @Override
- public void onFailure(Throwable caught) {
- // never invoked
- }
-});
-----
-
-The `onFailure(Throwable)` of the provided callback is never invoked.
-If an error occurs, it is shown in an error dialog.
-
-In order to be able to do REST calls the GWT module must inherit
-`com.google.gwt.json.JSON`:
-
-[source,xml]
-----
-<inherits name="com.google.gwt.json.JSON"/>
-----
-
-[[screen]]
-== Add Screen
-A link:#gwt_ui_extension[GWT plugin] can link:#top-menu-extensions[add
-a menu item] that opens a screen that is implemented by the plugin.
-This way plugin screens can be fully integrated into the Gerrit UI.
-
-Example menu item:
-[source,java]
-----
-public class MyMenu implements TopMenu {
- private final List<MenuEntry> menuEntries;
-
- @Inject
- public MyMenu(@PluginName String name) {
- menuEntries = new ArrayList<>();
- menuEntries.add(new MenuEntry("My Menu", Collections.singletonList(
- new MenuItem("My Screen", "#/x/" + name + "/my-screen", ""))));
- }
-
- @Override
- public List<MenuEntry> getEntries() {
- return menuEntries;
- }
-}
-----
-
-Example screen:
-[source,java]
-----
-public class MyPlugin extends PluginEntryPoint {
- @Override
- public void onPluginLoad() {
- Plugin.get().screen("my-screen", new Screen.EntryPoint() {
- @Override
- public void onLoad(Screen screen) {
- screen.add(new InlineLabel("My Screen");
- screen.show();
- }
- });
- }
-}
-----
-
-[[user-settings-screen]]
-== Add User Settings Screen
-
-A link:#gwt_ui_extension[GWT plugin] can implement a user settings
-screen that is integrated into the Gerrit user settings menu.
-
-Example settings screen:
-[source,java]
-----
-public class MyPlugin extends PluginEntryPoint {
- @Override
- public void onPluginLoad() {
- Plugin.get().settingsScreen("my-preferences", "My Preferences",
- new Screen.EntryPoint() {
- @Override
- public void onLoad(Screen screen) {
- screen.setPageTitle("Settings");
- screen.add(new InlineLabel("My Preferences"));
- screen.show();
- }
- });
- }
-}
-----
-
-By defining an link:config-gerrit.html#urlAlias[urlAlias] Gerrit
-administrators can map plugin screens into the Gerrit URL namespace or
-even replace Gerrit screens by plugin screens.
-
-Plugins may also programatically add URL aliases in the preferences of
-of a user. This way certain screens can be replaced for certain users.
-E.g. the plugin may offer a user preferences setting for choosing a
-screen that then sets/unsets a URL alias for the user.
-
[[settings-screen]]
== Plugin Settings Screen