From f006c3edce5d3fda894b1bea0b7737a8cff14819 Mon Sep 17 00:00:00 2001 From: Edwin Kempin Date: Mon, 30 Dec 2019 16:32:53 +0100 Subject: [PATCH] Remove theme preferences The themes were only used by CodeMirror in the GWT UI. Since the GWT UI is gone these preferences are no longer needed. Signed-off-by: Edwin Kempin Change-Id: I25196483fc1c3f97b23c4a6269b516f3429ae44e --- Documentation/rest-api-accounts.txt | 12 -- .../client/DiffPreferencesInfo.java | 2 - .../client/EditPreferencesInfo.java | 2 - .../gerrit/extensions/client/Theme.java | 123 ------------------ .../api/accounts/DiffPreferencesIT.java | 2 - .../api/accounts/EditPreferencesIT.java | 4 - .../gerrit/server/config/ConfigUtilTest.java | 8 -- 7 files changed, 153 deletions(-) delete mode 100644 java/com/google/gerrit/extensions/client/Theme.java diff --git a/Documentation/rest-api-accounts.txt b/Documentation/rest-api-accounts.txt index 9f19c59253..bbbab54414 100644 --- a/Documentation/rest-api-accounts.txt +++ b/Documentation/rest-api-accounts.txt @@ -1423,7 +1423,6 @@ link:#diff-preferences-info[DiffPreferencesInfo] entity. )]}' { "context": 10, - "theme": "DEFAULT", "ignore_whitespace": "IGNORE_ALL", "intraline_difference": true, "line_length": 100, @@ -1454,7 +1453,6 @@ link:#diff-preferences-input[DiffPreferencesInput] entity. { "context": 10, - "theme": "ECLIPSE", "ignore_whitespace": "IGNORE_ALL", "intraline_difference": true, "line_length": 100, @@ -1480,7 +1478,6 @@ link:#diff-preferences-info[DiffPreferencesInfo] entity. )]}' { "context": 10, - "theme": "ECLIPSE", "ignore_whitespace": "IGNORE_ALL", "intraline_difference": true, "line_length": 100, @@ -1517,7 +1514,6 @@ link:#edit-preferences-info[EditPreferencesInfo] entity. )]}' { - "theme": "ECLIPSE", "tab_size": 4, "line_length": 80, "indent_unit": 2, @@ -1549,7 +1545,6 @@ link:#edit-preferences-info[EditPreferencesInfo] entity. Content-Type: application/json;charset=UTF-8 { - "theme": "ECLIPSE", "tab_size": 4, "line_length": 80, "indent_unit": 2, @@ -1576,7 +1571,6 @@ link:#edit-preferences-info[EditPreferencesInfo] entity. )]}' { - "theme": "ECLIPSE", "tab_size": 4, "line_length": 80, "cursor_blink_rate": 530, @@ -2441,9 +2435,6 @@ preferences of a user. |Field Name ||Description |`context` || The number of lines of context when viewing a patch. -|`theme` || -The CodeMirror theme name in upper case, for example `DEFAULT`. All the themes -from the CodeMirror release that Gerrit is using are available. |`expand_all_comments` |not set if `false`| Whether all inline comments should be automatically expanded. |`ignore_whitespace` || @@ -2565,9 +2556,6 @@ preferences of a user. [options="header",cols="1,^1,5"] |=========================================== |Field Name ||Description -|`theme` || -The CodeMirror theme name in upper case, for example `DEFAULT`. All the themes -from the CodeMirror release that Gerrit is using are available. |`tab_size` || Number of spaces that should be used to display one tab. |`line_length` || diff --git a/java/com/google/gerrit/extensions/client/DiffPreferencesInfo.java b/java/com/google/gerrit/extensions/client/DiffPreferencesInfo.java index 0d5bdfa01b..652abcc7ab 100644 --- a/java/com/google/gerrit/extensions/client/DiffPreferencesInfo.java +++ b/java/com/google/gerrit/extensions/client/DiffPreferencesInfo.java @@ -60,7 +60,6 @@ public class DiffPreferencesInfo { public Boolean hideEmptyPane; public Boolean matchBrackets; public Boolean lineWrapping; - public Theme theme; public Whitespace ignoreWhitespace; public Boolean retainHeader; public Boolean skipDeleted; @@ -75,7 +74,6 @@ public class DiffPreferencesInfo { i.lineLength = DEFAULT_LINE_LENGTH; i.cursorBlinkRate = 0; i.ignoreWhitespace = Whitespace.IGNORE_NONE; - i.theme = Theme.DEFAULT; i.expandAllComments = false; i.intralineDifference = true; i.manualReview = false; diff --git a/java/com/google/gerrit/extensions/client/EditPreferencesInfo.java b/java/com/google/gerrit/extensions/client/EditPreferencesInfo.java index 32c2343da2..6672cb19b0 100644 --- a/java/com/google/gerrit/extensions/client/EditPreferencesInfo.java +++ b/java/com/google/gerrit/extensions/client/EditPreferencesInfo.java @@ -30,7 +30,6 @@ public class EditPreferencesInfo { public Boolean indentWithTabs; public Boolean autoCloseBrackets; public Boolean showBase; - public Theme theme; public static EditPreferencesInfo defaults() { EditPreferencesInfo i = new EditPreferencesInfo(); @@ -48,7 +47,6 @@ public class EditPreferencesInfo { i.indentWithTabs = false; i.autoCloseBrackets = false; i.showBase = false; - i.theme = Theme.DEFAULT; return i; } } diff --git a/java/com/google/gerrit/extensions/client/Theme.java b/java/com/google/gerrit/extensions/client/Theme.java deleted file mode 100644 index d7a5b80295..0000000000 --- a/java/com/google/gerrit/extensions/client/Theme.java +++ /dev/null @@ -1,123 +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.google.gerrit.extensions.client; - -public enum Theme { - // Light themes - DEFAULT, - DAY_3024, - DUOTONE_LIGHT, - BASE16_LIGHT, - ECLIPSE, - ELEGANT, - MDN_LIKE, - NEAT, - NEO, - PARAISO_LIGHT, - SOLARIZED, - TTCN, - XQ_LIGHT, - YETI, - - // Dark themes - NIGHT_3024, - ABCDEF, - AMBIANCE, - BASE16_DARK, - BESPIN, - BLACKBOARD, - COBALT, - COLORFORTH, - DRACULA, - DUOTONE_DARK, - ERLANG_DARK, - HOPSCOTCH, - ICECODER, - ISOTOPE, - LESSER_DARK, - LIQUIBYTE, - MATERIAL, - MBO, - MIDNIGHT, - MONOKAI, - NIGHT, - PARAISO_DARK, - PASTEL_ON_DARK, - RAILSCASTS, - RUBYBLUE, - SETI, - THE_MATRIX, - TOMORROW_NIGHT_BRIGHT, - TOMORROW_NIGHT_EIGHTIES, - TWILIGHT, - VIBRANT_INK, - XQ_DARK, - ZENBURN; - - public boolean isDark() { - switch (this) { - case ABCDEF: - case AMBIANCE: - case BASE16_DARK: - case BESPIN: - case BLACKBOARD: - case COBALT: - case COLORFORTH: - case DRACULA: - case DUOTONE_DARK: - case ERLANG_DARK: - case HOPSCOTCH: - case ICECODER: - case ISOTOPE: - case LESSER_DARK: - case LIQUIBYTE: - case MATERIAL: - case MBO: - case MIDNIGHT: - case MONOKAI: - case NIGHT: - case NIGHT_3024: - case PARAISO_DARK: - case PASTEL_ON_DARK: - case RAILSCASTS: - case RUBYBLUE: - case SETI: - case THE_MATRIX: - case TOMORROW_NIGHT_BRIGHT: - case TOMORROW_NIGHT_EIGHTIES: - case TWILIGHT: - case VIBRANT_INK: - case XQ_DARK: - case ZENBURN: - return true; - case BASE16_LIGHT: - case DEFAULT: - case DAY_3024: - case DUOTONE_LIGHT: - case ECLIPSE: - case ELEGANT: - case MDN_LIKE: - case NEAT: - case NEO: - case PARAISO_LIGHT: - case SOLARIZED: - case TTCN: - case XQ_LIGHT: - case YETI: - default: - return false; - } - } -} diff --git a/javatests/com/google/gerrit/acceptance/api/accounts/DiffPreferencesIT.java b/javatests/com/google/gerrit/acceptance/api/accounts/DiffPreferencesIT.java index d7e765bb74..a442ddd273 100644 --- a/javatests/com/google/gerrit/acceptance/api/accounts/DiffPreferencesIT.java +++ b/javatests/com/google/gerrit/acceptance/api/accounts/DiffPreferencesIT.java @@ -21,7 +21,6 @@ import com.google.gerrit.acceptance.AbstractDaemonTest; import com.google.gerrit.acceptance.NoHttpd; import com.google.gerrit.extensions.client.DiffPreferencesInfo; import com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace; -import com.google.gerrit.extensions.client.Theme; import org.junit.Test; @NoHttpd @@ -43,7 +42,6 @@ public class DiffPreferencesIT extends AbstractDaemonTest { i.fontSize *= -1; i.lineLength *= -1; i.cursorBlinkRate = 500; - i.theme = Theme.MIDNIGHT; i.ignoreWhitespace = Whitespace.IGNORE_ALL; i.expandAllComments ^= true; i.intralineDifference ^= true; diff --git a/javatests/com/google/gerrit/acceptance/api/accounts/EditPreferencesIT.java b/javatests/com/google/gerrit/acceptance/api/accounts/EditPreferencesIT.java index 3bca9bd3da..f142c0881e 100644 --- a/javatests/com/google/gerrit/acceptance/api/accounts/EditPreferencesIT.java +++ b/javatests/com/google/gerrit/acceptance/api/accounts/EditPreferencesIT.java @@ -19,7 +19,6 @@ import static com.google.common.truth.Truth.assertThat; import com.google.gerrit.acceptance.AbstractDaemonTest; import com.google.gerrit.acceptance.NoHttpd; import com.google.gerrit.extensions.client.EditPreferencesInfo; -import com.google.gerrit.extensions.client.Theme; import org.junit.Test; @NoHttpd @@ -42,7 +41,6 @@ public class EditPreferencesIT extends AbstractDaemonTest { assertThat(out.indentWithTabs).isNull(); assertThat(out.autoCloseBrackets).isNull(); assertThat(out.showBase).isNull(); - assertThat(out.theme).isEqualTo(Theme.DEFAULT); // change some default values out.lineLength = 80; @@ -59,7 +57,6 @@ public class EditPreferencesIT extends AbstractDaemonTest { out.indentWithTabs = true; out.autoCloseBrackets = true; out.showBase = true; - out.theme = Theme.TWILIGHT; EditPreferencesInfo info = gApi.accounts().id(admin.id().toString()).setEditPreferences(out); @@ -91,6 +88,5 @@ public class EditPreferencesIT extends AbstractDaemonTest { assertThat(out.indentWithTabs).isEqualTo(in.indentWithTabs); assertThat(out.autoCloseBrackets).isEqualTo(in.autoCloseBrackets); assertThat(out.showBase).isEqualTo(in.showBase); - assertThat(out.theme).isEqualTo(in.theme); } } diff --git a/javatests/com/google/gerrit/server/config/ConfigUtilTest.java b/javatests/com/google/gerrit/server/config/ConfigUtilTest.java index 75fb94e713..b1378ad265 100644 --- a/javatests/com/google/gerrit/server/config/ConfigUtilTest.java +++ b/javatests/com/google/gerrit/server/config/ConfigUtilTest.java @@ -21,7 +21,6 @@ import static java.util.concurrent.TimeUnit.MILLISECONDS; import static java.util.concurrent.TimeUnit.MINUTES; import static java.util.concurrent.TimeUnit.SECONDS; -import com.google.gerrit.extensions.client.Theme; import com.google.gerrit.testing.GerritBaseTests; import java.util.List; import java.util.Map; @@ -48,8 +47,6 @@ public class ConfigUtilTest extends GerritBaseTests { public String s; public String sd; public String nd; - public Theme t; - public Theme td; public List list; public Map map; @@ -67,8 +64,6 @@ public class ConfigUtilTest extends GerritBaseTests { i.s = "foo"; i.sd = "bar"; // i.nd = null; // Don't need to explicitly set it; it's null by default - i.t = Theme.DEFAULT; - i.td = Theme.DEFAULT; return i; } } @@ -86,7 +81,6 @@ public class ConfigUtilTest extends GerritBaseTests { in.bb = true; in.bd = false; in.s = "baz"; - in.t = Theme.MIDNIGHT; Config cfg = new Config(); ConfigUtil.storeSection(cfg, SECT, SUB, in, d); @@ -117,8 +111,6 @@ public class ConfigUtilTest extends GerritBaseTests { assertThat(out.s).isEqualTo(in.s); assertThat(out.sd).isEqualTo(d.sd); assertThat(out.nd).isNull(); - assertThat(out.t).isEqualTo(in.t); - assertThat(out.td).isEqualTo(d.td); } @Test