Format Java files with google-java-format

Change-Id: I894547ed6da862707705b17406f0311a91850a50
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/GetConfig.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/GetConfig.java
index 7fff131..dc25505 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/emoticons/GetConfig.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/GetConfig.java
@@ -26,8 +26,7 @@
   private final PluginConfig cfg;
 
   @Inject
-  public GetConfig(PluginConfigFactory cfgFactory,
-      @PluginName String pluginName) {
+  public GetConfig(PluginConfigFactory cfgFactory, @PluginName String pluginName) {
     this.cfg = cfgFactory.getFromGerritConfig(pluginName);
   }
 
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/GetPreference.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/GetPreference.java
index 82d6c1b..edc2a12 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/emoticons/GetPreference.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/GetPreference.java
@@ -27,9 +27,7 @@
 import com.google.gerrit.server.project.ProjectCache;
 import com.google.inject.Inject;
 import com.google.inject.Provider;
-
 import com.googlesource.gerrit.plugins.emoticons.GetConfig.ConfigInfo;
-
 import org.eclipse.jgit.lib.Config;
 
 public class GetPreference implements RestReadView<AccountResource> {
@@ -43,7 +41,8 @@
   private final PermissionBackend permissionBackend;
 
   @Inject
-  GetPreference(Provider<IdentifiedUser> self,
+  GetPreference(
+      Provider<IdentifiedUser> self,
       ProjectCache projectCache,
       @PluginName String pluginName,
       Provider<GetConfig> getConfig,
@@ -62,11 +61,13 @@
     }
 
     ConfigInfo globalCfg = getConfig.get().apply(new ConfigResource());
-    Config db =
-        projectCache.getAllProjects().getConfig(pluginName + ".config").get();
+    Config db = projectCache.getAllProjects().getConfig(pluginName + ".config").get();
     ConfigInfo info = new ConfigInfo();
     info.showEmoticons =
-        db.getBoolean(PREFERENCE, self.get().getUserName(), KEY_SHOW_EMOTICONS,
+        db.getBoolean(
+            PREFERENCE,
+            self.get().getUserName(),
+            KEY_SHOW_EMOTICONS,
             (globalCfg.showEmoticons != null ? globalCfg.showEmoticons : true));
     if (!info.showEmoticons) {
       info.showEmoticons = null;
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/HttpModule.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/HttpModule.java
index a02c286..d6ab5be 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/emoticons/HttpModule.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/HttpModule.java
@@ -23,9 +23,7 @@
 public class HttpModule extends HttpPluginModule {
   @Override
   protected void configureServlets() {
-    DynamicSet.bind(binder(), WebUiPlugin.class)
-        .toInstance(new GwtPlugin("emoticons"));
-    DynamicSet.bind(binder(), WebUiPlugin.class)
-        .toInstance(new JavaScriptPlugin("emoticons.js"));
+    DynamicSet.bind(binder(), WebUiPlugin.class).toInstance(new GwtPlugin("emoticons"));
+    DynamicSet.bind(binder(), WebUiPlugin.class).toInstance(new JavaScriptPlugin("emoticons.js"));
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/Module.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/Module.java
index a2a11c5..b76396b 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/emoticons/Module.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/Module.java
@@ -23,14 +23,15 @@
 public class Module extends AbstractModule {
   @Override
   protected void configure() {
-    install(new RestApiModule() {
-      @Override
-      protected void configure() {
-        get(CONFIG_KIND, "config").to(GetConfig.class);
-        put(CONFIG_KIND, "config").to(PutConfig.class);
-        get(ACCOUNT_KIND, "preference").to(GetPreference.class);
-        put(ACCOUNT_KIND, "preference").to(PutPreference.class);
-      }
-    });
+    install(
+        new RestApiModule() {
+          @Override
+          protected void configure() {
+            get(CONFIG_KIND, "config").to(GetConfig.class);
+            put(CONFIG_KIND, "config").to(PutConfig.class);
+            get(ACCOUNT_KIND, "preference").to(GetPreference.class);
+            put(ACCOUNT_KIND, "preference").to(PutPreference.class);
+          }
+        });
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/PutConfig.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/PutConfig.java
index af6d22c..d19cc12 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/emoticons/PutConfig.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/PutConfig.java
@@ -25,17 +25,14 @@
 import com.google.gerrit.server.config.PluginConfigFactory;
 import com.google.gerrit.server.config.SitePaths;
 import com.google.inject.Inject;
-
 import com.googlesource.gerrit.plugins.emoticons.PutConfig.Input;
-
+import java.io.IOException;
 import org.eclipse.jgit.errors.ConfigInvalidException;
 import org.eclipse.jgit.storage.file.FileBasedConfig;
 import org.eclipse.jgit.util.FS;
 
-import java.io.IOException;
-
 @RequiresCapability(value = GlobalCapability.ADMINISTRATE_SERVER, scope = CapabilityScope.CORE)
-public class PutConfig implements RestModifyView<ConfigResource, Input>{
+public class PutConfig implements RestModifyView<ConfigResource, Input> {
   public static class Input {
     public Boolean showEmoticons;
   }
@@ -45,9 +42,7 @@
   private final String pluginName;
 
   @Inject
-  PutConfig(PluginConfigFactory cfgFactory,
-      SitePaths sitePaths,
-      @PluginName String pluginName) {
+  PutConfig(PluginConfigFactory cfgFactory, SitePaths sitePaths, @PluginName String pluginName) {
     this.cfgFactory = cfgFactory;
     this.sitePaths = sitePaths;
     this.pluginName = pluginName;
@@ -59,8 +54,7 @@
     if (input == null) {
       input = new Input();
     }
-    FileBasedConfig cfg =
-        new FileBasedConfig(sitePaths.gerrit_config.toFile(), FS.DETECTED);
+    FileBasedConfig cfg = new FileBasedConfig(sitePaths.gerrit_config.toFile(), FS.DETECTED);
     cfg.load();
 
     if (input.showEmoticons != null) {
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/PutPreference.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/PutPreference.java
index e78e85a..d3bcd91 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/emoticons/PutPreference.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/PutPreference.java
@@ -14,9 +14,9 @@
 
 package com.googlesource.gerrit.plugins.emoticons;
 
+import static com.google.gerrit.server.permissions.GlobalPermission.ADMINISTRATE_SERVER;
 import static com.googlesource.gerrit.plugins.emoticons.GetPreference.KEY_SHOW_EMOTICONS;
 import static com.googlesource.gerrit.plugins.emoticons.GetPreference.PREFERENCE;
-import static com.google.gerrit.server.permissions.GlobalPermission.ADMINISTRATE_SERVER;
 
 import com.google.gerrit.extensions.annotations.PluginName;
 import com.google.gerrit.extensions.restapi.AuthException;
@@ -32,14 +32,11 @@
 import com.google.gerrit.server.project.ProjectCache;
 import com.google.inject.Inject;
 import com.google.inject.Provider;
-
 import com.googlesource.gerrit.plugins.emoticons.PutConfig.Input;
-
+import java.io.IOException;
 import org.eclipse.jgit.errors.RepositoryNotFoundException;
 import org.eclipse.jgit.lib.Config;
 
-import java.io.IOException;
-
 public class PutPreference implements RestModifyView<AccountResource, Input> {
   private final Provider<IdentifiedUser> self;
   private final ProjectCache projectCache;
@@ -48,7 +45,8 @@
   private final PermissionBackend permissionBackend;
 
   @Inject
-  PutPreference(Provider<IdentifiedUser> self,
+  PutPreference(
+      Provider<IdentifiedUser> self,
       ProjectCache projectCache,
       MetaDataUpdate.User metaDataUpdateFactory,
       @PluginName String pluginName,
@@ -62,8 +60,8 @@
 
   @Override
   public Response<String> apply(AccountResource rsrc, Input input)
-      throws AuthException, RepositoryNotFoundException, IOException,
-      UnprocessableEntityException, PermissionBackendException {
+      throws AuthException, RepositoryNotFoundException, IOException, UnprocessableEntityException,
+          PermissionBackendException {
     if (self.get() != rsrc.getUser()) {
       permissionBackend.user(self).check(ADMINISTRATE_SERVER);
     }
@@ -73,13 +71,11 @@
 
     String username = self.get().getUserName();
 
-    ProjectLevelConfig storage =
-        projectCache.getAllProjects().getConfig(pluginName + ".config");
+    ProjectLevelConfig storage = projectCache.getAllProjects().getConfig(pluginName + ".config");
     Config db = storage.get();
     boolean modified = false;
 
-    boolean showEmoticons =
-        db.getBoolean(PREFERENCE, username, KEY_SHOW_EMOTICONS, true);
+    boolean showEmoticons = db.getBoolean(PREFERENCE, username, KEY_SHOW_EMOTICONS, true);
     if (input.showEmoticons != null) {
       if (input.showEmoticons != showEmoticons) {
         db.setBoolean(PREFERENCE, username, KEY_SHOW_EMOTICONS, input.showEmoticons);
@@ -93,13 +89,12 @@
     }
 
     if (modified) {
-      MetaDataUpdate md = metaDataUpdateFactory.create(
-          projectCache.getAllProjects().getProject().getNameKey());
-      md.setMessage("Update " + pluginName + " Preferences for '"
-          + username + "'\n");
+      MetaDataUpdate md =
+          metaDataUpdateFactory.create(projectCache.getAllProjects().getProject().getNameKey());
+      md.setMessage("Update " + pluginName + " Preferences for '" + username + "'\n");
       storage.commit(md);
     }
 
-    return Response.<String> ok("OK");
+    return Response.<String>ok("OK");
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/ConfigInfo.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/ConfigInfo.java
index 9573b43..80d3eba 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/ConfigInfo.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/ConfigInfo.java
@@ -26,6 +26,5 @@
     return g;
   }
 
-  protected ConfigInfo() {
-  }
+  protected ConfigInfo() {}
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsAdminScreen.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsAdminScreen.java
index 049f40e..cd90aa3 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsAdminScreen.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsAdminScreen.java
@@ -29,7 +29,6 @@
   }
 
   EmoticonsAdminScreen() {
-    super(new RestApi("config").id("server").view(
-            Plugin.get().getPluginName(), "config"));
+    super(new RestApi("config").id("server").view(Plugin.get().getPluginName(), "config"));
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsConfigScreen.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsConfigScreen.java
index 879f46c..c0e3ee2 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsConfigScreen.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsConfigScreen.java
@@ -34,17 +34,18 @@
   protected EmoticonsConfigScreen(RestApi restApi) {
     this.restApi = restApi;
     setStyleName("emoticons-config-screen");
-    restApi.get(new AsyncCallback<ConfigInfo>() {
-        @Override
-        public void onSuccess(ConfigInfo info) {
-          display(info);
-        }
+    restApi.get(
+        new AsyncCallback<ConfigInfo>() {
+          @Override
+          public void onSuccess(ConfigInfo info) {
+            display(info);
+          }
 
-        @Override
-        public void onFailure(Throwable caught) {
-          // never invoked
-        }
-      });
+          @Override
+          public void onFailure(Throwable caught) {
+            // never invoked
+          }
+        });
   }
 
   protected void display(ConfigInfo info) {
@@ -63,12 +64,13 @@
 
     saveButton = new Button("Save");
     saveButton.setStyleName("emoticons-save-button");
-    saveButton.addClickHandler(new ClickHandler() {
-      @Override
-      public void onClick(final ClickEvent event) {
-        doSave();
-      }
-    });
+    saveButton.addClickHandler(
+        new ClickHandler() {
+          @Override
+          public void onClick(final ClickEvent event) {
+            doSave();
+          }
+        });
     buttons.add(saveButton);
     saveButton.setEnabled(false);
     new OnEditEnabler(saveButton, showEmoticonsBox);
@@ -80,20 +82,21 @@
   private void doSave() {
     ConfigInfo in = ConfigInfo.create();
     in.setShowEmoticons(showEmoticonsBox.getValue());
-    restApi.put(in, new AsyncCallback<JavaScriptObject>() {
-        @Override
-        public void onSuccess(JavaScriptObject result) {
-          saveButton.setEnabled(false);
-          onSave();
-        }
+    restApi.put(
+        in,
+        new AsyncCallback<JavaScriptObject>() {
+          @Override
+          public void onSuccess(JavaScriptObject result) {
+            saveButton.setEnabled(false);
+            onSave();
+          }
 
-        @Override
-        public void onFailure(Throwable caught) {
-          // never invoked
-        }
-      });
+          @Override
+          public void onFailure(Throwable caught) {
+            // never invoked
+          }
+        });
   }
 
-  protected void onSave() {
-  }
+  protected void onSave() {}
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsPlugin.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsPlugin.java
index 00c5c44..952e3ca 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsPlugin.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsPlugin.java
@@ -23,10 +23,11 @@
 
   @Override
   public void onPluginLoad() {
-    Plugin.get().screen("settings",
-        new EmoticonsAdminScreen.Factory());
-    Plugin.get().settingsScreen("preferences",
-        Plugin.get().getName() + " Preferences",
-        new EmoticonsPreferenceScreen.Factory());
+    Plugin.get().screen("settings", new EmoticonsAdminScreen.Factory());
+    Plugin.get()
+        .settingsScreen(
+            "preferences",
+            Plugin.get().getName() + " Preferences",
+            new EmoticonsPreferenceScreen.Factory());
   }
 }
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsPreferenceScreen.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsPreferenceScreen.java
index a2e113c..cabd6f6 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsPreferenceScreen.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/EmoticonsPreferenceScreen.java
@@ -30,8 +30,7 @@
   }
 
   EmoticonsPreferenceScreen() {
-    super(new RestApi("accounts").id("self").view(
-            Plugin.get().getPluginName(), "preference"));
+    super(new RestApi("accounts").id("self").view(Plugin.get().getPluginName(), "preference"));
   }
 
   @Override
diff --git a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/OnEditEnabler.java b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/OnEditEnabler.java
index 624473b..397edb2 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/OnEditEnabler.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/emoticons/client/OnEditEnabler.java
@@ -34,21 +34,23 @@
 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.
+/**
+ * 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> {
+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 constructors must be the FocusWidget to enable,
   // subsequent parameters are widgets to listenTo.
 
@@ -86,12 +88,13 @@
     // 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());
-        }
-      });
+    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.
@@ -136,19 +139,21 @@
   }
 
   private void on(GwtEvent<?> e) {
-    if (widget.isEnabled() ||
-        ! (e.getSource() instanceof FocusWidget) ||
-        ! ((FocusWidget) e.getSource()).isEnabled() ) {
+    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);
-            }
-          }
-        });
+        Scheduler.get()
+            .scheduleDeferred(
+                new ScheduledCommand() {
+                  @Override
+                  public void execute() {
+                    if (box.getValue().trim().equals(originalValue)) {
+                      widget.setEnabled(false);
+                    }
+                  }
+                });
       }
       return;
     }
@@ -165,17 +170,19 @@
 
   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);
-        }
-      }
-    });
+    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);
+                }
+              }
+            });
   }
 }