Merge branch 'stable-2.16' into stable-3.0
* stable-2.16:
Document the getConfig()-method in the plugin's restApi interface
Change-Id: Iebe0d99523c95a5b90669fec848162e743001a22
diff --git a/.bazelproject b/.bazelproject
index 8a726eb..e14c108 100644
--- a/.bazelproject
+++ b/.bazelproject
@@ -1,6 +1,6 @@
# The project view file (.bazelproject) is used to import Gerrit Bazel packages into the IDE.
#
-# See: https://ij.bazel.io/docs/project-views.html
+# See: https://ij.bazel.build/docs/project-views.html
directories:
.
diff --git a/.gitignore b/.gitignore
index ac244a6..93c1339 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,28 +6,42 @@
*.swp
*~
.DS_Store
-.gwt_work_dir
/.apt_generated
/.apt_generated_tests
/.bazel_path
/.classpath
/.factorypath
/.idea
+/.ijwb
/.metadata
/.project
/.settings/org.eclipse.ltk.core.refactoring.prefs
/.settings/org.eclipse.m2e.core.prefs
/.settings/org.maven.ide.eclipse.prefs
+/.vscode
/bazel-*
/bin/
+/bower_components/
/eclipse-out
/extras
/gerrit-package-plugins
-/gwt-unitCache
/infer-out
/local.properties
-/plugins/cookbook-plugin/
+/node_modules/
+/package-lock.json
+/plugins/*
+!/plugins/BUILD
+!/plugins/codemirror-editor
+!/plugins/commit-message-length-validator
+!/plugins/delete-project
+!/plugins/download-commands
+!/plugins/external_plugin_deps.bzl
+!/plugins/gitiles
+!/plugins/hooks
+!/plugins/plugin-manager
+!/plugins/replication
+!/plugins/reviewnotes
+!/plugins/singleusergroup
+!/plugins/webhooks
/test_site
/tools/format
-/.vscode
-/.ijwb
diff --git a/.gitmodules b/.gitmodules
index 8d75bcc..6844f6a 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -8,16 +8,31 @@
url = ../plugins/commit-message-length-validator
branch = .
+[submodule "plugins/delete-project"]
+ path = plugins/delete-project
+ url = ../plugins/delete-project
+ branch = .
+
[submodule "plugins/download-commands"]
path = plugins/download-commands
url = ../plugins/download-commands
branch = .
+[submodule "plugins/gitiles"]
+ path = plugins/gitiles
+ url = ../plugins/gitiles
+ branch = .
+
[submodule "plugins/hooks"]
path = plugins/hooks
url = ../plugins/hooks
branch = .
+[submodule "plugins/plugin-manager"]
+ path = plugins/plugin-manager
+ url = ../plugins/plugin-manager
+ branch = .
+
[submodule "plugins/replication"]
path = plugins/replication
url = ../plugins/replication
@@ -32,3 +47,8 @@
path = plugins/singleusergroup
url = ../plugins/singleusergroup
branch = .
+
+[submodule "plugins/webhooks"]
+ path = plugins/webhooks
+ url = ../plugins/webhooks
+ branch = .
diff --git a/.gitreview b/.gitreview
index 663037e..b3c37ad 100644
--- a/.gitreview
+++ b/.gitreview
@@ -2,4 +2,4 @@
host=gerrit-review.googlesource.com
scheme=https
project=gerrit.git
-defaultbranch=stable-2.16
+defaultbranch=stable-3.0
diff --git a/BUILD b/BUILD
index 907441e..3989a75 100644
--- a/BUILD
+++ b/BUILD
@@ -1,8 +1,8 @@
-package(default_visibility = ["//visibility:public"])
-
load("//tools/bzl:genrule2.bzl", "genrule2")
load("//tools/bzl:pkg_war.bzl", "pkg_war")
+package(default_visibility = ["//visibility:public"])
+
config_setting(
name = "java9",
values = {
@@ -43,15 +43,9 @@
)
pkg_war(
- name = "polygerrit",
- ui = "polygerrit",
-)
-
-pkg_war(
name = "release",
context = ["//plugins:core"],
doc = True,
- ui = "ui_optdbg_r",
)
pkg_war(
@@ -69,9 +63,6 @@
"//plugins:plugin-api_deploy.jar",
"//plugins:plugin-api-sources_deploy.jar",
"//plugins:plugin-api-javadoc",
- "//gerrit-plugin-gwtui:gwtui-api_deploy.jar",
- "//gerrit-plugin-gwtui:gwtui-api-source_deploy.jar",
- "//gerrit-plugin-gwtui:gwtui-api-javadoc",
]
genrule2(
diff --git a/Documentation/BUILD b/Documentation/BUILD
index 79b9e51..52ab7a8 100644
--- a/Documentation/BUILD
+++ b/Documentation/BUILD
@@ -44,7 +44,6 @@
name = "licenses",
opts = ["--asciidoctor"],
targets = [
- "//gerrit-gwtui:ui_module",
"//polygerrit-ui/app:polygerrit_ui",
"//java/com/google/gerrit/pgm",
],
@@ -53,14 +52,24 @@
license_map(
name = "js_licenses",
targets = [
- "//gerrit-gwtui:ui_module",
"//polygerrit-ui/app:polygerrit_ui",
],
)
+sh_test(
+ name = "check_licenses",
+ srcs = ["check_licenses_test.sh"],
+ data = [
+ "js_licenses.gen.txt",
+ "js_licenses.txt",
+ "licenses.gen.txt",
+ "licenses.txt",
+ ],
+)
+
DOC_DIR = "Documentation"
-SRCS = glob(["*.txt"]) + [":licenses.txt"]
+SRCS = glob(["*.txt"])
genrule(
name = "index",
diff --git a/Documentation/access-control.txt b/Documentation/access-control.txt
index 370a891..cdf6b30 100644
--- a/Documentation/access-control.txt
+++ b/Documentation/access-control.txt
@@ -5,6 +5,12 @@
to those groups. Access rights cannot be granted to individual
users.
+To view/edit the access controls for a specific project, first
+navigate to the projects page: for example,
+https://gerrit-review.googlesource.com/admin/repos/ . Then click on
+the individual project, and then click Access. This will bring you
+to a url that looks like
+https://gerrit-review.googlesource.com/admin/repos/gerrit,access
[[system_groups]]
== System Groups
@@ -828,7 +834,7 @@
[[category_view_private_changes]]
=== View Private Changes
-This category permits users to view all private changes.
+This category permits users to view all private changes and all change edit refs.
The change owner and any explicitly added reviewers can always see
private changes (even without having the `View Private Changes` access
@@ -1083,21 +1089,43 @@
[[block]]
=== 'BLOCK' access rule
-The 'BLOCK' rule blocks a permission globally. An inherited 'BLOCK'
-rule cannot be overridden in the inheriting project. Any 'ALLOW' rule
-from an inheriting project, which conflicts with an inherited 'BLOCK'
-rule will not be honored. Searching for 'BLOCK' rules, in the chain
-of parent projects, ignores the Exclusive flag, unless the rule with
-the Exclusive flag is defined on the same project as the 'BLOCK'
-rule. This means within the same project a 'BLOCK' rule can be
-overruled by 'ALLOW' rules on the same access section and 'ALLOW'
-rules with Exclusive flag on access section for more specific refs.
+The 'BLOCK' rule can be used to take away rights from users. The BLOCK rule
+works across project inheritance, from the top down, so an administrator can
+use 'BLOCK' rules to enforce site-wide restrictions.
+
+For example, if a user in the 'Foo Users' group tries to push to
+'refs/heads/mater' with the permissions below, that user will be blocked
+
+[options="header"]
+|=========================================================================
+|Project | Inherits From |Reference Name |Permissions |
+|All-Projects | - |refs/* |push = block Foo Users |
+|Foo | All-Projects |refs/heads/* |push = Foo Users |
+|=========================================================================
+
+'BLOCK' rules are evaluated starting from the parent project, and after a 'BLOCK'
+rule is found to apply, further rules are ignored. Hence, in this example, the
+permissions on child-project is ignored.
+
+----
+All-Projects: project.config
+ [access "refs/heads/*"]
+ push = block group X
+
+child-project: project.config
+ [access "refs/heads/*"]
+ exclusiveGroupPermissions = push
+ push = group X
+----
+
+In this case push for group 'X' will be blocked, even though the Exclusive
+flag was set for the child-project.
A 'BLOCK' rule that blocks the 'push' permission blocks any type of push,
force or not. A blocking force push rule blocks only force pushes, but
allows non-forced pushes if an 'ALLOW' rule would have permitted it.
-It is also possible to block label ranges. To block a group 'X' from voting
+It is also possible to block label ranges. To block a group 'X' from voting
'-2' and '+2', but keep their existing voting permissions for the '-1..+1'
range intact we would define:
@@ -1124,6 +1152,24 @@
In this case a user which is a member of the group 'Y' will still be allowed to
push to 'refs/heads/*' even if it is a member of the group 'X'.
+=== 'BLOCK' and 'ALLOW' rules in the same project with the Exclusive flag
+
+When a project contains a 'BLOCK' and 'ALLOW' that uses the Exclusive flag in a
+more specific reference, the 'ALLOW' rule with the Exclusive flag will override
+the 'BLOCK' rule:
+
+----
+ [access "refs/*"]
+ read = block group X
+
+ [access "refs/heads/*"]
+ exclusiveGroupPermissions = read
+ read = group X
+----
+
+In this case a user which is a member of the group 'X' will still be allowed to
+read 'refs/heads/*'.
+
[NOTE]
An 'ALLOW' rule overrides a 'BLOCK' rule only when both of them are
inside the same access section of the same project. An 'ALLOW' rule in a
@@ -1198,8 +1244,7 @@
[[capability_accessDatabase]]
=== Access Database
-Allow users to access the database using the `gsql` command, and view code
-review metadata refs in repositories.
+Allow users to view code review metadata refs in repositories.
[[capability_administrateServer]]
diff --git a/Documentation/check_licenses_test.sh b/Documentation/check_licenses_test.sh
new file mode 100755
index 0000000..52e27f2
--- /dev/null
+++ b/Documentation/check_licenses_test.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+hook=$(pwd)/resources/com/google/gerrit/server/tools/root/hooks/commit-msg
+
+for f in js_licenses licenses ; do
+ if ! diff -u Documentation/${f}.txt Documentation/${f}.gen.txt ; then
+ echo ""
+ echo "FAIL: ${f}.txt out of date"
+ echo "to fix: "
+ echo ""
+ echo " cp bazel-bin/Documentation/${f}.gen.txt Documentation/${f}.txt"
+ echo ""
+ exit 1
+ fi
+done
diff --git a/Documentation/cmd-create-project.txt b/Documentation/cmd-create-project.txt
index 026d7b1..9e3d70b 100644
--- a/Documentation/cmd-create-project.txt
+++ b/Documentation/cmd-create-project.txt
@@ -28,9 +28,8 @@
== DESCRIPTION
Creates a new bare Git repository under `gerrit.basePath`, using
the project name supplied. The newly created repository is empty
-(has no commits), but is registered in the Gerrit database so that
-the initial commit may be uploaded for review, or initial content
-can be pushed directly into a branch.
+(has no commits), and the initial content may either be uploaded for
+review, or pushed directly to a branch.
If replication is enabled, this command also connects to each of
the configured remote systems over SSH and uses command line git
@@ -119,7 +118,7 @@
Defaults to MERGE_IF_NECESSARY unless
link:config-gerrit.html#repository.name.defaultSubmitType[
repository.<name>.defaultSubmitType] is set to a different value.
-For more details see link:project-configuration.html#submit_type[
+For more details see link:config-project-config.html#submit-type[
Submit Types].
--use-content-merge::
diff --git a/Documentation/cmd-flush-caches.txt b/Documentation/cmd-flush-caches.txt
index 55d9083..5a84b9d 100644
--- a/Documentation/cmd-flush-caches.txt
+++ b/Documentation/cmd-flush-caches.txt
@@ -16,7 +16,7 @@
truth when it needs the information again.
Flushing a cache may be necessary if an administrator modifies
-database records directly in the database, rather than going through
+NoteDb metadata directly in a repository, rather than going through
the Gerrit web interface.
If no options are supplied, defaults to `--all`.
diff --git a/Documentation/cmd-gsql.txt b/Documentation/cmd-gsql.txt
deleted file mode 100644
index 7f2aaf7..0000000
--- a/Documentation/cmd-gsql.txt
+++ /dev/null
@@ -1,64 +0,0 @@
-= gerrit gsql
-
-== NAME
-gerrit gsql - Administrative interface to active database.
-
-== SYNOPSIS
-[verse]
---
-_ssh_ -p <port> <host> _gerrit gsql_
- [--format {PRETTY | JSON | JSON_SINGLE}]
- [-c QUERY]
---
-
-== DESCRIPTION
-Provides interactive query support directly against the underlying
-SQL database used by the host Gerrit server. All SQL statements
-are supported, including SELECT, UPDATE, INSERT, DELETE and ALTER.
-
-== OPTIONS
---format::
- Set the format records are output in. In PRETTY (the
- default) records are displayed in a tabular output suitable
- for reading by a human on a sufficiently wide terminal.
- In JSON mode records are output as JSON objects using the
- column names as the property names, one object per line.
- In JSON_SINGLE mode the whole result set is output as a
- single JSON object.
-
--c::
- Execute the single query statement supplied, and then exit.
-
-== ACCESS
-Caller must have been granted the
-link:access-control.html#capability_accessDatabase[Access Database]
-global capability.
-
-== SCRIPTING
-Intended for interactive use only, unless format is JSON, or
-JSON_SINGLE.
-
-== EXAMPLES
-To manually correct a user's SSH user name:
-
-----
-$ ssh -p 29418 review.example.com gerrit gsql
-Welcome to Gerrit Code Review v2.0.25
-(PostgreSQL 8.3.8)
-
-Type '\h' for help. Type '\r' to clear the buffer.
-
-gerrit> update accounts set ssh_user_name = 'alice' where account_id=1;
-UPDATE 1; 1 ms
-gerrit> \q
-Bye
-
-$ ssh -p 29418 review.example.com gerrit flush-caches --cache sshkeys --cache accounts
-----
-
-GERRIT
-------
-Part of link:index.html[Gerrit Code Review]
-
-SEARCHBOX
----------
diff --git a/Documentation/cmd-index.txt b/Documentation/cmd-index.txt
index 25099fa..edb54b5 100644
--- a/Documentation/cmd-index.txt
+++ b/Documentation/cmd-index.txt
@@ -71,7 +71,7 @@
List projects visible to the caller.
link:cmd-query.html[gerrit query]::
- Query the change database.
+ Query the change search index.
'gerrit receive-pack'::
'Deprecated alias for `git receive-pack`.'
@@ -130,9 +130,6 @@
link:cmd-gc.html[gerrit gc]::
Run the Git garbage collection.
-link:cmd-gsql.html[gerrit gsql]::
- Administrative interface to active database.
-
link:cmd-index-activate.html[gerrit index activate]::
Activate the latest index version available.
diff --git a/Documentation/cmd-ls-user-refs.txt b/Documentation/cmd-ls-user-refs.txt
index cba7d1b..0363f60 100644
--- a/Documentation/cmd-ls-user-refs.txt
+++ b/Documentation/cmd-ls-user-refs.txt
@@ -32,8 +32,8 @@
--user::
-u::
Required; User for which the visible refs should be listed. Gerrit
- will query the database to find matching users, so the
- full identity/name does not need to be specified.
+ will query the index to find matching users, so the full
+ identity/name does not need to be specified.
--only-refs-heads::
Only list the refs found under refs/heads/*
diff --git a/Documentation/cmd-query.txt b/Documentation/cmd-query.txt
index 79723c5..d0419d7 100644
--- a/Documentation/cmd-query.txt
+++ b/Documentation/cmd-query.txt
@@ -1,7 +1,7 @@
= gerrit query
== NAME
-gerrit query - Query the change database
+gerrit query - Query the change search index
== SYNOPSIS
[verse]
@@ -17,6 +17,7 @@
[--submit-records]
[--all-reviewers]
[--start <n> | -S <n>]
+ [--no-limit]
[--]
<query>
[limit:<n>]
@@ -24,7 +25,7 @@
== DESCRIPTION
-Queries the change database and returns results describing changes
+Queries the change search index and returns results describing changes
that match the input query. More recently updated changes appear
before older changes, which is the same order presented in the
web interface. For each matching change, the result contains data
@@ -101,6 +102,9 @@
-S::
Number of changes to skip.
+--no-limit::
+ Return all results, overriding the default limit.
+
limit:<n>::
Maximum number of results to return. This is actually a
query operator, and not a command line option. If more
diff --git a/Documentation/cmd-review.txt b/Documentation/cmd-review.txt
index 27a39f4..eef47fc 100644
--- a/Documentation/cmd-review.txt
+++ b/Documentation/cmd-review.txt
@@ -25,7 +25,7 @@
== DESCRIPTION
Updates the current user's approval status of the specified patch
sets and/or submits them for merging, sending out email
-notifications and updating the database.
+notifications and updating code review metadata.
Patch sets may be specified in 'CHANGEID,PATCHSET' format, such as
'8242,2', or 'COMMIT' format.
@@ -142,7 +142,7 @@
Approve the change with commit c0ff33 as "Verified +1"
----
-$ ssh -p 29418 review.example.com gerrit review --verified +1 c0ff33
+$ ssh -p 29418 review.example.com gerrit review --verified +1 8242,2
----
Approve the change with change number 8242 and patch set 2 as "Code-Review +2"
diff --git a/Documentation/cmd-set-project.txt b/Documentation/cmd-set-project.txt
index 45b31ff..9686230 100644
--- a/Documentation/cmd-set-project.txt
+++ b/Documentation/cmd-set-project.txt
@@ -59,7 +59,7 @@
+
For more details see
-link:project-configuration.html#submit_type[Submit Types].
+link:config-project-config.html#submit-type[Submit Types].
--content-merge::
If enabled, Gerrit will try to perform a 3-way merge of text
diff --git a/Documentation/config-auto-site-initialization.txt b/Documentation/config-auto-site-initialization.txt
index 1be0af9..2253ed0 100644
--- a/Documentation/config-auto-site-initialization.txt
+++ b/Documentation/config-auto-site-initialization.txt
@@ -2,74 +2,41 @@
== Description
-Gerrit supports automatic site initialization on server startup
-when Gerrit runs in a servlet container. Both creation of a new site
-and upgrade of an existing site are supported. By default, all packaged
-plugins will be installed when Gerrit is deployed in a servlet container
-and the location of the Gerrit distribution can be determined at
-runtime. It is also possible to install only a subset of packaged
-plugins or not install any plugins.
+Gerrit supports automatic site initialization on server startup when Gerrit runs
+in a servlet container. Both creation of a new site and upgrade of an existing
+site are supported. By default, all packaged plugins will be installed when
+Gerrit is deployed in a servlet container and the location of the Gerrit
+distribution can be determined at runtime. It is also possible to install only a
+subset of packaged plugins or not install any plugins.
-This feature may be useful for such setups where Gerrit administrators
-don't have direct access to the database and the file system of the
-server where Gerrit should be deployed and, therefore, cannot perform
-the init from their local machine prior to deploying Gerrit on such a
-server. It may also make deployment and testing in a local servlet
-container faster to set up as the init step could be skipped.
+This feature may be useful for such setups where Gerrit administrators don't
+have direct access to the file system of the server where Gerrit should be
+deployed and, therefore, cannot perform the init from their local machine prior
+to deploying Gerrit on such a server. It may also make deployment and testing in
+a local servlet container faster to set up as the init step could be skipped.
== Gerrit Configuration
-The site initialization will be performed only if the `gerrit.init`
-system property exists. The value of the property is not used; only the
-existence of the property matters.
+In order to perform site initialization, define `gerrit.site_path` with the path
+to your site. If the site already exists, this is the only required property.
+If your site does not yet exist, set the `gerrit.init` system property to
+automatically initialize the site.
-If the `gerrit.site_path` system property is defined then the init is
-run for that site. The database connectivity, in that case, is defined
-in the `etc/gerrit.config`.
+During initialization, if the `gerrit.install_plugins` property is not defined,
+then all packaged plugins will be installed. If it is defined, then it is parsed
+as a comma-separated list of plugin names to install. If the value is an empty
+string then no plugins will be installed.
-`gerrit.site_path` system property must be defined to run the init for
-that site.
+=== Example
-[WARNING]
-Defining the `jdbc/ReviewDb` JNDI property for an H2 database under the
-path defined by `gerrit.site_path` will cause an incomplete auto
-initialization and Gerrit will fail to start.
-
-Opening a connection to such a database will create a subfolder under the
-site path folder (in order to create the H2 database) and Gerrit will
-no longer consider that site path to be new and, because of that,
-skip some required initialization steps (for example, Lucene index
-creation). In order to auto initialize Gerrit with an embedded H2
-database use the `gerrit.site_path` to define the location of the review
-site and don't define a JNDI resource with a URL under that path.
-
-If the `gerrit.install_plugins` property is not defined then all packaged
-plugins will be installed. If it is defined then it is parsed as a
-comma-separated list of plugin names to install. If the value is an
-empty string then no plugin will be installed.
-
-=== Example 1
-
-Prepare Tomcat so that a site is initialized at a given path using
-the H2 database (if the site doesn't exist yet) or using whatever
-database is defined in `etc/gerrit.config` of that site:
+Prepare Tomcat so that a site is initialized at a given path (if the site
+doesn't exist yet), installing all packaged plugins.
----
$ export CATALINA_OPTS='-Dgerrit.init -Dgerrit.site_path=/path/to/site'
$ catalina.sh start
----
-=== Example 2
-
-Assuming the database schema doesn't exist in the database defined
-via the `jdbc/ReviewDb` JNDI property, initialize a new site using that
-database and a given path:
-
-----
- $ export CATALINA_OPTS='-Dgerrit.init -Dgerrit.init_path=/path/to/site'
- $ catalina.sh start
-----
-
GERRIT
------
Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/config-cla.txt b/Documentation/config-cla.txt
index 2234808..2c7b194 100644
--- a/Documentation/config-cla.txt
+++ b/Documentation/config-cla.txt
@@ -25,13 +25,15 @@
----
Contributor agreements are defined as contributor-agreement sections in
-`project.config`:
+`project.config` of `All-Projects`:
----
[contributor-agreement "Individual"]
description = If you are going to be contributing code on your own, this is the one you want. You can sign this one online.
agreementUrl = static/cla_individual.html
autoVerify = group CLA Accepted - Individual
accepted = group CLA Accepted - Individual
+ matchProjects = ^/.*$
+ excludeProjects = ^/not/my/project/
----
Each `contributor-agreement` section within the `project.config` file must
@@ -75,6 +77,16 @@
contributor agreement has been accepted. The groups' UUID must also
appear in the `groups` file.
+[[contributor-agreement.name.matchProjects]]contributor-agreement.<name>.matchProjects::
++
+List of project regular expressions identifying projects where the
+agreement is required. Defaults to every project when omitted.
+
+[[contributor-agreement.name.excludeProjects]]contributor-agreement.<name>.excludeProjects::
++
+List of project regular expressions identifying projects where the
+agreement does not apply. Defaults to empty. i.e. no projects excluded.
+
GERRIT
------
Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt
index 57f4db1..08f5ce3 100644
--- a/Documentation/config-gerrit.txt
+++ b/Documentation/config-gerrit.txt
@@ -32,7 +32,7 @@
=== Section accountPatchReviewDb
The AccountPatchReviewDb is a database used to store the user file reviewed
-flags. It co-exists with <<database,ReviewDb>> and link:note-db.html[NoteDb].
+flags.
[[accountPatchReviewDb.url]]accountPatchReviewDb.url::
+
@@ -46,8 +46,8 @@
link:pgm-MigrateAccountPatchReviewDb.html[MigrateAccountPatchReviewDb] program.
Migration cannot be done while the server is running.
+
-Also note that the db_name has to be a new db and not reusing gerrit's own review database,
-otherwise gerrit's init will remove the table.
+Also note that the db_name has to be a new db and not reusing an old ReviewDb
+database from a former 2.x site, otherwise gerrit's init will remove the table.
----
[accountPatchReviewDb]
@@ -273,10 +273,7 @@
`Become` appears in the top right corner of the page, taking the
user to a form where they can enter the username of any existing
user account, and immediately login as that account, without any
-authentication taking place. This form of authentication is only
-useful for the GWT hosted mode shell, where OpenID authentication
-redirects might be risky to the developer's host computer, and HTTP
-authentication is not possible.
+authentication taking place.
+
By default, OpenID.
@@ -485,13 +482,12 @@
+
When `auth.type` does not normally enable this URL administrators may
set this to `login/`, allowing users to begin a new web session. This value
-is used as an href in PolyGerrit and the GWT UI, so absolute URLs like
+is used as an href in PolyGerrit, so absolute URLs like
`https://someotherhost/login` work as well.
+
If a ${path} parameter is included, then PolyGerrit will substitute the
currently viewed path in the link. Be aware that this path will include
a leading slash, so a value like this might be appropriate: `/login${path}`.
-Note: in the GWT UI this substitution for ${path} is *always* `/`.
[[auth.cookiePath]]auth.cookiePath::
+
@@ -697,7 +693,9 @@
allows to limit the memory used by H2 and thus prevent out-of-memory
caused by the H2 database using too much memory.
+
-See <<database.h2.cacheSize,database.h2.cacheSize>> for a detailed discussion.
+Technically the H2 cache size is configured using the CACHE_SIZE parameter in
+the H2 JDBC connection URL, as described
+link:http://www.h2database.com/html/features.html#cache_settings[here]
+
Default is unset, using up to half of the available memory.
+
@@ -807,11 +805,10 @@
+
Cache entries contain important details of an active user, including
their display name, preferences, and known email addresses. Entry
-information is obtained from the `accounts` database table.
+information is obtained from NoteDb data in the `All-Users` repo.
+
-If direct updates are made to any of these database tables, this
-cache should be flushed.
+If direct updates are made to `All-Users`, this cache should be flushed.
cache `"adv_bases"`::
+
@@ -982,6 +979,11 @@
Caches parsed `rules.pl` contents for each project. This cache uses the same
size as the `projects` cache, and cannot be configured independently.
+cache `"pure_revert"`::
++
+Result of checking if one change or commit is a pure/clean revert of
+another.
+
cache `"sshkeys"`::
+
Caches unpacked versions of user SSH keys, so the internal SSH daemon
@@ -1143,43 +1145,23 @@
[[change]]
=== Section change
-[[change.largeChange]]change.largeChange::
-+
-Number of changed lines from which on a change is considered as a large
-change. The number of changed lines of a change is the sum of the lines
-that were inserted and deleted in the change.
-+
-The specified value is used to visualize the change sizes in the Web UI
-in change tables and user dashboards.
-+
-By default 500.
-
-[[change.updateDelay]]change.updateDelay::
-+
-How often in seconds the web interface should poll for updates to the
-currently open change. The poller relies on the client's browser
-cache to use If-Modified-Since and respect `304 Not Modified` HTTP
-responses. This allows for fast polls, often under 8 milliseconds.
-+
-With a configured 30 second delay a server with 4900 active users will
-typically need to dedicate 1 CPU to the update check. 4900 users
-divided by an average delay of 30 seconds is 163 requests arriving per
-second. If requests are served at \~6 ms response time, 1 CPU is
-necessary to keep up with the update request traffic. On a smaller
-user base of 500 active users, the default 30 second delay is only 17
-requests per second and requires ~10% CPU.
-+
-If 0 the update polling is disabled.
-+
-Default is 5 minutes.
-
[[change.allowBlame]]change.allowBlame::
+
-Allow blame on side by side diff in the GWT UI. If set to false, blame cannot be
-used.
+Allow blame on side by side diff. If set to false, blame cannot be used.
+
Default is true.
+[[change.allowDrafts]]change.allowDrafts::
++
+Legacy support for drafts workflow. If set to true, pushing a new change
+with draft option will create a private change. Pushing with draft option
+to an existing change will create change edit.
++
+Enabling this option allows to push to the `refs/drafts/branch`. When
+disabled any push to `refs/drafts/branch` will be rejected.
++
+Default is false.
+
[[change.api.allowedIdentifier]]change.api.allowedIdentifier::
+
Change identifier(s) that are allowed on the API. See
@@ -1192,14 +1174,12 @@
+
Default is `ALL`.
-[[change.allowDrafts]]change.allowDrafts::
+[[change.api.excludeMergeableInChangeInfo]]change.api.excludeMergeableInChangeInfo::
+
-Legacy support for drafts workflow. If set to true, pushing a new change
-with draft option will create a private change. Pushing with draft option
-to an existing change will create change edit.
-+
-Enabling this option allows to push to the `refs/drafts/branch`. When
-disabled any push to `refs/drafts/branch` will be rejected.
+If true, the mergeability bit in
+link:rest-api-changes.html#change-info[ChangeInfo] will never be set. It can
+be requested separately through the
+link:rest-api-changes.html#get-mergeable[get-mergeable] endpoint.
+
Default is false.
@@ -1218,6 +1198,65 @@
+
Default is true.
+[[change.disablePrivateChanges]]change.disablePrivateChanges::
++
+If set to true, users are not allowed to create private changes.
++
+The default is false.
+
+[[change.largeChange]]change.largeChange::
++
+Number of changed lines from which on a change is considered as a large
+change. The number of changed lines of a change is the sum of the lines
+that were inserted and deleted in the change.
++
+The specified value is used to visualize the change sizes in the Web UI
+in change tables and user dashboards.
++
+By default 500.
+
+[[change.move]]change.move::
++
+Whether the link:rest-api-changes.html#move-change[Move Change] REST
+endpoint is enabled.
++
+The move change functionality has some corner cases with undesired side
+effects. Hence administrators may decide to disable this functionality.
+In particular, if a change that has dependencies on other changes is
+moved to a new branch, and the moved change gets submitted to the new
+branch, the changes on which the change depends are silently merged
+into the new branch, although these changes have not been moved to that
+branch (see details in
+link:https://bugs.chromium.org/p/gerrit/issues/detail?id=9877[issue
+9877]).
++
+By default true.
+
+[[change.replyLabel]]change.replyLabel::
++
+Label name for the reply button. In the user interface an ellipsis (…)
+is appended.
++
+Default is "Reply". In the user interface it becomes "Reply…".
+
+[[change.replyTooltip]]change.replyTooltip::
++
+Tooltip for the reply button. In the user interface a note about the
+keyboard shortcut is appended.
++
+Default is "Reply and score". In the user interface it becomes "Reply
+and score (Shortcut: a)".
+
+[[change.robotCommentSizeLimit]]change.robotCommentSizeLimit::
++
+Maximum allowed size of a robot comment that will be accepted. Robot comments
+which exceed the indicated size will be rejected on addition. The specified
+value is interpreted as the maximum size in bytes of the JSON representation of
+the robot comment. Common unit suffixes of 'k', 'm', or 'g' are supported.
+Zero or negative values allow robot comments of unlimited size.
++
+The default limit is 1024kB.
+
[[change.showAssigneeInChangesTable]]change.showAssigneeInChangesTable::
+
Show assignee field in changes table. If set to false, assignees will
@@ -1225,6 +1264,14 @@
+
Default is false.
+[[change.strictLabels]]change.strictLabels::
++
+Reject invalid label votes: invalid labels or invalid values. This
+configuration option is provided for backwards compaitbility and may
+be removed in future gerrit versions.
++
+Default is false.
+
[[change.submitLabel]]change.submitLabel::
+
Label name for the submit button.
@@ -1258,13 +1305,6 @@
Default is "Submit all ${topicSize} changes of the same topic (${submitSize}
changes including ancestors and other changes related by topic)".
-[[change.submitWholeTopic]]change.submitWholeTopic::
-+
-Determines if the submit button submits the whole topic instead of
-just the current change.
-+
-Default is false.
-
[[change.submitTopicLabel]]change.submitTopicLabel::
+
If `change.submitWholeTopic` is set and a change has a topic,
@@ -1285,44 +1325,31 @@
(${submitSize} changes including ancestors and other
changes related by topic)".
-[[change.replyLabel]]change.replyLabel::
+[[change.submitWholeTopic]]change.submitWholeTopic::
+
-Label name for the reply button. In the user interface an ellipsis (…)
-is appended.
-+
-Default is "Reply". In the user interface it becomes "Reply…".
-
-[[change.replyTooltip]]change.replyTooltip::
-+
-Tooltip for the reply button. In the user interface a note about the
-keyboard shortcut is appended.
-+
-Default is "Reply and score". In the user interface it becomes "Reply
-and score (Shortcut: a)".
-
-[[change.robotCommentSizeLimit]]change.robotCommentSizeLimit::
-+
-Maximum allowed size of a robot comment that will be accepted. Robot comments
-which exceed the indicated size will be rejected on addition. The specified
-value is interpreted as the maximum size in bytes of the JSON representation of
-the robot comment. Common unit suffixes of 'k', 'm', or 'g' are supported.
-Zero or negative values allow robot comments of unlimited size.
-+
-The default limit is 1024kB.
-
-[[change.strictLabels]]change.strictLabels::
-+
-Reject invalid label votes: invalid labels or invalid values. This
-configuration option is provided for backwards compaitbility and may
-be removed in future gerrit versions.
+Determines if the submit button submits the whole topic instead of
+just the current change.
+
Default is false.
-[[change.disablePrivateChanges]]change.disablePrivateChanges::
+[[change.updateDelay]]change.updateDelay::
+
-If set to true, users are not allowed to create private changes.
+How often in seconds the web interface should poll for updates to the
+currently open change. The poller relies on the client's browser
+cache to use If-Modified-Since and respect `304 Not Modified` HTTP
+responses. This allows for fast polls, often under 8 milliseconds.
+
-The default is false.
+With a configured 30 second delay a server with 4900 active users will
+typically need to dedicate 1 CPU to the update check. 4900 users
+divided by an average delay of 30 seconds is 163 requests arriving per
+second. If requests are served at \~6 ms response time, 1 CPU is
+necessary to keep up with the update request traffic. On a smaller
+user base of 500 active users, the default 30 second delay is only 17
+requests per second and requires ~10% CPU.
++
+If 0 the update polling is disabled.
++
+Default is 5 minutes.
[[changeCleanup]]
=== Section changeCleanup
@@ -1354,6 +1381,13 @@
+
By default `true`.
+[[changeCleanup.cleanupAccountPatchReview]]changeCleanup.cleanupAccountPatchReview::
++
+Whether accountPatchReview data should be also removed when change
+gets auto-abandoned.
++
+By default `false`.
+
[[changeCleanup.abandonMessage]]changeCleanup.abandonMessage::
+
Change message that should be posted when a change is abandoned.
@@ -1433,13 +1467,10 @@
example, to match the string `bug` in a case insensitive way the match
pattern `[bB][uU][gG]` needs to be used.
+
-Between the GWT UI and PolyGerrit, the commentlink.name.match regular
-expressions are applied differently. Whereas in the GWT UI the
-expressions are applied to the formatted and escaped HTML result, the
-PolyGerrit UI applies them only to the raw, unformatted and unescaped
-text form. PolyGerrit does not support regex matching against HTML.
-Comment link patterns that are written in this style should be updated
-to match text formats.
+The commentlink.name.match regular expressions are applied to the raw,
+unformatted and unescaped text form. Regex matching against HTML is not
+supported. Comment link patterns that are written in this style should
+be updated to match text formats.
+
A common pattern to match is `bug\\s+(\\d+)`.
@@ -1685,215 +1716,6 @@
+
Default is 1 hour.
-[[database]]
-=== Section database
-
-The database section configures ReviewDb, where Gerrit stores its metadata
-records about account groups and change reviews. Starting from 2.15, accounts
-are always stored in NoteDb and, optionally, changes too. See the
-link:note-db.html[NoteDb documentation] for more information.
-
-Note that user file reviewed flags are stored in a separate database. See the
-<<accountPatchReviewDb,accountPatchReviewDb>> section for more information.
-
-----
-[database]
- type = POSTGRESQL
- hostname = localhost
- database = reviewdb
- username = gerrit
- password = s3kr3t
-----
-
-[[database.type]]database.type::
-+
-Type of database server to connect to. If set this value will be
-used to automatically create correct database.driver and database.url
-values to open the connection.
-+
-* `DB2`
-+
-Connect to a DB2 database server.
-+
-* `DERBY`
-+
-Connect to an Apache Derby database server.
-+
-* `H2`
-+
-Connect to a local embedded H2 database.
-+
-* `JDBC`
-+
-Connect using a JDBC driver class name and URL.
-+
-* `MAXDB`
-+
-Connect to an SAP MaxDB database server.
-+
-* `MYSQL`
-+
-Connect to a MySQL database server.
-+
-* `MARIADB`
-+
-Connect to a MariaDB database server.
-+
-* `ORACLE`
-+
-Connect to an Oracle database server.
-+
-* `POSTGRESQL`
-+
-Connect to a PostgreSQL database server.
-
-+
-If not specified, database.driver and database.url are used as-is,
-and if they are also not specified, defaults to H2.
-
-[[database.hostname]]database.hostname::
-+
-Hostname of the database server. Defaults to 'localhost'.
-
-[[database.port]]database.port::
-+
-Port number of the database server. Defaults to the default port
-of the server named by database.type.
-
-[[database.database]]database.database::
-+
-For POSTGRESQL or MYSQL, the name of the database on the server.
-+
-For H2, this is the path to the database, and if not absolute is
-relative to `'$site_path'`.
-
-[[database.username]]database.username::
-+
-Username to connect to the database server as.
-
-[[database.password]]database.password::
-+
-Password to authenticate to the database server with.
-
-[[database.driver]]database.driver::
-+
-Name of the JDBC driver class to connect to the database with.
-Setting this usually isn't necessary as it can be derived from
-database.type or database.url for any supported database.
-
-[[database.url]]database.url::
-+
-'jdbc:' URL for the database. Setting this variable usually
-isn't necessary as it can be constructed from the all of the
-above properties.
-
-[[database.connectionPool]]database.connectionPool::
-+
-If true, use connection pooling for database connections. Otherwise, a
-new database connection is opened for each request.
-+
-Default is false for MySQL, and true for other database backends.
-
-[[database.poolLimit]]database.poolLimit::
-+
-Maximum number of open database connections. If the server needs
-more than this number, request processing threads will wait up
-to <<database.poolMaxWait, poolMaxWait>> seconds for a
-connection to be released before they abort with an exception.
-This limit must be several units higher than the total number of
-httpd and sshd threads as some request processing code paths may
-need multiple connections.
-+
-Default is <<sshd.threads, sshd.threads>>
- + <<httpd.maxThreads, httpd.maxThreads>> + 2.
-+
-This setting only applies if
-<<database.connectionPool,database.connectionPool>> is true.
-
-[[database.poolMinIdle]]database.poolMinIdle::
-+
-Minimum number of connections to keep idle in the pool.
-Default is 4.
-+
-This setting only applies if
-<<database.connectionPool,database.connectionPool>> is true.
-
-[[database.poolMaxIdle]]database.poolMaxIdle::
-+
-Maximum number of connections to keep idle in the pool. If there
-are more idle connections, connections will be closed instead of
-being returned back to the pool.
-Default is min(<<database.poolLimit, database.poolLimit>>, 16).
-+
-This setting only applies if
-<<database.connectionPool,database.connectionPool>> is true.
-
-[[database.poolMaxWait]]database.poolMaxWait::
-+
-Maximum amount of time a request processing thread will wait to
-acquire a database connection from the pool. If no connection is
-released within this time period, the processing thread will abort
-its current operations and return an error to the client.
-Values should use common unit suffixes to express their setting:
-+
-* ms, milliseconds
-* s, sec, second, seconds
-* m, min, minute, minutes
-* h, hr, hour, hours
-
-+
---
-If a unit suffix is not specified, `milliseconds` is assumed.
-
-Default is `30 seconds`.
-
-This setting only applies if
-<<database.connectionPool,database.connectionPool>> is true.
---
-
-[[database.dataSourceInterceptorClass]]database.dataSourceInterceptorClass::
-
-Class that implements DataSourceInterceptor interface to monitor SQL activity.
-This class must have default constructor and be available on Gerrit's bootstrap
-classpath, e. g. in `$gerrit_site/lib` directory. Example implementation of
-SQL monitoring can be found in javamelody-plugin.
-
-[[database.h2]]database.h2::
-+
-The settings in this section are used for the reviewdb if the
-<<database.type,database.type>> is H2.
-+
-Additionally gerrit uses H2 for storing reviewed flags on changes.
-
-[[database.h2.cacheSize]]database.h2.cacheSize::
-+
-The size of the H2 internal database cache, in bytes. The H2 internal cache for
-persistent H2-backed caches is controlled by
-<<cache.h2CacheSize,cache.h2CacheSize>>.
-+
-H2 uses memory to cache its database content. The parameter `cacheSize`
-allows to limit the memory used by H2 and thus prevent out-of-memory
-caused by the H2 database using too much memory.
-+
-Technically the H2 cache size is configured using the CACHE_SIZE parameter in
-the H2 JDBC connection URL, as described
-link:http://www.h2database.com/html/features.html#cache_settings[here]
-+
-Default is unset, using up to half of the available memory.
-+
-H2 will persist this value in the database, so to unset explicitly specify 0.
-+
-Common unit suffixes of 'k', 'm', or 'g' are supported.
-
-[[database.h2.autoServer]]database.h2.autoServer::
-+
-If `true` enable the automatic mixed mode
-(see link:http://www.h2database.com/html/features.html#auto_mixed_mode[Automatic Mixed Mode]).
-This enables concurrent access to the embedded H2 database from command line
-utils (e.g. MigrateToNoteDb).
-+
-Default is `false`.
-
[[download]]
=== Section download
@@ -2157,10 +1979,20 @@
by the system administrator, and might not even be running on the
same host as Gerrit.
+[[gerrit.installDbModule]]gerrit.installDbModule::
++
+Repeatable list of class name of additional Guice modules to load at
+Gerrit startup as part of the dbInjector and during the init phases.
+Classes are resolved using the primary Gerrit class loader, hence the
+class needs to be either declared in Gerrit or an additional JAR
+located under the `/lib` directory.
++
+By default unset.
+
[[gerrit.installModule]]gerrit.installModule::
+
Repeatable list of class name of additional Guice modules to load at
-Gerrit startup and init phases.
+Gerrit startup as part of the sysInjector and during the init phases.
Classes are resolved using the primary Gerrit class loader, hence the
class needs to be either declared in Gerrit or an additional JAR
located under the `/lib` directory.
@@ -2172,6 +2004,7 @@
[gerrit]
installModule = com.googlesource.gerrit.libmodule.MyModule
installModule = com.example.abc.OurSpecialSauceModule
+ installDbModule = com.example.def.OurCustomProvider
----
[[gerrit.listProjectsFromIndex]]gerrit.listProjectsFromIndex::
@@ -2214,19 +2047,16 @@
By default unset, meaning no bug report URL will be displayed. Administrators
should set this to the URL of their issue tracker, if necessary.
-[[gerrit.reportBugText]]gerrit.reportBugText::
+[[gerrit.enableReverseDnsLookup]]gerrit.enableReverseDnsLookup::
+
-Text to be displayed in the link to the bug report URL.
+Enable reverse DNS lookup during computing ref log entry for identified user,
+to record the actual hostname of the user's host in the ref log.
+
-Only used when `gerrit.reportBugUrl` is set and only supported in GWT (Old UI).
+Enabling reverse DNS lookup can cause performance issues on git push when
+the reverse DNS lookup is slow.
+
-Defaults to "Report Bug".
-
-[[gerrit.disableReverseDnsLookup]]gerrit.disableReverseDnsLookup::
-+
-Disables reverse DNS lookup during computing ref log entry for identified user.
-+
-Defaults to false.
+Defaults to false, reverse DNS lookup is disabled. The user's IP address
+will be recorded in the ref log rather than their hostname.
[[gerrit.secureStoreClass]]gerrit.secureStoreClass::
+
@@ -2276,12 +2106,6 @@
used to create the NoteDb will show in the resulting exception message in case
the value differs.
-[[gerrit.ui]]gerrit.ui::
-+
-Configure which UI is the default. Valid values are `polygerrit` and `gwt`.
-+
-Defaults to `polygerrit`.
-
[[gitweb]]
=== Section gitweb
@@ -2937,8 +2761,7 @@
+
Maximum number of leaf terms to allow in a query. Too-large queries may
perform poorly, so setting this option causes query parsing to fail fast
-before attempting to send them to the secondary index. Should this limit
-be reached, database is used instead of index as applicable.
+before attempting to send them to the secondary index.
+
When the index type is `LUCENE`, also sets the maximum number of clauses
permitted per BooleanQuery. This is so that all enforced query limits
@@ -3680,9 +3503,9 @@
[[note-db]]
=== Section noteDb
-NoteDb is the next generation of Gerrit storage backend, currently powering
-`googlesource.com`. For more information, including how to migrate your data,
-see the link:note-db.html[documentation].
+NoteDb is the Git-based database storage backend for Gerrit. For more
+information, including how to migrate data from an older Gerrit version, see the
+link:note-db.html[documentation].
[[notedb.accounts.sequenceBatchSize]]notedb.accounts.sequenceBatchSize::
+
@@ -4035,9 +3858,9 @@
are `INHERIT`, `MERGE_IF_NECESSARY`, `FAST_FORWARD_ONLY`, `REBASE_IF_NECESSARY`,
`REBASE_ALWAYS`, `MERGE_ALWAYS` and `CHERRY_PICK`.
+
-For more details see link:project-configuration.html#submit_type[Submit Types].
+For more details see link:config-project-config.html#submit-type[Submit Types].
+
-Default is link:project-configuration.html#submit_type_inherit[`INHERIT`].
+Default is link:config-project-config.html#submit_type_inherit[`INHERIT`].
+
This submit type is only applied at project creation time if a submit type is
omitted from the link:rest-api-projects.html#project-input[ProjectInput]. If the
@@ -4829,103 +4652,6 @@
+
By default 0.
-[[theme]]
-=== Section theme
-
-[[theme.backgroundColor]]theme.backgroundColor::
-+
-_(GWT UI only)_ Background color for the page, and major data tables like the all
-open changes table or the account dashboard. The value must be a
-valid HTML hex color code, or standard color name.
-+
-By default white, `FFFFFF`.
-
-[[theme.topMenuColor]]theme.topMenuColor::
-+
-_(GWT UI only)_ This is the color of the main menu bar at the top of the page.
-The value must be a valid HTML hex color code, or standard color
-name.
-+
-By default white, `FFFFFF`.
-
-[[theme.textColor]]theme.textColor::
-+
-_(GWT UI only)_ Text color for the page, and major data tables like the all open
-changes table or the account dashboard. The value must be a valid HTML hex color
-code, or standard color name.
-+
-By default dark grey, `353535`.
-
-[[theme.trimColor]]theme.trimColor::
-+
-_(GWT UI only)_ Primary color used as a background color behind text. This is
-the color of the main menu bar at the top, of table headers, and of major UI
-areas that we want to offset from other portions of the page. The value must be
-a valid HTML hex color code, or standard color name.
-+
-By default a light grey, `EEEEEE`.
-
-[[theme.selectionColor]]theme.selectionColor::
-+
-_(GWT UI only)_ Background color used within a trimColor area to denote the
-currently selected tab, or the background color used in a table to denote the
-currently selected row. The value must be a valid HTML hex color code, or
-standard color name.
-+
-By default a pale blue, `D8EDF9`.
-
-[[theme.changeTableOutdatedColor]]theme.changeTableOutdatedColor::
-+
-_(GWT UI only)_ Background color used for patch outdated messages. The value
-must be a valid HTML hex color code, or standard color name.
-+
-By default a shade of red, `F08080`.
-
-[[theme.tableOddRowColor]]theme.tableOddRowColor::
-+
-_(GWT UI only)_ Background color for tables such as lists of open reviews for
-odd rows. This is so you can have a different color for odd and even rows of
-the table. The value must be a valid HTML hex color code, or standard color
-name.
-+
-By default transparent.
-
-[[theme.tableEvenRowColor]]theme.tableEvenRowColor::
-+
-_(GWT UI only)_ Background color for tables such as lists of open reviews for
-even rows. This is so you can have a different color for odd and even rows of
-the table. The value must be a valid HTML hex color code, or standard color
-name.
-+
-By default transparent.
-
-A different theme may be used for signed-in vs. signed-out user status
-by using the "signed-in" and "signed-out" theme sections. Variables
-not specified in a section are inherited from the default theme.
-
-----
-[theme]
- backgroundColor = FFFFFF
-[theme "signed-in"]
- backgroundColor = C0C0C0
-[theme "signed-out"]
- backgroundColor = 00FFFF
-----
-
-As example, here is the theme configuration to have the old green look:
-
-----
-[theme]
- backgroundColor = FCFEEF
- textColor = 000000
- trimColor = D4E9A9
- selectionColor = FFFFCC
- topMenuColor = D4E9A9
- changeTableOutdatedColor = F08080
-[theme "signed-in"]
- backgroundColor = FFFFFF
-----
-
[[trackingid]]
=== Section trackingid
@@ -5042,54 +4768,6 @@
link:#schedule-configuration-examples[Schedule examples] can be found
in the link:#schedule-configuration[Schedule Configuration] section.
-[[urlAlias]]
-=== Section urlAlias
-
-[NOTE]
-urlAlias settings are only supported in GWT (Old UI) and only effective
-in GWT pages. Plugins that serve their own pages (e.g. gitiles) may
-ignore these settings. An alternative is serving Gerrit behind a
-link:config-reverseproxy.html[reverse proxy] and configure URL rewriting
-in the proxy configuration.
-
-URL aliases define regular expressions for URL tokens that are mapped
-to target URL tokens.
-
-Each URL alias must be specified in its own subsection. The subsection
-name should be a descriptive name. It must be unique, but is not
-interpreted in any way.
-
-The URL aliases are applied in no particular order. The first matching
-URL alias is used and further matches are ignored.
-
-URL aliases can be used to map plugin screens into the Gerrit URL
-namespace, or to replace Gerrit screens by plugin screens.
-
-Example:
-
-----
-[urlAlias "MyPluginScreen"]
- match = /myscreen/(.*)
- token = /x/myplugin/myscreen/$1
-[urlAlias "MyChangeScreen"]
- match = /c/(.*)
- token = /x/myplugin/c/$1
-----
-
-[[urlAlias.match]]urlAlias.match::
-+
-A regular expression for a URL token.
-+
-The matched URL token is replaced by `urlAlias.token`.
-
-[[urlAlias.token]]urlAlias.token::
-+
-The target URL token.
-+
-It can contain placeholders for the groups matched by the
-`urlAlias.match` regular expression: `$1` for the first matched group,
-`$2` for the second matched group, etc.
-
[[submodule]]
=== Section submodule
@@ -5238,6 +4916,38 @@
Assuming that the server is started on `Mon 07:00` then this yields the
first run on Tuesday at 06:00 and a repetition interval of 1 day.
+[[All-Projects-project.config]]
+== File `etc/All-Projects/project.config`
+
+The optional file `'$site_path'/etc/All-Projects/project.config` provides
+defaults for configuration read from
+link:config-project-config.html[`project.config`] in the
+`All-Projects` repo. Unlike `gerrit.config`, this file contains project-type
+configuration rather than server-type configuration.
+
+Most administrators will not need this file, and should instead make commits to
+`All-Projects` to modify global config. However, a separate file can be useful
+when managing multiple Gerrit servers, since pushing changes to defaults using
+Puppet or a similar tool can be easier than scripting git updates to
+`All-Projects`.
+
+The contents of the file are loaded each time the `All-Projects` project is
+reloaded. Updating the file requires either evicting the project cache or
+restarting the server.
+
+Caveats:
+
+* The path from which the file is read corresponds to the name of the repo,
+ which is link:#gerrit.allProjects[configurable].
+* Although the file lives in a directory that shares a name with a repository,
+ this directory is not a Git repository.
+* Only the file `project.config` is read from this directory to provide
+ defaults; any other files in this directory, such as `rules.pl`, are ignored.
+ (This behavior may change in the future.)
+* Group names listed in the access config in this file are resolved to UUIDs
+ using the `groups` file in the repository, not in the config directory. As a
+ result, setting ACLs in this file is not recommended.
+
[[secure.config]]
== File `etc/secure.config`
diff --git a/Documentation/config-plugins.txt b/Documentation/config-plugins.txt
index 9f7634a..7485db0 100644
--- a/Documentation/config-plugins.txt
+++ b/Documentation/config-plugins.txt
@@ -9,6 +9,10 @@
link:config-gerrit.html#plugins.checkFrequency[a few minutes] until
the server picks up new and updated plugins.
+Due to caching, you might need to flush your browser cache after
+installing a plugin. Users will usually see the result within
+several minutes.
+
Plugins can also be installed via
link:rest-api-plugins.html#install-plugin[REST] and
link:cmd-plugin-install.html[SSH].
@@ -65,6 +69,18 @@
link:https://gerrit.googlesource.com/plugins/commit-message-length-validator/+doc/master/src/main/resources/Documentation/config.md[
Configuration]
+[[delete-project]]
+=== delete-project
+
+Provides the ability to delete a project.
+
+link:https://gerrit-review.googlesource.com/admin/repos/plugins/delete-project[
+Project] |
+link:https://gerrit.googlesource.com/plugins/delete-project/+doc/master/src/main/resources/Documentation/about.md[
+Documentation] |
+link:https://gerrit.googlesource.com/plugins/delete-project/+doc/master/src/main/resources/Documentation/config.md[
+Configuration]
+
[[download-commands]]
=== download-commands
@@ -78,6 +94,14 @@
link:https://gerrit.googlesource.com/plugins/download-commands/+doc/master/src/main/resources/Documentation/config.md[
Configuration]
+[[gitiles]]
+=== gitiles
+
+Plugin running Gitiles alongside a Gerrit server.
+
+link:https://gerrit-review.googlesource.com/admin/repos/plugins/gitiles[
+Project]
+
[[hooks]]
=== hooks
@@ -90,6 +114,20 @@
link:https://gerrit.googlesource.com/plugins/hooks/+doc/master/src/main/resources/Documentation/config.md[
Configuration]
+[[plugin-manager]]
+=== plugin-manager
+
+This plugins provides an initial wizard to discover and install Gerrit plugins.
+Per default GerritForge CI is used to download the plugin artifacts from, but
+this can be changed per plugin configuration.
+
+link:https://gerrit-review.googlesource.com/admin/repos/plugins/plugin-manager[
+Project]
+link:https://gerrit.googlesource.com/plugins/plugin-manager/+doc/master/src/main/resources/Documentation/about.md[
+Documentation]
+link:https://gerrit.googlesource.com/plugins/plugin-manager/+doc/master/src/main/resources/Documentation/config.md[
+Configuration]
+
[[replication]]
=== replication
@@ -123,6 +161,18 @@
rights directly to a single user, since in Gerrit access rights can
only be assigned to groups.
+[[webhooks]]
+=== webhooks
+
+This plugin allows to propagate Gerrit events to remote http endpoints.
+
+link:https://gerrit-review.googlesource.com/admin/repos/plugins/webhooks[
+Project] |
+link:https://gerrit.googlesource.com/plugins/webhooks/+doc/master/src/main/resources/Documentation/about.md[
+Documentation] |
+link:https://gerrit.googlesource.com/plugins/webhooks/+doc/master/src/main/resources/Documentation/config.md[
+Configuration]
+
[[other-plugins]]
== Other Plugins
@@ -199,8 +249,7 @@
This plugin allows the rendering of Git repository branch network in a
graphical HTML5 Canvas. It is mainly intended to be used as a
-"project link" in a gitweb configuration or by other Gerrit GWT UI
-plugins to be plugged elsewhere in Gerrit.
+"project link" in a gitweb configuration.
link:https://gerrit-review.googlesource.com/admin/repos/plugins/branch-network[
Project] |
@@ -221,15 +270,16 @@
link:https://gerrit.googlesource.com/plugins/changemessage/+doc/master/src/main/resources/Documentation/config.md[
Configuration]
-[[delete-project]]
-=== delete-project
+[[checks]]
+=== checks
-Provides the ability to delete a project.
+The checks plugin provides a REST API and UI extensions for integrating
+CI systems with Gerrit.
-link:https://gerrit-review.googlesource.com/admin/repos/plugins/delete-project[
+link:https://gerrit-review.googlesource.com/admin/repos/plugins/checks[
Project] |
-link:https://gerrit.googlesource.com/plugins/delete-project/+doc/master/src/main/resources/Documentation/about.md[
-Documentation]
+link:https://gerrit.googlesource.com/plugins/checks/+doc/master/src/main/resources/Documentation/about.md[
+Plugin Documentation]]
[[egit]]
=== egit
@@ -257,6 +307,17 @@
link:https://gerrit.googlesource.com/plugins/emoticons/+doc/master/src/main/resources/Documentation/config.md[
Configuration]
+[[find-owners]]
+=== find-owners
+This plugin provides (1) a change review action button `[FIND OWNERS]`
+that shows owners of changed files to be included as code reviewers, and
+(2) Prolog predicates to make sure that a CL is submittable
+only with owner Code-Review +1 votes.
+
+link:https://gerrit-review.googlesource.com/admin/repos/plugins/find-owners[Project] |
+link:https://gerrit.googlesource.com/plugins/find-owners/+doc/master/src/main/resources/Documentation/about.md[Documentation] |
+link:https://gerrit.googlesource.com/plugins/find-owners/+doc/master/src/main/resources/Documentation/config.md[Configuration]
+
[[gitblit]]
=== gitblit
@@ -273,14 +334,6 @@
link:https://gerrit-review.googlesource.com/admin/repos/plugins/github[
Project]
-[[gitiles]]
-=== gitiles
-
-Plugin running Gitiles alongside a Gerrit server.
-
-link:https://gerrit-review.googlesource.com/admin/repos/plugins/gitiles[
-Project]
-
[[healthcheck]]
=== healthcheck
@@ -499,13 +552,21 @@
[[oauth-authentication-provider]]
=== OAuth authentication provider
This plugin enables Gerrit to use OAuth2 protocol for authentication.
-Two different OAuth providers are supported:
+Several OAuth2 providers are supported:
+* AirVantage
+* Bitbucket
+* CAS
+* CoreOS Dex
+* Facebook
* GitHub
+* GitLab
* Google
+* Keycloak
+* Office365
-https://github.com/davido/gerrit-oauth-provider[Project] |
-https://github.com/davido/gerrit-oauth-provider/wiki/Getting-Started[Configuration]
+link:https://gerrit-review.googlesource.com/admin/repos/plugins/oauth[Project] |
+link:https://gerrit.googlesource.com/plugins/oauth/+doc/master/src/main/resources/Documentation/config.md[Configuration]
[[owners]]
=== owners
@@ -643,6 +704,13 @@
link:https://gerrit.googlesource.com/plugins/scripting/groovy-provider/+doc/master/src/main/resources/Documentation/about.md[
Documentation]
+[[saml-authentication-provider]]
+=== SAML2 authentication provider
+
+This plugin enables Gerrit to use SAML2 protocol for authentication.
+
+link:https://gerrit-review.googlesource.com/admin/repos/plugins/saml[Project]
+
[[scala-provider]]
=== scripting/scala-provider
diff --git a/Documentation/config-project-config.txt b/Documentation/config-project-config.txt
index f2c7965..71af331 100644
--- a/Documentation/config-project-config.txt
+++ b/Documentation/config-project-config.txt
@@ -96,7 +96,41 @@
These are the keys:
-- Description
+[[description]]description::
++
+A description for the project.
+
+[[state]]state::
++
+This setting defines the state of the project. A project can have the
+following states:
+
+- `Active`:
++
+The project is active and users can see and modify the project according
+to their access rights on the project.
+
+- `Read Only`:
++
+The project is read only and all modifying operations on it are
+disabled. E.g. this means that pushing to this project fails for all
+users even if they have push permissions assigned on it.
++
+Setting a project to this state is an easy way to temporary close a
+project, as you can keep all write access rights in place and they will
+become active again as soon as the project state is set back to
+`Active`.
++
+This state also makes sense if a project was moved to another location.
+In this case all new development should happen in the new project and
+you want to prevent that somebody accidentally works on the old
+project, while keeping the old project around for old references.
+
+- `Hidden`:
++
+The project is hidden and only visible to project owners. Other users
+are not able to see the project even if they have read permissions
+granted on the project.
[[receive-section]]
@@ -125,11 +159,27 @@
[[receive.requireChangeId]]receive.requireChangeId::
+
-Controls whether or not the Change-Id must be included in the commit message
-in the last paragraph. Default is `INHERIT`, which means that this property
-is inherited from the parent project. The global default for new hosts
-is `true`
-+
+The `Require Change-Id in commit message` option defines whether a
+link:user-changeid.html[Change-Id] in the commit message is required
+for pushing a commit for review. If this option is set, trying to push
+a commit for review that doesn't contain a Change-Id in the commit
+message fails with link:error-missing-changeid.html[missing Change-Id
+in commit message footer].
+
+It is recommended to set this option and use a
+link:user-changeid.html#create[commit-msg hook] (or other client side
+tooling like EGit) to automatically generate Change-Id's for new
+commits. This way the Change-Id is automatically in place when changes
+are reworked or rebased and uploading new patch sets gets easy.
+
+If this option is not set, commits can be uploaded without a Change-Id,
+but then users have to remember to copy the assigned Change-Id from the
+change screen and insert it manually into the commit message when they
+want to upload a second patch set.
+
+Default is `INHERIT`, which means that this property is inherited from
+the parent project. The global default for new hosts is `true`
+
This option is deprecated and future releases will behave as if this
is always `true`.
@@ -210,6 +260,25 @@
Default is `INHERIT`, which means that this property is inherited from
the parent project.
+[[receive.createNewChangeForAllNotInTarget]]receive.createNewChangeForAllNotInTarget::
++
+The `create-new-change-for-all-not-in-target` option provides a
+convenience for selecting link:user-upload.html#base[the merge base]
+by setting it automatically to the target branch's tip so you can
+create new changes for all commits not in the target branch.
+
+This option is disabled if the tip of the push is a merge commit.
+
+This option also only works if there are no merge commits in the
+commit chain, in such cases it fails warning the user that such
+pushes can only be performed by manually specifying
+link:user-upload.html#base[bases]
+
+This option is useful if you want to push a change to your personal
+branch first and for review to another branch for example. Or in cases
+where a commit is already merged into a branch and you want to create
+a new open change for that commit on another branch.
+
[[change-section]]
=== Change section
@@ -250,7 +319,7 @@
- 'mergeContent': Defines whether to automatically merge changes. Valid values
are 'true', 'false', or 'INHERIT'. Default is 'INHERIT'.
-- 'action': defines the link:project-configuration.html#submit_type[submit type]. Valid
+- 'action': defines the link:#submit-type[submit type]. Valid
values are 'fast forward only', 'merge if necessary', 'rebase if necessary',
'rebase always', 'merge always' and 'cherry pick'. The default is 'merge if necessary'.
@@ -404,6 +473,100 @@
You can read more about the +rules.pl+ file and the prolog rules on
link:prolog-cookbook.html[the Prolog cookbook page].
+[[submit-type]]
+=== Submit Type
+
+The method Gerrit uses to submit a change to a project can be
+modified by any project owner through the project console, `Projects` >
+`List` > my/project. In general, a submitted change is only merged if all
+its dependencies are also submitted, with exceptions documented below.
+The following submit types are supported:
+
+[[submit_type_inherit]]
+* Inherit
++
+This is the default for new projects, unless overridden by a global
+link:config-gerrit.html#repository.name.defaultSubmitType[`defaultSubmitType` option].
++
+Inherit the submit type from the parent project. In `All-Projects`, this
+is equivalent to link:#merge_if_necessary[Merge If Necessary].
+
+[[fast_forward_only]]
+* Fast Forward Only
++
+With this method Gerrit does not create merge commits on submitting a
+change. Merge commits may still be submitted, but they must be created
+on the client prior to uploading to Gerrit for review.
++
+To submit a change, the change must be a strict superset of the
+destination branch. That is, the change must already contain the
+tip of the destination branch at submit time.
+
+[[merge_if_necessary]]
+* Merge If Necessary
++
+If the change being submitted is a strict superset of the destination
+branch, then the branch is fast-forwarded to the change. If not,
+then a merge commit is automatically created. This is identical
+to the classical `git merge` behavior, or `git merge --ff`.
+
+[[always_merge]]
+* Always Merge
++
+Always produce a merge commit, even if the change is a strict
+superset of the destination branch. This is identical to the
+behavior of `git merge --no-ff`, and may be useful if the
+project needs to follow submits with `git log --first-parent`.
+
+[[cherry_pick]]
+* Cherry Pick
++
+Always cherry pick the patch set, ignoring the parent lineage
+and instead creating a brand new commit on top of the current
+branch head.
++
+When cherry picking a change, Gerrit automatically appends onto the
+end of the commit message a short summary of the change's approvals,
+and a URL link back to the change on the web. The committer header
+is also set to the submitter, while the author header retains the
+original patch set author.
++
+Note that Gerrit ignores dependencies between changes when using this
+submit type unless
+link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
+is enabled and depending changes share the same topic. So generally
+submitters must remember to submit changes in the right order when using this
+submit type. If all you want is extra information in the commit message,
+consider using the Rebase Always submit strategy.
+
+[[rebase_if_necessary]]
+* Rebase If Necessary
++
+If the change being submitted is a strict superset of the destination
+branch, then the branch is fast-forwarded to the change. If not,
+then the change is automatically rebased and then the branch is
+fast-forwarded to the change.
++
+When Gerrit tries to do a merge, by default the merge will only
+succeed if there is no path conflict. A path conflict occurs when
+the same file has also been changed on the other side of the merge.
+
+[[rebase_always]]
+* Rebase Always
++
+Basically, the same as Rebase If Necessary, but it creates a new patchset even
+if fast forward is possible AND like Cherry Pick it ensures footers such as
+Change-Id, Reviewed-On, and others are present in resulting commit that is
+merged.
++
+Thus, Rebase Always can be considered similar to Cherry Pick, but with
+the important distinction that Rebase Always does not ignore dependencies.
+
+[[content_merge]]
+=== Allow content merges
+If `Allow content merges` is enabled, Gerrit will try
+to do a content merge when a path conflict occurs.
+
GERRIT
------
Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/config-robot-comments.txt b/Documentation/config-robot-comments.txt
index cf5de10..0077697 100644
--- a/Documentation/config-robot-comments.txt
+++ b/Documentation/config-robot-comments.txt
@@ -36,7 +36,6 @@
== Limitations
-* Robot comments are only supported with NoteDb, but not with ReviewDb.
* Robot comments are not displayed in the web UI yet.
* There is no support for draft robot comments, but robot comments are
always published and visible to everyone who can see the change.
diff --git a/Documentation/config-themes.txt b/Documentation/config-themes.txt
index dcfd711..a83c747 100644
--- a/Documentation/config-themes.txt
+++ b/Documentation/config-themes.txt
@@ -4,34 +4,28 @@
the browser, allowing organizations to alter the look and
feel of the application to fit with their general scheme.
-Configuration can either be sitewide or per-project. Projects without a
-specified theme inherit from their parents, or from the sitewide theme
-for `All-Projects`.
+== HTML Header/Footer and CSS
-Sitewide themes are stored in `'$site_path'/etc`, and per-project
-themes are stored in `'$site_path'/themes/{project-name}`. Files are
-only served from a single theme directory; if you want to modify or
-extend an inherited theme, you must copy it into the appropriate
-per-project directory.
-
-== HTML Header/Footer
+The HTML header, footer and CSS may be customized for login
+screens (LDAP, OAuth, OpenId) and the internally managed
+Gitweb servlet.
At startup Gerrit reads the following files (if they exist) and
uses them to customize the HTML page it sends to clients:
-* `<theme-dir>/GerritSiteHeader.html`
+* `etc/GerritSiteHeader.html`
+
HTML is inserted below the menu bar, but above any page content.
This is a good location for an organizational logo, or links to
other systems like bug tracking.
-* `<theme-dir>/GerritSiteFooter.html`
+* `etc/GerritSiteFooter.html`
+
HTML is inserted at the bottom of the page, below all other content,
but just above the footer rule and the "Powered by Gerrit Code
Review (v....)" message shown at the extreme bottom.
-* `<theme-dir>/GerritSite.css`
+* `etc/GerritSite.css`
+
The CSS rules are inlined into the top of the HTML page, inside
of a `<style>` tag. These rules can be used to support styling
@@ -129,9 +123,7 @@
The `window.onload` callback is necessary to ensure that the
`Gerrit.on()` function has actually been defined by the
-page. Because GWT loads the module asynchronously any `<script>`
-block in the header or footer will execute before Gerrit has defined
-the function and is ready to register the hook callback.
+page.
GERRIT
------
diff --git a/Documentation/database-setup.txt b/Documentation/database-setup.txt
deleted file mode 100644
index de4fb20..0000000
--- a/Documentation/database-setup.txt
+++ /dev/null
@@ -1,280 +0,0 @@
-[[createdb]]
-== Database Setup
-
-During the init phase of Gerrit you will need to specify which database to use.
-
-[[createdb_h2]]
-=== H2
-
-If you choose H2, Gerrit will automatically set up the embedded H2 database as
-backend so no set up or configuration is necessary.
-
-Using the embedded H2 database is the easiest way to get a Gerrit
-site up and running, making it ideal for proof of concepts or small team
-servers. On the flip side, H2 is not the recommended option for large
-corporate installations when using ReviewDb. This is because there is no easy way to interact
-with the database while Gerrit is offline, it's not easy to backup the data,
-and it's not possible to set up H2 in a load balanced/hotswap configuration.
-
-If this option interests you, you might want to consider
-link:linux-quickstart.html[the quick guide].
-
-[[createdb_derby]]
-=== Apache Derby
-
-If Derby is selected, Gerrit will automatically set up the embedded Derby
-database as backend so no set up or configuration is necessary.
-
-Currently only support for embedded mode is added. There are two other
-deployment options for Apache Derby that can be added later:
-
-* link:http://db.apache.org/derby/papers/DerbyTut/ns_intro.html#Network+Server+Options[
-Derby Network Server (standalone mode)]
-
-* link:http://db.apache.org/derby/papers/DerbyTut/ns_intro.html#Embedded+Server[
-Embedded Server (hybrid mode)]
-
-[[createdb_postgres]]
-=== PostgreSQL
-
-This option is more complicated than the H2 option but is recommended
-for larger installations. It's the database backend with the largest userbase
-in the Gerrit community.
-
-Create a user for the web application within PostgreSQL, assign it a
-password, create a database to store the metadata, and grant the user
-full rights on the newly created database:
-
-----
- $ createuser --username=postgres -RDIElPS gerrit
- $ createdb --username=postgres -E UTF-8 -O gerrit reviewdb
-----
-
-Visit PostgreSQL's link:http://www.postgresql.org/docs/9.1/interactive/index.html[documentation] for further information regarding
-using PostgreSQL.
-
-[[createdb_mysql]]
-=== MySQL
-
-Requirements: MySQL version 5.1 or later.
-
-This option is also more complicated than the H2 option. Just as with
-PostgreSQL it's also recommended for larger installations.
-
-Create a user for the web application within the database, assign it a
-password, create a database, and give the newly created user full
-rights on it:
-
-----
- mysql
-
- CREATE USER 'gerrit'@'localhost' IDENTIFIED BY 'secret';
- CREATE DATABASE reviewdb DEFAULT CHARACTER SET 'utf8';
- GRANT ALL ON reviewdb.* TO 'gerrit'@'localhost';
- FLUSH PRIVILEGES;
-----
-
-Visit MySQL's link:http://dev.mysql.com/doc/[documentation] for further
-information regarding using MySQL.
-
-[[createdb_mariadb]]
-=== MariaDB
-
-Requirements: MariaDB version 5.5 or later.
-
-Refer to MySQL section above how to create MariaDB database.
-
-Visit MariaDB's link:https://mariadb.com/kb/en/mariadb/[documentation] for further
-information regarding using MariaDB.
-
-[[createdb_oracle]]
-=== Oracle
-
-PostgreSQL or H2 is the recommended database for Gerrit Code Review.
-Oracle is supported for environments where running on an existing Oracle
-installation simplifies administrative overheads, such as database backups.
-
-Create a user for the web application within sqlplus, assign it a
-password, and grant the user full rights on the newly created database:
-
-----
- SQL> create user gerrit identified by secret_password default tablespace users;
- SQL> grant connect, resources to gerrit;
-----
-
-JDBC driver ojdbc6.jar must be obtained from your Oracle distribution. Gerrit
-initialization process tries to copy it from a known location:
-
-----
-/u01/app/oracle/product/11.2.0/xe/jdbc/lib/ojdbc6.jar
-----
-
-If this file can not be located at this place, then the alternative location
-can be provided.
-
-Instance name is the Oracle SID. Sample database section in
-$site_path/etc/gerrit.config:
-
-----
-[database]
- type = oracle
- instance = xe
- hostname = localhost
- username = gerrit
- port = 1521
-----
-
-Sample database section in $site_path/etc/secure.config:
-
-----
-[database]
- password = secret_password
-----
-
-[[createdb_maxdb]]
-=== SAP MaxDB
-
-SAP MaxDB is a supported database for running Gerrit Code Review. However it is
-recommended only for environments where you intend to run Gerrit on an existing
-MaxDB installation to reduce administrative overhead.
-
-In the MaxDB studio or using the SQLCLI command line interface create a user
-'gerrit' with the user class 'RESOURCE' and a password <secret password>. This
-will also create an associated schema on the database.
-
-To run Gerrit on MaxDB, you need to obtain the MaxDB JDBC driver. It can be
-found in your MaxDB installation at the following location:
-
-- on Windows 64bit at "C:\Program Files\sdb\MaxDB\runtime\jar\sapdbc.jar"
-- on Linux at "/opt/sdb/MaxDB/runtime/jar/sapdbc.jar"
-
-It needs to be stored in the 'lib' folder of the review site.
-
-In the following sample database section it is assumed that the database name is
-'reviewdb' and the database is installed on localhost:
-
-In $site_path/etc/gerrit.config:
-
-----
-[database]
- type = maxdb
- database = reviewdb
- hostname = localhost
- username = gerrit
-
-----
-
-In $site_path/etc/secure.config:
-
-----
-[database]
- password = <secret password>
-----
-
-Visit SAP MaxDB's link:http://maxdb.sap.com/documentation/[documentation] for further
-information regarding using SAP MaxDB.
-
-[[createdb_db2]]
-=== DB2
-
-IBM DB2 is a supported database for running Gerrit Code Review. However it is
-recommended only for environments where you intend to run Gerrit on an existing
-DB2 installation to reduce administrative overhead.
-
-Create a system wide user for the Gerrit application, and grant the user
-full rights on the newly created database:
-
-----
- db2 => create database gerrit
- db2 => connect to gerrit
- db2 => grant connect,accessctrl,dataaccess,dbadm,secadm on database to gerrit;
-----
-
-JDBC driver db2jcc4.jar and db2jcc_license_cu.jar must be obtained
-from your DB2 distribution. Gerrit initialization process tries to copy
-it from a known location:
-
-----
-/opt/ibm/db2/V10.5/java/db2jcc4.jar
-/opt/ibm/db2/V10.5/java/db2jcc_license_cu.jar
-----
-
-If these files cannot be located at this place, then an alternative location
-can be provided during init step execution.
-
-Sample database section in $site_path/etc/gerrit.config:
-
-----
-[database]
- type = db2
- database = gerrit
- hostname = localhost
- username = gerrit
- port = 50001
-----
-
-Sample database section in $site_path/etc/secure.config:
-
-----
-[database]
- password = secret_password
-----
-
-[[createdb_hana]]
-=== SAP HANA
-
-SAP HANA is a supported database for running Gerrit Code Review. However it is
-recommended only for environments where you intend to run Gerrit on an existing
-HANA installation to reduce administrative overhead.
-
-In the HANA studio or the SAP HANA Web-based Development Workbench create a user
-'GERRIT2' with the role 'RESTRICTED_USER_JDBC_ACCESS' and a password
-<secret password>. This will also create an associated schema on the database.
-As this user would be required to change the password upon first login you might
-want to to disable the password lifetime check by executing
-'ALTER USER GERRIT2 DISABLE PASSWORD LIFETIME'.
-
-To run Gerrit on HANA, you need to obtain the HANA JDBC driver. It can be found
-as described
-link:http://help.sap.com/saphelp_hanaplatform/helpdata/en/ff/15928cf5594d78b841fbbe649f04b4/frameset.htm[here].
-It needs to be stored in the 'lib' folder of the review site.
-
-In the following sample database section it is assumed that HANA is running on
-the host 'hana.host' and listening on port '4242' where a schema/user GERRIT2
-was created:
-
-In $site_path/etc/gerrit.config:
-
-----
-[database]
- type = hana
- hostname = hana.host
- port = 4242
- username = GERRIT2
-
-----
-
-In order to configure a specific database in a multi-database environment (MDC)
-the database name has to be specified additionally:
-
-In $site_path/etc/gerrit.config:
-
-----
-[database]
- type = hana
- hostname = hana.host
- database = tdb1
- port = 4242
- username = GERRIT2
-
-----
-
-In $site_path/etc/secure.config:
-
-----
-[database]
- password = <secret password>
-----
-
-Visit SAP HANA's link:http://help.sap.com/hana_appliance/[documentation] for
-further information regarding using SAP HANA.
diff --git a/Documentation/dev-bazel.txt b/Documentation/dev-bazel.txt
index 2bc356a..5131c2c 100644
--- a/Documentation/dev-bazel.txt
+++ b/Documentation/dev-bazel.txt
@@ -9,7 +9,7 @@
* A JDK for Java 8|9|10|11|...
* Python 2 or 3
* Node.js
-* link:https://www.bazel.io/versions/master/docs/install.html[Bazel]
+* link:https://docs.bazel.build/versions/master/install.html[Bazel]
* Maven
* zip, unzip
* gcc
@@ -20,7 +20,7 @@
[[java-10]]
==== Java 10 support
-Java 10 is supported through vanilla java toolchain
+Java 10 (and newer) is supported through vanilla java toolchain
link:https://docs.bazel.build/versions/master/toolchains.html[Bazel option].
To build Gerrit with Java 10 and newer, specify vanilla java toolchain and
provide the path to JDK home:
@@ -99,7 +99,7 @@
=== Gerrit Development WAR File
-To build the Gerrit web application that includes the PolyGerrit UI:
+To build the Gerrit web application:
----
bazel build gerrit
@@ -118,8 +118,8 @@
[[release]]
=== Gerrit Release WAR File
-To build the Gerrit web application that includes the GWT UI, the
-PolyGerrit UI, core plugins and documentation:
+To build the Gerrit web application that includes the PolyGerrit UI,
+core plugins and documentation:
----
bazel build release
@@ -133,7 +133,7 @@
=== Headless Mode
-To build Gerrit in headless mode, i.e. without the PolyGerrit and GWT
+To build Gerrit in headless mode, i.e. without the PolyGerrit UI:
Web UI:
----
@@ -148,7 +148,7 @@
=== Extension and Plugin API JAR Files
-To build the extension, plugin and GWT API JAR files:
+To build the extension, plugin and acceptance-framework JAR files:
----
bazel build api
@@ -161,7 +161,8 @@
bazel-bin/api.zip
----
-Install {extension,plugin,gwt}-api to the local maven repository:
+Install {extension,plugin,acceptance-framework}-api to the local
+maven repository:
----
tools/maven/api.sh install
@@ -218,7 +219,7 @@
=== IntelliJ
-The Gerrit build works with Bazel's link:https://ij.bazel.io[IntelliJ plugin].
+The Gerrit build works with Bazel's link:https://ij.bazel.build[IntelliJ plugin].
Please follow the instructions on <<dev-intellij#,IntelliJ Setup>>.
=== Eclipse
@@ -238,7 +239,7 @@
If an updated classpath is needed, the Eclipse project can be
refreshed and missing dependency JARs can be downloaded by running
`project.py` again. For IntelliJ, you need to click the `Sync Project
-with BUILD Files` button of link:https://ij.bazel.io[IntelliJ plugin].
+with BUILD Files` button of link:https://ij.bazel.build[Bazel plugin].
[[documentation]]
=== Documentation
@@ -292,31 +293,6 @@
bazel test //javatests/com/google/gerrit/acceptance/rest/account:rest_account
----
-To run the tests against NoteDb backend with write
-to NoteDb, but not read from it:
-
-----
- bazel test --test_env=GERRIT_NOTEDB=WRITE //...
-----
-
-Write and read from NoteDb:
-
-----
- bazel test --test_env=GERRIT_NOTEDB=READ_WRITE //...
-----
-
-Primary storage NoteDb:
-
-----
- bazel test --test_env=GERRIT_NOTEDB=PRIMARY //...
-----
-
-Primary storage NoteDb and ReviewDb disabled:
-
-----
- bazel test --test_env=GERRIT_NOTEDB=ON //...
-----
-
To run only tests that do not use SSH:
----
diff --git a/Documentation/dev-contributing.txt b/Documentation/dev-contributing.txt
index 42a7f1b..5033d39 100644
--- a/Documentation/dev-contributing.txt
+++ b/Documentation/dev-contributing.txt
@@ -255,7 +255,6 @@
Here are some design level objectives that you should keep in mind
when coding:
- * ORM entity objects should match exactly one row in the database.
* Most client pages should perform only one RPC to load so as to
keep latencies down. Exceptions would apply to RPCs which need
to load large data sets if splitting them out will help the
@@ -274,11 +273,11 @@
* Don't leave repository objects (git or schema) open. A .close()
after every open should be placed in a finally{} block.
* Don't leave UI components, which can cause new actions to occur,
- enabled during RPCs which update the DB. This is to prevent
- people from submitting actions more than once when operating
- on slow links. If the action buttons are disabled, they cannot
- be resubmitted and the user can see that Gerrit is still busy.
- * GWT EventBus is the new way forward.
+ enabled during RPCs which update Git repositories, including NoteDb.
+ This is to prevent people from submitting actions more than once
+ when operating on slow links. If the action buttons are disabled,
+ they cannot be resubmitted and the user can see that Gerrit is still
+ busy.
* ...and so is Guava (previously known as Google Collections).
@@ -327,31 +326,44 @@
[[process]]
== Process
+[[dev-in-stable-branches]]
+=== Development in stable branches
+
+As their name suggests stable branches are intended to be stable. This means that generally
+only bug-fixes should be done on stable branches, however this is not strictly enforced and
+exceptions may apply:
+
+ * When a stable branch is initially created to prepare a new release the Gerrit community
+ discusses on the mailing list if there are pending features which should still make it into the
+ release. Those features are blocking the release and should be implemented on the stable
+ branch before the first release candidate is created.
+ * To stabilize the code before doing a major release several release candidates are created. Once
+ the first release candidate was done no more features should be accepted on the stable branch.
+ If more features are found to be required they should be discussed with the Gerrit maintainers
+ and should only be allowed if the risk of breaking things is considered to be low.
+ * Once a major release is done only bug-fixes and documentation updates should be done on the
+ stable branch. These updates will be included in the next minor release.
+ * For minor releases new features are only acceptable if they are important to the Gerrit
+ community, if they are backwards compatible and the risk of breaking things is low and if there
+ are no objections from the Gerrit community.
+ * In cases of doubt it's the responsibility of the release maintainer to evaluate the risk of new
+ features and make a decision based on these rules and opinions from the Gerrit community.
+ * The older a stable branch is the more stable it should be. This means old stable branches
+ should only receive bug-fixes that are either important or low risk. Security fixes, including
+ security updates for third party dependencies, are always considered as important and hence can
+ always be done on stable branches.
+
=== Backporting to stable branches
From time to time bug fix releases are made for existing stable branches.
-Developers concerned with stable branches are encouraged to backport or push
-patchsets to these branches, even if no new release is planned.
+Developers concerned with stable branches are encouraged to backport or push fixes to these
+branches, even if no new release is planned. Backporting features is only possible in compliance
+with the rules link:#dev-in-stable-branches[above].
-Fixes that are known to be needed for a particular release should be pushed
-for review on that release's stable branch. It will then be included in
-the master branch when the stable branch is merged back.
-
-=== Updating to new version of GWT
-
-When updating to a new version of GWT, there are several things that also need
-to be updated or at least checked.
-
-* Update common and plugin dependencies in `tools/gwt-constants.defs`.
-* Update to the same GWT version in the cookbook plugin and optionally in other
-plugins that have a dependency on GWT.
-* Update the GWT version in the archetype metadata in the
-`gerrit-plugin-gwt-archetype`.
-* Update the version of `gwt-maven-plugin` in the example pom.xml file in
-link:dev-plugins.html[dev-plugins].
-* Update to the same GWT version in the `gwtjsonrpc` project, and release a
-new version.
+Fixes that are known to be needed for a particular release should be pushed for review on that
+release's stable branch. They will then be included into the master branch when the stable branch
+is merged back.
=== Finding starter projects to work on
@@ -384,20 +396,21 @@
developers can agree and rely on.
General process:
-* Make sure that the feature (e.g. a field on the API) is not needed anymore or blocks
- further development or improvement. If in doubt, consult the mailing list.
-* If you can provide a schema migration that moves users to a comparable feature, do
- so and stop here.
-* Mark the feature as deprecated in the documentation and release notes.
-* If possible, mark the feature deprecated in any user-visible interface. For example,
- if you are deprecating a Git push option, add a message to the Git response if
- the user provided the option informing them about deprecation.
-* Annotate the code with `@Deprecated` and `@RemoveAfter(x.xx)` if applicable.
- Alternatively, use `// DEPRECATED, remove after x.xx` (where x.xx is the version
- number that has to be branched off before removing the feature)
-* Gate the feature behind a config that is off by default (forcing admins to turn
- the deprecated feature on explicitly).
-* After the next release was branched off, remove any code that backed the feature.
+
+ * Make sure that the feature (e.g. a field on the API) is not needed anymore or blocks
+ further development or improvement. If in doubt, consult the mailing list.
+ * If you can provide a schema migration that moves users to a comparable feature, do
+ so and stop here.
+ * Mark the feature as deprecated in the documentation and release notes.
+ * If possible, mark the feature deprecated in any user-visible interface. For example,
+ if you are deprecating a Git push option, add a message to the Git response if
+ the user provided the option informing them about deprecation.
+ * Annotate the code with `@Deprecated` and `@RemoveAfter(x.xx)` if applicable.
+ Alternatively, use `// DEPRECATED, remove after x.xx` (where x.xx is the version
+ number that has to be branched off before removing the feature)
+ * Gate the feature behind a config that is off by default (forcing admins to turn
+ the deprecated feature on explicitly).
+ * After the next release was branched off, remove any code that backed the feature.
You can optionally consult the mailing list to ask if there are users of the feature you
wish to deprecate. If there are no major users, you can remove the feature without
diff --git a/Documentation/dev-design.txt b/Documentation/dev-design.txt
index bdd2a68..69af18d 100644
--- a/Documentation/dev-design.txt
+++ b/Documentation/dev-design.txt
@@ -65,6 +65,9 @@
changing the implementation from Python on Google App Engine, to Java
on a J2EE servlet container and an SQL database.
+Since Gerrit 3.x link:note-db.html[NoteDb] replaced the SQL database
+and all metadata is now stored in Git.
+
* link:http://video.google.com/videoplay?docid=-8502904076440714866[Mondrian Code Review On The Web]
* link:https://github.com/rietveld-codereview/rietveld[Rietveld - Code Review for Subversion]
* link:http://eagain.net/gitweb/?p=gitosis.git;a=blob;f=README.rst;hb=HEAD[Gitosis README]
@@ -83,9 +86,7 @@
Each Git commit created on the client desktop system is converted
into a unique change record which can be reviewed independently.
-Change records are stored in a database: PostgreSQL, MySQL, or the
-built-in H2, where they can be queried to present customized user
-dashboards, enumerating any pending changes.
+Change records are stored in NoteDb.
A summary of each newly uploaded change is automatically emailed
to reviewers, so they receive a direct hyperlink to review the
@@ -121,9 +122,9 @@
End-user web browsers make HTTP requests directly to Gerrit's
HTTP server. As nearly all of the user interface is implemented
-through Google Web Toolkit (GWT), the majority of these requests
-are transmitting compressed JSON payloads, with all HTML being
-generated within the browser. Most responses are under 1 KB.
+through PolyGerrit, the majority of these requests are transmitting
+compressed JSON payloads, with all HTML being generated within the
+browser. Most responses are under 1 KB.
Gerrit's HTTP server side component is implemented as a standard
Java servlet, and thus runs within any J2EE servlet container.
@@ -166,9 +167,7 @@
requires that the OpenID provider selected by a user must be
online and operating in order to authenticate that user.
-* link:http://www.gwtproject.org/[Google Web Toolkit (GWT)]
* link:http://www.kernel.org/pub/software/scm/git/docs/gitrepository-layout.html[Git Repository Format]
-* link:http://www.postgresql.org/about/[About PostgreSQL]
* link:http://openid.net/developers/specs/[OpenID Specifications]
*1 Although an effort is underway to eliminate the use of the
@@ -200,11 +199,6 @@
and comments in English, and therefore an English user interface
is usable by the target user base.
-Gerrit uses GWT's i18n support to externalize all constant strings
-and messages shown to the user, so that in the future someone who
-really needed a translated version of the UI could contribute new
-string files for their locale(s).
-
Right-to-left (RTL) support is only barely considered within the
Gerrit code base. Some portions of the code have tried to take
RTL into consideration, while others probably need to be modified
@@ -235,20 +229,11 @@
Supporting non-JavaScript enabled browsers is a non-goal for Gerrit.
-As Gerrit is a pure-GWT application with no server side rendering
-fallbacks, the browser must support modern JavaScript semantics in
-order to access the Gerrit web application. Dumb clients such as
-`lynx`, `wget`, `curl`, or even many search engine spiders are not
-able to access Gerrit content.
-
-As Google Web Toolkit (GWT) is used to generate the browser
-specific versions of the client-side JavaScript code, Gerrit works
-on any JavaScript enabled browser which GWT can produce code for.
-This covers the majority of the popular browsers.
-
-The Gerrit project does not have the development resources necessary
-to support two parallel UI implementations (GWT based JavaScript
-and server-side rendering). Consequently only one is implemented.
+As Gerrit is a pure JavaScript application on the client side, with
+no server side rendering fallbacks, the browser must support modern
+JavaScript semantics in order to access the Gerrit web application.
+Dumb clients such as `lynx`, `wget`, `curl`, or even many search engine
+spiders are not able to access Gerrit content.
There are number of web browsers available with full JavaScript
support, and nearly every operating system (including any PDA-like
@@ -317,34 +302,6 @@
Gerrit does not integrate with any Google service, or any other
services other than those listed above.
-
-== Standards / Developer APIs
-
-Gerrit uses an XSRF protected variant of JSON-RPC 1.1 to communicate
-between the browser client and the server.
-
-As the protocol is not the GWT-RPC protocol, but is instead a
-self-describing standard JSON format it is easily implemented by
-any 3rd party client application, provided the client has a JSON
-parser and HTTP client library available.
-
-As the entire command set necessary for the standard web browser
-based UI is exposed through JSON-RPC over HTTP, there are no other
-data feeds or command interfaces to the server.
-
-Commands requiring user authentication may require the user agent to
-complete a sign-in cycle through the user's OpenID provider in order
-to establish the HTTP cookie Gerrit uses to track user identity.
-Automating this sign-in process for non-web browser agents is
-outside of the scope of Gerrit, as each OpenID provider uses its own
-sign-in sequence. Use of OpenID providers which have difficult to
-automate interfaces may make it impossible for non-browser agents
-to be used with the JSON-RPC interface.
-
-* link:http://json-rpc.org/wd/JSON-RPC-1-1-WD-20060807.html[JSON-RPC 1.1]
-* link:https://gerrit.googlesource.com/gwtjsonrpc/+/master/README[XSRF JSON-RPC]
-
-
== Privacy Considerations
Gerrit stores the following information per user account:
@@ -378,7 +335,7 @@
project's mailing list archives.
The user's name and email address is stored unencrypted in the
-Gerrit metadata store, typically a PostgreSQL database.
+link:config-accounts.html#all-users[All-Users] repository.
The snail-mail mailing address, country, and phone and fax numbers
are gathered to help project leads contact the user should there
@@ -648,12 +605,6 @@
=== Backups
-PostgreSQL and MySQL can be configured to replicate their data to
-other systems, where they are applied to a warm-standby backup in
-real time. Gerrit instances which care about redundancy will setup
-this feature of PostgreSQL or MySQL to ensure the warm-standby is
-reasonably current should the master go offline.
-
Using the standard replication plugin, Gerrit can be configured
to replicate changes made to the local Git repositories over any
standard Git transports. After the plugin is installed, remote
diff --git a/Documentation/dev-eclipse.txt b/Documentation/dev-eclipse.txt
index e5c1e36..67ced54 100644
--- a/Documentation/dev-eclipse.txt
+++ b/Documentation/dev-eclipse.txt
@@ -1,11 +1,9 @@
= Gerrit Code Review - Eclipse Setup
This document is about configuring Gerrit Code Review into an
-Eclipse workspace for development and debugging with GWT.
+Eclipse workspace for development.
-Java 8 or later SDK is also required to run GWT's compiler and
-runtime debugging environment.
-
+Java 8 or later SDK is require
[[setup]]
== Project Setup
@@ -104,61 +102,6 @@
* Change Save as to be Local file.
* Close the Debug Configurations dialog and save the changes when prompted.
-
-=== Running GWT Debug Mode
-
-The `gerrit_gwt_debug` launch configuration uses GWT's
-link:http://www.gwtproject.org/articles/superdevmode.html[Super Dev Mode].
-
-* Make a local copy of the `gerrit_gwt_debug` configuration, using the
-process described for `gerrit_daemon` above.
-* Launch the local copy of `gerrit_gwt_debug` from the Eclipse debug menu.
-* If debugging GWT for the first time:
-
-** Open the link:http://localhost:9876/[codeserver URL] and add the `Dev Mode On`
-and `Dev Mode Off` bookmarklet to your bookmark bar.
-
-** Activate the source maps feature in your browser. Refer to the
-link:https://developer.chrome.com/devtools/docs/javascript-debugging#source-maps[
-Chrome] and
-link:https://developer.mozilla.org/en-US/docs/Tools/Debugger#Use_a_source_map[
-Firefox] developer documentation.
-
-* Load the link:http://localhost:8080[Gerrit page].
-* Open the source tab in developer tools.
-* Click the `Dev Mode On` bookmark to incrementally recompile changed files.
-* Select the `gerrit_ui` module to compile (the `Compile` button can also be used
-as a bookmarklet).
-* In the developer tools source tab, open a file and set a breakpoint.
-* Navigate to the UI and confirm that the breakpoint is hit.
-* To end the debugging session, click the `Dev Mode Off` bookmark.
-
-.After changing the client side code:
-
-* Hitting `F5` in the browser only reloads the last compile output, without
-recompiling.
-* To reflect your changes in the debug session, click `Dev Mode On` then `Compile`.
-
-
-=== Running GWT Debug Mode for Gerrit plugins
-
-A Gerrit plugin can expose GWT module and its implementation can be inspected
-in the SDM debug session.
-
-`codeserver` needs two additional inputs to expose the plugin module in the SDM
-debug session: the module name and the source folder location. For example the
-module name and source folder of any GWT plugin should be added in the local
-copy of the `gerrit_gwt_debug` configuration:
-
-----
- com.googlesource.gerrit.plugins.myplugin.HelloForm \
- -src ${resource_loc:/gerrit}/plugins/myplugin/src/main/java \
- -- --console-log [...]
-----
-
-After doing that, both the Gerrit core and plugin GWT modules can be activated
-during SDM (debug session).
-
GERRIT
------
Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/dev-inspector.txt b/Documentation/dev-inspector.txt
index 2134f2f..b1559ca 100644
--- a/Documentation/dev-inspector.txt
+++ b/Documentation/dev-inspector.txt
@@ -54,8 +54,6 @@
----
"Shell" is "com.google.gerrit.pgm.shell.JythonShell@61644f2d"
"m" is "com.google.gerrit.lifecycle.LifecycleManager@6f03b248"
-"ds" is "com.google.gerrit.server.schema.DataSourceProvider@6b3592c"
-"schk" is "com.google.gerrit.server.schema.SchemaVersionCheck@5e8cb9bd"
Welcome to the Gerrit Inspector
Enter help() to see the above again, EOF to quit and stop Gerrit
@@ -109,71 +107,11 @@
'registerNatives', 'toString', 'wait']
----
-Startup script provides some convenient variables to access some global Gerrit components,
-for example a connection to the review database is kept open:
-
-----
->>> ds
-org.apache.commons.dbcp.BasicDataSource@61db2215
->>> ds.driverClassName
-u'org.postgresql.Driver'
->>> ds.dataSource
-org.apache.commons.dbcp.PoolingDataSource@23226fe1
->>> ds.dataSource.connection
-jdbc:postgresql://localhost/reviewdb, UserName=rv, PostgreSQL Native Driver
-----
-
-It is also possible to interact with the ORM layer:
-
-----
->>> db = schk.schema.open()
->>> db
-com.google.gerrit.reviewdb.server.ReviewDb_Schema_GwtOrm$$28@24cbbdf3
->>> db.getDialect()
-com.google.gwtorm.schema.sql.DialectPostgreSQL@4de07d3e
->>> for x in db.patchSets().iterateAllEntities():
-... print x
-...
-[PatchSet 1,1]
-[PatchSet 2,1]
-[PatchSet 3,1]
-[PatchSet 4,1]
-[PatchSet 5,1]
-[PatchSet 6,1]
-[PatchSet 7,1]
-[PatchSet 8,1]
-[PatchSet 6,2]
->>> for x in db.patchComments().iterateAllEntities():
-... print x
-com.google.gerrit.reviewdb.client.PatchLineComment@5381298a
-com.google.gerrit.reviewdb.client.PatchLineComment@44ce4dda
-com.google.gerrit.reviewdb.client.PatchLineComment@44594680
->>> dir(com.google.gerrit.reviewdb.client.PatchLineComment)
-['Key', 'STATUS_DRAFT', 'STATUS_PUBLISHED', 'Status', '__class__',
-'__copy__', '__deepcopy__', '__delattr__', '__doc__', '__eq__',
-'__getattribute__', '__hash__', '__init__', '__ne__', '__new__',
-'__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__str__',
-'__unicode__', 'author', 'class', 'clone', 'equals', 'finalize',
-'getAuthor', 'getClass', 'getKey', 'getLine', 'getMessage',
-'getParentUuid', 'getSide', 'getStatus', 'getWrittenOn', 'hashCode',
-'key', 'line', 'lineNbr', 'message', 'notify', 'notifyAll',
-'parentUuid', 'registerNatives', 'setMessage', 'setSide', 'setStatus',
-'side', 'status', 'toString', 'updated', 'wait', 'writtenOn']
->>> for x in db.patchComments().iterateAllEntities():
-... print x.status, x.line, x.message
-...
-P 2 I like it!
-P 2 more
-P 1 better
-----
-
A built-in *help()* function provides values of global variables
defined in the interpreter:
----
>>> help()
-"schk" is "com.google.gerrit.server.schema.SchemaVersionCheck@5e8cb9bd"
-"ds" is "com.google.gerrit.server.schema.DataSourceProvider@6b3592c"
"m" is "com.google.gerrit.lifecycle.LifecycleManager@6f03b248"
"Shell" is "com.google.gerrit.pgm.shell.JythonShell@61644f2d"
"d" is "com.google.gerrit.pgm.Daemon@28a3f689"
diff --git a/Documentation/dev-intellij.txt b/Documentation/dev-intellij.txt
index 8bedd08..5077079 100644
--- a/Documentation/dev-intellij.txt
+++ b/Documentation/dev-intellij.txt
@@ -1,10 +1,24 @@
-= Gerrit Code Review - IntelliJ Setup
+= Gerrit Code Review - IntelliJ IDEA Setup
== Prerequisites
-You need an installation of IntelliJ version 2016.2 or later. The latest version
-might not yet be in-sync with the Bazel plugin for IntelliJ. It usually becomes
-so quite quickly after new IDEA versions get released, though. It should then be
-possible to use the fairly latest IntelliJ release with an updated Bazel plugin.
+
+=== Bazel
+
+Bazel must be installed as described by
+<<dev-bazel#installation,Building with Bazel - Installation>>.
+
+It's strongly recommended to verify you can build your Gerrit tree with Bazel
+for Java 8 from the command line first. Ensure that at least
+`bazel build gerrit` runs successfully before you proceed.
+
+=== IntelliJ version and Bazel plugin
+
+Before downloading IntelliJ, look at the
+link:https://plugins.jetbrains.com/plugin/8609-bazel/versions[JetBrains plugin repository page of the Bazel plugin]
+to see what version of the IntelliJ IDEA it is actually compatible with.
+
+Also note that the version of the Bazel plugin used in turn may or may not be
+compatible with the Bazel version used.
In addition, Java 8 must be specified on your path or via `JAVA_HOME` so that
building with Bazel via the Bazel plugin is possible.
@@ -13,39 +27,64 @@
plugin fails and IntelliJ reports the error **Could not get Bazel roots**, this
indicates that the Bazel plugin couldn't find Java 8.
-Bazel must be installed as described by
-<<dev-bazel#installation,Building with Bazel - Installation>>.
+=== Installation of IntelliJ IDEA
+
+Please refer to the
+link:https://www.jetbrains.com/help/idea/installation-guide.html[installation guide provided by Jetbrains]
+to install it on your platform. Make sure to install a version compatible with
+the Bazel plugin as mentioned above.
== Installation of the Bazel plugin
-. Go to *File -> Settings -> Plugins*.
-. Click on *Browse Repositories*.
-. Search for the plugin `IntelliJ with Bazel`.
-. Install it.
-. Restart IntelliJ.
+The plugin is usually installed using the Jetbrains plugin repository as shown
+in the steps below, but it's also possible to
+link:https://github.com/bazelbuild/intellij[build it from source].
-== Creation of IntelliJ project
+. Go to *File -> Settings -> Plugins*.
++
+(Or, from the welcome screen, *Configure -> Plugins*)
+. Activate the *Marketplace* tab.
+. Search for the plugin `Bazel` (by Google).
++
+TIP: In case the Bazel plugin is not listed, or if it shows an outdated version,
+verify the compatibility between the Bazel plugin and IntelliJ IDEA on link:https://plugins.jetbrains.com/plugin/8609-bazel/versions[the JetBrains plugin page].
+. Install it.
+. Restart IntelliJ IDEA.
+
+[TIP]
+====
+If your project's Bazel build fails with **Cannot run program "bazel": No such
+file or directory**, then you may have to set the binary location in the Bazel
+plugin settings:
+
+. Go to *Preferences -> Other Settings -> Bazel Settings*.
+. Set the *Bazel binary location*.
+====
+
+== Creation of the project
. Go to *File -> Import Bazel Project*.
++
+(Or, from the welcome screen, *Import Bazel Project* should already be shown in
+there.)
. For *Use existing bazel workspace -> Workspace*, select the directory
containing the Gerrit source code.
. Choose *Import from workspace* and select the `.bazelproject` file which is
located in the top directory of the Gerrit source code.
. Adjust the path of the project data directory and the name of the project if
desired.
+. Finish the creation of the project.
+. Verify that you can now build the project. Hit the button with the Bazel icon
+(located on the top-right by default) to synchronize the project. Note that
+warnings may be present in the build.
+
+At this point all the basic functionality should be working such as Java class
+inspection and running <<unit-tests,unit tests>>.
TIP: The project data directory can be separate from the source code. One
advantage of this is that project files don't need to be excluded from version
control.
-Unfortunately, the created project seems to have a broken output path. To fix
-it, please complete the following steps:
-
-. Go to *File -> Project Structure -> Project Settings -> Modules*.
-. Switch to the tab *Paths*.
-. Click on *Inherit project compile output path*.
-. Click on *Use module compile output path*.
-
== Recommended settings
=== Code style
@@ -54,17 +93,20 @@
Install the `google-java-format` plugin by following these steps:
. Go to *File -> Settings -> Plugins*.
-. Click on *Browse Repositories*.
-. Search for the plugin `google-java-format`.
+. Activate the *Marketplace* tab.
+. Search for the plugin `google-java-format` by Google.
. Install it.
-. Restart IntelliJ.
+. Restart IntelliJ IDEA.
-Every time you start IntelliJ, make sure to use *Code -> Reformat with
+Every time you start IntelliJ IDEA, make sure to use *Code -> Reformat with
google-java-format* on an arbitrary line of code. This replaces the default
CodeStyleManager with a custom one. Thus, uses of *Reformat Code* either via
*Code -> Reformat Code*, keyboard shortcuts, or the commit dialog will use the
custom style defined by the `google-java-format` plugin.
+Please refer to the documentation on the <<dev-contributing#style,code style>>
+for which version of `google-java-format` is used with Gerrit.
+
==== Code style settings
The `google-java-format` plugin is the preferred way to format the code. As it
only kicks in on demand, it's also recommended to have code style settings
@@ -77,11 +119,10 @@
https://raw.githubusercontent.com/google/styleguide/gh-pages/intellij-java-google-style.xml[
intellij-java-google-style.xml].
. Go to *File -> Settings -> Editor -> Code Style*.
-. Click on *Manage*.
-. Click on *Import*.
-. Choose `IntelliJ IDEA Code Style XML`.
+. Click on the wrench icon with the tooltip _Show Scheme Actions_.
+. Click on *Import Scheme*.
. Select the previously downloaded file `intellij-java-google-style.xml`.
-. Make sure that `Google Style` is chosen as *Scheme*.
+. Make sure that `GoogleStyle` is chosen as the current *Scheme*.
In addition, the EditorConfig settings (which ensure a consistent style between
Eclipse, IntelliJ, and other editors) should be applied on top of that. Those
@@ -90,7 +131,7 @@
and configured correctly as can be verified by:
. Go to *File -> Settings -> Plugins*.
-. Ensure that the EditorConfig plugin is enabled.
+. Ensure that the *EditorConfig* plugin (by JetBrains) is enabled.
. Go to *File -> Settings -> Editor -> Code Style*.
. Ensure that *Enable EditorConfig support* is checked.
@@ -98,33 +139,42 @@
the code style settings, simply confirm that.
=== Copyright
-Copy the folder `$(gerrit_source_code)/tools/intellij/copyright` (not just the
+
+. Copy the folder `$(gerrit_source_code)/tools/intellij/copyright` (not just the
contents) to `$(project_data_directory)/.idea`. If it already exists, replace
-it.
+it. If you didn't select a custom data directory the command could look like
+this, as run from the Gerrit source tree checkout as working directory:
++
+----
+cp -r tools/intellij/copyright .ijwb/.idea/
+----
+. Go to *File -> Settings -> Editor -> Copyright -> Copyright Profiles*.
+. Verify that the *Gerrit Copyright* is now present there.
++
+Only in case it hasn't picked up the copyright profile automatically, import
+the `Gerrit_Copyright.xml` from that folder manually.
-=== File header
-By default, IntelliJ adds a file header containing the name of the author and
-the current date to new files. To disable that, follow these steps:
+=== Git integration
+This section is only relevant in case you want to use the Git integration
+plugin in IntelliJ IDEA.
-. Go to *File -> Settings -> Editor -> File and Code Templates*.
-. Select the tab *Includes*.
-. Select *File Header*.
-. Remove the template code in the right editor.
-
-=== Commit message
To simplify the creation of commit messages which are compliant with the
<<dev-contributing#commit-message,Commit Message>> format, do the following:
-. Go to *File -> Settings -> Version Control*.
-. Check *Commit message right margin (columns)*.
-. Make sure that 72 is specified as value.
-. Check *Wrap when typing reaches right margin*.
+. Go to *File -> Settings -> Version Control -> Commit Dialog*.
+. In the *Commit message inspections*, activate the three inspections:
+* *Blank line between subject and body*,
+* *Limit body line* and
+* *Limit subject line*.
+. For the limit line inspections, make sure that 72 is specified as value.
+. For *Limit body line*, tick *Show right margin* and *Wrap when typing reaches
+right margin*.
In addition, you should follow the instructions of
<<dev-contributing#git_commit_settings,this section>> (if you haven't
done so already):
-* Install the Git hook for the `Change-Id` line.
+* Install the Git commit message hook for the `Change-Id` line.
* Set up the HTTP access.
Setting up the HTTP access will allow you to commit changes via IntelliJ without
@@ -136,29 +186,19 @@
choose *Edit Configurations* on the drop-down list of the run configurations
or go to *Run -> Edit Configurations*.
-=== Pre-configured run configurations
+[[runconfigurations-daemon]]
+=== Gerrit Daemon
-In order to be able to use the pre-configured run configurations, the following
-steps are necessary:
-
-. Make sure that the folder `runConfigurations` exists within
-`$(project_data_directory)/.idea`. If it doesn't exist, create it.
-. Specify the IntelliJ path variable `GERRIT_TESTSITE`. (This configuration is
-shared among all IntelliJ projects.)
-.. Go to *Settings -> Appearance & Behavior -> Path Variables*.
-.. Click on the *+* to add a new path variable.
-.. Specify `GERRIT_TESTSITE` as name and the path to your local test site as
-value.
-
-The copied run configurations will be added automatically to the available run
-configurations of the IntelliJ project.
-
-==== Gerrit Daemon
-WARNING: At the moment running this configuration results in a
+[WARNING]
+====
+At the moment running this (local) configuration results in a
`java.io.FileNotFoundException`. To debug a local Gerrit server with IntelliJ,
use the instructions of <<dev-readme#run_daemon,Running the Daemon>> in
combination with <<remote-debug,Debugging a remote Gerrit server>>.
+(link:https://bugs.chromium.org/p/gerrit/issues/detail?id=11360[Issue 11360])
+====
+
Copy `$(gerrit_source_code)/tools/intellij/gerrit_daemon.xml` to
`$(project_data_directory)/.idea/runConfigurations/`.
@@ -168,19 +208,17 @@
NOTE: The <<dev-readme#init,Site Initialization>> has to be completed
before this run configuration works properly.
+[[unit-tests]]
=== Unit tests
To create run configurations for unit tests, run or debug them via a right-click
on a method, class, file, or package. The created run configuration is a
-temporary one and can be saved to make it permanent.
+temporary one and can be saved to make it permanent by selecting *Create
+'Bazel test [...]'...* from the context menu.
Normally, this approach generates JUnit run configurations. When the Bazel
plugin manages a project, it intercepts the creation and creates a Bazel test
run configuration instead, which can be used just like the standard ones.
-TIP: If you would like to execute a test in NoteDb mode, add
-`--test_env=GERRIT_NOTEDB=READ_WRITE` to the *Bazel flags* of your run
-configuration.
-
[[remote-debug]]
=== Debugging a remote Gerrit server
If a remote Gerrit server is running and has opened a debug port, you can attach
@@ -188,10 +226,15 @@
. Go to *Run -> Edit Configurations*.
. Click on the *+* to add a new configuration.
-. Choose *Remote*.
+. Choose *Remote* from the *Templates*.
. Adjust *Configuration -> Settings -> Host* and *Port*.
. Start this configuration in `Debug` mode.
+TIP: This run configuration dialog also shows the line for the JVM as startup
+flag that you can copy to include in your
+`$(gerrit_test_site)/etc/gerrit.config` in the `[container]` section in order
+to work-around the <<runconfigurations-daemon,local run configuration issue>>.
+
GERRIT
------
Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/dev-plugins.txt b/Documentation/dev-plugins.txt
index 974e370..0e61b98 100644
--- a/Documentation/dev-plugins.txt
+++ b/Documentation/dev-plugins.txt
@@ -322,10 +322,10 @@
Plugins' InitSteps are executed during the "Gerrit Plugin init" phase, after
the extraction of the plugins embedded in the distribution .war file into
-`$GERRIT_SITE/plugins` and before the DB Schema initialization or upgrade.
+`$GERRIT_SITE/plugins` and before the site initialization or upgrade.
-A plugin's InitStep cannot refer to Gerrit's DB Schema or any other Gerrit
-runtime objects injected at startup.
+A plugin's InitStep cannot refer to any Gerrit runtime objects injected at
+startup.
[source,java]
----
@@ -452,7 +452,7 @@
----
import com.google.gerrit.common.EventDispatcher;
import com.google.gerrit.extensions.registration.DynamicItem;
-import com.google.gwtorm.server.OrmException;
+import com.google.exceptions.StorageException;
import com.google.inject.Inject;
class MyPlugin {
@@ -466,7 +466,7 @@
private void postEvent(MyPluginEvent event) {
try {
eventDispatcher.get().postEvent(event);
- } catch (OrmException e) {
+ } catch (StorageException e) {
// error handling
}
}
@@ -715,10 +715,9 @@
[source,java]
----
-@Singleton
public class SampleOperator
implements ChangeQueryBuilder.ChangeOperatorFactory {
- public static class MyPredicate extends OperatorChangePredicate<ChangeData> {
+ public static class MyPredicate extends PostFilterPredicate<ChangeData> {
...
}
@@ -748,7 +747,6 @@
new `has:sample_pluginName` operand is shown below:
====
- @Singleton
public class SampleHasOperand implements ChangeHasOperandFactory {
public static class Module extends AbstractModule {
@Override
@@ -798,56 +796,112 @@
}
----
+=== Calling Command Options ===
+
+Within an OptionHandler, during the processing of an option, plugins can
+provide and call extra parameters on the current command during parsing
+simulating as if they had been passed from the command line originally.
+
+To call additional parameters from within an option handler, instantiate
+the com.google.gerrit.util.cli.CmdLineParser.Parameters class with the
+existing parameters, and then call callParameters() with the additional
+parameters to be parsed. OptionHandlers may optionally pass this class to
+other methods which may then both parse/consume more parameters and call
+additional parameters.
+
+When calling command options not provided by your plugin, there is always
+a risk that the options may not exist, perhaps because the options being
+called are to be provided by another plugin, and said plugin is not
+currently installed. To protect againt this situation, it is possible to
+define an option as being dependent on other options using the
+@RequiresOptions() annotation. If the required options are not all not
+currently present, then the dependent option will not be available or
+visible in the help.
+
+The example below shows a plugin that adds a "--special" option (perhaps
+for use with the Query command) that calls (and requires) the
+"--format json" option.
+
+[source, java]
+----
+public class JsonOutputOptionHandler<T> extends OptionHandler<T> {
+ protected com.google.gerrit.util.cli.CmdLineParser.MyParser myParser;
+
+ public JsonOutputOptionHandler(CmdLineParser parser, OptionDef option, Setter<? super T> setter) {
+ super(parser, option, setter);
+ myParser = (com.google.gerrit.util.cli.CmdLineParser.MyParser) owner;
+ }
+
+ @Override
+ public int parseArguments(org.kohsuke.args4j.spi.Parameters params) throws CmdLineException {
+ new Parameters(params, myParser).callParameters("--format", "json");
+ setter.addValue(true);
+ return 0; // we didn't consume any additional args
+ }
+
+ @Override
+ public String getDefaultMetaVariable() {
+ ...
+ }
+}
+
+@RequiresOptions("--format")
+@Option(
+ name = "--special",
+ usage = "ouptut results using json",
+ handler = JsonOutputOptionHandler.class
+)
+boolean json;
+----
+
[[query_attributes]]
-=== Query Attributes ===
+=== Change Attributes ===
-Plugins can provide additional attributes to be returned in Gerrit queries by
-implementing the ChangeAttributeFactory interface and registering it to the
-ChangeQueryProcessor.ChangeAttributeFactory class in the plugin module's
-'configure()' method. The new attribute(s) will be output under a "plugin"
-attribute in the change query output. This can be further controlled with an
-option registered in the Http and Ssh modules' 'configure*()' methods.
+Plugins can provide additional attributes to be returned from the Get Change and
+Query Change APIs by implementing implementing the `ChangeAttributeFactory`
+interface and adding it to the `DynamicSet` in the plugin module's `configure()`
+method. The new attribute(s) will be output under a `plugin` attribute in the
+change output. This can be further controlled by registering a class containing
+@Option declarations as a `DynamicBean`, annotated with the with HTTP/SSH
+commands on which the options should be available.
-The example below shows a plugin that adds two attributes ('exampleName' and
-'changeValue'), to the change query output, when the query command is provided
-the --myplugin-name--all option.
+The example below shows a plugin that adds two attributes (`exampleName` and
+`changeValue`), to the change query output, when the query command is provided
+the `--myplugin-name--all` option.
[source, java]
----
public class Module extends AbstractModule {
@Override
protected void configure() {
- bind(ChangeAttributeFactory.class)
- .annotatedWith(Exports.named("example"))
+ // Register attribute factory.
+ DynamicSet.bind(binder(), ChangeAttributeFactory.class)
.to(AttributeFactory.class);
+
+ // Register options for GET /changes/X/change and /changes/X/detail.
+ bind(DynamicBean.class)
+ .annotatedWith(Exports.named(GetChange.class))
+ .to(MyChangeOptions.class);
+
+ // Register options for GET /changes/?q=...
+ bind(DynamicBean.class)
+ .annotatedWith(Exports.named(QueryChanges.class))
+ .to(MyChangeOptions.class);
+
+ // Register options for ssh gerrit query.
+ bind(DynamicBean.class)
+ .annotatedWith(Exports.named(Query.class))
+ .to(MyChangeOptions.class);
}
}
-public class MyQueryOptions implements DynamicBean {
+public class MyChangeOptions implements DynamicBean {
@Option(name = "--all", usage = "Include plugin output")
public boolean all = false;
}
-public static class HttpModule extends HttpPluginModule {
- @Override
- protected void configureServlets() {
- bind(DynamicBean.class)
- .annotatedWith(Exports.named(QueryChanges.class))
- .to(MyQueryOptions.class);
- }
-}
-
-public static class SshModule extends PluginCommandModule {
- @Override
- protected void configureCommands() {
- bind(DynamicBean.class)
- .annotatedWith(Exports.named(Query.class))
- .to(MyQueryOptions.class);
- }
-}
-
public class AttributeFactory implements ChangeAttributeFactory {
- protected MyQueryOptions options;
+ protected MyChangeOptions options;
public class PluginAttribute extends PluginDefinedInfo {
public String exampleName;
@@ -860,9 +914,9 @@
}
@Override
- public PluginDefinedInfo create(ChangeData c, ChangeQueryProcessor qp, String plugin) {
+ public PluginDefinedInfo create(ChangeData c, BeanProvider bp, String plugin) {
if (options == null) {
- options = (MyQueryOptions) qp.getDynamicBean(plugin);
+ options = (MyChangeOptions) bp.getDynamicBean(plugin);
}
if (options.all) {
return new PluginAttribute(c);
@@ -890,6 +944,23 @@
],
...
}
+
+curl http://localhost:8080/changes/1?myplugin-name--all
+
+Output:
+
+{
+ "_number": 1,
+ ...
+ "plugins": [
+ {
+ "name": "myplugin-name",
+ "example_name": "Attribute Example",
+ "change_value": "1"
+ }
+ ],
+ ...
+}
----
[[simple-configuration]]
@@ -1299,7 +1370,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:
@@ -1512,9 +1583,8 @@
// schedule a build
[...]
// update change
- ReviewDb db = dbProvider.get();
try (BatchUpdate bu = batchUpdateFactory.create(
- db, project.getNameKey(), user, TimeUtil.nowTs())) {
+ project.getNameKey(), user, TimeUtil.nowTs())) {
bu.addOp(change.getId(), new BatchUpdate.Op() {
@Override
public boolean updateChange(ChangeContext ctx) {
@@ -1875,317 +1945,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 ServletModule {
-
- @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
@@ -2686,40 +2445,6 @@
Disabled plugins can be re-enabled using the
link:cmd-plugin-enable.html[plugin enable] command.
-== Known issues and bugs
-
-=== Error handling in UI when using the REST API
-
-When a plugin invokes a REST endpoint in the UI, it provides an
-`AsyncCallback` to handle the result. At the moment the
-`onFailure(Throwable)` of the callback is never invoked, even if there
-is an error. Errors are always handled by the Gerrit core UI which
-shows the error dialog. This means currently plugins cannot do any
-error handling and e.g. ignore expected errors.
-
-In the following example the REST endpoint would return '404 Not
-Found' if the user has no username and the Gerrit core UI would
-display an error dialog for this. However having no username is
-not an error and the plugin may like to handle this case.
-
-[source,java]
-----
-new RestApi("accounts").id("self").view("username")
- .get(new AsyncCallback<NativeString>() {
-
- @Override
- public void onSuccess(NativeString username) {
- // TODO
- }
-
- @Override
- public void onFailure(Throwable caught) {
- // never invoked
- }
-});
-----
-
-
[[reviewer-suggestion]]
== Reviewer Suggestion Plugins
@@ -2800,6 +2525,39 @@
return pluginName + " mycommand";
----
+[[ssh-command-execution-interception]]
+== SSH Command Execution Interception
+Gerrit provides an extension point that enables plugins to check and
+prevent an SSH command from being run.
+
+[source, java]
+----
+import com.google.gerrit.sshd.SshExecuteCommandInterceptor;
+
+@Singleton
+public class SshExecuteCommandInterceptorImpl implements SshExecuteCommandInterceptor {
+ private final Provider<SshSession> sessionProvider;
+
+ @Inject
+ SshExecuteCommandInterceptorImpl(Provider<SshSession> sessionProvider) {
+ this.sessionProvider = sessionProvider;
+ }
+
+ @Override
+ public boolean accept(String command, List<String> arguments) {
+ if (command.startsWith("gerrit") && !"10.1.2.3".equals(sessionProvider.get().getRemoteAddressAsString())) {
+ return false;
+ }
+ return true;
+ }
+}
+----
+
+And then declare it in your SSH module:
+[source, java]
+----
+ DynamicSet.bind(binder(), SshExecuteCommandInterceptor.class).to(SshExecuteCommandInterceptorImpl.class);
+----
[[pre-submit-evaluator]]
== Pre-submit Validation Plugins
@@ -2907,40 +2665,6 @@
}
----
-[[ssh-command-execution-interception]]
-== SSH Command Execution Interception
-Gerrit provides an extension point that enables plugins to check and
-prevent an SSH command from being run.
-
-[source, java]
-----
-import com.google.gerrit.sshd.SshExecuteCommandInterceptor;
-
-@Singleton
-public class SshExecuteCommandInterceptorImpl implements SshExecuteCommandInterceptor {
- private final Provider<SshSession> sessionProvider;
-
- @Inject
- SshExecuteCommandInterceptorImpl(Provider<SshSession> sessionProvider) {
- this.sessionProvider = sessionProvider;
- }
-
- @Override
- public boolean accept(String command, List<String> arguments) {
- if (command.startsWith("gerrit") && !"10.1.2.3".equals(sessionProvider.get().getRemoteAddressAsString())) {
- return false;
- }
- return true;
- }
-}
-----
-
-And then declare it in your SSH module:
-[source, java]
-----
- DynamicSet.bind(binder(), SshExecuteCommandInterceptor.class).to(SshExecuteCommandInterceptorImpl.class);
-----
-
Plugin authors should also consider binding their SubmitRule using a `Gerrit-BatchModule`.
See link:dev-plugins.html[Batch runtime] for more informations.
@@ -2954,6 +2678,94 @@
are met, but marked as `OK`. If the requirements were not displayed, reviewers
would need to use their precious time to manually check that they were met.
+[[quota-enforcer]]
+== Quota Enforcer
+
+Gerrit provides an extension point that allows a plugin to enforce quota.
+link:quota.html[This documentation page] has a list of all quota requests that
+Gerrit core issues. Plugins can choose to respond to all or just a subset of
+requests. Some implementations might want to keep track of user quota in buckets,
+others might just check against instance or project state to enforce limits on how
+many projects can be created or how large a repository can become.
+
+Checking against instance state can be racy for concurrent requests as the server does not
+refill tokens if the action fails in a later stage (e.g. database failure). If
+plugins want to guarantee an absolute maximum on a resource, they have to do their own
+book-keeping.
+
+[source, java]
+----
+import com.google.server.quota.QuotaEnforcer;
+
+class ProjectLimiter implements QuotaEnforcer {
+ private final long maxNumberOfProjects = 100;
+ @Override
+ QuotaResponse requestTokens(String quotaGroup, QuotaRequestContext ctx, long numTokens) {
+ if (!"/projects/create".equals(quotaGroup)) {
+ return QuotaResponse.noOp();
+ }
+ // No deduction because we always check against the instance state (racy but fine for
+ // this plugin)
+ if (currentNumberOfProjects() + numTokens > maxNumberOfProjects) {
+ return QuotaResponse.error("too many projects");
+ }
+ return QuotaResponse.ok();
+ }
+
+ @Override
+ QuotaResponse dryRun(String quotaGroup, QuotaRequestContext ctx, long numTokens) {
+ // Since we are not keeping any state in this enforcer, we can simply call requestTokens().
+ return requestTokens(quotaGroup, ctx, numTokens);
+ }
+
+ void refill(String quotaGroup, QuotaRequestContext ctx, long numTokens) {
+ // No-op
+ }
+}
+----
+
+[source, java]
+----
+import com.google.server.quota.QuotaEnforcer;
+
+class ApiQpsEnforcer implements QuotaEnforcer {
+ // AutoRefillingPerUserBuckets is a imaginary bucket implementation that could be based on
+ // a loading cache or a commonly used bucketing algorithm.
+ private final AutoRefillingPerUserBuckets<CurrentUser, Long> buckets;
+ @Override
+ QuotaResponse requestTokens(String quotaGroup, QuotaRequestContext ctx, long numTokens) {
+ if (!quotaGroup.startsWith("/restapi/")) {
+ return QuotaResponse.noOp();
+ }
+ boolean success = buckets.deduct(ctx.user(), numTokens);
+ if (!success) {
+ return QuotaResponse.error("user sent too many qps, please wait for 5 minutes");
+ }
+ return QuotaResponse.ok();
+ }
+
+ @Override
+ QuotaResponse dryRun(String quotaGroup, QuotaRequestContext ctx, long numTokens) {
+ if (!quotaGroup.startsWith("/restapi/")) {
+ return QuotaResponse.noOp();
+ }
+ boolean success = buckets.checkOnly(ctx.user(), numTokens);
+ if (!success) {
+ return QuotaResponse.error("user sent too many qps, please wait for 5 minutes");
+ }
+ return QuotaResponse.ok();
+ }
+
+ @Override
+ void refill(String quotaGroup, QuotaRequestContext ctx, long numTokens) {
+ if (!quotaGroup.startsWith("/restapi/")) {
+ return;
+ }
+ buckets.add(ctx.user(), numTokens);
+ }
+}
+----
+
== SEE ALSO
diff --git a/Documentation/dev-readme.txt b/Documentation/dev-readme.txt
index 92d080b..8bf4814 100644
--- a/Documentation/dev-readme.txt
+++ b/Documentation/dev-readme.txt
@@ -93,6 +93,7 @@
. Click 'become' in the upper right corner.
. Select 'Switch User'.
. Register a new account.
+. link:user-upload.html#ssh[Configure your SSH key].
Use the `ssh` protocol to clone from and push to the local server. For
example, to clone a repository that you've created through the admin
@@ -187,27 +188,6 @@
CAUTION: When using the Inspector, be careful not to modify the internal state
of the system.
-=== Querying the database
-
-The embedded H2 database can be queried and updated from the command line. If
-the daemon is not running, run:
-
-----
- $(bazel info output_base)/external/local_jdk/bin/java \
- -jar bazel-bin/gerrit.war gsql -d ../gerrit_testsite -s
-----
-
-NOTE: To learn why using `java -jar` isn't sufficient, see
-<<special_bazel_java_version,this explanation>>.
-
-Alternatively, if the daemon is running and the database is in use, use an
-administrator user account to connect over SSH:
-
-----
- ssh -p 29418 user@localhost gerrit gsql
-----
-
-
== Switching between branches
When using `git checkout` without `--recurse-submodules` to switch between
diff --git a/Documentation/dev-release-deploy-config.txt b/Documentation/dev-release-deploy-config.txt
index 5f95cb3..5411927 100644
--- a/Documentation/dev-release-deploy-config.txt
+++ b/Documentation/dev-release-deploy-config.txt
@@ -91,7 +91,7 @@
* `gerrit-maven`:
+
-Bucket to store Gerrit Subproject Artifacts (e.g. `gwtjsonrpc` etc.).
+Bucket to store Gerrit Subproject Artifacts (e.g. `gwtorm` etc.).
To upload artifacts to a bucket the user must authenticate with a
username and password. The username and password need to be retrieved
diff --git a/Documentation/dev-release-subproject.txt b/Documentation/dev-release-subproject.txt
index 4886849..c9369b9 100644
--- a/Documentation/dev-release-subproject.txt
+++ b/Documentation/dev-release-subproject.txt
@@ -73,7 +73,7 @@
* Deploy the new release:
+
----
- mvn deploy
+ mvn deploy -DperformRelease=true
----
* Push the pom change(s) to the project's repository
diff --git a/Documentation/error-changeid-above-footer.txt b/Documentation/error-changeid-above-footer.txt
new file mode 100644
index 0000000..abc0186
--- /dev/null
+++ b/Documentation/error-changeid-above-footer.txt
@@ -0,0 +1,31 @@
+= commit xxxxxxx: Change-Id must be in message footer
+
+With this error message, Gerrit rejects a push of a commit to a project
+if the commit message of the pushed commit contains a Change-Id line that
+is not in the footer (the last paragraph).
+
+To be picked up by Gerrit, a Change-Id must be in the last paragraph
+of a commit message. For details, see link:user-changeid.html[Change-Id Lines].
+
+You can see the commit messages for existing commits in the history
+by doing a link:http://www.kernel.org/pub/software/scm/git/docs/git-log.html[git log].
+
+
+== Change-Id is contained in the commit message but not in the last paragraph
+
+If the Change-Id is contained in the commit message but not in its
+last paragraph, you have to update the commit message and move the
+Change-Id into the last paragraph. How to update the commit message
+is explained link:error-push-fails-due-to-commit-message.html[here].
+
+To avoid confusion due to a Change-Id that was meant to be picked up by
+Gerrit not being picked up, this is an error whether or not the project
+is configured to always require a Change-Id in the commit message.
+
+
+GERRIT
+------
+Part of link:error-messages.html[Gerrit Error Messages]
+
+SEARCHBOX
+---------
diff --git a/Documentation/error-messages.txt b/Documentation/error-messages.txt
index 37eb1f6..b523663 100644
--- a/Documentation/error-messages.txt
+++ b/Documentation/error-messages.txt
@@ -18,6 +18,7 @@
* link:error-invalid-changeid-line.html[invalid Change-Id line format in commit message footer]
* link:error-invalid-committer.html[invalid committer]
* link:error-missing-changeid.html[missing Change-Id in commit message footer]
+* link:error-changeid-above-footer.html[Change-Id must be in commit message footer]
* link:error-missing-subject.html[missing subject; Change-Id must be in commit message footer]
* link:error-multiple-changeid-lines.html[multiple Change-Id lines in commit message footer]
* link:error-no-common-ancestry.html[no common ancestry]
diff --git a/Documentation/error-missing-changeid.txt b/Documentation/error-missing-changeid.txt
index 08f2c09..27bfea5 100644
--- a/Documentation/error-missing-changeid.txt
+++ b/Documentation/error-missing-changeid.txt
@@ -3,13 +3,7 @@
With this error message Gerrit rejects to push a commit to a project
which is configured to always require a Change-Id in the commit
message if the commit message of the pushed commit does not contain
-a Change-Id in the footer (the last paragraph).
-
-This error may happen for different reasons:
-
-. missing Change-Id in the commit message
-. Change-Id is contained in the commit message but not in the last
- paragraph
+a Change-Id.
You can see the commit messages for existing commits in the history
by doing a link:http://www.kernel.org/pub/software/scm/git/docs/git-log.html[git log].
@@ -38,17 +32,6 @@
is explained link:error-push-fails-due-to-commit-message.html[here].
-== Change-Id is contained in the commit message but not in the last paragraph
-
-To be picked up by Gerrit, a Change-Id must be in the last paragraph
-of a commit message, for details, see link:user-changeid.html[Change-Id Lines].
-
-If the Change-Id is contained in the commit message but not in its
-last paragraph you have to update the commit message and move the
-Change-Id into the last paragraph. How to update the commit message
-is explained link:error-push-fails-due-to-commit-message.html[here].
-
-
GERRIT
------
Part of link:error-messages.html[Gerrit Error Messages]
diff --git a/Documentation/index.txt b/Documentation/index.txt
index 6011158..557cf90 100644
--- a/Documentation/index.txt
+++ b/Documentation/index.txt
@@ -85,6 +85,7 @@
.. link:js-api.html[JavaScript Plugin API]
.. link:config-validation.html[Validation Interfaces]
.. link:dev-stars.html[Starring Changes]
+.. link:quota.html[Quota Enforcement]
. link:dev-design.html[System Design]
. link:i18n-readme.html[i18n Support]
diff --git a/Documentation/install-j2ee.txt b/Documentation/install-j2ee.txt
index 91d73cc..48751b7 100644
--- a/Documentation/install-j2ee.txt
+++ b/Documentation/install-j2ee.txt
@@ -14,9 +14,8 @@
== Installation
-* Complete the link:install.html#createdb[database setup] and
- link:install.html#init[site initialization] tasks described
- in the standard installation documentation.
+* Complete the link:install.html#init[site initialization] task
+ described in the standard installation documentation.
* Stop the embedded daemon that was automatically started by 'init':
+
@@ -24,13 +23,6 @@
review_site/bin/gerrit.sh stop
----
-* Configure JNDI DataSource 'jdbc/ReviewDb'.
-+
-This DataSource must point to the database you created above.
-Don't forget to ensure your JNDI configuration can load the
-necessary JDBC drivers. You may wish to ensure connection pooling
-is configured and enabled within the DataSource.
-
* Deploy the 'gerrit.war' file to your application server.
+
The deployment process differs between servers, but typically this
@@ -70,20 +62,8 @@
java -jar webapps/gerrit.war cat extra/jetty7/gerrit.xml >contexts/gerrit.xml
----
-Install the required additional libraries by copying them into the
-`'$JETTY_HOME'/lib/ext` directory:
-
-----
- cp ../review_db/lib/* lib/ext/
- java -jar webapps/gerrit.war cat lib/commons-dbcp-1.2.2.jar >lib/ext/commons-dbcp-1.2.2.jar
- java -jar webapps/gerrit.war cat lib/commons-pool-1.5.4.jar >lib/ext/commons-pool-1.5.4.jar
- java -jar webapps/gerrit.war cat lib/h2-1.2.128.jar >lib/ext/h2-1.2.128.jar
- java -jar webapps/gerrit.war cat lib/postgresql-8.4-701.jdbc4.jar >lib/ext/postgresql-8.4-701.jdbc4.jar
-----
-
Edit `'$JETTY_HOME'/contexts/gerrit.xml` to correctly configure
-the database and outgoing SMTP connections, especially the user
-and password fields.
+outgoing SMTP connections.
If OpenID authentication (or certain enterprise single-sign-on
solutions) is being used, you may need to increase the
diff --git a/Documentation/install.txt b/Documentation/install.txt
index dbca368..0885da1 100644
--- a/Documentation/install.txt
+++ b/Documentation/install.txt
@@ -9,10 +9,6 @@
+
Gerrit is not yet compatible with Java 9 or newer at this time.
-By default, Gerrit uses link:note-db.html[NoteDB] as the storage backend. (If
-desired, you can _optionally_ use an external database such as MySQL or
-PostgreSQL.)
-
[[cryptography]]
== Configure Java for Strong Cryptography
@@ -60,15 +56,12 @@
If you would prefer to build Gerrit directly from source, review
the notes under link:dev-readme.html[developer setup].
-include::database-setup.txt[]
-
[[init]]
== Initialize the Site
Gerrit stores configuration files, the server's SSH keys, and the
managed Git repositories under a local directory, typically referred
-to as `'$site_path'`. If the embedded H2 database is being used,
-its data files will also be stored under this directory.
+to as `'$site_path'`.
You also have to decide where to store your server side git repositories. This
can either be a relative path under `'$site_path'` or an absolute path
@@ -93,11 +86,10 @@
then give ownership of that location to the `'gerrit'` user.
If run from an interactive terminal, the init command will prompt through a
-series of configuration questions, including gathering information
-about the database created above. If the terminal is not interactive,
-running the init command will choose some reasonable default selections,
-and will use the embedded H2 database. Once the init phase is complete,
-you can review your settings in the file `'$site_path/etc/gerrit.config'`.
+series of configuration questions. If the terminal is not interactive,
+running the init command will choose some reasonable default selections.
+Once the init phase is complete, you can review your settings in the file
+`'$site_path/etc/gerrit.config'`.
When running the init command, additional JARs might be downloaded to
support optional selected functionality. If a download fails a URL will
@@ -217,8 +209,7 @@
--StartPath=C:\MY\GERRIT\SITE ^
--StartMode=jvm --StopMode=jvm ^
--StartClass=com.google.gerrit.launcher.GerritLauncher --StartMethod=daemonStart ^
- --StopClass=com.google.gerrit.launcher.GerritLauncher --StopMethod=daemonStop ^
- ++DependsOn=postgresql-x64-9.4
+ --StopClass=com.google.gerrit.launcher.GerritLauncher --StopMethod=daemonStop
====
[[customize]]
@@ -255,8 +246,6 @@
== External Documentation Links
-* http://www.postgresql.org/docs/[PostgreSQL Documentation]
-* http://dev.mysql.com/doc/[MySQL Documentation]
* http://www.kernel.org/pub/software/scm/git/docs/git-daemon.html[git-daemon]
diff --git a/Documentation/intro-project-owner.txt b/Documentation/intro-project-owner.txt
index a5895c5..1f98291 100644
--- a/Documentation/intro-project-owner.txt
+++ b/Documentation/intro-project-owner.txt
@@ -123,6 +123,13 @@
are a number of link:access-control.html#references_special[special refs]
and link:access-control.html#references_magic[magic refs].
+Gerrit only supports tags that are reachable by any ref not owned by
+Gerrit. This includes branches (refs/heads/*) or custom ref namespaces
+(refs/my-company/*). Tagging a change ref is not supported.
+When filtering tags by visibility, Gerrit performs a reachability check
+and will present the user ony with tags that are reachable by any ref
+they can see.
+
Access rights can be assigned on a concrete ref, e.g.
`refs/heads/master` but also on ref patterns and regular expressions
for ref names.
@@ -209,7 +216,7 @@
addition you can benefit from Gerrit's merge strategies that can
automatically merge/rebase commits on server side if necessary. You can
control the merge strategy by configuring the
-link:project-configuration.html#submit_type[submit type] on the project. If you
+link:config-project-config.html#submit-type[submit type] on the project. If you
bypass code review you always need to merge/rebase manually if the tip
of the destination branch has moved. Please keep this in mind if you
choose to not work with code review because you think it's easier to
@@ -239,7 +246,7 @@
An important decision for a project is the choice of the submit type
and the content merge setting (see the `Allow content merges` option).
-The link:project-configuration.html#submit_type[submit type] is the method
+The link:config-project-config.html#submit-type[submit type] is the method
Gerrit uses to submit a change to the project. The submit type defines
what Gerrit should do on submit of a change if the destination branch
has moved while the change was in review. The
@@ -281,7 +288,7 @@
types for different branches.
Please note that there are other submit types available; they are
-described in the link:project-configuration.html#submit_type[Submit Type]
+described in the link:config-project-config.html#submit-type[Submit Type]
section.
[[labels]]
@@ -607,18 +614,6 @@
are inherited by the child projects. A child project can overwrite an
inherited download command, or remove it by assigning no value to it.
-[[theme]]
-== Theme
-
-Gerrit supports project-specific themes for customizing the appearance
-of the change screen and the diff screens. It is possible to define an
-HTML header and footer and to adapt Gerrit's CSS. Details about themes
-are explained in the link:config-themes.html[Themes] section.
-
-Project-specific themes can only be installed by Gerrit administrators
-since the theme files must be copied into the Gerrit installation
-folder.
-
[[tool-integration]]
== Integration with other tools
diff --git a/Documentation/intro-user.txt b/Documentation/intro-user.txt
index 2a877ec..1074a69 100644
--- a/Documentation/intro-user.txt
+++ b/Documentation/intro-user.txt
@@ -383,7 +383,7 @@
How the code modification is applied to the target branch when a change
is submitted is controlled by the
-link:project-configuration.html#submit_type[submit type] which can be
+link:config-project-config.html#submit-type[submit type] which can be
link:intro-project-owner.html#submit-type[configured on project-level].
Submitting a change may fail with conflicts. In this case you need to
@@ -548,7 +548,8 @@
----
Alternatively, click *Ready* from the Change screen.
-Only change owners, project owners and site administrators can mark changes as
+Change owners, project owners, site administrators and members of a group that
+was granted "Toggle Work In Progress state" permission can mark changes as
`work-in-progress` and `ready`.
[[wip-polygerrit]]
@@ -578,10 +579,9 @@
creating a private throwaway change without reviewers, you can push
from one device, and fetch to another device.
-* You want to do code review on a change that has sensitive
- aspects. By reviewing a security fix in a private change,
- outsiders can't discover the fix before it is pushed out. Even after
- merging the change, the review can be kept private.
+Do *not* use private changes for making security fixes (see
+link:#private-changes-pitfalls[pitfalls] below). How to make security
+fixes is explained link:#security-fixes[below].
To create a private change, you push it with the `private` option.
@@ -605,6 +605,26 @@
In that case, care should be taken to prevent the CI system from
exposing secret details.
+[[private-changes-pitfalls]]
+Pitfalls
+===
+
+If private changes are used, be aware of the following pitfalls:
+
+* If a private change gets merged the corresponding commit gets visible
+ for all users that can access the target branch and the private flag
+ from the change is automatically removed. This makes private changes
+ a bad choice for security fixes, as the security fix will be
+ accessible as soon as the change was merged, but for security issues
+ you want to keep an embargo until new releases have been made
+ available.
+* If you push a non-private change on top of a private change the
+ commit of the private change gets implicitly visible through the
+ parent relationship of the follow-up change.
+* If you have a series of private changes and share one with reviewers,
+ the reviewers can also see the commits of the predecessor private
+ changes through the commit parent relationship.
+
[[ignore]]
== Ignoring Or Marking Changes As 'Reviewed'
@@ -942,6 +962,29 @@
a file comment ("Rename this file to File.java") as well as a reply to an
inline comment ("Yeah, I see why, let me try again.").
+[[security-fixes]]
+-- Security Fixes
+
+If a security vulnerability is discovered you normally want to have an
+embargo about it until fixed releases have been made available. This
+means you want to develop and review security fixes in private.
+
+If your repository is public or grants broad read access it is
+recommended to fix security issues in a copy of your repository which
+has very restricted read permissions (e.g. `myproject-security-fixes`).
+You can then implement, review and submit the security fix in this
+repository, make and publish a new release and only then integrate the
+security fix back into the normal (public) repository.
+
+Alternatively you can do the security fix in your normal repository in
+a branch with restricted read permissions. We don't recommend this
+because there is a risk of configuring the access rights wrongly and
+unintentionally granting read access to the wrong people.
+
+Using private changes for security fixes is *not* recommended due to
+the link:#private-changes-pitfalls[pitfalls] discussed above.
+Especially you don't want the fix to become visible after submit and
+before you had a chance to make and publish a new release.
GERRIT
------
diff --git a/Documentation/js-api.txt b/Documentation/js-api.txt
index 96b5107..4ef2a6c 100644
--- a/Documentation/js-api.txt
+++ b/Documentation/js-api.txt
@@ -188,6 +188,12 @@
comments, file-level comments and summary comments, and it may change
with new Gerrit versions.
+* `highlightjs-loaded`: Invoked when the highlight.js library has
+ finished loading. The global `hljs` object (also now accessible via
+ `window.hljs`) is passed as an argument to the callback function.
+ This event can be used to register a new language highlighter with
+ the highlight.js library before syntax highlighting begins.
+
[[self_onAction]]
=== self.onAction()
Register a JavaScript callback to be invoked when the user clicks
diff --git a/Documentation/js_licenses.txt b/Documentation/js_licenses.txt
new file mode 100644
index 0000000..6a83980
--- /dev/null
+++ b/Documentation/js_licenses.txt
@@ -0,0 +1,509 @@
+
+[[Apache2_0]]
+Apache2.0
+
+* fonts:robotofonts
+* js:web-animations-js
+* polymer_externs:polymer_closure
+
+[[Apache2_0_license]]
+----
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
+----
+
+
+[[ba-linkify]]
+ba-linkify
+
+* js:ba-linkify
+
+[[ba-linkify_license]]
+----
+Copyright (c) 2009 "Cowboy" Ben Alman
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+----
+
+
+[[es6-promise]]
+es6-promise
+
+* js:es6-promise
+
+[[es6-promise_license]]
+----
+Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+----
+
+
+[[fetch]]
+fetch
+
+* js:fetch
+
+[[fetch_license]]
+----
+Copyright (c) 2014-2016 GitHub, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+----
+
+
+[[highlightjs]]
+highlightjs
+
+* js:highlightjs
+* js:highlightjs_files
+
+[[highlightjs_license]]
+----
+Copyright (c) 2006, Ivan Sagalaev
+All rights reserved.
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of highlight.js nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+----
+
+
+[[moment]]
+moment
+
+* js:moment
+
+[[moment_license]]
+----
+Copyright (c) 2011-2016 Tim Wood, Iskren Chernev, Moment.js contributors
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+----
+
+
+[[page_js]]
+page.js
+
+* js:page
+
+[[page_js_license]]
+----
+(The MIT License)
+
+Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the 'Software'), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+----
+
+
+[[polymer]]
+polymer
+
+* js:font-roboto
+* js:iron-a11y-announcer
+* js:iron-a11y-keys-behavior
+* js:iron-autogrow-textarea
+* js:iron-behaviors
+* js:iron-checked-element-behavior
+* js:iron-dropdown
+* js:iron-fit-behavior
+* js:iron-flex-layout
+* js:iron-form-element-behavior
+* js:iron-icon
+* js:iron-iconset-svg
+* js:iron-input
+* js:iron-menu-behavior
+* js:iron-meta
+* js:iron-overlay-behavior
+* js:iron-resizable-behavior
+* js:iron-selector
+* js:iron-validatable-behavior
+* js:neon-animation
+* js:paper-behaviors
+* js:paper-button
+* js:paper-icon-button
+* js:paper-input
+* js:paper-item
+* js:paper-listbox
+* js:paper-ripple
+* js:paper-styles
+* js:paper-tabs
+* js:paper-toggle-button
+* js:polymer
+* js:polymer-resin
+* js:webcomponentsjs
+
+[[polymer_license]]
+----
+Copyright (c) 2014 The Polymer Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+----
+
+
+[[promise-polyfill]]
+promise-polyfill
+
+* js:promise-polyfill
+
+[[promise-polyfill_license]]
+----
+Copyright (c) 2014 Taylor Hakes
+Copyright (c) 2014 Forbes Lindesay
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+----
+
diff --git a/Documentation/licenses.txt b/Documentation/licenses.txt
new file mode 100644
index 0000000..6e61e29
--- /dev/null
+++ b/Documentation/licenses.txt
@@ -0,0 +1,3468 @@
+= Gerrit Code Review - Licenses
+
+// DO NOT EDIT - GENERATED AUTOMATICALLY.
+
+Gerrit open source software is licensed under the <<Apache2_0,Apache
+License 2.0>>. Executable distributions also include other software
+components that are provided under additional licenses.
+
+[[cryptography]]
+== Cryptography Notice
+
+This distribution includes cryptographic software. The country
+in which you currently reside may have restrictions on the import,
+possession, use, and/or re-export to another country, of encryption
+software. BEFORE using any encryption software, please check
+your country's laws, regulations and policies concerning the
+import, possession, or use, and re-export of encryption software,
+to see if this is permitted. See the
+link:http://www.wassenaar.org/[Wassenaar Arrangement]
+for more information.
+
+The U.S. Government Department of Commerce, Bureau of Industry
+and Security (BIS), has classified this software as Export
+Commodity Control Number (ECCN) 5D002.C.1, which includes
+information security software using or performing cryptographic
+functions with asymmetric algorithms. The form and manner of
+this distribution makes it eligible for export under the License
+Exception ENC Technology Software Unrestricted (TSU) exception
+(see the BIS Export Administration Regulations, Section 740.13)
+for both object code and source code.
+
+Gerrit includes an SSH daemon (Apache SSHD), to support authenticated
+uploads of changes directly from `git push` command line clients.
+
+Gerrit includes an SSH client (JSch), to support authenticated
+replication of changes to remote systems, such as for automatic
+updates of mirror servers, or realtime backups.
+
+== Licenses
+
+
+[[Apache2_0]]
+Apache2.0
+
+* auto:auto-value
+* auto:auto-value-annotations
+* commons:codec
+* commons:compress
+* commons:dbcp
+* commons:lang
+* commons:net
+* commons:pool
+* commons:validator
+* dropwizard:dropwizard-core
+* flogger:api
+* fonts:robotofonts
+* guice:guice
+* guice:guice-assistedinject
+* guice:guice-library
+* guice:guice-servlet
+* guice:javax_inject
+* httpcomponents:httpasyncclient
+* httpcomponents:httpclient
+* httpcomponents:httpcore
+* httpcomponents:httpcore-nio
+* jackson:jackson-core
+* jetty:continuation
+* jetty:http
+* jetty:io
+* jetty:jmx
+* jetty:security
+* jetty:server
+* jetty:servlet
+* jetty:util
+* jgit/org.eclipse.jgit:javaewah
+* js:web-animations-js
+* log:json-smart
+* log:jsonevent-layout
+* log:log4j
+* lucene:lucene-analyzers-common
+* lucene:lucene-core-and-backward-codecs
+* lucene:lucene-misc
+* lucene:lucene-queryparser
+* mime4j:core
+* mime4j:dom
+* mina:core
+* mina:sshd
+* openid:consumer
+* openid:nekohtml
+* openid:xerces
+* polymer_externs:polymer_closure
+* blame-cache
+* gson
+* guava
+* guava-failureaccess
+* guava-retrying
+* html-types
+* j2objc
+* jsr305
+* mime-util
+* servlet-api-3_1
+* servlet-api-3_1-without-neverlink
+* soy
+
+[[Apache2_0_license]]
+----
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ 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.
+
+----
+
+
+[[CC0-1_0]]
+CC0-1.0
+
+* mina:eddsa
+
+[[CC0-1_0_license]]
+----
+Creative Commons Legal Code
+
+CC0 1.0 Universal
+
+ CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
+ LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
+ ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
+ INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
+ REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
+ PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
+ THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
+ HEREUNDER.
+
+Statement of Purpose
+
+The laws of most jurisdictions throughout the world automatically confer
+exclusive Copyright and Related Rights (defined below) upon the creator
+and subsequent owner(s) (each and all, an "owner") of an original work of
+authorship and/or a database (each, a "Work").
+
+Certain owners wish to permanently relinquish those rights to a Work for
+the purpose of contributing to a commons of creative, cultural and
+scientific works ("Commons") that the public can reliably and without fear
+of later claims of infringement build upon, modify, incorporate in other
+works, reuse and redistribute as freely as possible in any form whatsoever
+and for any purposes, including without limitation commercial purposes.
+These owners may contribute to the Commons to promote the ideal of a free
+culture and the further production of creative, cultural and scientific
+works, or to gain reputation or greater distribution for their Work in
+part through the use and efforts of others.
+
+For these and/or other purposes and motivations, and without any
+expectation of additional consideration or compensation, the person
+associating CC0 with a Work (the "Affirmer"), to the extent that he or she
+is an owner of Copyright and Related Rights in the Work, voluntarily
+elects to apply CC0 to the Work and publicly distribute the Work under its
+terms, with knowledge of his or her Copyright and Related Rights in the
+Work and the meaning and intended legal effect of CC0 on those rights.
+
+1. Copyright and Related Rights. A Work made available under CC0 may be
+protected by copyright and related or neighboring rights ("Copyright and
+Related Rights"). Copyright and Related Rights include, but are not
+limited to, the following:
+
+ i. the right to reproduce, adapt, distribute, perform, display,
+ communicate, and translate a Work;
+ ii. moral rights retained by the original author(s) and/or performer(s);
+iii. publicity and privacy rights pertaining to a person's image or
+ likeness depicted in a Work;
+ iv. rights protecting against unfair competition in regards to a Work,
+ subject to the limitations in paragraph 4(a), below;
+ v. rights protecting the extraction, dissemination, use and reuse of data
+ in a Work;
+ vi. database rights (such as those arising under Directive 96/9/EC of the
+ European Parliament and of the Council of 11 March 1996 on the legal
+ protection of databases, and under any national implementation
+ thereof, including any amended or successor version of such
+ directive); and
+vii. other similar, equivalent or corresponding rights throughout the
+ world based on applicable law or treaty, and any national
+ implementations thereof.
+
+2. Waiver. To the greatest extent permitted by, but not in contravention
+of, applicable law, Affirmer hereby overtly, fully, permanently,
+irrevocably and unconditionally waives, abandons, and surrenders all of
+Affirmer's Copyright and Related Rights and associated claims and causes
+of action, whether now known or unknown (including existing as well as
+future claims and causes of action), in the Work (i) in all territories
+worldwide, (ii) for the maximum duration provided by applicable law or
+treaty (including future time extensions), (iii) in any current or future
+medium and for any number of copies, and (iv) for any purpose whatsoever,
+including without limitation commercial, advertising or promotional
+purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
+member of the public at large and to the detriment of Affirmer's heirs and
+successors, fully intending that such Waiver shall not be subject to
+revocation, rescission, cancellation, termination, or any other legal or
+equitable action to disrupt the quiet enjoyment of the Work by the public
+as contemplated by Affirmer's express Statement of Purpose.
+
+3. Public License Fallback. Should any part of the Waiver for any reason
+be judged legally invalid or ineffective under applicable law, then the
+Waiver shall be preserved to the maximum extent permitted taking into
+account Affirmer's express Statement of Purpose. In addition, to the
+extent the Waiver is so judged Affirmer hereby grants to each affected
+person a royalty-free, non transferable, non sublicensable, non exclusive,
+irrevocable and unconditional license to exercise Affirmer's Copyright and
+Related Rights in the Work (i) in all territories worldwide, (ii) for the
+maximum duration provided by applicable law or treaty (including future
+time extensions), (iii) in any current or future medium and for any number
+of copies, and (iv) for any purpose whatsoever, including without
+limitation commercial, advertising or promotional purposes (the
+"License"). The License shall be deemed effective as of the date CC0 was
+applied by Affirmer to the Work. Should any part of the License for any
+reason be judged legally invalid or ineffective under applicable law, such
+partial invalidity or ineffectiveness shall not invalidate the remainder
+of the License, and in such case Affirmer hereby affirms that he or she
+will not (i) exercise any of his or her remaining Copyright and Related
+Rights in the Work or (ii) assert any associated claims and causes of
+action with respect to the Work, in either case contrary to Affirmer's
+express Statement of Purpose.
+
+4. Limitations and Disclaimers.
+
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
+ surrendered, licensed or otherwise affected by this document.
+ b. Affirmer offers the Work as-is and makes no representations or
+ warranties of any kind concerning the Work, express, implied,
+ statutory or otherwise, including without limitation warranties of
+ title, merchantability, fitness for a particular purpose, non
+ infringement, or the absence of latent or other defects, accuracy, or
+ the present or absence of errors, whether or not discoverable, all to
+ the greatest extent permissible under applicable law.
+ c. Affirmer disclaims responsibility for clearing rights of other persons
+ that may apply to the Work or any use thereof, including without
+ limitation any person's Copyright and Related Rights in the Work.
+ Further, Affirmer disclaims responsibility for obtaining any necessary
+ consents, permissions or other rights required for any use of the
+ Work.
+ d. Affirmer understands and acknowledges that Creative Commons is not a
+ party to this document and has no duty or obligation with respect to
+ this CC0 or use of the Work.
+
+For more information, please see https://creativecommons.org/publicdomain/zero/1.0/
+
+----
+
+
+[[MPL1_1]]
+MPL1.1
+
+* juniversalchardet
+
+[[MPL1_1_license]]
+----
+ MOZILLA PUBLIC LICENSE
+ Version 1.1
+
+ ---------------
+
+1. Definitions.
+
+ 1.0.1. "Commercial Use" means distribution or otherwise making the
+ Covered Code available to a third party.
+
+ 1.1. "Contributor" means each entity that creates or contributes to
+ the creation of Modifications.
+
+ 1.2. "Contributor Version" means the combination of the Original
+ Code, prior Modifications used by a Contributor, and the Modifications
+ made by that particular Contributor.
+
+ 1.3. "Covered Code" means the Original Code or Modifications or the
+ combination of the Original Code and Modifications, in each case
+ including portions thereof.
+
+ 1.4. "Electronic Distribution Mechanism" means a mechanism generally
+ accepted in the software development community for the electronic
+ transfer of data.
+
+ 1.5. "Executable" means Covered Code in any form other than Source
+ Code.
+
+ 1.6. "Initial Developer" means the individual or entity identified
+ as the Initial Developer in the Source Code notice required by Exhibit
+ A.
+
+ 1.7. "Larger Work" means a work which combines Covered Code or
+ portions thereof with code not governed by the terms of this License.
+
+ 1.8. "License" means this document.
+
+ 1.8.1. "Licensable" means having the right to grant, to the maximum
+ extent possible, whether at the time of the initial grant or
+ subsequently acquired, any and all of the rights conveyed herein.
+
+ 1.9. "Modifications" means any addition to or deletion from the
+ substance or structure of either the Original Code or any previous
+ Modifications. When Covered Code is released as a series of files, a
+ Modification is:
+ A. Any addition to or deletion from the contents of a file
+ containing Original Code or previous Modifications.
+
+ B. Any new file that contains any part of the Original Code or
+ previous Modifications.
+
+ 1.10. "Original Code" means Source Code of computer software code
+ which is described in the Source Code notice required by Exhibit A as
+ Original Code, and which, at the time of its release under this
+ License is not already Covered Code governed by this License.
+
+ 1.10.1. "Patent Claims" means any patent claim(s), now owned or
+ hereafter acquired, including without limitation, method, process,
+ and apparatus claims, in any patent Licensable by grantor.
+
+ 1.11. "Source Code" means the preferred form of the Covered Code for
+ making modifications to it, including all modules it contains, plus
+ any associated interface definition files, scripts used to control
+ compilation and installation of an Executable, or source code
+ differential comparisons against either the Original Code or another
+ well known, available Covered Code of the Contributor's choice. The
+ Source Code can be in a compressed or archival form, provided the
+ appropriate decompression or de-archiving software is widely available
+ for no charge.
+
+ 1.12. "You" (or "Your") means an individual or a legal entity
+ exercising rights under, and complying with all of the terms of, this
+ License or a future version of this License issued under Section 6.1.
+ For legal entities, "You" includes any entity which controls, is
+ controlled by, or is under common control with You. For purposes of
+ this definition, "control" means (a) the power, direct or indirect,
+ to cause the direction or management of such entity, whether by
+ contract or otherwise, or (b) ownership of more than fifty percent
+ (50%) of the outstanding shares or beneficial ownership of such
+ entity.
+
+2. Source Code License.
+
+ 2.1. The Initial Developer Grant.
+ The Initial Developer hereby grants You a world-wide, royalty-free,
+ non-exclusive license, subject to third party intellectual property
+ claims:
+ (a) under intellectual property rights (other than patent or
+ trademark) Licensable by Initial Developer to use, reproduce,
+ modify, display, perform, sublicense and distribute the Original
+ Code (or portions thereof) with or without Modifications, and/or
+ as part of a Larger Work; and
+
+ (b) under Patents Claims infringed by the making, using or
+ selling of Original Code, to make, have made, use, practice,
+ sell, and offer for sale, and/or otherwise dispose of the
+ Original Code (or portions thereof).
+
+ (c) the licenses granted in this Section 2.1(a) and (b) are
+ effective on the date Initial Developer first distributes
+ Original Code under the terms of this License.
+
+ (d) Notwithstanding Section 2.1(b) above, no patent license is
+ granted: 1) for code that You delete from the Original Code; 2)
+ separate from the Original Code; or 3) for infringements caused
+ by: i) the modification of the Original Code or ii) the
+ combination of the Original Code with other software or devices.
+
+ 2.2. Contributor Grant.
+ Subject to third party intellectual property claims, each Contributor
+ hereby grants You a world-wide, royalty-free, non-exclusive license
+
+ (a) under intellectual property rights (other than patent or
+ trademark) Licensable by Contributor, to use, reproduce, modify,
+ display, perform, sublicense and distribute the Modifications
+ created by such Contributor (or portions thereof) either on an
+ unmodified basis, with other Modifications, as Covered Code
+ and/or as part of a Larger Work; and
+
+ (b) under Patent Claims infringed by the making, using, or
+ selling of Modifications made by that Contributor either alone
+ and/or in combination with its Contributor Version (or portions
+ of such combination), to make, use, sell, offer for sale, have
+ made, and/or otherwise dispose of: 1) Modifications made by that
+ Contributor (or portions thereof); and 2) the combination of
+ Modifications made by that Contributor with its Contributor
+ Version (or portions of such combination).
+
+ (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
+ effective on the date Contributor first makes Commercial Use of
+ the Covered Code.
+
+ (d) Notwithstanding Section 2.2(b) above, no patent license is
+ granted: 1) for any code that Contributor has deleted from the
+ Contributor Version; 2) separate from the Contributor Version;
+ 3) for infringements caused by: i) third party modifications of
+ Contributor Version or ii) the combination of Modifications made
+ by that Contributor with other software (except as part of the
+ Contributor Version) or other devices; or 4) under Patent Claims
+ infringed by Covered Code in the absence of Modifications made by
+ that Contributor.
+
+3. Distribution Obligations.
+
+ 3.1. Application of License.
+ The Modifications which You create or to which You contribute are
+ governed by the terms of this License, including without limitation
+ Section 2.2. The Source Code version of Covered Code may be
+ distributed only under the terms of this License or a future version
+ of this License released under Section 6.1, and You must include a
+ copy of this License with every copy of the Source Code You
+ distribute. You may not offer or impose any terms on any Source Code
+ version that alters or restricts the applicable version of this
+ License or the recipients' rights hereunder. However, You may include
+ an additional document offering the additional rights described in
+ Section 3.5.
+
+ 3.2. Availability of Source Code.
+ Any Modification which You create or to which You contribute must be
+ made available in Source Code form under the terms of this License
+ either on the same media as an Executable version or via an accepted
+ Electronic Distribution Mechanism to anyone to whom you made an
+ Executable version available; and if made available via Electronic
+ Distribution Mechanism, must remain available for at least twelve (12)
+ months after the date it initially became available, or at least six
+ (6) months after a subsequent version of that particular Modification
+ has been made available to such recipients. You are responsible for
+ ensuring that the Source Code version remains available even if the
+ Electronic Distribution Mechanism is maintained by a third party.
+
+ 3.3. Description of Modifications.
+ You must cause all Covered Code to which You contribute to contain a
+ file documenting the changes You made to create that Covered Code and
+ the date of any change. You must include a prominent statement that
+ the Modification is derived, directly or indirectly, from Original
+ Code provided by the Initial Developer and including the name of the
+ Initial Developer in (a) the Source Code, and (b) in any notice in an
+ Executable version or related documentation in which You describe the
+ origin or ownership of the Covered Code.
+
+ 3.4. Intellectual Property Matters
+ (a) Third Party Claims.
+ If Contributor has knowledge that a license under a third party's
+ intellectual property rights is required to exercise the rights
+ granted by such Contributor under Sections 2.1 or 2.2,
+ Contributor must include a text file with the Source Code
+ distribution titled "LEGAL" which describes the claim and the
+ party making the claim in sufficient detail that a recipient will
+ know whom to contact. If Contributor obtains such knowledge after
+ the Modification is made available as described in Section 3.2,
+ Contributor shall promptly modify the LEGAL file in all copies
+ Contributor makes available thereafter and shall take other steps
+ (such as notifying appropriate mailing lists or newsgroups)
+ reasonably calculated to inform those who received the Covered
+ Code that new knowledge has been obtained.
+
+ (b) Contributor APIs.
+ If Contributor's Modifications include an application programming
+ interface and Contributor has knowledge of patent licenses which
+ are reasonably necessary to implement that API, Contributor must
+ also include this information in the LEGAL file.
+
+ (c) Representations.
+ Contributor represents that, except as disclosed pursuant to
+ Section 3.4(a) above, Contributor believes that Contributor's
+ Modifications are Contributor's original creation(s) and/or
+ Contributor has sufficient rights to grant the rights conveyed by
+ this License.
+
+ 3.5. Required Notices.
+ You must duplicate the notice in Exhibit A in each file of the Source
+ Code. If it is not possible to put such notice in a particular Source
+ Code file due to its structure, then You must include such notice in a
+ location (such as a relevant directory) where a user would be likely
+ to look for such a notice. If You created one or more Modification(s)
+ You may add your name as a Contributor to the notice described in
+ Exhibit A. You must also duplicate this License in any documentation
+ for the Source Code where You describe recipients' rights or ownership
+ rights relating to Covered Code. You may choose to offer, and to
+ charge a fee for, warranty, support, indemnity or liability
+ obligations to one or more recipients of Covered Code. However, You
+ may do so only on Your own behalf, and not on behalf of the Initial
+ Developer or any Contributor. You must make it absolutely clear than
+ any such warranty, support, indemnity or liability obligation is
+ offered by You alone, and You hereby agree to indemnify the Initial
+ Developer and every Contributor for any liability incurred by the
+ Initial Developer or such Contributor as a result of warranty,
+ support, indemnity or liability terms You offer.
+
+ 3.6. Distribution of Executable Versions.
+ You may distribute Covered Code in Executable form only if the
+ requirements of Section 3.1-3.5 have been met for that Covered Code,
+ and if You include a notice stating that the Source Code version of
+ the Covered Code is available under the terms of this License,
+ including a description of how and where You have fulfilled the
+ obligations of Section 3.2. The notice must be conspicuously included
+ in any notice in an Executable version, related documentation or
+ collateral in which You describe recipients' rights relating to the
+ Covered Code. You may distribute the Executable version of Covered
+ Code or ownership rights under a license of Your choice, which may
+ contain terms different from this License, provided that You are in
+ compliance with the terms of this License and that the license for the
+ Executable version does not attempt to limit or alter the recipient's
+ rights in the Source Code version from the rights set forth in this
+ License. If You distribute the Executable version under a different
+ license You must make it absolutely clear that any terms which differ
+ from this License are offered by You alone, not by the Initial
+ Developer or any Contributor. You hereby agree to indemnify the
+ Initial Developer and every Contributor for any liability incurred by
+ the Initial Developer or such Contributor as a result of any such
+ terms You offer.
+
+ 3.7. Larger Works.
+ You may create a Larger Work by combining Covered Code with other code
+ not governed by the terms of this License and distribute the Larger
+ Work as a single product. In such a case, You must make sure the
+ requirements of this License are fulfilled for the Covered Code.
+
+4. Inability to Comply Due to Statute or Regulation.
+
+ If it is impossible for You to comply with any of the terms of this
+ License with respect to some or all of the Covered Code due to
+ statute, judicial order, or regulation then You must: (a) comply with
+ the terms of this License to the maximum extent possible; and (b)
+ describe the limitations and the code they affect. Such description
+ must be included in the LEGAL file described in Section 3.4 and must
+ be included with all distributions of the Source Code. Except to the
+ extent prohibited by statute or regulation, such description must be
+ sufficiently detailed for a recipient of ordinary skill to be able to
+ understand it.
+
+5. Application of this License.
+
+ This License applies to code to which the Initial Developer has
+ attached the notice in Exhibit A and to related Covered Code.
+
+6. Versions of the License.
+
+ 6.1. New Versions.
+ Netscape Communications Corporation ("Netscape") may publish revised
+ and/or new versions of the License from time to time. Each version
+ will be given a distinguishing version number.
+
+ 6.2. Effect of New Versions.
+ Once Covered Code has been published under a particular version of the
+ License, You may always continue to use it under the terms of that
+ version. You may also choose to use such Covered Code under the terms
+ of any subsequent version of the License published by Netscape. No one
+ other than Netscape has the right to modify the terms applicable to
+ Covered Code created under this License.
+
+ 6.3. Derivative Works.
+ If You create or use a modified version of this License (which you may
+ only do in order to apply it to code which is not already Covered Code
+ governed by this License), You must (a) rename Your license so that
+ the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
+ "MPL", "NPL" or any confusingly similar phrase do not appear in your
+ license (except to note that your license differs from this License)
+ and (b) otherwise make it clear that Your version of the license
+ contains terms which differ from the Mozilla Public License and
+ Netscape Public License. (Filling in the name of the Initial
+ Developer, Original Code or Contributor in the notice described in
+ Exhibit A shall not of themselves be deemed to be modifications of
+ this License.)
+
+7. DISCLAIMER OF WARRANTY.
+
+ COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
+ DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
+ THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
+ IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
+ YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
+ COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
+ OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
+ ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+
+8. TERMINATION.
+
+ 8.1. This License and the rights granted hereunder will terminate
+ automatically if You fail to comply with terms herein and fail to cure
+ such breach within 30 days of becoming aware of the breach. All
+ sublicenses to the Covered Code which are properly granted shall
+ survive any termination of this License. Provisions which, by their
+ nature, must remain in effect beyond the termination of this License
+ shall survive.
+
+ 8.2. If You initiate litigation by asserting a patent infringement
+ claim (excluding declatory judgment actions) against Initial Developer
+ or a Contributor (the Initial Developer or Contributor against whom
+ You file such action is referred to as "Participant") alleging that:
+
+ (a) such Participant's Contributor Version directly or indirectly
+ infringes any patent, then any and all rights granted by such
+ Participant to You under Sections 2.1 and/or 2.2 of this License
+ shall, upon 60 days notice from Participant terminate prospectively,
+ unless if within 60 days after receipt of notice You either: (i)
+ agree in writing to pay Participant a mutually agreeable reasonable
+ royalty for Your past and future use of Modifications made by such
+ Participant, or (ii) withdraw Your litigation claim with respect to
+ the Contributor Version against such Participant. If within 60 days
+ of notice, a reasonable royalty and payment arrangement are not
+ mutually agreed upon in writing by the parties or the litigation claim
+ is not withdrawn, the rights granted by Participant to You under
+ Sections 2.1 and/or 2.2 automatically terminate at the expiration of
+ the 60 day notice period specified above.
+
+ (b) any software, hardware, or device, other than such Participant's
+ Contributor Version, directly or indirectly infringes any patent, then
+ any rights granted to You by such Participant under Sections 2.1(b)
+ and 2.2(b) are revoked effective as of the date You first made, used,
+ sold, distributed, or had made, Modifications made by that
+ Participant.
+
+ 8.3. If You assert a patent infringement claim against Participant
+ alleging that such Participant's Contributor Version directly or
+ indirectly infringes any patent where such claim is resolved (such as
+ by license or settlement) prior to the initiation of patent
+ infringement litigation, then the reasonable value of the licenses
+ granted by such Participant under Sections 2.1 or 2.2 shall be taken
+ into account in determining the amount or value of any payment or
+ license.
+
+ 8.4. In the event of termination under Sections 8.1 or 8.2 above,
+ all end user license agreements (excluding distributors and resellers)
+ which have been validly granted by You or any distributor hereunder
+ prior to termination shall survive termination.
+
+9. LIMITATION OF LIABILITY.
+
+ UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
+ (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
+ DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
+ OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
+ ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
+ CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
+ WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
+ COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
+ INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
+ LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
+ RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
+ PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
+ EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
+ THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+
+10. U.S. GOVERNMENT END USERS.
+
+ The Covered Code is a "commercial item," as that term is defined in
+ 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
+ software" and "commercial computer software documentation," as such
+ terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
+ C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
+ all U.S. Government End Users acquire Covered Code with only those
+ rights set forth herein.
+
+11. MISCELLANEOUS.
+
+ This License represents the complete agreement concerning subject
+ matter hereof. If any provision of this License is held to be
+ unenforceable, such provision shall be reformed only to the extent
+ necessary to make it enforceable. This License shall be governed by
+ California law provisions (except to the extent applicable law, if
+ any, provides otherwise), excluding its conflict-of-law provisions.
+ With respect to disputes in which at least one party is a citizen of,
+ or an entity chartered or registered to do business in the United
+ States of America, any litigation relating to this License shall be
+ subject to the jurisdiction of the Federal Courts of the Northern
+ District of California, with venue lying in Santa Clara County,
+ California, with the losing party responsible for costs, including
+ without limitation, court costs and reasonable attorneys' fees and
+ expenses. The application of the United Nations Convention on
+ Contracts for the International Sale of Goods is expressly excluded.
+ Any law or regulation which provides that the language of a contract
+ shall be construed against the drafter shall not apply to this
+ License.
+
+12. RESPONSIBILITY FOR CLAIMS.
+
+ As between Initial Developer and the Contributors, each party is
+ responsible for claims and damages arising, directly or indirectly,
+ out of its utilization of rights under this License and You agree to
+ work with Initial Developer and Contributors to distribute such
+ responsibility on an equitable basis. Nothing herein is intended or
+ shall be deemed to constitute any admission of liability.
+
+13. MULTIPLE-LICENSED CODE.
+
+ Initial Developer may designate portions of the Covered Code as
+ "Multiple-Licensed". "Multiple-Licensed" means that the Initial
+ Developer permits you to utilize portions of the Covered Code under
+ Your choice of the NPL or the alternative licenses, if any, specified
+ by the Initial Developer in the file described in Exhibit A.
+
+EXHIBIT A -Mozilla Public License.
+
+ ``The contents of this file are subject to the Mozilla Public License
+ Version 1.1 (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.mozilla.org/MPL/
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ License for the specific language governing rights and limitations
+ under the License.
+
+ The Original Code is ______________________________________.
+
+ The Initial Developer of the Original Code is ________________________.
+ Portions created by ______________________ are Copyright (C) ______
+ _______________________. All Rights Reserved.
+
+ Contributor(s): ______________________________________.
+
+ Alternatively, the contents of this file may be used under the terms
+ of the _____ license (the "[___] License"), in which case the
+ provisions of [______] License are applicable instead of those
+ above. If you wish to allow use of your version of this file only
+ under the terms of the [____] License and not to allow others to use
+ your version of this file under the MPL, indicate your decision by
+ deleting the provisions above and replace them with the notice and
+ other provisions required by the [___] License. If you do not delete
+ the provisions above, a recipient may use your version of this file
+ under either the MPL or the [___] License."
+
+ [NOTE: The text of this Exhibit A may differ slightly from the text of
+ the notices in the Source Code files of the Original Code. You should
+ use the text of this Exhibit A rather than the text found in the
+ Original Code Source Code for Your Modifications.]
+
+----
+
+
+[[PublicDomain]]
+PublicDomain
+
+* guice:aopalliance
+
+[[PublicDomain_license]]
+----
+This software has been placed in the public domain by its author(s).
+
+----
+
+
+[[antlr]]
+antlr
+
+* antlr:antlr27
+* antlr:java-runtime
+* antlr:stringtemplate
+* antlr:tool
+
+[[antlr_license]]
+----
+Copyright (c) 2003-2008, Terence Parr
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+ * Neither the name of the author nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+----
+
+
+[[args4j]]
+args4j
+
+* args4j
+
+[[args4j_license]]
+----
+Copyright (c) 2013 Kohsuke Kawaguchi and other contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+----
+
+
+[[autolink]]
+autolink
+
+* autolink
+
+[[autolink_license]]
+----
+The MIT License (MIT)
+
+Copyright (c) 2015 Robin Stocker
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+----
+
+
+[[automaton]]
+automaton
+
+* automaton
+
+[[automaton_license]]
+----
+Copyright (c) 2001-2011 Anders Moeller
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the JSR305 expert group nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+----
+
+
+[[ba-linkify]]
+ba-linkify
+
+* js:ba-linkify
+
+[[ba-linkify_license]]
+----
+Copyright (c) 2009 "Cowboy" Ben Alman
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+----
+
+
+[[bouncycastle]]
+bouncycastle
+
+* bouncycastle:bcpg-neverlink
+* bouncycastle:bcpkix-neverlink
+* bouncycastle:bcprov-neverlink
+
+[[bouncycastle_license]]
+----
+Copyright (c) 2000 - 2015 The Legion of the Bouncy Castle Inc.
+(http://www.bouncycastle.org)
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+----
+
+
+[[elasticsearch]]
+elasticsearch
+
+* elasticsearch-rest-client:elasticsearch-rest-client
+
+[[elasticsearch_license]]
+----
+Elasticsearch
+Copyright 2009-2015 Elasticsearch
+
+This product includes software developed by The Apache Software
+Foundation (http://www.apache.org/).
+
+----
+
+
+[[es6-promise]]
+es6-promise
+
+* js:es6-promise
+
+[[es6-promise_license]]
+----
+Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+----
+
+
+[[fetch]]
+fetch
+
+* js:fetch
+
+[[fetch_license]]
+----
+Copyright (c) 2014-2016 GitHub, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+----
+
+
+[[flexmark]]
+flexmark
+
+* flexmark
+* flexmark-ext-abbreviation
+* flexmark-ext-anchorlink
+* flexmark-ext-autolink
+* flexmark-ext-definition
+* flexmark-ext-emoji
+* flexmark-ext-escaped-character
+* flexmark-ext-footnotes
+* flexmark-ext-gfm-issues
+* flexmark-ext-gfm-strikethrough
+* flexmark-ext-gfm-tables
+* flexmark-ext-gfm-tasklist
+* flexmark-ext-gfm-users
+* flexmark-ext-ins
+* flexmark-ext-jekyll-front-matter
+* flexmark-ext-superscript
+* flexmark-ext-tables
+* flexmark-ext-toc
+* flexmark-ext-typographic
+* flexmark-ext-wikilink
+* flexmark-ext-yaml-front-matter
+* flexmark-formatter
+* flexmark-html-parser
+* flexmark-profile-pegdown
+* flexmark-util
+
+[[flexmark_license]]
+----
+Copyright (c) 2015-2016, Atlassian Pty Ltd
+All rights reserved.
+
+Copyright (c) 2016, Vladimir Schneider,
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+* Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+* Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
+FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+----
+
+
+[[h2]]
+h2
+
+* h2
+
+[[h2_license]]
+----
+H2 is dual licensed and available under a modified version of the
+MPL 1.1 (Mozilla Public License) or under the (unmodified) EPL 1.0.
+----
+
+link:http://www.h2database.com/html/license.html[H2 License]
+
+----
+H2 License - Version 1.0
+1. Definitions
+
+1.0.1. "Commercial Use" means distribution or otherwise making the
+ Covered Code available to a third party.
+
+1.1. "Contributor" means each entity that creates or contributes
+ to the creation of Modifications.
+
+1.2. "Contributor Version" means the combination of the Original
+ Code, prior Modifications used by a Contributor, and the
+ Modifications made by that particular Contributor.
+
+1.3. "Covered Code" means the Original Code or Modifications or
+ the combination of the Original Code and Modifications, in each
+ case including portions thereof.
+
+1.4. "Electronic Distribution Mechanism" means a mechanism generally
+ accepted in the software development community for the electronic
+ transfer of data.
+
+1.5. "Executable" means Covered Code in any form other than Source Code.
+
+1.6. "Initial Developer" means the individual or entity identified
+ as the Initial Developer in the Source Code notice required
+ by Exhibit A.
+
+1.7. "Larger Work" means a work which combines Covered Code or
+ portions thereof with code not governed by the terms of this
+ License.
+
+1.8. "License" means this document.
+
+1.8.1. "Licensable" means having the right to grant, to the maximum
+ extent possible, whether at the time of the initial grant
+ or subsequently acquired, any and all of the rights conveyed
+ herein.
+
+1.9. "Modifications" means any addition to or deletion from the
+ substance or structure of either the Original Code or any
+ previous Modifications. When Covered Code is released as a
+ series of files, a Modification is:
+
+1.9.a. Any addition to or deletion from the contents of a file
+ containing Original Code or previous Modifications.
+
+1.9.b. Any new file that contains any part of the Original Code or
+ previous Modifications.
+
+1.10. "Original Code" means Source Code of computer software
+ code which is described in the Source Code notice required
+ by Exhibit A as Original Code, and which, at the time of
+ its release under this License is not already Covered Code
+ governed by this License.
+
+1.10.1. "Patent Claims" means any patent claim(s), now owned or
+ hereafter acquired, including without limitation, method,
+ process, and apparatus claims, in any patent Licensable
+ by grantor.
+
+1.11. "Source Code" means the preferred form of the Covered Code
+ for making modifications to it, including all modules it
+ contains, plus any associated interface definition files,
+ scripts used to control compilation and installation of an
+ Executable, or source code differential comparisons against
+ either the Original Code or another well known, available
+ Covered Code of the Contributor's choice. The Source Code can
+ be in a compressed or archival form, provided the appropriate
+ decompression or de-archiving software is widely available
+ for no charge.
+
+1.12. "You" (or "Your") means an individual or a legal entity
+ exercising rights under, and complying with all of the terms
+ of, this License or a future version of this License issued
+ under Section 6.1. For legal entities, "You" includes any
+ entity which controls, is controlled by, or is under common
+ control with You. For purposes of this definition, "control"
+ means (a) the power, direct or indirect, to cause the direction
+ or management of such entity, whether by contract or otherwise,
+ or (b) ownership of more than fifty percent (50%) of the
+ outstanding shares or beneficial ownership of such entity.
+
+2. Source Code License
+
+2.1. The Initial Developer Grant
+
+The Initial Developer hereby grants You a world-wide, royalty-free,
+non-exclusive license, subject to third party intellectual property
+claims:
+
+2.1.a. under intellectual property rights (other than patent
+ or trademark) Licensable by Initial Developer to use,
+ reproduce, modify, display, perform, sublicense and distribute
+ the Original Code (or portions thereof) with or without
+ Modifications, and/or as part of a Larger Work; and
+
+2.1.b. under Patents Claims infringed by the making, using or selling
+ of Original Code, to make, have made, use, practice, sell,
+ and offer for sale, and/or otherwise dispose of the Original
+ Code (or portions thereof).
+
+2.1.c. the licenses granted in this Section 2.1 (a) and (b) are
+ effective on the date Initial Developer first distributes
+ Original Code under the terms of this License.
+
+2.1.d. Notwithstanding Section 2.1 (b) above, no patent license is
+ granted: 1) for code that You delete from the Original Code;
+ 2) separate from the Original Code; or 3) for infringements
+ caused by: i) the modification of the Original Code or ii)
+ the combination of the Original Code with other software
+ or devices.
+
+2.2. Contributor Grant
+
+Subject to third party intellectual property claims, each Contributor
+hereby grants You a world-wide, royalty-free, non-exclusive license
+
+2.2.a. under intellectual property rights (other than patent or
+ trademark) Licensable by Contributor, to use, reproduce,
+ modify, display, perform, sublicense and distribute the
+ Modifications created by such Contributor (or portions
+ thereof) either on an unmodified basis, with other
+ Modifications, as Covered Code and/or as part of a Larger
+ Work; and
+
+2.2.b. under Patent Claims infringed by the making, using, or selling
+ of Modifications made by that Contributor either alone and/or
+ in combination with its Contributor Version (or portions
+ of such combination), to make, use, sell, offer for sale,
+ have made, and/or otherwise dispose of: 1) Modifications
+ made by that Contributor (or portions thereof); and 2) the
+ combination of Modifications made by that Contributor with
+ its Contributor Version (or portions of such combination).
+
+2.2.c. the licenses granted in Sections 2.2 (a) and 2.2 (b) are
+ effective on the date Contributor first makes Commercial
+ Use of the Covered Code.
+
+2.2.c. Notwithstanding Section 2.2 (b) above, no patent license is
+ granted: 1) for any code that Contributor has deleted from
+ the Contributor Version; 2) separate from the Contributor
+ Version; 3) for infringements caused by: i) third party
+ modifications of Contributor Version or ii) the combination
+ of Modifications made by that Contributor with other software
+ (except as part of the Contributor Version) or other devices;
+ or 4) under Patent Claims infringed by Covered Code in the
+ absence of Modifications made by that Contributor.
+
+3. Distribution Obligations
+
+3.1. Application of License
+
+The Modifications which You create or to which You contribute
+are governed by the terms of this License, including without
+limitation Section 2.2. The Source Code version of Covered Code may
+be distributed only under the terms of this License or a future
+version of this License released under Section 6.1, and You must
+include a copy of this License with every copy of the Source Code
+You distribute. You may not offer or impose any terms on any Source
+Code version that alters or restricts the applicable version of
+this License or the recipients' rights hereunder. However, You
+may include an additional document offering the additional rights
+described in Section 3.5.
+
+3.2. Availability of Source Code
+
+Any Modification which You create or to which You contribute must
+be made available in Source Code form under the terms of this
+License either on the same media as an Executable version or via
+an accepted Electronic Distribution Mechanism to anyone to whom
+you made an Executable version available; and if made available
+via Electronic Distribution Mechanism, must remain available for
+at least twelve (12) months after the date it initially became
+available, or at least six (6) months after a subsequent version
+of that particular Modification has been made available to such
+recipients. You are responsible for ensuring that the Source Code
+version remains available even if the Electronic Distribution
+Mechanism is maintained by a third party.
+
+3.3. Description of Modifications
+
+You must cause all Covered Code to which You contribute to contain
+a file documenting the changes You made to create that Covered
+Code and the date of any change. You must include a prominent
+statement that the Modification is derived, directly or indirectly,
+from Original Code provided by the Initial Developer and including
+the name of the Initial Developer in (a) the Source Code, and (b)
+in any notice in an Executable version or related documentation in
+which You describe the origin or ownership of the Covered Code.
+
+3.4. Intellectual Property Matters
+
+3.4.a. Third Party Claims: If Contributor has knowledge that
+ a license under a third party's intellectual property
+ rights is required to exercise the rights granted by such
+ Contributor under Sections 2.1 or 2.2, Contributor must
+ include a text file with the Source Code distribution titled
+ "LEGAL" which describes the claim and the party making the
+ claim in sufficient detail that a recipient will know whom
+ to contact. If Contributor obtains such knowledge after the
+ Modification is made available as described in Section 3.2,
+ Contributor shall promptly modify the LEGAL file in all
+ copies Contributor makes available thereafter and shall take
+ other steps (such as notifying appropriate mailing lists or
+ newsgroups) reasonably calculated to inform those who received
+ the Covered Code that new knowledge has been obtained.
+
+3.4.b. Contributor APIs: If Contributor's Modifications include
+ an application programming interface and Contributor has
+ knowledge of patent licenses which are reasonably necessary
+ to implement that API, Contributor must also include this
+ information in the legal file.
+
+3.4.c. Representations: Contributor represents that, except as
+ disclosed pursuant to Section 3.4 (a) above, Contributor
+ believes that Contributor's Modifications are Contributor's
+ original creation(s) and/or Contributor has sufficient rights
+ to grant the rights conveyed by this License.
+
+3.5. Required Notices
+
+You must duplicate the notice in Exhibit A in each file of
+the Source Code. If it is not possible to put such notice in a
+particular Source Code file due to its structure, then You must
+include such notice in a location (such as a relevant directory)
+where a user would be likely to look for such a notice. If You
+created one or more Modification(s) You may add your name as a
+Contributor to the notice described in Exhibit A. You must also
+duplicate this License in any documentation for the Source Code
+where You describe recipients' rights or ownership rights relating
+to Covered Code. You may choose to offer, and to charge a fee for,
+warranty, support, indemnity or liability obligations to one or
+more recipients of Covered Code. However, You may do so only on
+Your own behalf, and not on behalf of the Initial Developer or
+any Contributor. You must make it absolutely clear than any such
+warranty, support, indemnity or liability obligation is offered by
+You alone, and You hereby agree to indemnify the Initial Developer
+and every Contributor for any liability incurred by the Initial
+Developer or such Contributor as a result of warranty, support,
+indemnity or liability terms You offer.
+
+3.6. Distribution of Executable Versions
+
+You may distribute Covered Code in Executable form only if the
+requirements of Sections 3.1, 3.2, 3.3, 3.4 and 3.5 have been met
+for that Covered Code, and if You include a notice stating that
+the Source Code version of the Covered Code is available under the
+terms of this License, including a description of how and where
+You have fulfilled the obligations of Section 3.2. The notice
+must be conspicuously included in any notice in an Executable
+version, related documentation or collateral in which You describe
+recipients' rights relating to the Covered Code. You may distribute
+the Executable version of Covered Code or ownership rights under
+a license of Your choice, which may contain terms different from
+this License, provided that You are in compliance with the terms
+of this License and that the license for the Executable version
+does not attempt to limit or alter the recipient's rights in the
+Source Code version from the rights set forth in this License. If
+You distribute the Executable version under a different license You
+must make it absolutely clear that any terms which differ from this
+License are offered by You alone, not by the Initial Developer or any
+Contributor. You hereby agree to indemnify the Initial Developer and
+every Contributor for any liability incurred by the Initial Developer
+or such Contributor as a result of any such terms You offer.
+
+3.7. Larger Works
+
+You may create a Larger Work by combining Covered Code with other
+code not governed by the terms of this License and distribute the
+Larger Work as a single product. In such a case, You must make sure
+the requirements of this License are fulfilled for the Covered Code.
+
+4. Inability to Comply Due to Statute or Regulation.
+
+If it is impossible for You to comply with any of the terms of
+this License with respect to some or all of the Covered Code due to
+statute, judicial order, or regulation then You must: (a) comply with
+the terms of this License to the maximum extent possible; and (b)
+describe the limitations and the code they affect. Such description
+must be included in the legal file described in Section 3.4 and
+must be included with all distributions of the Source Code. Except
+to the extent prohibited by statute or regulation, such description
+must be sufficiently detailed for a recipient of ordinary skill to
+be able to understand it.
+
+5. Application of this License.
+
+This License applies to code to which the Initial Developer has
+attached the notice in Exhibit A and to related Covered Code.
+
+6. Versions of the License.
+
+6.1. New Versions
+
+The H2 Group may publish revised and/or new versions of the License
+from time to time. Each version will be given a distinguishing
+version number.
+
+6.2. Effect of New Versions
+
+Once Covered Code has been published under a particular version of
+the License, You may always continue to use it under the terms of
+that version. You may also choose to use such Covered Code under the
+terms of any subsequent version of the License published by the H2
+Group. No one other than the H2 Group has the right to modify the
+terms applicable to Covered Code created under this License.
+
+6.3. Derivative Works
+
+If You create or use a modified version of this License (which you
+may only do in order to apply it to code which is not already Covered
+Code governed by this License), You must (a) rename Your license so
+that the phrases "H2 Group", "H2" or any confusingly similar phrase
+do not appear in your license (except to note that your license
+differs from this License) and (b) otherwise make it clear that
+Your version of the license contains terms which differ from the
+H2 License. (Filling in the name of the Initial Developer, Original
+Code or Contributor in the notice described in Exhibit A shall not
+of themselves be deemed to be modifications of this License.)
+
+7. Disclaimer of Warranty
+
+Covered code is provided under this license on an "as is" basis,
+without warranty of any kind, either expressed or implied,
+including, without limitation, warranties that the covered code
+is free of defects, merchantable, fit for a particular purpose or
+non-infringing. The entire risk as to the quality and performance
+of the covered code is with you. Should any covered code prove
+defective in any respect, you (not the initial developer or any
+other contributor) assume the cost of any necessary servicing,
+repair or correction. This disclaimer of warranty constitutes
+an essential part of this license. No use of any covered code is
+authorized hereunder except under this disclaimer.
+
+8. Termination
+
+8.1. This License and the rights granted hereunder will terminate
+ automatically if You fail to comply with terms herein and
+ fail to cure such breach within 30 days of becoming aware
+ of the breach. All sublicenses to the Covered Code which
+ are properly granted shall survive any termination of this
+ License. Provisions which, by their nature, must remain in
+ effect beyond the termination of this License shall survive.
+
+8.2. If You initiate litigation by asserting a patent infringement
+ claim (excluding declaratory judgment actions) against
+ Initial Developer or a Contributor (the Initial Developer or
+ Contributor against whom You file such action is referred to as
+ "Participant") alleging that:
+
+8.2.a. such Participant's Contributor Version directly or indirectly
+ infringes any patent, then any and all rights granted by
+ such Participant to You under Sections 2.1 and/or 2.2 of this
+ License shall, upon 60 days notice from Participant terminate
+ prospectively, unless if within 60 days after receipt of
+ notice You either: (i) agree in writing to pay Participant
+ a mutually agreeable reasonable royalty for Your past and
+ future use of Modifications made by such Participant, or (ii)
+ withdraw Your litigation claim with respect to the Contributor
+ Version against such Participant. If within 60 days of notice,
+ a reasonable royalty and payment arrangement are not mutually
+ agreed upon in writing by the parties or the litigation claim
+ is not withdrawn, the rights granted by Participant to You
+ under Sections 2.1 and/or 2.2 automatically terminate at
+ the expiration of the 60 day notice period specified above.
+
+8.2.b. any software, hardware, or device, other than such
+ Participant's Contributor Version, directly or indirectly
+ infringes any patent, then any rights granted to You by
+ such Participant under Sections 2.1(b) and 2.2(b) are
+ revoked effective as of the date You first made, used,
+ sold, distributed, or had made, Modifications made by that
+ Participant.
+
+8.3. If You assert a patent infringement claim against Participant
+ alleging that such Participant's Contributor Version directly
+ or indirectly infringes any patent where such claim is resolved
+ (such as by license or settlement) prior to the initiation of
+ patent infringement litigation, then the reasonable value of
+ the licenses granted by such Participant under Sections 2.1
+ or 2.2 shall be taken into account in determining the amount
+ or value of any payment or license.
+
+8.4. In the event of termination under Sections 8.1 or 8.2 above,
+ all end user license agreements (excluding distributors and
+ resellers) which have been validly granted by You or any
+ distributor hereunder prior to termination shall survive
+ termination.
+
+9. Limitation of Liability
+
+Under no circumstances and under no legal theory, whether tort
+(including negligence), contract, or otherwise, shall you, the
+initial developer, any other contributor, or any distributor of
+covered code, or any supplier of any of such parties, be liable to
+any person for any indirect, special, incidental, or consequential
+damages of any character including, without limitation, damages for
+loss of goodwill, work stoppage, computer failure or malfunction, or
+any and all other commercial damages or losses, even if such party
+shall have been informed of the possibility of such damages. This
+limitation of liability shall not apply to liability for death or
+personal injury resulting from such party's negligence to the extent
+applicable law prohibits such limitation. Some jurisdictions do not
+allow the exclusion or limitation of incidental or consequential
+damages, so this exclusion and limitation may not apply to you.
+
+10. United States Government End Users
+
+The Covered Code is a "commercial item", as that term is defined in
+48 C.F.R. 2.101 (October 1995), consisting of "commercial computer
+software" and "commercial computer software documentation", as such
+terms are used in 48 C.F.R. 12.212 (September 1995). Consistent
+with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4
+(June 1995), all U.S. Government End Users acquire Covered Code
+with only those rights set forth herein.
+
+11. Miscellaneous
+
+This License represents the complete agreement concerning subject
+matter hereof. If any provision of this License is held to be
+unenforceable, such provision shall be reformed only to the extent
+necessary to make it enforceable. This License shall be governed
+by California law provisions (except to the extent applicable
+law, if any, provides otherwise), excluding its conflict-of-law
+provisions. With respect to disputes in which at least one party is
+a citizen of, or an entity chartered or registered to do business in
+United States of America, any litigation relating to this License
+shall be subject to the jurisdiction of the Federal Courts of the
+Northern District of California, with venue lying in Santa Clara
+County, California, with the losing party responsible for costs,
+including without limitation, court costs and reasonable attorneys'
+fees and expenses. The application of the United Nations Convention
+on Contracts for the International Sale of Goods is expressly
+excluded. Any law or regulation which provides that the language of
+a contract shall be construed against the drafter shall not apply
+to this License.
+
+12. Responsibility for Claims
+
+As between Initial Developer and the Contributors, each party is
+responsible for claims and damages arising, directly or indirectly,
+out of its utilization of rights under this License and You agree
+to work with Initial Developer and Contributors to distribute such
+responsibility on an equitable basis. Nothing herein is intended
+or shall be deemed to constitute any admission of liability.
+
+13. Multiple-Licensed Code
+
+Initial Developer may designate portions of the Covered Code as
+"Multiple-Licensed". "Multiple-Licensed" means that the Initial
+Developer permits you to utilize portions of the Covered Code under
+Your choice of this or the alternative licenses, if any, specified
+by the Initial Developer in the file described in Exhibit A.
+
+Exhibit A
+
+Multiple-Licensed under the H2 License, Version 1.0,
+and under the Eclipse Public License, Version 1.0
+(http://h2database.com/html/license.html).
+Initial Developer: H2 Group
+----
+
+----
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
+OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and
+ documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from
+and are distributed by that particular Contributor. A Contribution
+'originates' from a Contributor if it was added to the Program
+by such Contributor itself or anyone acting on such Contributor's
+behalf. Contributions do not include additions to the Program which:
+(i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are
+not derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor
+which are necessarily infringed by the use or sale of its
+Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with
+this Agreement.
+
+"Recipient" means anyone who receives the Program under this
+Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free copyright
+ license to reproduce, prepare derivative works of, publicly display,
+ publicly perform, distribute and sublicense the Contribution of such
+ Contributor, if any, and such derivative works, in source code and
+ object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free patent
+ license under Licensed Patents to make, use, sell, offer to sell,
+ import and otherwise transfer the Contribution of such Contributor,
+ if any, in source code and object code form. This patent license
+ shall apply to the combination of the Contribution and the Program
+ if, at the time the Contribution is added by the Contributor, such
+ addition of the Contribution causes such combination to be covered
+ by the Licensed Patents. The patent license shall not apply to any
+ other combinations which include the Contribution. No hardware per
+ se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the
+ licenses to its Contributions set forth herein, no assurances are
+ provided by any Contributor that the Program does not infringe
+ the patent or other intellectual property rights of any other
+ entity. Each Contributor disclaims any liability to Recipient
+ for claims brought by any other entity based on infringement
+ of intellectual property rights or otherwise. As a condition to
+ exercising the rights and licenses granted hereunder, each Recipient
+ hereby assumes sole responsibility to secure any other intellectual
+ property rights needed, if any. For example, if a third party patent
+ license is required to allow Recipient to distribute the Program,
+ it is Recipient's responsibility to acquire that license before
+ distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has
+ sufficient copyright rights in its Contribution, if any, to grant
+ the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code
+ form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties
+ and conditions, express and implied, including warranties or
+ conditions of title and non-infringement, and implied warranties or
+ conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability
+ for damages, including direct, indirect, special, incidental and
+ consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement
+ are offered by that Contributor alone and not by any other
+ party; and
+
+iv) states that source code for the Program is available from such
+ Contributor, and informs licensees how to obtain it in a reasonable
+ manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained
+within the Program.
+
+Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial
+use of the Program, the Contributor who includes the Program in a
+commercial product offering should do so in a manner which does not
+create potential liability for other Contributors. Therefore, if a
+Contributor includes the Program in a commercial product offering,
+such Contributor ("Commercial Contributor") hereby agrees to defend
+and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising
+from claims, lawsuits and other legal actions brought by a third
+party against the Indemnified Contributor to the extent caused by
+the acts or omissions of such Commercial Contributor in connection
+with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims
+or Losses relating to any actual or alleged intellectual property
+infringement. In order to qualify, an Indemnified Contributor must:
+a) promptly notify the Commercial Contributor in writing of such
+claim, and b) allow the Commercial Contributor to control, and
+cooperate with the Commercial Contributor in, the defense and any
+related settlement negotiations. The Indemnified Contributor may
+participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a
+commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes
+performance claims, or offers warranties related to Product X, those
+performance claims and warranties are such Commercial Contributor's
+responsibility alone. Under this section, the Commercial Contributor
+would have to defend claims against the other Contributors related
+to those performance claims and warranties, and if a court requires
+any other Contributor to pay any damages as a result, the Commercial
+Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
+WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with
+its exercise of rights under this Agreement , including but not
+limited to the risks and costs of program errors, compliance with
+applicable laws, damage to or loss of data, programs or equipment,
+and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY
+RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further
+action by the parties hereto, such provision shall be reformed
+to the minimum extent necessary to make such provision valid and
+enforceable.
+
+If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging
+that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s),
+then such Recipient's rights granted under Section 2(b) shall
+terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if
+it fails to comply with any of the material terms or conditions
+of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all
+Recipient's rights under this Agreement terminate, Recipient agrees
+to cease use and distribution of the Program as soon as reasonably
+practicable. However, Recipient's obligations under this Agreement
+and any licenses granted by Recipient relating to the Program shall
+continue and survive.
+
+Everyone is permitted to copy and distribute copies of this
+Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The
+Agreement Steward reserves the right to publish new versions
+(including revisions) of this Agreement from time to time. No
+one other than the Agreement Steward has the right to modify
+this Agreement. The Eclipse Foundation is the initial Agreement
+Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each
+new version of the Agreement will be given a distinguishing
+version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it
+was received. In addition, after a new version of the Agreement is
+published, Contributor may elect to distribute the Program (including
+its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or
+licenses to the intellectual property of any Contributor under
+this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under
+this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No
+party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each
+party waives its rights to a jury trial in any resulting litigation.
+----
+
+----
+Export Control Classification Number (ECCN)
+
+As far as we know, the U.S. Export Control Classification Number
+(ECCN) for this software is 5D002. However, for legal reasons, we
+can make no warranty that this information is correct. For details,
+see also the Apache Software Foundation Export Classifications page.
+
+----
+
+
+[[highlightjs]]
+highlightjs
+
+* js:highlightjs
+* js:highlightjs_files
+
+[[highlightjs_license]]
+----
+Copyright (c) 2006, Ivan Sagalaev
+All rights reserved.
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ * Neither the name of highlight.js nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY
+DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+----
+
+
+[[icu4j]]
+icu4j
+
+* icu4j
+
+[[icu4j_license]]
+----
+COPYRIGHT AND PERMISSION NOTICE (ICU 58 and later)
+
+Copyright © 1991-2016 Unicode, Inc. All rights reserved.
+Distributed under the Terms of Use in http://www.unicode.org/copyright.html
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the Unicode data files and any associated documentation
+(the "Data Files") or Unicode software and any associated documentation
+(the "Software") to deal in the Data Files or Software
+without restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, and/or sell copies of
+the Data Files or Software, and to permit persons to whom the Data Files
+or Software are furnished to do so, provided that either
+(a) this copyright and permission notice appear with all copies
+of the Data Files or Software, or
+(b) this copyright and permission notice appear in associated
+Documentation.
+
+THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
+ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT OF THIRD PARTY RIGHTS.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
+NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
+DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THE DATA FILES OR SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale,
+use or other dealings in these Data Files or Software without prior
+written authorization of the copyright holder.
+
+---------------------
+
+Third-Party Software Licenses
+
+This section contains third-party software notices and/or additional
+terms for licensed third-party software components included within ICU
+libraries.
+
+1. ICU License - ICU 1.8.1 to ICU 57.1
+
+COPYRIGHT AND PERMISSION NOTICE
+
+Copyright (c) 1995-2016 International Business Machines Corporation and others
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, and/or sell copies of the Software, and to permit persons
+to whom the Software is furnished to do so, provided that the above
+copyright notice(s) and this permission notice appear in all copies of
+the Software and that both the above copyright notice(s) and this
+permission notice appear in supporting documentation.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
+HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
+SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
+RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
+CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
+CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+Except as contained in this notice, the name of a copyright holder
+shall not be used in advertising or otherwise to promote the sale, use
+or other dealings in this Software without prior written authorization
+of the copyright holder.
+
+All trademarks and registered trademarks mentioned herein are the
+property of their respective owners.
+
+2. Chinese/Japanese Word Break Dictionary Data (cjdict.txt)
+
+ # The Google Chrome software developed by Google is licensed under
+ # the BSD license. Other software included in this distribution is
+ # provided under other licenses, as set forth below.
+ #
+ # The BSD License
+ # http://opensource.org/licenses/bsd-license.php
+ # Copyright (C) 2006-2008, Google Inc.
+ #
+ # All rights reserved.
+ #
+ # Redistribution and use in source and binary forms, with or without
+ # modification, are permitted provided that the following conditions are met:
+ #
+ # Redistributions of source code must retain the above copyright notice,
+ # this list of conditions and the following disclaimer.
+ # Redistributions in binary form must reproduce the above
+ # copyright notice, this list of conditions and the following
+ # disclaimer in the documentation and/or other materials provided with
+ # the distribution.
+ # Neither the name of Google Inc. nor the names of its
+ # contributors may be used to endorse or promote products derived from
+ # this software without specific prior written permission.
+ #
+ #
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ #
+ #
+ # The word list in cjdict.txt are generated by combining three word lists
+ # listed below with further processing for compound word breaking. The
+ # frequency is generated with an iterative training against Google web
+ # corpora.
+ #
+ # * Libtabe (Chinese)
+ # - https://sourceforge.net/project/?group_id=1519
+ # - Its license terms and conditions are shown below.
+ #
+ # * IPADIC (Japanese)
+ # - http://chasen.aist-nara.ac.jp/chasen/distribution.html
+ # - Its license terms and conditions are shown below.
+ #
+ # ---------COPYING.libtabe ---- BEGIN--------------------
+ #
+ # /*
+ # * Copyrighy (c) 1999 TaBE Project.
+ # * Copyright (c) 1999 Pai-Hsiang Hsiao.
+ # * All rights reserved.
+ # *
+ # * Redistribution and use in source and binary forms, with or without
+ # * modification, are permitted provided that the following conditions
+ # * are met:
+ # *
+ # * . Redistributions of source code must retain the above copyright
+ # * notice, this list of conditions and the following disclaimer.
+ # * . Redistributions in binary form must reproduce the above copyright
+ # * notice, this list of conditions and the following disclaimer in
+ # * the documentation and/or other materials provided with the
+ # * distribution.
+ # * . Neither the name of the TaBE Project nor the names of its
+ # * contributors may be used to endorse or promote products derived
+ # * from this software without specific prior written permission.
+ # *
+ # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ # * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ # * OF THE POSSIBILITY OF SUCH DAMAGE.
+ # */
+ #
+ # /*
+ # * Copyright (c) 1999 Computer Systems and Communication Lab,
+ # * Institute of Information Science, Academia
+ # * Sinica. All rights reserved.
+ # *
+ # * Redistribution and use in source and binary forms, with or without
+ # * modification, are permitted provided that the following conditions
+ # * are met:
+ # *
+ # * . Redistributions of source code must retain the above copyright
+ # * notice, this list of conditions and the following disclaimer.
+ # * . Redistributions in binary form must reproduce the above copyright
+ # * notice, this list of conditions and the following disclaimer in
+ # * the documentation and/or other materials provided with the
+ # * distribution.
+ # * . Neither the name of the Computer Systems and Communication Lab
+ # * nor the names of its contributors may be used to endorse or
+ # * promote products derived from this software without specific
+ # * prior written permission.
+ # *
+ # * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ # * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ # * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ # * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ # * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ # * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ # * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ # * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ # * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ # * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ # * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ # * OF THE POSSIBILITY OF SUCH DAMAGE.
+ # */
+ #
+ # Copyright 1996 Chih-Hao Tsai @ Beckman Institute,
+ # University of Illinois
+ # c-tsai4@uiuc.edu http://casper.beckman.uiuc.edu/~c-tsai4
+ #
+ # ---------------COPYING.libtabe-----END--------------------------------
+ #
+ #
+ # ---------------COPYING.ipadic-----BEGIN-------------------------------
+ #
+ # Copyright 2000, 2001, 2002, 2003 Nara Institute of Science
+ # and Technology. All Rights Reserved.
+ #
+ # Use, reproduction, and distribution of this software is permitted.
+ # Any copy of this software, whether in its original form or modified,
+ # must include both the above copyright notice and the following
+ # paragraphs.
+ #
+ # Nara Institute of Science and Technology (NAIST),
+ # the copyright holders, disclaims all warranties with regard to this
+ # software, including all implied warranties of merchantability and
+ # fitness, in no event shall NAIST be liable for
+ # any special, indirect or consequential damages or any damages
+ # whatsoever resulting from loss of use, data or profits, whether in an
+ # action of contract, negligence or other tortuous action, arising out
+ # of or in connection with the use or performance of this software.
+ #
+ # A large portion of the dictionary entries
+ # originate from ICOT Free Software. The following conditions for ICOT
+ # Free Software applies to the current dictionary as well.
+ #
+ # Each User may also freely distribute the Program, whether in its
+ # original form or modified, to any third party or parties, PROVIDED
+ # that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear
+ # on, or be attached to, the Program, which is distributed substantially
+ # in the same form as set out herein and that such intended
+ # distribution, if actually made, will neither violate or otherwise
+ # contravene any of the laws and regulations of the countries having
+ # jurisdiction over the User or the intended distribution itself.
+ #
+ # NO WARRANTY
+ #
+ # The program was produced on an experimental basis in the course of the
+ # research and development conducted during the project and is provided
+ # to users as so produced on an experimental basis. Accordingly, the
+ # program is provided without any warranty whatsoever, whether express,
+ # implied, statutory or otherwise. The term "warranty" used herein
+ # includes, but is not limited to, any warranty of the quality,
+ # performance, merchantability and fitness for a particular purpose of
+ # the program and the nonexistence of any infringement or violation of
+ # any right of any third party.
+ #
+ # Each user of the program will agree and understand, and be deemed to
+ # have agreed and understood, that there is no warranty whatsoever for
+ # the program and, accordingly, the entire risk arising from or
+ # otherwise connected with the program is assumed by the user.
+ #
+ # Therefore, neither ICOT, the copyright holder, or any other
+ # organization that participated in or was otherwise related to the
+ # development of the program and their respective officials, directors,
+ # officers and other employees shall be held liable for any and all
+ # damages, including, without limitation, general, special, incidental
+ # and consequential damages, arising out of or otherwise in connection
+ # with the use or inability to use the program or any product, material
+ # or result produced or otherwise obtained by using the program,
+ # regardless of whether they have been advised of, or otherwise had
+ # knowledge of, the possibility of such damages at any time during the
+ # project or thereafter. Each user will be deemed to have agreed to the
+ # foregoing by his or her commencement of use of the program. The term
+ # "use" as used herein includes, but is not limited to, the use,
+ # modification, copying and distribution of the program and the
+ # production of secondary products from the program.
+ #
+ # In the case where the program, whether in its original form or
+ # modified, was distributed or delivered to or received by a user from
+ # any person, organization or entity other than ICOT, unless it makes or
+ # grants independently of ICOT any specific warranty to the user in
+ # writing, such person, organization or entity, will also be exempted
+ # from and not be held liable to the user for any such damages as noted
+ # above as far as the program is concerned.
+ #
+ # ---------------COPYING.ipadic-----END----------------------------------
+
+3. Lao Word Break Dictionary Data (laodict.txt)
+
+ # Copyright (c) 2013 International Business Machines Corporation
+ # and others. All Rights Reserved.
+ #
+ # Project: http://code.google.com/p/lao-dictionary/
+ # Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt
+ # License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt
+ # (copied below)
+ #
+ # This file is derived from the above dictionary, with slight
+ # modifications.
+ # ----------------------------------------------------------------------
+ # Copyright (C) 2013 Brian Eugene Wilson, Robert Martin Campbell.
+ # All rights reserved.
+ #
+ # Redistribution and use in source and binary forms, with or without
+ # modification,
+ # are permitted provided that the following conditions are met:
+ #
+ #
+ # Redistributions of source code must retain the above copyright notice, this
+ # list of conditions and the following disclaimer. Redistributions in
+ # binary form must reproduce the above copyright notice, this list of
+ # conditions and the following disclaimer in the documentation and/or
+ # other materials provided with the distribution.
+ #
+ #
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ # OF THE POSSIBILITY OF SUCH DAMAGE.
+ # --------------------------------------------------------------------------
+
+4. Burmese Word Break Dictionary Data (burmesedict.txt)
+
+ # Copyright (c) 2014 International Business Machines Corporation
+ # and others. All Rights Reserved.
+ #
+ # This list is part of a project hosted at:
+ # github.com/kanyawtech/myanmar-karen-word-lists
+ #
+ # --------------------------------------------------------------------------
+ # Copyright (c) 2013, LeRoy Benjamin Sharon
+ # All rights reserved.
+ #
+ # Redistribution and use in source and binary forms, with or without
+ # modification, are permitted provided that the following conditions
+ # are met: Redistributions of source code must retain the above
+ # copyright notice, this list of conditions and the following
+ # disclaimer. Redistributions in binary form must reproduce the
+ # above copyright notice, this list of conditions and the following
+ # disclaimer in the documentation and/or other materials provided
+ # with the distribution.
+ #
+ # Neither the name Myanmar Karen Word Lists, nor the names of its
+ # contributors may be used to endorse or promote products derived
+ # from this software without specific prior written permission.
+ #
+ # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+ # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
+ # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+ # TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ # ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ # TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
+ # THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ # SUCH DAMAGE.
+ # --------------------------------------------------------------------------
+
+5. Time Zone Database
+
+ ICU uses the public domain data and code derived from Time Zone
+Database for its time zone support. The ownership of the TZ database
+is explained in BCP 175: Procedure for Maintaining the Time Zone
+Database section 7.
+
+ # 7. Database Ownership
+ #
+ # The TZ database itself is not an IETF Contribution or an IETF
+ # document. Rather it is a pre-existing and regularly updated work
+ # that is in the public domain, and is intended to remain in the
+ # public domain. Therefore, BCPs 78 [RFC5378] and 79 [RFC3979] do
+ # not apply to the TZ Database or contributions that individuals make
+ # to it. Should any claims be made and substantiated against the TZ
+ # Database, the organization that is providing the IANA
+ # Considerations defined in this RFC, under the memorandum of
+ # understanding with the IETF, currently ICANN, may act in accordance
+ # with all competent court orders. No ownership claims will be made
+ # by ICANN or the IETF Trust on the database or the code. Any person
+ # making a contribution to the database or code waives all rights to
+ # future claims in that contribution or in the TZ Database.
+
+----
+
+
+[[jgit]]
+jgit
+
+* jgit/org.eclipse.jgit.archive:jgit-archive
+* jgit/org.eclipse.jgit.http.server:jgit-servlet
+* jgit/org.eclipse.jgit:jgit
+
+[[jgit_license]]
+----
+This program and the accompanying materials are made available
+under the terms of the Eclipse Distribution License v1.0 which
+accompanies this distribution, is reproduced below, and is
+available at http://www.eclipse.org/org/documents/edl-v10.php
+
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or
+without modification, are permitted provided that the following
+conditions are met:
+
+- Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+- Redistributions in binary form must reproduce the above
+ copyright notice, this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided
+ with the distribution.
+
+- Neither the name of the Eclipse Foundation, Inc. nor the
+ names of its contributors may be used to endorse or promote
+ products derived from this software without specific prior
+ written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
+CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+----
+
+
+[[jsch]]
+jsch
+
+* jsch
+
+[[jsch_license]]
+----
+Copyright (c) 2002-2012 Atsuhiko Yamanaka, JCraft,Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in
+ the documentation and/or other materials provided with the distribution.
+
+ 3. The names of the authors may not be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JCRAFT,
+INC. OR ANY CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+----
+
+
+[[jsoup]]
+jsoup
+
+* jsoup:jsoup
+
+[[jsoup_license]]
+----
+The MIT License
+
+© 2009-2016, Jonathan Hedley <jonathan@hedley.net>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+----
+
+
+[[moment]]
+moment
+
+* js:moment
+
+[[moment_license]]
+----
+Copyright (c) 2011-2016 Tim Wood, Iskren Chernev, Moment.js contributors
+
+Permission is hereby granted, free of charge, to any person
+obtaining a copy of this software and associated documentation
+files (the "Software"), to deal in the Software without
+restriction, including without limitation the rights to use,
+copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the
+Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+----
+
+
+[[ow2]]
+ow2
+
+* ow2:ow2-asm
+* ow2:ow2-asm-analysis
+* ow2:ow2-asm-commons
+* ow2:ow2-asm-tree
+* ow2:ow2-asm-util
+
+[[ow2_license]]
+----
+Copyright (c) 2000-2011 INRIA, France Telecom
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holders nor the names of its
+ contributors may be used to endorse or promote products derived from
+ this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.
+
+----
+
+
+[[page_js]]
+page.js
+
+* js:page
+
+[[page_js_license]]
+----
+(The MIT License)
+
+Copyright (c) 2012 TJ Holowaychuk <tj@vision-media.ca>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the 'Software'), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+----
+
+
+[[polymer]]
+polymer
+
+* js:font-roboto
+* js:iron-a11y-announcer
+* js:iron-a11y-keys-behavior
+* js:iron-autogrow-textarea
+* js:iron-behaviors
+* js:iron-checked-element-behavior
+* js:iron-dropdown
+* js:iron-fit-behavior
+* js:iron-flex-layout
+* js:iron-form-element-behavior
+* js:iron-icon
+* js:iron-iconset-svg
+* js:iron-input
+* js:iron-menu-behavior
+* js:iron-meta
+* js:iron-overlay-behavior
+* js:iron-resizable-behavior
+* js:iron-selector
+* js:iron-validatable-behavior
+* js:neon-animation
+* js:paper-behaviors
+* js:paper-button
+* js:paper-icon-button
+* js:paper-input
+* js:paper-item
+* js:paper-listbox
+* js:paper-ripple
+* js:paper-styles
+* js:paper-tabs
+* js:paper-toggle-button
+* js:polymer
+* js:polymer-resin
+* js:webcomponentsjs
+
+[[polymer_license]]
+----
+Copyright (c) 2014 The Polymer Authors. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+----
+
+
+[[prologcafe]]
+prologcafe
+
+* prolog:cafeteria
+* prolog:compiler
+* prolog:io
+* prolog:runtime
+
+[[prologcafe_license]]
+----
+Prolog Cafe (A Prolog to Java Translator System)
+Copyright (C) 1997-2009 by Mutsunori Banbara and Naoyuki Tamura
+
+Prolog Cafe is free software; you can redistribute it and/or modify
+it under the terms of either:
+
+ * the GNU General Public License as published by the Free Software
+ Foundation; either version 2 of the License, or (at your option)
+ any later version, or
+
+ * the Eclipse Public License
+----
+
+In the context of Gerrit Code Review, Prolog Cafe is consumed under
+the <<prologcafe_EPL,EPL>>. Gerrit Code Review uses a fork derived
+from the 1.2.5 release and offers the corresponding source code at
+link:https://gerrit.googlesource.com/prolog-cafe[].
+
+----
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the program's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License along
+ with this program; if not, write to the Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+ Gnomovision version 69, Copyright (C) year name of author
+ Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+ This is free software, and you are welcome to redistribute it
+ under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License. Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+ `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+ <signature of Ty Coon>, 1 April 1989
+ Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs. If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library. If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
+----
+
+[[prologcafe_EPL]]
+----
+Eclipse Public License - v 1.0
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE
+PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION
+OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and
+ documentation distributed under this Agreement, and
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from
+and are distributed by that particular Contributor. A Contribution
+'originates' from a Contributor if it was added to the Program
+by such Contributor itself or anyone acting on such Contributor's
+behalf. Contributions do not include additions to the Program which:
+(i) are separate modules of software distributed in conjunction
+with the Program under their own license agreement, and (ii) are
+not derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor
+which are necessarily infringed by the use or sale of its
+Contribution alone or when combined with the Program.
+
+"Program" means the Contributions distributed in accordance with
+this Agreement.
+
+"Recipient" means anyone who receives the Program under this
+Agreement, including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free copyright
+ license to reproduce, prepare derivative works of, publicly display,
+ publicly perform, distribute and sublicense the Contribution of such
+ Contributor, if any, and such derivative works, in source code and
+ object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby
+ grants Recipient a non-exclusive, worldwide, royalty-free patent
+ license under Licensed Patents to make, use, sell, offer to sell,
+ import and otherwise transfer the Contribution of such Contributor,
+ if any, in source code and object code form. This patent license
+ shall apply to the combination of the Contribution and the Program
+ if, at the time the Contribution is added by the Contributor, such
+ addition of the Contribution causes such combination to be covered
+ by the Licensed Patents. The patent license shall not apply to any
+ other combinations which include the Contribution. No hardware per
+ se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the
+ licenses to its Contributions set forth herein, no assurances are
+ provided by any Contributor that the Program does not infringe
+ the patent or other intellectual property rights of any other
+ entity. Each Contributor disclaims any liability to Recipient
+ for claims brought by any other entity based on infringement
+ of intellectual property rights or otherwise. As a condition to
+ exercising the rights and licenses granted hereunder, each Recipient
+ hereby assumes sole responsibility to secure any other intellectual
+ property rights needed, if any. For example, if a third party patent
+ license is required to allow Recipient to distribute the Program,
+ it is Recipient's responsibility to acquire that license before
+ distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has
+ sufficient copyright rights in its Contribution, if any, to grant
+ the copyright license set forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code
+ form under its own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties
+ and conditions, express and implied, including warranties or
+ conditions of title and non-infringement, and implied warranties or
+ conditions of merchantability and fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability
+ for damages, including direct, indirect, special, incidental and
+ consequential damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement
+ are offered by that Contributor alone and not by any other
+ party; and
+
+iv) states that source code for the Program is available from such
+ Contributor, and informs licensees how to obtain it in a reasonable
+ manner on or through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained
+within the Program.
+
+Each Contributor must identify itself as the originator of its
+Contribution, if any, in a manner that reasonably allows subsequent
+Recipients to identify the originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain
+responsibilities with respect to end users, business partners and the
+like. While this license is intended to facilitate the commercial
+use of the Program, the Contributor who includes the Program in a
+commercial product offering should do so in a manner which does not
+create potential liability for other Contributors. Therefore, if a
+Contributor includes the Program in a commercial product offering,
+such Contributor ("Commercial Contributor") hereby agrees to defend
+and indemnify every other Contributor ("Indemnified Contributor")
+against any losses, damages and costs (collectively "Losses") arising
+from claims, lawsuits and other legal actions brought by a third
+party against the Indemnified Contributor to the extent caused by
+the acts or omissions of such Commercial Contributor in connection
+with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims
+or Losses relating to any actual or alleged intellectual property
+infringement. In order to qualify, an Indemnified Contributor must:
+a) promptly notify the Commercial Contributor in writing of such
+claim, and b) allow the Commercial Contributor to control, and
+cooperate with the Commercial Contributor in, the defense and any
+related settlement negotiations. The Indemnified Contributor may
+participate in any such claim at its own expense.
+
+For example, a Contributor might include the Program in a
+commercial product offering, Product X. That Contributor is then a
+Commercial Contributor. If that Commercial Contributor then makes
+performance claims, or offers warranties related to Product X, those
+performance claims and warranties are such Commercial Contributor's
+responsibility alone. Under this section, the Commercial Contributor
+would have to defend claims against the other Contributors related
+to those performance claims and warranties, and if a court requires
+any other Contributor to pay any damages as a result, the Commercial
+Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS
+PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY
+WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
+OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
+responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with
+its exercise of rights under this Agreement , including but not
+limited to the risks and costs of program errors, compliance with
+applicable laws, damage to or loss of data, programs or equipment,
+and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
+NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY
+RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under
+applicable law, it shall not affect the validity or enforceability of
+the remainder of the terms of this Agreement, and without further
+action by the parties hereto, such provision shall be reformed
+to the minimum extent necessary to make such provision valid and
+enforceable.
+
+If Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging
+that the Program itself (excluding combinations of the Program with
+other software or hardware) infringes such Recipient's patent(s),
+then such Recipient's rights granted under Section 2(b) shall
+terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if
+it fails to comply with any of the material terms or conditions
+of this Agreement and does not cure such failure in a reasonable
+period of time after becoming aware of such noncompliance. If all
+Recipient's rights under this Agreement terminate, Recipient agrees
+to cease use and distribution of the Program as soon as reasonably
+practicable. However, Recipient's obligations under this Agreement
+and any licenses granted by Recipient relating to the Program shall
+continue and survive.
+
+Everyone is permitted to copy and distribute copies of this
+Agreement, but in order to avoid inconsistency the Agreement is
+copyrighted and may only be modified in the following manner. The
+Agreement Steward reserves the right to publish new versions
+(including revisions) of this Agreement from time to time. No
+one other than the Agreement Steward has the right to modify
+this Agreement. The Eclipse Foundation is the initial Agreement
+Steward. The Eclipse Foundation may assign the responsibility to
+serve as the Agreement Steward to a suitable separate entity. Each
+new version of the Agreement will be given a distinguishing
+version number. The Program (including Contributions) may always be
+distributed subject to the version of the Agreement under which it
+was received. In addition, after a new version of the Agreement is
+published, Contributor may elect to distribute the Program (including
+its Contributions) under the new version. Except as expressly stated
+in Sections 2(a) and 2(b) above, Recipient receives no rights or
+licenses to the intellectual property of any Contributor under
+this Agreement, whether expressly, by implication, estoppel or
+otherwise. All rights in the Program not expressly granted under
+this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and
+the intellectual property laws of the United States of America. No
+party to this Agreement will bring a legal action under this
+Agreement more than one year after the cause of action arose. Each
+party waives its rights to a jury trial in any resulting litigation.
+
+----
+
+
+[[promise-polyfill]]
+promise-polyfill
+
+* js:promise-polyfill
+
+[[promise-polyfill_license]]
+----
+Copyright (c) 2014 Taylor Hakes
+Copyright (c) 2014 Forbes Lindesay
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+----
+
+
+[[protobuf]]
+protobuf
+
+* protobuf
+
+[[protobuf_license]]
+----
+Copyright 2008, Google Inc.
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+ * Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above
+copyright notice, this list of conditions and the following disclaimer
+in the documentation and/or other materials provided with the
+distribution.
+ * Neither the name of Google Inc. nor the names of its
+contributors may be used to endorse or promote products derived from
+this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+Code generated by the Protocol Buffer compiler is owned by the owner
+of the input file used when generating it. This code is not
+standalone and requires a support library to be linked with it. This
+support library is itself covered by the above license.
+
+----
+
+
+[[slf4j]]
+slf4j
+
+* log:api
+* log:jcl-over-slf4j
+
+[[slf4j_license]]
+----
+Copyright (c) 2004-2008 QOS.ch
+All rights reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+----
+
+
+[[xz]]
+xz
+
+* tukaani-xz
+
+[[xz_license]]
+----
+All the files in this package have been written by Lasse Collin
+and/or Igor Pavlov. All these files have been put into the
+public domain. You can do whatever you want with these files.
+This software is provided "as is", without any warranty.
+
+----
+
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
+
diff --git a/Documentation/metrics.txt b/Documentation/metrics.txt
index 37d6d01..064859d 100644
--- a/Documentation/metrics.txt
+++ b/Documentation/metrics.txt
@@ -23,10 +23,12 @@
=== Pushes
* `receivecommits/changes`: histogram of number of changes processed
-in a single upload, split up by update type (new change created,
-existing changed updated, change autoclosed).
+in a single upload, split up by update type (change created/updated,
+change autoclosed).
* `receivecommits/latency`: latency per change for processing a push,
split up by update type (create+replace, and autoclose)
+* `receivecommits/push_latency`: total latency for processing a push,
+split up by update type (create+replace, autoclose, normal)
* `receivecommits/timeout`: number of timeouts during push processing.
=== Process
@@ -106,10 +108,6 @@
* `sshd/sessions/created`: Rate of new SSH sessions.
* `sshd/sessions/authentication_failures`: Rate of SSH authentication failures.
-=== SQL connections
-
-* `sql/connection_pool/connections`: SQL database connections.
-
=== Topics
* `topic/cross_project_submit`: number of cross-project topic submissions.
@@ -140,9 +138,6 @@
* `notedb/stage_update_latency`: Latency for staging updates to NoteDb by table.
* `notedb/read_latency`: NoteDb read latency by table.
* `notedb/parse_latency`: NoteDb parse latency by table.
-* `notedb/auto_rebuild_latency`: NoteDb auto-rebuilding latency by table.
-* `notedb/auto_rebuild_failure_count`: NoteDb auto-rebuilding attempts that
-failed by table.
* `notedb/external_id_update_count`: Total number of external ID updates.
* `notedb/read_all_external_ids_latency`: Latency for reading all
external ID's from NoteDb.
@@ -177,6 +172,10 @@
* `plugin/latency`: Latency for plugin invocation.
* `plugin/error_count`: Number of plugin errors.
+=== Group
+
+* `group/guess_relevant_groups_latency`: Latency for guessing relevant groups.
+
=== Replication Plugin
* `plugins/replication/replication_latency`: Time spent pushing to remote
diff --git a/Documentation/note-db.txt b/Documentation/note-db.txt
index fd2bef37..308e045 100644
--- a/Documentation/note-db.txt
+++ b/Documentation/note-db.txt
@@ -1,8 +1,8 @@
= Gerrit Code Review - NoteDb Backend
NoteDb is the next generation of Gerrit storage backend, which replaces the
-traditional SQL backend for change and account metadata with storing data in the
-same repository as code changes.
+traditional SQL backend for change, account and group metadata with storing
+data in the same repository as code changes.
.Advantages
- *Simplicity*: All data is stored in one location in the site directory, rather
@@ -32,12 +32,15 @@
2.15 release. Account data is migrated automatically during the upgrade
process by running `gerrit.war init`.
- Storing link:config-groups.html[group metadata] is fully implemented
- for the 2.16 release. Group data is migrated automatically during
+ in the 2.16 release. Group data is migrated automatically during
the upgrade process by running `gerrit.war init`
- Account, group and change metadata on the servers behind `googlesource.com` is fully
migrated to NoteDb. In other words, if you use
link:https://gerrit-review.googlesource.com/[gerrit-review], you're already
using NoteDb.
+- NoteDb is the only database format supported by Gerrit 3.0. The change data
+ migration tools are only included in Gerrit 2.15 and 2.16; they are not
+ available in 3.0.
For an example NoteDb change, poke around at this one:
----
@@ -45,12 +48,6 @@
&& git log -p FETCH_HEAD
----
-== Future Work ("Gerrit 3.0")
-
-- NoteDb will be the only database format supported by Gerrit 3.0. The offline
- change data migration tool will be included in Gerrit 3.0, but online
- migration will only be available in the 2.x line.
-
[[migration]]
== Migration
@@ -64,6 +61,9 @@
[[online-migration]]
=== Online
+Note that online migration is only available in 2.x. To do the online migration
+from 2.14.x or 2.15.x to 3.0, it is necessary to first upgrade to 2.16.x.
+
To start the online migration, set the `noteDb.changes.autoMigrate` option in
`gerrit.config` and restart Gerrit:
----
@@ -87,7 +87,7 @@
*Disadvantages*
-* Only available in 2.x; will not be available in Gerrit 3.0.
+* Only available in 2.x; not available in Gerrit 3.0.
* Much slower than offline; uses only a single thread, to leave resources
available for serving traffic.
* Performance may be degraded, particularly of updates; data needs to be written
@@ -114,10 +114,10 @@
* Much faster than online; can use all available CPUs, since no live traffic
needs to be served.
* No degraded performance of live servers due to writing data to 2 locations.
-* Available in both Gerrit 2.x and 3.0.
*Disadvantages*
+* Available in Gerrit 2.15 and 2.16 only.
* May require substantial downtime; takes about twice as long as an
link:pgm-reindex.html[offline reindex]. (In fact, one of the migration steps is a
full reindex, so it can't possibly take less time.)
diff --git a/Documentation/pg-plugin-admin-api.txt b/Documentation/pg-plugin-admin-api.txt
index 1c724d0..084fa2c 100644
--- a/Documentation/pg-plugin-admin-api.txt
+++ b/Documentation/pg-plugin-admin-api.txt
@@ -4,7 +4,7 @@
and provides customization of the admin menu.
== addMenuLink
-`adminApi.addMenuLink(text, url, opt_external)`
+`adminApi.addMenuLink(text, url, opt_external, opt_capabilities)`
Add a new link to the end of the admin navigation menu.
diff --git a/Documentation/pg-plugin-dev.txt b/Documentation/pg-plugin-dev.txt
index c7aa57c..8fb5655 100644
--- a/Documentation/pg-plugin-dev.txt
+++ b/Documentation/pg-plugin-dev.txt
@@ -177,6 +177,14 @@
Note: TODO
+=== registerDynamicCustomComponent
+`plugin.registerDynamicCustomComponent(dynamicEndpointName, opt_moduleName,
+opt_options)`
+
+See list of supported link:pg-plugin-endpoints.html[endpoints].
+
+Note: TODO
+
=== registerStyleModule
`plugin.registerStyleModule(endpointName, moduleName)`
diff --git a/Documentation/pg-plugin-endpoints.txt b/Documentation/pg-plugin-endpoints.txt
index c0d7854..ff62da1 100644
--- a/Documentation/pg-plugin-endpoints.txt
+++ b/Documentation/pg-plugin-endpoints.txt
@@ -146,3 +146,52 @@
+
The submit action, including the title and label, an instance of
link:rest-api-changes.html#action-info[ActionInfo]
+
+== Dynamic Plugin endpoints
+
+The following endpoints are available to plugins.
+
+=== change-list-header
+The `change-list-header` extension point adds a header to the change list view.
+
+=== change-list-item-cell
+The `change-list-item-cell` extension point adds a cell to the change list item.
+
+In addition to default parameters, the following are available:
+
+* `change`
++
+current change of the row, an instance of
+link:rest-api-changes.html#change-info[ChangeInfo]
+
+=== change-view-tab-header
+The `change-view-tab-header` extension point adds a primary tab to the change
+view. This must be used in conjunction with `change-view-tab-content`.
+
+In addition to default parameters, the following are available:
+
+* `change`
++
+current change displayed, an instance of
+link:rest-api-changes.html#change-info[ChangeInfo]
+
+* `revision`
++
+current revision displayed, an instance of
+link:rest-api-changes.html#revision-info[RevisionInfo]
+
+=== change-view-tab-content
+The `change-view-tab-content` extension point adds primary tab content to
+the change view. This must be used in conjunction with `change-view-tab-header`.
+
+In addition to default parameters, the following are available:
+
+* `change`
++
+current change displayed, an instance of
+link:rest-api-changes.html#change-info[ChangeInfo]
+
+* `revision`
++
+current revision displayed, an instance of
+link:rest-api-changes.html#revision-info[RevisionInfo]
diff --git a/Documentation/pgm-LocalUsernamesToLowerCase.txt b/Documentation/pgm-LocalUsernamesToLowerCase.txt
index 4b50961..53081a1 100644
--- a/Documentation/pgm-LocalUsernamesToLowerCase.txt
+++ b/Documentation/pgm-LocalUsernamesToLowerCase.txt
@@ -47,7 +47,7 @@
== CONTEXT
This command can only be run on a server which has direct
-connectivity to the metadata database.
+connectivity to the managed Git repositories.
== EXAMPLES
To convert the local username of every account to lower case:
diff --git a/Documentation/pgm-daemon.txt b/Documentation/pgm-daemon.txt
index 0b1a3e5..ad07cfa 100644
--- a/Documentation/pgm-daemon.txt
+++ b/Documentation/pgm-daemon.txt
@@ -19,14 +19,8 @@
== DESCRIPTION
Runs the Gerrit network daemon on the local system, configured as
-per the local copy of link:config-gerrit.html[gerrit.config].
-
-The path to gerrit.config is read from the metadata database,
-which requires that all slaves (and master) reading from the same
-database must place gerrit.config at the same location on the local
-filesystem. However, any option within gerrit.config, including
-link:config-gerrit.html#gerrit.basePath[gerrit.basePath] may be set
-to different values.
+per the local copy of link:config-gerrit.html[gerrit.config] located under
+`<SITE_PATH>/etc`.
== OPTIONS
diff --git a/Documentation/pgm-gsql.txt b/Documentation/pgm-gsql.txt
deleted file mode 100644
index 4986522..0000000
--- a/Documentation/pgm-gsql.txt
+++ /dev/null
@@ -1,55 +0,0 @@
-= gsql
-
-== NAME
-gsql - Administrative interface to idle database
-
-== SYNOPSIS
-[verse]
---
-_java_ -jar gerrit.war _gsql_
- -d <SITE_PATH>
---
-
-== DESCRIPTION
-Interactive query support against the configured SQL database.
-All SQL statements are supported, including SELECT, UPDATE, INSERT,
-DELETE and ALTER.
-
-This command is primarily intended to access a local H2 database
-which is not currently open by a Gerrit daemon. To access an open
-database use link:cmd-gsql.html[gerrit gsql] over SSH.
-
-== OPTIONS
-
--d::
---site-path::
- Location of the gerrit.config file, and all other per-site
- configuration data, supporting libraries and log files.
-
-== CONTEXT
-This command can only be run on a server which has direct
-connectivity to the metadata database, and local access to the
-managed Git repositories.
-
-== EXAMPLES
-To manually correct a user's SSH user name:
-
-----
- $ java -jar gerrit.war gsql
- Welcome to Gerrit Code Review v2.0.25
- (PostgreSQL 8.3.8)
-
- Type '\h' for help. Type '\r' to clear the buffer.
-
- gerrit> update accounts set ssh_user_name = 'alice' where account_id=1;
- UPDATE 1; 1 ms
- gerrit> \q
- Bye
-----
-
-GERRIT
-------
-Part of link:index.html[Gerrit Code Review]
-
-SEARCHBOX
----------
diff --git a/Documentation/pgm-index.txt b/Documentation/pgm-index.txt
index d61cc0b..dde0231 100644
--- a/Documentation/pgm-index.txt
+++ b/Documentation/pgm-index.txt
@@ -15,9 +15,6 @@
link:pgm-daemon.html[daemon]::
Gerrit HTTP, SSH network server.
-link:pgm-gsql.html[gsql]::
- Administrative interface to idle database.
-
link:pgm-prolog-shell.html[prolog-shell]::
Simple interactive Prolog interpreter.
diff --git a/Documentation/pgm-init.txt b/Documentation/pgm-init.txt
index 9a16cdf..f6c3c85 100644
--- a/Documentation/pgm-init.txt
+++ b/Documentation/pgm-init.txt
@@ -28,7 +28,7 @@
into a newly created `$site_path`.
If run in an existing `$site_path`, init upgrades existing resources
-(e.g. DB schema, plugins) as necessary.
+(e.g. NoteDb schema, plugins) as necessary.
== OPTIONS
-b::
@@ -100,8 +100,7 @@
folder.
== CONTEXT
-This command can only be run on a server which has direct
-connectivity to the metadata database, and local access to the
+This command can only be run on a server which has direct local access to the
managed Git repositories.
GERRIT
diff --git a/Documentation/pgm-prolog-shell.txt b/Documentation/pgm-prolog-shell.txt
index a669aa7..3566b8f 100644
--- a/Documentation/pgm-prolog-shell.txt
+++ b/Documentation/pgm-prolog-shell.txt
@@ -7,7 +7,7 @@
[verse]
--
_java_ -jar gerrit.war _prolog-shell_
- [-s FILE.pl ...]
+ [-q] [-s FILE.pl ...]
--
== DESCRIPTION
@@ -15,6 +15,8 @@
and testing.
== OPTIONS
+-q::
+ Do not display banner.
-s::
Dynamically load the Prolog source code at startup,
as though the user had entered `['FILE.pl'].` into
diff --git a/Documentation/pgm-rulec.txt b/Documentation/pgm-rulec.txt
index 1b50812..2a987205 100644
--- a/Documentation/pgm-rulec.txt
+++ b/Documentation/pgm-rulec.txt
@@ -33,8 +33,7 @@
Compile rules for the specified project.
== CONTEXT
-This command can only be run on a server which has direct
-connectivity to the metadata database, and local access to the
+This command can only be run on a server which has local access to the
managed Git repositories.
Caching needs to be enabled. See
diff --git a/Documentation/project-configuration.txt b/Documentation/project-configuration.txt
index 9fa21ff..23030a4 100644
--- a/Documentation/project-configuration.txt
+++ b/Documentation/project-configuration.txt
@@ -48,201 +48,7 @@
[[project_options]]
== Project Options
-[[submit_type]]
-=== Submit Type
-
-The method Gerrit uses to submit a change to a project can be
-modified by any project owner through the project console, `Projects` >
-`List` > my/project. In general, a submitted change is only merged if all
-its dependencies are also submitted, with exceptions documented below.
-The following submit types are supported:
-
-[[submit_type_inherit]]
-* Inherit
-+
-This is the default for new projects, unless overridden by a global
-link:config-gerrit.html#repository.name.defaultSubmitType[`defaultSubmitType` option].
-+
-Inherit the submit type from the parent project. In `All-Projects`, this
-is equivalent to link:#merge_if_necessary[Merge If Necessary].
-
-[[fast_forward_only]]
-* Fast Forward Only
-+
-With this method Gerrit does not create merge commits on submitting a
-change. Merge commits may still be submitted, but they must be created
-on the client prior to uploading to Gerrit for review.
-+
-To submit a change, the change must be a strict superset of the
-destination branch. That is, the change must already contain the
-tip of the destination branch at submit time.
-
-[[merge_if_necessary]]
-* Merge If Necessary
-+
-If the change being submitted is a strict superset of the destination
-branch, then the branch is fast-forwarded to the change. If not,
-then a merge commit is automatically created. This is identical
-to the classical `git merge` behavior, or `git merge --ff`.
-
-[[always_merge]]
-* Always Merge
-+
-Always produce a merge commit, even if the change is a strict
-superset of the destination branch. This is identical to the
-behavior of `git merge --no-ff`, and may be useful if the
-project needs to follow submits with `git log --first-parent`.
-
-[[cherry_pick]]
-* Cherry Pick
-+
-Always cherry pick the patch set, ignoring the parent lineage
-and instead creating a brand new commit on top of the current
-branch head.
-+
-When cherry picking a change, Gerrit automatically appends onto the
-end of the commit message a short summary of the change's approvals,
-and a URL link back to the change on the web. The committer header
-is also set to the submitter, while the author header retains the
-original patch set author.
-+
-Note that Gerrit ignores dependencies between changes when using this
-submit type unless
-link:config-gerrit.html#change.submitWholeTopic[`change.submitWholeTopic`]
-is enabled and depending changes share the same topic. So generally
-submitters must remember to submit changes in the right order when using this
-submit type. If all you want is extra information in the commit message,
-consider using the Rebase Always submit strategy.
-
-[[rebase_if_necessary]]
-* Rebase If Necessary
-+
-If the change being submitted is a strict superset of the destination
-branch, then the branch is fast-forwarded to the change. If not,
-then the change is automatically rebased and then the branch is
-fast-forwarded to the change.
-+
-When Gerrit tries to do a merge, by default the merge will only
-succeed if there is no path conflict. A path conflict occurs when
-the same file has also been changed on the other side of the merge.
-
-[[rebase_always]]
-* Rebase Always
-+
-Basically, the same as Rebase If Necessary, but it creates a new patchset even
-if fast forward is possible AND like Cherry Pick it ensures footers such as
-Change-Id, Reviewed-On, and others are present in resulting commit that is
-merged.
-+
-Thus, Rebase Always can be considered similar to Cherry Pick, but with
-the important distinction that Rebase Always does not ignore dependencies.
-
-[[content_merge]]
-=== Allow content merges
-
-If `Allow content merges` is enabled, Gerrit will try
-to do a content merge when a path conflict occurs.
-
-[[project-state]]
-=== State
-
-This setting defines the state of the project. A project can have the
-following states:
-
-- `Active`:
-+
-The project is active and users can see and modify the project according
-to their access rights on the project.
-
-- `Read Only`:
-+
-The project is read only and all modifying operations on it are
-disabled. E.g. this means that pushing to this project fails for all
-users even if they have push permissions assigned on it.
-+
-Setting a project to this state is an easy way to temporary close a
-project, as you can keep all write access rights in place and they will
-become active again as soon as the project state is set back to
-`Active`.
-+
-This state also makes sense if a project was moved to another location.
-In this case all new development should happen in the new project and
-you want to prevent that somebody accidentally works on the old
-project, while keeping the old project around for old references.
-
-- `Hidden`:
-+
-The project is hidden and only visible to project owners. Other users
-are not able to see the project even if they have read permissions
-granted on the project.
-
-=== Use target branch when determining new changes to open
-
-The `create-new-change-for-all-not-in-target` option provides a
-convenience for selecting link:user-upload.html#base[the merge base]
-by setting it automatically to the target branch's tip so you can
-create new changes for all commits not in the target branch.
-
-This option is disabled if the tip of the push is a merge commit.
-
-This option also only works if there are no merge commits in the
-commit chain, in such cases it fails warning the user that such
-pushes can only be performed by manually specifying
-link:user-upload.html#base[bases]
-
-This option is useful if you want to push a change to your personal
-branch first and for review to another branch for example. Or in cases
-where a commit is already merged into a branch and you want to create
-a new open change for that commit on another branch.
-
-[[require-change-id]]
-=== Require Change-Id
-
-The `Require Change-Id in commit message` option defines whether a
-link:user-changeid.html[Change-Id] in the commit message is required
-for pushing a commit for review. If this option is set, trying to push
-a commit for review that doesn't contain a Change-Id in the commit
-message fails with link:error-missing-changeid.html[missing Change-Id
-in commit message footer].
-
-It is recommended to set this option and use a
-link:user-changeid.html#create[commit-msg hook] (or other client side
-tooling like EGit) to automatically generate Change-Id's for new
-commits. This way the Change-Id is automatically in place when changes
-are reworked or rebased and uploading new patch sets gets easy.
-
-If this option is not set, commits can be uploaded without a Change-Id,
-but then users have to remember to copy the assigned Change-Id from the
-change screen and insert it manually into the commit message when they
-want to upload a second patch set.
-
-=== Maximum Git Object Size Limit
-
-This option defines the maximum allowed Git object size that
-receive-pack will accept. If an object is larger than the given size
-the pack-parsing will abort and the push operation will fail.
-
-With this option users can be prevented from uploading commits that
-contain files which are too large.
-
-Normally the link:config-gerrit.html#receive.maxObjectSizeLimit[maximum
-Git object size limit] is configured globally for a Gerrit server. At
-the project level, the maximum Git object size limit can be further
-reduced, but not extended. The displayed effective limit shows the
-maximum Git object size limit that is actually used on the project.
-
-The defined maximum Git object size limit is inherited by any child
-project.
-
-[[require-signed-off-by]]
-=== Require Signed-off-by
-
-The `Require Signed-off-by in commit message` option defines whether a
-link:user-signedoffby.html[Signed-off-by] line in the commit message is
-required for pushing a commit. If this option is set, trying to push a
-commit that doesn't contain a Signed-off-by line in the commit message
-fails with link:error-not-signed-off-by.html[not Signed-off-by
-author/committer/uploader in commit message footer].
+See details at link:config-project-config.html#project-section[project section].
[[branch-admin]]
== Branch Administration
diff --git a/Documentation/prolog-cookbook.txt b/Documentation/prolog-cookbook.txt
index 19ed98a..9a23a27 100644
--- a/Documentation/prolog-cookbook.txt
+++ b/Documentation/prolog-cookbook.txt
@@ -725,6 +725,9 @@
if the `cut` in the first rule is not reached and it only happens if a
predicate before the `cut` fails.
+This fact can be bypassed by users who have
+link:access-control.html#category_forge_author[Forge Author] permission.
+
==== Don't use `gerrit:default_submit`
Let's implement the same submit rule the other way, without reusing the
`gerrit:default_submit`:
@@ -1044,10 +1047,7 @@
gerrit:uploader(U),
R = label('Is-Pure-Revert', ok(U)).
-submit_rule(submit(R)) :-
- gerrit:pure_revert(U),
- U /= 1,
- R = label('Is-Pure-Revert', need(_)).
+submit_rule(submit(label('Is-Pure-Revert', need(_)))).
----
Suppose currently a change is submittable if it gets `+2` for `Code-Review`
@@ -1058,21 +1058,20 @@
[source,prolog]
----
submit_rule(submit(CR, V, R)) :-
- base(CR, V),
- gerrit:pure_revert(1),
- !,
- gerrit:uploader(U),
- R = label('Is-Pure-Revert', ok(U)).
-
-submit_rule(submit(CR, V, R)) :-
- base(CR, V),
- gerrit:pure_revert(U),
- U /= 1,
- R = label('Is-Pure-Revert', need(_)).
+ base(CR, V),
+ set_pure_revert_label(R).
base(CR, V) :-
- gerrit:max_with_block(-2, 2, 'Code-Review', CR),
- gerrit:max_with_block(-1, 1, 'Verified', V).
+ gerrit:max_with_block(-2, 2, 'Code-Review', CR),
+ gerrit:max_with_block(-1, 1, 'Verified', V).
+
+set_pure_revert_label(R) :-
+ gerrit:pure_revert(1),
+ !,
+ gerrit:uploader(U),
+ R = label('Is-Pure-Revert', ok(U)).
+
+set_pure_revert_label(label('Is-Pure-Revert', need(_))).
----
Note that a new label as `Is-Pure-Revert` should not be configured.
diff --git a/Documentation/quota.txt b/Documentation/quota.txt
new file mode 100644
index 0000000..a647e33
--- /dev/null
+++ b/Documentation/quota.txt
@@ -0,0 +1,50 @@
+= Gerrit Code Review - Quota
+
+Gerrit does not provide out of the box quota enforcement. However, it does
+support an extension mechanism for plugins to hook into to provide this
+functionality. The most prominent plugin is the
+link:https://gerrit.googlesource.com/plugins/quota/[Quota Plugin].
+
+This documentation is intended to be read by plugin developers. It contains all
+quota requests implemented in Gerrit-core as well as the metadata that they have
+associated.
+
+== Quota Groups
+
+The following quota groups are defined in core Gerrit:
+
+=== REST API
+[[rest-api]]
+
+The REST API enforces quota after the resource was parsed (if applicable) and before the
+endpoint's logic is executed. This enables quota enforcer implementations to throttle calls
+to specific endpoints while knowing the general context (user and top-level entity such as
+change, project or account).
+
+If the quota enforcer wants to throttle HTTP requests, they should use
+link:quota.html#http-requests[HTTP Requests] instead.
+
+The quota groups used for checking follow the exact definition of the endoint in the REST
+API, but remove all IDs. The schema is:
+
+/restapi/<ENDPOINT>:<HTTP-METHOD>
+
+Examples:
+
+[options="header",cols="1,6"]
+|=======================
+|HTTP call |Quota Group |Metadata
+|GET /a/changes/1/revisions/current/detail |/changes/revisions/detail:GET |CurrentUser, Change.Id, Project.NameKey
+|POST /a/changes/ |/changes/:POST |CurrentUser
+|GET /a/accounts/self/detail |/accounts/detail:GET |CurrentUser, Account.Id
+|=======================
+
+The user provided in the check's metadata is always the calling user (having the
+impersonation bit and real user set in case the user is impersonating another user).
+
+GERRIT
+------
+Part of link:index.html[Gerrit Code Review]
+
+SEARCHBOX
+---------
diff --git a/Documentation/replace_macros.py b/Documentation/replace_macros.py
index 309a135..7d8ea23 100755
--- a/Documentation/replace_macros.py
+++ b/Documentation/replace_macros.py
@@ -87,6 +87,12 @@
id="searchBox">
Search
</button>
+ %s
+</div>
+++++
+"""
+
+BUILTIN_SEARCH = """
<script type="text/javascript">
var f = function() {
window.location = '../#/Documentation/q/' +
@@ -99,11 +105,25 @@
}
}
</script>
-</div>
-++++
-
"""
+GOOGLE_SITE_SEARCH = """
+<script type="text/javascript">
+var f = function() {
+ window.location = 'https://www.google.com/search?q=' +
+ encodeURIComponent(document.getElementById("docSearch").value +
+ ' site:@SITE@');
+}
+document.getElementById("searchBox").onclick = f;
+document.getElementById("docSearch").onkeypress = function(e) {
+ if (13 == (e.keyCode ? e.keyCode : e.which)) {
+ f();
+ }
+}
+</script>
+"""
+
+
LINK_SCRIPT = """
++++
@@ -227,8 +247,19 @@
help="generate the search boxes")
opts.add_option('--no-searchbox', action="store_false", dest='searchbox',
help="don't generate the search boxes")
+opts.add_option('--site-search', action="store", metavar="SITE",
+ help=("generate the search box using google. SITE should " +
+ "point to the domain/path of the site, eg. " +
+ "gerrit-review.googlesource.com/Documentation"))
options, _ = opts.parse_args()
+if options.site_search:
+ SEARCH_BOX = (SEARCH_BOX %
+ GOOGLE_SITE_SEARCH.replace("@SITE@", options.site_search))
+else:
+ SEARCH_BOX = SEARCH_BOX % BUILTIN_SEARCH
+
+
try:
try:
out_file = open(options.out, 'w', errors='ignore')
diff --git a/Documentation/rest-api-accounts.txt b/Documentation/rest-api-accounts.txt
index 8247212..13dfe34 100644
--- a/Documentation/rest-api-accounts.txt
+++ b/Documentation/rest-api-accounts.txt
@@ -2143,12 +2143,37 @@
This can be:
+* `self` or `me` for the calling user
+* a bare account ID ("18419")
+* an account ID following a name in parentheses ("Full Name (18419)")
* a string of the format "Full Name <email@example.com>"
* just the email address ("email@example")
-* a full name if it is unique ("Full Name")
-* an account ID ("18419")
+* a full name ("Full Name")
* a user name ("username")
-* `self` for the calling user
+
+In all cases, accounts that are not
+link:config-gerrit.txt#accounts.visibility[visible] to the calling user are not
+considered.
+
+In all cases _except_ a bare account ID and `self`/`me`, inactive accounts are
+not considered. Inactive accounts should only be referenced by bare ID.
+
+If the input is a bare account ID, this will always resolve to exactly
+one account if there is a visible account with that ID, and zero accounts
+otherwise. (This is true even in corner cases like a user having a full name
+which is exactly a numeric account ID belonging to a different user; such a user
+cannot be identified by this number.)
+
+If the identifier is ambiguous or only refers to inactive accounts, the error
+message from the API should contain a human-readable description of how to
+disambiguate the request.
+
+*Note*: Except as noted above, callers should not rely on the particular
+priorities of any of the identifiers in the account resolution algorithm. Any
+other formats may be subject to future deprecation. If callers require specific
+searching semantics, they should use the link:#query-account[Query Account]
+endpoint to resolve a string to one or more accounts, then access the API using
+the account ID.
[[capability-id]]
=== \{capability-id\}
@@ -2739,9 +2764,6 @@
|`change_table` ||
The columns to display in the change table (PolyGerrit only). The default is
empty, which will default columns as determined by the frontend.
-|`url_aliases` |optional|
-A map of URL path pairs, where the first URL path is an alias for the
-second URL path.
|`email_strategy` ||
The type of email strategy to use. On `ENABLED`, the user will receive emails
from Gerrit. On `CC_ON_OWN_COMMENTS` the user will also receive emails for
@@ -2811,9 +2833,6 @@
|`change_table` ||
The columns to display in the change table (PolyGerrit only). The default is
empty, which will default columns as determined by the frontend.
-|`url_aliases` |optional|
-A map of URL path pairs, where the first URL path is an alias for the
-second URL path.
|`email_strategy` |optional|
The type of email strategy to use. On `ENABLED`, the user will receive emails
from Gerrit. On `CC_ON_OWN_COMMENTS` the user will also receive emails for
diff --git a/Documentation/rest-api-changes.txt b/Documentation/rest-api-changes.txt
index a7367f3..95c38a6 100644
--- a/Documentation/rest-api-changes.txt
+++ b/Documentation/rest-api-changes.txt
@@ -309,6 +309,14 @@
* `SKIP_MERGEABLE`: skip the `mergeable` field in
link:#change-info[ChangeInfo]. For fast moving projects, this field must
be recomputed often, which is slow for projects with big trees.
++
+When link:config-gerrit.html#change.api.excludeMergeableInChangeInfo[
+`change.api.excludeMergeableInChangeInfo`] is set in the `gerrit.config`,
+the `mergeable` field will always be omitted and `SKIP_MERGEABLE` has no
+effect.
++
+A change's mergeability can be requested separately by calling the
+link:#get-mergeable[get-mergeable] endpoint.
--
[[submittable]]
@@ -350,6 +358,11 @@
as link:#tracking-id-info[TrackingIdInfo].
--
+[[no-limit]]
+--
+* `NO-LIMIT`: Return all results
+--
+
.Request
----
GET /changes/?q=97&o=CURRENT_REVISION&o=CURRENT_COMMIT&o=CURRENT_FILES&o=DOWNLOAD_COMMANDS HTTP/1.0
@@ -2200,8 +2213,8 @@
'POST /changes/link:#change-id[\{change-id\}]/private'
--
-Marks the change to be private. Changes may only be marked private by the
-owner or site administrators.
+Marks the change to be private. Only open changes can be marked private.
+Changes may only be marked private by the owner or site administrators.
A message can be specified in the request body inside a
link:#private-input[PrivateInput] entity.
@@ -5165,9 +5178,6 @@
for supporting review of merge commits. The value is the 1-based index of the
parent's position in the commit object.
-[[weblinks-only]]
-If the `weblinks-only` parameter is specified, only the diff web links are returned.
-
.Request
----
GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/revisions/b6b9c10649b9041884046119ab794374470a1b45/files/gerrit-server%2Fsrc%2Fmain%2Fjava%2Fcom%2Fgoogle%2Fgerrit%2Fserver%2Fproject%2FRefControl.java/diff?base=2 HTTP/1.0
@@ -5770,12 +5780,14 @@
Whether the change was reviewed by the calling user.
Only set if link:#reviewed[reviewed] is requested.
|`submit_type` |optional|
-The link:project-configuration.html#submit_type[submit type] of the change. +
+The link:config-project-config.html#submit-type[submit type] of the change. +
Not set for merged changes.
|`mergeable` |optional|
Whether the change is mergeable. +
Not set for merged changes, if the change has not yet been tested, or
-if the link:#skip_mergeable[skip_mergeable] option is set.
+if the link:#skip_mergeable[skip_mergeable] option is set or when
+link:config-gerrit.html#change.api.excludeMergeableInChangeInfo[change.api.excludeMergeableInChangeInfo]
+is set.
|`submittable` |optional|
Whether the change has been approved by the project submit rules. +
Only set if link:#submittable[requested].
@@ -5783,8 +5795,12 @@
Number of inserted lines.
|`deletions` ||
Number of deleted lines.
+|`total_comment_count` |optional|
+Total number of inline comments across all patch sets. Not set if the current
+change index doesn't have the data.
|`unresolved_comment_count` |optional|
-Number of unresolved comments. Not set if the current change index doesn't have the data.
+Number of unresolved inline comment threads across all patch sets. Not set if
+the current change index doesn't have the data.
|`_number` ||The legacy numeric ID of the change.
|`owner` ||
The owner of the change as an link:rest-api-accounts.html#account-info[
@@ -5892,9 +5908,13 @@
created change. If set, it must be a merged commit on the destination branch.
Mutually exclusive with `base_change`.
|`new_branch` |optional, default to `false`|
-Allow creating a new branch when set to `true`.
+Allow creating a new branch when set to `true`. Using this option is
+only possible for non-merge commits (if the `merge` field is not set).
|`merge` |optional|
The detail of a merge commit as a link:#merge-input[MergeInput] entity.
+If set, the target branch (see `branch` field) must exist (it is not
+possible to create it automatically by setting the `new_branch` field
+to `true`.
|`notify` |optional|
Notify handling that defines to whom email notifications should be sent
after the change is created. +
diff --git a/Documentation/rest-api-config.txt b/Documentation/rest-api-config.txt
index 7be8c32..20f649e 100644
--- a/Documentation/rest-api-config.txt
+++ b/Documentation/rest-api-config.txt
@@ -126,10 +126,7 @@
"gerrit": {
"all_projects": "All-Projects",
"all_users": "All-Users"
- "doc_search": true,
- "web_uis": [
- "gwt"
- ]
+ "doc_search": true
},
"sshd": {},
"suggest": {
@@ -1824,12 +1821,6 @@
Whether to enable the web UI for editing GPG keys.
|`report_bug_url` |optional|
link:config-gerrit.html#gerrit.reportBugUrl[URL to report bugs].
-|`report_bug_text` |optional, not set if default|
-link:config-gerrit.html#gerrit.reportBugText[Display text for report
-bugs link].
-|`web_uis` ||
-List of web UIs supported by the HTTP server. Possible values are `GWT`
-and `POLYGERRIT`.
|=================================
[[hit-ration-info]]
@@ -1974,11 +1965,6 @@
Information about the configuration from the
link:config-gerrit.html#suggest[suggest] section as link:#suggest-info[
SuggestInfo] entity.
-|`url_aliases` |optional|
-A map of URL aliases, where a regular expression for an URL token is
-mapped to a target URL token. The target URL token can contain
-placeholders for the groups matched by the regular expression: `$1` for
-the first matched group, `$2` for the second matched group, etc.
|`user` ||
Information about the configuration from the
link:config-gerrit.html#user[user] section as link:#user-config-info[
diff --git a/Documentation/rest-api-projects.txt b/Documentation/rest-api-projects.txt
index 5006b6d..76151b40 100644
--- a/Documentation/rest-api-projects.txt
+++ b/Documentation/rest-api-projects.txt
@@ -1356,25 +1356,6 @@
Ref(ref)::
The branch for which to check access. This must be given if `perm` is specified.
-[[check-access-post]]
-=== Check Access (POST)
-
-This endpoint can also be accessed as a POST request (deprecated). In
-this case, the input for the access checks must be provided in the
-request body inside a link:#access-check-input[AccessCheckInput]
-entity.
-
-.Request
-----
- POST /projects/MyProject/check.access HTTP/1.0
- Content-Type: application/json; charset=UTF-8
-
- {
- "account": "Kristen.Burns@gerritcodereview.com",
- "ref": "refs/heads/secret/bla"
- }
-----
-
[[index]]
=== Index project
@@ -2934,21 +2915,6 @@
|`message` |optional|A clarifying message if `status` is not 200.
|=========================================
-[[access-check-input]]
-=== AccessCheckInput
-The `AccessCheckInput` entity is either an account or
-(account, ref) tuple for which we want to check access.
-
-[options="header",cols="1,^1,5"]
-|=========================================
-|Field Name ||Description
-|`account` ||The account for which to check access
-|`ref` |optional|The refname for which to check
-access
-|`permission` |optional|The ref permission for which to
-check. This defaults to `read`. If given, it `ref` must be given too.
-|=========================================
-
[[auto_closeable_changes_check_input]]
=== AutoCloseableChangesCheckInput
The `AutoCloseableChangesCheckInput` entity contains options for running
@@ -3169,9 +3135,6 @@
Map with the comment link configurations of the project. The name of
the comment link configuration is mapped to a link:#commentlink-info[
CommentlinkInfo] entity.
-|`theme` |optional|
-The theme that is configured for the project as a link:#theme-info[
-ThemeInfo] entity.
|`plugin_config` |optional|
Plugin configuration as map which maps the plugin name to a map of
parameter names to link:#config-parameter-info[ConfigParameterInfo]
@@ -3660,7 +3623,7 @@
[[submit-type-info]]
=== SubmitTypeInfo
-Information about the link:project-configuration.html#submit_type[default submit
+Information about the link:config-project-config.html#submit-type[default submit
type of a project], taking into account project inheritance.
Valid values for each field are `MERGE_IF_NECESSARY`, `FAST_FORWARD_ONLY`,
@@ -3723,21 +3686,6 @@
|=========================
-[[theme-info]]
-=== ThemeInfo
-The `ThemeInfo` entity describes a theme.
-
-[options="header",cols="1,^2,4"]
-|=============================
-|Field Name ||Description
-|`css` |optional|
-The path to the `GerritSite.css` file.
-|`header` |optional|
-The path to the `GerritSiteHeader.html` file.
-|`footer` |optional|
-The path to the `GerritSiteFooter.html` file.
-|=============================
-
GERRIT
------
Part of link:index.html[Gerrit Code Review]
diff --git a/Documentation/rest-api.txt b/Documentation/rest-api.txt
index 8f6a47b..a8ab353 100644
--- a/Documentation/rest-api.txt
+++ b/Documentation/rest-api.txt
@@ -191,6 +191,11 @@
"`422 Unprocessable Entity`" is returned if the ID of a resource that is
specified in the request body cannot be resolved.
+==== 429 Too Many Requests
+"`429 Too Many Requests`" is returned if the request exhausted any set
+quota limits. Depending on the exhausted quota, the request may be retried
+with exponential backoff.
+
[[tracing]]
=== Request Tracing
For each REST endpoint tracing can be enabled by setting the
diff --git a/Documentation/user-search.txt b/Documentation/user-search.txt
index 48d331b..cafd5ca 100644
--- a/Documentation/user-search.txt
+++ b/Documentation/user-search.txt
@@ -277,6 +277,8 @@
ones using a bracket expression). For example, to match all XML
files named like 'name1.xml', 'name2.xml', and 'name3.xml' use
`file:"^name[1-3].xml"`.
++
+Slash ('/') is used path separator.
[[file]]
file:'NAME', f:'NAME'::
@@ -290,6 +292,46 @@
Regular expression matching can be enabled by starting the string
with `^`. In this mode `file:` is an alias of `path:` (see above).
+[[extension]]
+extension:'EXT', ext:'EXT'::
++
+Matches any change touching a file with extension 'EXT', case-insensitive. The
+extension is defined as the portion of the filename following the final `.`.
+Files with no `.` in their name have no extension and can be matched by an
+empty string.
+
+[[onlyextensions]]
+onlyextensions:'EXT_LIST', onlyexts:'EXT_LIST'::
++
+Matches any change touching only files with extensions that are listed in
+'EXT_LIST' (comma-separated list). The matching is done case-insensitive.
+An extension is defined as the portion of the filename following the final `.`.
+Files with no `.` in their name have no extension and can be matched by an
+empty string.
+
+[[directory]]
+directory:'DIR', dir:'DIR'::
++
+Matches any change where the current patch set touches a file in the directory
+'DIR'. The matching is done case-insensitive. 'DIR' can be a full directory
+name, a directory prefix or any combination of intermediate directory segments.
+E.g. a change that touches a file in the directory 'a/b/c' matches for 'a/b/c',
+'a', 'a/b', 'b', 'b/c' and 'c'.
++
+Slash ('/') is used path separator. Leading and trailing slashes are allowed
+but are not mandatory.
++
+If 'DIR' starts with `^` it matches directories and directory segments by
+regular expression. The link:http://www.brics.dk/automaton/[dk.brics.automaton
+library] is used for evaluation of such patterns.
+
+[[footer]]
+footer:'FOOTER'::
++
+Matches any change that has 'FOOTER' as footer in the commit message of the
+current patch set. 'FOOTER' can be specified verbatim ('<key>: <value>', must
+be quoted) or as '<key>=<value>'. The matching is done case-insensitive.
+
[[star]]
star:'LABEL'::
+
diff --git a/Documentation/user-upload.txt b/Documentation/user-upload.txt
index 751e886..56602e2 100644
--- a/Documentation/user-upload.txt
+++ b/Documentation/user-upload.txt
@@ -732,7 +732,7 @@
Gerrit to provide magical refs, such as `+refs/for/*+` for new
change submission and `+refs/changes/*+` for change replacement.
When a push request is received to create a ref in one of these
-namespaces Gerrit performs its own logic to update the database,
+namespaces Gerrit performs its own logic to update the review metadata,
and then lies to the client about the result of the operation.
A successful result causes the client to believe that Gerrit has
created the ref, but in reality Gerrit hasn't created the ref at all.
diff --git a/Jenkinsfile b/Jenkinsfile
index ea52b23..9bb4ce18 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -134,7 +134,7 @@
}
def collectBuildModes() {
- Builds.modes = ["reviewdb", "notedb"]
+ Builds.modes = ["notedb"]
def changedFiles = queryChangedFiles(Globals.gerritUrl, Change.number, Change.sha1)
def polygerritFiles = changedFiles.findAll { it.startsWith("polygerrit-ui") ||
it.startsWith("lib/js") }
@@ -150,7 +150,7 @@
}
}
-def prepareBuildsForMode(buildName, mode="reviewdb", retryTimes = 1) {
+def prepareBuildsForMode(buildName, mode="notedb", retryTimes = 1) {
def propagate = retryTimes == 1 ? false : true
return {
stage("${buildName}/${mode}") {
diff --git a/WORKSPACE b/WORKSPACE
index 8a156a8..7f3a91d 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -71,9 +71,6 @@
rules_closure_toolchains()
-# This has to be done after loading of rules_closure, because it loads rules_java
-load("//lib/codemirror:cm.bzl", "CM_VERSION", "DIFF_MATCH_PATCH_VERSION")
-
# Golang support for PolyGerrit local dev server.
http_archive(
name = "io_bazel_rules_go",
@@ -102,12 +99,6 @@
# Dependencies for PolyGerrit local dev server.
go_repository(
- name = "com_github_robfig_soy",
- commit = "82face14ebc0883b4ca9c901b5aaf3738b9f6a24",
- importpath = "github.com/robfig/soy",
-)
-
-go_repository(
name = "com_github_howeyc_fsnotify",
commit = "441bbc86b167f3c1f4786afae9931403b99fdacf",
importpath = "github.com/howeyc/fsnotify",
@@ -171,24 +162,24 @@
sha1 = "83cd2cd674a217ade95a4bb83a8a14f351f48bd0",
)
-GUICE_VERS = "4.2.1"
+GUICE_VERS = "4.2.2"
maven_jar(
name = "guice-library",
artifact = "com.google.inject:guice:" + GUICE_VERS,
- sha1 = "f77dfd89318fe3ff293bafceaa75fbf66e4e4b10",
+ sha1 = "6dacbe18e5eaa7f6c9c36db33b42e7985e94ce77",
)
maven_jar(
name = "guice-assistedinject",
artifact = "com.google.inject.extensions:guice-assistedinject:" + GUICE_VERS,
- sha1 = "d327e4aee7c96f08cd657c17da231a1f4a8999ac",
+ sha1 = "c33fb10080d58446f752b4fcfff8a5fabb80a449",
)
maven_jar(
name = "guice-servlet",
artifact = "com.google.inject.extensions:guice-servlet:" + GUICE_VERS,
- sha1 = "3927e462f923b0c672fdb045c5645bca4beab5c0",
+ sha1 = "0d0054bdd812224078357a9b11409e43d182a046",
)
maven_jar(
@@ -209,61 +200,6 @@
sha1 = "021a212688ec94fe77aff74ab34cc74f6f940e60",
)
-GWT_VERS = "2.8.2"
-
-maven_jar(
- name = "user",
- artifact = "com.google.gwt:gwt-user:" + GWT_VERS,
- sha1 = "a2b9be2c996a658c4e009ba652a9c6a81c88a797",
-)
-
-maven_jar(
- name = "dev",
- artifact = "com.google.gwt:gwt-dev:" + GWT_VERS,
- sha1 = "7a87e060bbf129386b7ae772459fb9f87297c332",
-)
-
-maven_jar(
- name = "javax-validation",
- artifact = "javax.validation:validation-api:1.0.0.GA",
- sha1 = "b6bd7f9d78f6fdaa3c37dae18a4bd298915f328e",
- src_sha1 = "7a561191db2203550fbfa40d534d4997624cd369",
-)
-
-maven_jar(
- name = "jsinterop-annotations",
- artifact = "com.google.jsinterop:jsinterop-annotations:1.0.2",
- sha1 = "abd7319f53d018e11108a88f599bd16492448dd2",
- src_sha1 = "33716f8aef043f2f02b78ab4a1acda6cd90a7602",
-)
-
-maven_jar(
- name = "ant",
- artifact = "ant:ant:1.6.5",
- attach_source = False,
- sha1 = "7d18faf23df1a5c3a43613952e0e8a182664564b",
-)
-
-maven_jar(
- name = "colt",
- artifact = "colt:colt:1.2.0",
- attach_source = False,
- sha1 = "0abc984f3adc760684d49e0f11ddf167ba516d4f",
-)
-
-maven_jar(
- name = "tapestry",
- artifact = "tapestry:tapestry:4.0.2",
- attach_source = False,
- sha1 = "e855a807425d522e958cbce8697f21e9d679b1f7",
-)
-
-maven_jar(
- name = "w3c-css-sac",
- artifact = "org.w3c.css:sac:1.3",
- sha1 = "cdb2dcb4e22b83d6b32b93095f644c3462739e82",
-)
-
load("//lib/jgit:jgit.bzl", "jgit_repos")
jgit_repos()
@@ -296,25 +232,11 @@
)
maven_jar(
- name = "gwtjsonrpc",
- artifact = "com.google.gerrit:gwtjsonrpc:1.11",
- sha1 = "0990e7eec9eec3a15661edcf9232acbac4aeacec",
- src_sha1 = "a682afc46284fb58197a173cb5818770a1e7834a",
-)
-
-maven_jar(
name = "gson",
artifact = "com.google.code.gson:gson:2.8.5",
sha1 = "f645ed69d595b24d4cf8b3fbb64cc505bede8829",
)
-maven_jar(
- name = "gwtorm-client",
- artifact = "com.google.gerrit:gwtorm:1.18",
- sha1 = "f326dec463439a92ccb32f05b38345e21d0b5ecf",
- src_sha1 = "e0b973d5cafef3d145fa80cdf032fcead1186d29",
-)
-
load("//lib:guava.bzl", "GUAVA_BIN_SHA1", "GUAVA_VERSION")
maven_jar(
@@ -324,6 +246,12 @@
)
maven_jar(
+ name = "guava-failureaccess",
+ artifact = "com.google.guava:failureaccess:1.0.1",
+ sha1 = "1dcf1de382a0bf95a3d8b0849546c88bac1292c9",
+)
+
+maven_jar(
name = "j2objc",
artifact = "com.google.j2objc:j2objc-annotations:1.1",
sha1 = "ed28ded51a8b1c6b112568def5f4b455e6809019",
@@ -412,8 +340,14 @@
maven_jar(
name = "commons-lang3",
- artifact = "org.apache.commons:commons-lang3:3.6",
- sha1 = "9d28a6b23650e8a7e9063c04588ace6cf7012c17",
+ artifact = "org.apache.commons:commons-lang3:3.8.1",
+ sha1 = "6505a72a097d9270f7a9e7bf42c4238283247755",
+)
+
+maven_jar(
+ name = "commons-text",
+ artifact = "org.apache.commons:commons-text:1.2",
+ sha1 = "74acdec7237f576c4803fff0c1008ab8a3808b2b",
)
maven_jar(
@@ -448,6 +382,33 @@
sha1 = "959a0c62f9a5c2309e0ad0b0589c74d69e101241",
)
+COMMONMARK_VERS = "0.10.0"
+
+# commonmark must match the version used in Gitiles
+maven_jar(
+ name = "commonmark",
+ artifact = "com.atlassian.commonmark:commonmark:" + COMMONMARK_VERS,
+ sha1 = "119cb7bedc3570d9ecb64ec69ab7686b5c20559b",
+)
+
+maven_jar(
+ name = "cm-autolink",
+ artifact = "com.atlassian.commonmark:commonmark-ext-autolink:" + COMMONMARK_VERS,
+ sha1 = "a6056a5efbd68f57d420bc51bbc54b28a5d3c56b",
+)
+
+maven_jar(
+ name = "gfm-strikethrough",
+ artifact = "com.atlassian.commonmark:commonmark-ext-gfm-strikethrough:" + COMMONMARK_VERS,
+ sha1 = "40837da951b421b545edddac57012e15fcc9e63c",
+)
+
+maven_jar(
+ name = "gfm-tables",
+ artifact = "com.atlassian.commonmark:commonmark-ext-gfm-tables:" + COMMONMARK_VERS,
+ sha1 = "c075db2a3301100cf70c7dced8ecf86b494458a2",
+)
+
FLEXMARK_VERS = "0.34.18"
maven_jar(
@@ -600,7 +561,7 @@
sha1 = "31e2e1fbe8273d7c913506eafeb06b1a7badb062",
)
-# Transitive dependency of flexmark
+# Transitive dependency of flexmark and gitiles
maven_jar(
name = "autolink",
artifact = "org.nibor.autolink:autolink:0.7.0",
@@ -643,50 +604,50 @@
sha1 = "5e3bda828a80c7a21dfbe2308d1755759c2fd7b4",
)
-OW2_VERS = "6.2.1"
+OW2_VERS = "7.0"
maven_jar(
name = "ow2-asm",
artifact = "org.ow2.asm:asm:" + OW2_VERS,
- sha1 = "c01b6798f81b0fc2c5faa70cbe468c275d4b50c7",
+ sha1 = "d74d4ba0dee443f68fb2dcb7fcdb945a2cd89912",
)
maven_jar(
name = "ow2-asm-analysis",
artifact = "org.ow2.asm:asm-analysis:" + OW2_VERS,
- sha1 = "e8b876c5ccf226cae2f44ed2c436ad3407d0ec1d",
+ sha1 = "4b310d20d6f1c6b7197a75f1b5d69f169bc8ac1f",
)
maven_jar(
name = "ow2-asm-commons",
artifact = "org.ow2.asm:asm-commons:" + OW2_VERS,
- sha1 = "eaf31376d741a3e2017248a4c759209fe25c77d3",
+ sha1 = "478006d07b7c561ae3a92ddc1829bca81ae0cdd1",
)
maven_jar(
name = "ow2-asm-tree",
artifact = "org.ow2.asm:asm-tree:" + OW2_VERS,
- sha1 = "332b022092ecec53cdb6272dc436884b2d940615",
+ sha1 = "29bc62dcb85573af6e62e5b2d735ef65966c4180",
)
maven_jar(
name = "ow2-asm-util",
artifact = "org.ow2.asm:asm-util:" + OW2_VERS,
- sha1 = "400d664d7c92a659d988c00cb65150d1b30cf339",
+ sha1 = "18d4d07010c24405129a6dbb0e92057f8779fb9d",
)
-AUTO_VALUE_VERSION = "1.6.2"
+AUTO_VALUE_VERSION = "1.6.5"
maven_jar(
name = "auto-value",
artifact = "com.google.auto.value:auto-value:" + AUTO_VALUE_VERSION,
- sha1 = "e7eae562942315a983eea3e191b72d755c153620",
+ sha1 = "816872c85048f36a67a276ef7a49cc2e4595711c",
)
maven_jar(
name = "auto-value-annotations",
artifact = "com.google.auto.value:auto-value-annotations:" + AUTO_VALUE_VERSION,
- sha1 = "ed193d86e0af90cc2342aedbe73c5d86b03fa09b",
+ sha1 = "c3dad10377f0e2242c9a4b88e9704eaf79103679",
)
declare_nongoogle_deps()
@@ -730,7 +691,7 @@
sha1 = "0c9cfae15c74f62491d4f28def0dff1dabe52a47",
)
-PROLOG_VERS = "1.4.3"
+PROLOG_VERS = "1.4.4"
PROLOG_REPO = GERRIT
@@ -739,7 +700,7 @@
artifact = "com.googlecode.prolog-cafe:prolog-runtime:" + PROLOG_VERS,
attach_source = False,
repository = PROLOG_REPO,
- sha1 = "d5206556cbc76ffeab21313ffc47b586a1efbcbb",
+ sha1 = "e9a364f4233481cce63239e8e68a6190c8f58acd",
)
maven_jar(
@@ -747,7 +708,7 @@
artifact = "com.googlecode.prolog-cafe:prolog-compiler:" + PROLOG_VERS,
attach_source = False,
repository = PROLOG_REPO,
- sha1 = "f37032cf1dec3e064427745bc59da5a12757a3b2",
+ sha1 = "570295026f6aa7b905e423d107cb2e081eecdc04",
)
maven_jar(
@@ -755,7 +716,7 @@
artifact = "com.googlecode.prolog-cafe:prolog-io:" + PROLOG_VERS,
attach_source = False,
repository = PROLOG_REPO,
- sha1 = "d02b2640b26f64036b6ba2b45e4acc79281cea17",
+ sha1 = "1f25c4e27d22bdbc31481ee0c962a2a2853e4428",
)
maven_jar(
@@ -763,7 +724,7 @@
artifact = "com.googlecode.prolog-cafe:prolog-cafeteria:" + PROLOG_VERS,
attach_source = False,
repository = PROLOG_REPO,
- sha1 = "e3b1860c63e57265e5435f890263ad82dafa724f",
+ sha1 = "0e6c2deeaf5054815a561cbd663566fd59b56c6c",
)
maven_jar(
@@ -778,25 +739,43 @@
sha1 = "f7be08ec23c21485b9b5a1cf1654c2ec8c58168d",
)
+GITILES_VERS = "0.2-10"
+
+GITILES_REPO = GERRIT
+
maven_jar(
name = "blame-cache",
- artifact = "com/google/gitiles:blame-cache:0.2-7",
+ artifact = "com.google.gitiles:blame-cache:" + GITILES_VERS,
attach_source = False,
- repository = GERRIT,
- sha1 = "8170f33b8b1db6f55e41d7069fa050a4d102a62b",
+ repository = GITILES_REPO,
+ sha1 = "7ee42a4f2a2f88d2768a78c5b6e5c7c9fe79b0fa",
+)
+
+maven_jar(
+ name = "gitiles-servlet",
+ artifact = "com.google.gitiles:gitiles-servlet:" + GITILES_VERS,
+ repository = GITILES_REPO,
+ sha1 = "9b78bd8efab7c161019364bff57e9ab9a2e2a475",
+)
+
+# prettify must match the version used in Gitiles
+maven_jar(
+ name = "prettify",
+ artifact = "com.github.twalcari:java-prettify:1.2.2",
+ sha1 = "b8ba1c1eb8b2e45cfd465d01218c6060e887572e",
)
# Keep this version of Soy synchronized with the version used in Gitiles.
maven_jar(
name = "soy",
- artifact = "com.google.template:soy:2018-03-14",
- sha1 = "76a1322705ba5a6d6329ee26e7387417725ce4b3",
+ artifact = "com.google.template:soy:2019-03-11",
+ sha1 = "119ac4b3eb0e2c638526ca99374013965c727097",
)
maven_jar(
name = "html-types",
- artifact = "com.google.common.html.types:types:1.0.4",
- sha1 = "2adf4c8bfccc0ff7346f9186ac5aa57d829ad065",
+ artifact = "com.google.common.html.types:types:1.0.8",
+ sha1 = "9e9cf7bc4b2a60efeb5f5581fe46d17c068e0777",
)
maven_jar(
@@ -919,30 +898,30 @@
sha1 = "42a25dc3219429f0e5d060061f71acb49bf010a0",
)
-TRUTH_VERS = "0.42"
+TRUTH_VERS = "0.44"
maven_jar(
name = "truth",
artifact = "com.google.truth:truth:" + TRUTH_VERS,
- sha1 = "b5768f644b114e6cf5c3962c2ebcb072f788dcbb",
+ sha1 = "11eff954c0c14da7d43276d7b3bcf71463105368",
)
maven_jar(
name = "truth-java8-extension",
artifact = "com.google.truth.extensions:truth-java8-extension:" + TRUTH_VERS,
- sha1 = "4d01dfa5b3780632a3d109e14e101f01d10cce2c",
+ sha1 = "2081a0721d3101e1cf559f013e59c6129b4b10b0",
)
maven_jar(
name = "truth-liteproto-extension",
artifact = "com.google.truth.extensions:truth-liteproto-extension:" + TRUTH_VERS,
- sha1 = "c231e6735aa6c133c7e411ae1c1c90b124900a8b",
+ sha1 = "64f47e4e3f79b0a582573098b9c3c6b73599f7c6",
)
maven_jar(
name = "truth-proto-extension",
artifact = "com.google.truth.extensions:truth-proto-extension:" + TRUTH_VERS,
- sha1 = "c41d22e8b4a61b4171e57c44a2959ebee0091a14",
+ sha1 = "c03fbc16087d8cb3bf0f3265a04566d4beb88a6d",
)
maven_jar(
@@ -964,12 +943,6 @@
sha1 = "92bf48723d277d6efd1150b2f7e9e1e92cb56caf",
)
-maven_jar(
- name = "objenesis",
- artifact = "org.objenesis:objenesis:1.3",
- sha1 = "dc13ae4faca6df981fc7aeb5a522d9db446d5d50",
-)
-
POWERM_VERS = "1.6.1"
maven_jar(
@@ -1014,13 +987,6 @@
sha1 = "3e83394258ae2089be7219b971ec21a8288528ad",
)
-maven_jar(
- name = "derby",
- artifact = "org.apache.derby:derby:10.12.1.1",
- attach_source = False,
- sha1 = "75070c744a8e52a7d17b8b476468580309d5cd09",
-)
-
JETTY_VERS = "9.4.14.v20181114"
maven_jar(
@@ -1036,12 +1002,6 @@
)
maven_jar(
- name = "jetty-servlets",
- artifact = "org.eclipse.jetty:jetty-servlets:" + JETTY_VERS,
- sha1 = "38cfc07b53e5d285bb2fca78bb2531565ed9c9e5",
-)
-
-maven_jar(
name = "jetty-server",
artifact = "org.eclipse.jetty:jetty-server:" + JETTY_VERS,
sha1 = "b36a3d52d78a1df6406f6fa236a6eeff48cbfef6",
@@ -1097,31 +1057,6 @@
)
maven_jar(
- name = "postgresql",
- artifact = "org.postgresql:postgresql:42.2.5",
- sha1 = "951b7eda125f3137538a94e2cbdcf744088ad4c2",
-)
-
-maven_jar(
- name = "codemirror-minified-gwt",
- artifact = "org.webjars.npm:codemirror-minified:" + CM_VERSION,
- sha1 = "36558ea3b8e30782e1e09c0e7bd781e09614f139",
-)
-
-maven_jar(
- name = "codemirror-original-gwt",
- artifact = "org.webjars.npm:codemirror:" + CM_VERSION,
- sha1 = "f1f8fbbc3e2d224fdccc43d2f4180658a92320f9",
-)
-
-maven_jar(
- name = "diff-match-patch",
- artifact = "org.webjars:google-diff-match-patch:" + DIFF_MATCH_PATCH_VERSION,
- attach_source = False,
- sha1 = "0cf1782dbcb8359d95070da9176059a5a9d37709",
-)
-
-maven_jar(
name = "commons-io",
artifact = "commons-io:commons-io:2.2",
sha1 = "83b5b8a7ba1c08f9e8c8ff2373724e33d3c1e22a",
@@ -1191,6 +1126,32 @@
sha1 = "485de3a253e23f645037828c07f1d7f1af40763a",
)
+maven_jar(
+ name = "mockito",
+ artifact = "org.mockito:mockito-core:2.24.0",
+ sha1 = "969a7bcb6f16e076904336ebc7ca171d412cc1f9",
+)
+
+BYTE_BUDDY_VERSION = "1.9.7"
+
+maven_jar(
+ name = "byte-buddy",
+ artifact = "net.bytebuddy:byte-buddy:" + BYTE_BUDDY_VERSION,
+ sha1 = "8fea78fea6449e1738b675cb155ce8422661e237",
+)
+
+maven_jar(
+ name = "byte-buddy-agent",
+ artifact = "net.bytebuddy:byte-buddy-agent:" + BYTE_BUDDY_VERSION,
+ sha1 = "8e7d1b599f4943851ffea125fd9780e572727fc0",
+)
+
+maven_jar(
+ name = "objenesis",
+ artifact = "org.objenesis:objenesis:2.6",
+ sha1 = "639033469776fd37c08358c6b92a4761feb2af4b",
+)
+
load("//tools/bzl:js.bzl", "bower_archive", "npm_binary")
# NPM binaries bundled along with their dependencies.
@@ -1362,8 +1323,8 @@
bower_archive(
name = "codemirror-minified",
package = "Dominator008/codemirror-minified",
- sha1 = "1524e19087d8223edfe4a5b1ccf04c1e3707235d",
- version = "5.37.0",
+ sha1 = "e6bda82afc7cf3493f4282c6f17265d40e1485e5",
+ version = "5.43.0",
)
# bower test stuff
diff --git a/antlr3/BUILD b/antlr3/BUILD
index 4af6006..549946a 100644
--- a/antlr3/BUILD
+++ b/antlr3/BUILD
@@ -21,7 +21,8 @@
name = "query_parser",
srcs = [":query"],
visibility = [
- "//java/com/google/gerrit/index:__pkg__",
+ "//java/com/google/gerrit/index:__subpackages__",
+ "//javatests/com/google/gerrit:__subpackages__",
"//javatests/com/google/gerrit/index:__pkg__",
"//plugins:__pkg__",
],
diff --git a/antlr3/com/google/gerrit/index/query/Query.g b/antlr3/com/google/gerrit/index/query/Query.g
index 953a473..1bf20aa 100644
--- a/antlr3/com/google/gerrit/index/query/Query.g
+++ b/antlr3/com/google/gerrit/index/query/Query.g
@@ -120,12 +120,24 @@
;
conditionBase
: '('! conditionOr ')'!
- | (FIELD_NAME ':') => FIELD_NAME^ ':'! fieldValue
+ | (FIELD_NAME COLON) => FIELD_NAME^ COLON! fieldValue
| fieldValue -> ^(DEFAULT_FIELD fieldValue)
;
fieldValue
- : n=FIELD_NAME -> SINGLE_WORD[n]
+ // Rewrite by invoking SINGLE_WORD fragment lexer rule, passing the field name as an argument.
+ : n=FIELD_NAME -> SINGLE_WORD[n]
+
+ // Allow field values to contain a colon. We can't do this at the lexer level, because we need to
+ // emit a separate token for the field name. If we were to allow ':' in SINGLE_WORD, then
+ // everything would just lex as DEFAULT_FIELD.
+ //
+ // Field values with a colon may be lexed either as <field>:<rest> or <word>:<rest>, depending on
+ // whether the part before the colon looks like a field name.
+ // TODO(dborowitz): Field values ending in colon still don't work.
+ | (FIELD_NAME COLON) => n=FIELD_NAME COLON fieldValue -> SINGLE_WORD[n] COLON fieldValue
+ | (SINGLE_WORD COLON) => SINGLE_WORD COLON fieldValue
+
| SINGLE_WORD
| EXACT_PHRASE
;
@@ -134,6 +146,8 @@
OR: 'OR' ;
NOT: 'NOT' ;
+COLON: ':' ;
+
WS
: ( ' ' | '\r' | '\t' | '\n' ) { $channel=HIDDEN; }
;
@@ -172,7 +186,7 @@
// '-' permit
// '.' permit
// '/' permit
- | ':'
+ | COLON
| ';'
// '<' permit
// '=' permit
diff --git a/contrib/mitm-ui/README.md b/contrib/mitm-ui/README.md
new file mode 100644
index 0000000..1ec8dd4
--- /dev/null
+++ b/contrib/mitm-ui/README.md
@@ -0,0 +1,61 @@
+# Scripts for PolyGerrit local development against prod using MitmProxy.
+
+## Installation (OSX)
+
+1. Install Docker from http://docker.com
+2. Start the proxy and create a new proxied browser instance
+ ```
+ cd ~/gerrit
+ ~/mitm-gerrit/mitm-serve-app-dev.sh
+ ```
+3. Make sure that the browser uses the proxy provided by the command line,
+ e.g. if you are a Googler check that the BeyondCorp extension uses the
+ "System/Alternative" proxy.
+4. Install MITM certificates
+ - Open http://mitm.it in the proxied browser window
+ - Follow the instructions to install MITM certs
+
+## Usage
+
+### Add or replace a single plugin containing static content
+
+To develop unminified plugin that loads multiple files, use this.
+
+1. Create a new proxied browser window and start mitmproxy via Docker:
+ ```
+ ~/mitm-gerrit/mitm-single-plugin.sh ./path/to/static/plugin.html
+ ```
+2. Open any *.googlesource.com domain in proxied window
+3. plugin.html and ./path/to/static/* will be served
+
+### Add or replace a minified plugin for *.googlesource.com
+
+This flow assumes no additional .html/.js are needed, i.e. the plugin is a single file.
+
+1. Create a new proxied browser window and start mitmproxy via Docker:
+ ```
+ ~/mitm-gerrit/mitm-plugins.sh ./path/to/plugin.html,./maybe/one/more.js
+ ```
+2. Open any *.googlesource.com domain in proxied window
+3. plugin.html and more.js are served
+
+### Force or replace default site theme for *.googlesource.com
+
+1. Create a new proxied browser window and start mitmproxy via Docker:
+ ```
+ ~/mitm-gerrit/mitm-theme.sh ./path/to/theme.html
+ ```
+2. Open any *.googlesource.com domain in proxied window
+3. Default site themes are enabled.
+4. Local `theme.html` content replaces `/static/gerrit-theme.html`
+5. `/static/*` URLs are served from local theme directory, i.e. `./path/to/`
+
+### Serve uncompiled PolyGerrit
+
+1. Create a new proxied browser window and start mitmproxy via Docker:
+ ```
+ cd ~/gerrit
+ ~/mitm-gerrit/mitm-serve-app-dev.sh
+ ```
+2. Open any *.googlesource.com domain in proxied window
+3. Instead of prod UI (gr-app.html, gr-app.js), local source files will be served
diff --git a/contrib/mitm-ui/add-header.py b/contrib/mitm-ui/add-header.py
new file mode 100644
index 0000000..f9b2b12
--- /dev/null
+++ b/contrib/mitm-ui/add-header.py
@@ -0,0 +1,5 @@
+# mitmdump -s add-header.py
+def response(flow):
+ if flow.request.host == 'gerrit-review.googlesource.com' and flow.request.path == "/c/92000?1":
+ #flow.response.headers['any'] = '<meta.rdf>; rel=meta'
+ flow.response.headers['Link'] = '</changes/98000/detail?O=11640c>;rel="preload";crossorigin;'
diff --git a/contrib/mitm-ui/dev-chrome.sh b/contrib/mitm-ui/dev-chrome.sh
new file mode 100755
index 0000000..adcb296
--- /dev/null
+++ b/contrib/mitm-ui/dev-chrome.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+if [[ "$OSTYPE" != "darwin"* ]]; then
+ echo Only works on OSX.
+ exit 1
+fi
+
+/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222 --user-data-dir=${HOME}/devchrome --proxy-server="127.0.0.1:8888"
diff --git a/contrib/mitm-ui/force-version.py b/contrib/mitm-ui/force-version.py
new file mode 100644
index 0000000..a69c885
--- /dev/null
+++ b/contrib/mitm-ui/force-version.py
@@ -0,0 +1,22 @@
+# mitmdump -q -p 8888 -s "force-version.py --version $1"
+# Request URL is not changed, only the response context
+from mitmproxy import http
+import argparse
+import re
+
+class Server:
+ def __init__(self, version):
+ self.version = version
+
+ def request(self, flow: http.HTTPFlow) -> None:
+ if "gr-app." in flow.request.pretty_url:
+ flow.request.url = re.sub(
+ r"polygerrit_ui/([\d.]+)/elements",
+ "polygerrit_ui/" + self.version + "/elements",
+ flow.request.url)
+
+def start():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--version", type=str, help="Rapid release version, e.g. 432.0")
+ args = parser.parse_args()
+ return Server(args.version)
diff --git a/contrib/mitm-ui/mitm-docker.sh b/contrib/mitm-ui/mitm-docker.sh
new file mode 100755
index 0000000..a1206f7
--- /dev/null
+++ b/contrib/mitm-ui/mitm-docker.sh
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+extra_volume='/tmp:/tmp'
+
+POSITIONAL=()
+while [[ $# -gt 0 ]]
+do
+key="$1"
+
+case $key in
+ -v|--volume)
+ extra_volume="$2"
+ shift # past argument
+ shift # past value
+ ;;
+ *) # unknown option
+ POSITIONAL+=("$1") # save it in an array for later
+ shift # past argument
+ ;;
+esac
+done
+set -- "${POSITIONAL[@]}" # restore positional parameters
+
+if [[ -z "$1" ]]; then
+ echo This is a runner for higher-level scripts, e.g. mitm-serve-app-dev.sh
+ echo Alternatively, pass mitmproxy script from the same dir as a parameter, e.g. serve-app-dev.py
+ exit 1
+fi
+
+gerrit_dir=$(pwd)
+mitm_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+
+CMD="${mitm_dir}/$1"
+
+docker run --rm -it \
+ -v ~/.mitmproxy:/home/mitmproxy/.mitmproxy \
+ -v ${mitm_dir}:${mitm_dir} \
+ -v ${gerrit_dir}:${gerrit_dir} \
+ -v ${gerrit_dir}/bazel-out:${gerrit_dir}/bazel-out \
+ -v ${extra_volume} \
+ -p 8888:8888 \
+ mitmproxy/mitmproxy:2.0.2 \
+ mitmdump -q -p 8888 -s "${CMD}"
diff --git a/contrib/mitm-ui/mitm-plugins.sh b/contrib/mitm-ui/mitm-plugins.sh
new file mode 100755
index 0000000..fc542bb
--- /dev/null
+++ b/contrib/mitm-ui/mitm-plugins.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+if [[ -z "$1" ]]; then
+ echo This script injects plugins for *.googlesource.com.
+ echo Provide plugin paths, comma-separated, as a parameter.
+ echo This script assumes files do not have dependencies, i.e. minified.
+ exit 1
+fi
+
+realpath() {
+ [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
+}
+
+join () {
+ local IFS="$1"
+ shift
+ echo "$*"
+}
+
+plugins=$1
+plugin_paths=()
+for plugin in $(echo ${plugins} | sed "s/,/ /g")
+do
+ plugin_paths+=($(realpath ${plugin}))
+done
+
+absolute_plugin_paths=$(join , "${plugin_paths[@]}")
+
+mitm_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+
+${mitm_dir}/dev-chrome.sh &
+
+bazel build //polygerrit-ui/app:test_components &
+
+${mitm_dir}/mitm-docker.sh \
+ "serve-app-dev.py \
+ --plugins ${absolute_plugin_paths} \
+ --strip_assets \
+ --components $(pwd)/bazel-bin/polygerrit-ui/app/"
diff --git a/contrib/mitm-ui/mitm-serve-app-dev.sh b/contrib/mitm-ui/mitm-serve-app-dev.sh
new file mode 100755
index 0000000..d4c72cc
--- /dev/null
+++ b/contrib/mitm-ui/mitm-serve-app-dev.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+workspace="./WORKSPACE"
+if [[ ! -f ${workspace} ]] || [[ ! $(head -n 1 ${workspace}) == *"gerrit"* ]]; then
+ echo Please change to cloned Gerrit repo from https://gerrit.googlesource.com/gerrit/
+ exit 1
+fi
+
+mitm_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+
+bazel build //polygerrit-ui/app:test_components &
+
+${mitm_dir}/dev-chrome.sh &
+
+${mitm_dir}/mitm-docker.sh "serve-app-dev.py --app $(pwd)/polygerrit-ui/app/ --components $(pwd)/bazel-bin/polygerrit-ui/app/"
diff --git a/contrib/mitm-ui/mitm-single-plugin.sh b/contrib/mitm-ui/mitm-single-plugin.sh
new file mode 100755
index 0000000..8958229
--- /dev/null
+++ b/contrib/mitm-ui/mitm-single-plugin.sh
@@ -0,0 +1,38 @@
+#!/bin/sh
+
+if [[ -z "$1" ]]; then
+ echo This script serves one plugin with the rest of static content.
+ echo Provide path to index plugin file, e.g. buildbucket.html for buildbucket plugin
+ exit 1
+fi
+
+realpath() {
+ OURPWD=$PWD
+ cd "$(dirname "$1")"
+ LINK=$(basename "$1")
+ while [ -L "$LINK" ]; do
+ LINK=$(readlink "$LINK")
+ cd "$(dirname "$LINK")"
+ LINK="$(basename "$1")"
+ done
+ REAL_DIR=`pwd -P`
+ RESULT=$REAL_DIR/$LINK
+ cd "$OURPWD"
+ echo "$RESULT"
+}
+
+plugin=$(realpath $1)
+plugin_root=$(dirname ${plugin})
+
+mitm_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+
+${mitm_dir}/dev-chrome.sh &
+
+bazel build //polygerrit-ui/app:test_components &
+
+${mitm_dir}/mitm-docker.sh -v ${plugin_root}:${plugin_root} \
+ "serve-app-dev.py \
+ --plugins ${plugin} \
+ --strip_assets \
+ --plugin_root ${plugin_root} \
+ --components $(pwd)/bazel-bin/polygerrit-ui/app/"
diff --git a/contrib/mitm-ui/mitm-theme.sh b/contrib/mitm-ui/mitm-theme.sh
new file mode 100755
index 0000000..9290235
--- /dev/null
+++ b/contrib/mitm-ui/mitm-theme.sh
@@ -0,0 +1,31 @@
+#!/bin/sh
+
+if [[ -z "$1" ]]; then
+ echo This script forces or replaces default site theme on *.googlesource.com
+ echo Provide path to the theme.html as a parameter.
+ exit 1
+fi
+
+realpath() {
+ OURPWD=$PWD
+ cd "$(dirname "$1")"
+ LINK=$(basename "$1")
+ while [ -L "$LINK" ]; do
+ LINK=$(readlink "$LINK")
+ cd "$(dirname "$LINK")"
+ LINK="$(basename "$1")"
+ done
+ REAL_DIR=`pwd -P`
+ RESULT=$REAL_DIR/$LINK
+ cd "$OURPWD"
+ echo "$RESULT"
+}
+
+theme=$(realpath "$1")
+theme_dir=$(dirname "${theme}")
+
+mitm_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
+
+"${mitm_dir}"/dev-chrome.sh &
+
+"${mitm_dir}"/mitm-docker.sh -v "${theme_dir}":"${theme_dir}" "serve-app-dev.py --strip_assets --theme \"${theme}\""
diff --git a/contrib/mitm-ui/serve-app-dev.py b/contrib/mitm-ui/serve-app-dev.py
new file mode 100644
index 0000000..cdf7bfc
--- /dev/null
+++ b/contrib/mitm-ui/serve-app-dev.py
@@ -0,0 +1,169 @@
+# 1. install and setup mitmproxy v2.0.2: https://mitmproxy.readthedocs.io/en/v2.0.2/install.html
+# (In case of python versions trouble, use https://www.anaconda.com/)
+# 2. mitmdump -q -s -p 8888 \
+# "serve-app-dev.py --app /path/to/polygerrit-ui/app/"
+# 3. start Chrome with --proxy-server="127.0.0.1:8888" --user-data-dir=/tmp/devchrome
+# 4. open, say, gerrit-review.googlesource.com. Or chromium-review.googlesource.com. Any.
+# 5. uncompiled source files are served and you can log in, too.
+# 6. enjoy!
+#
+# P.S. For replacing plugins, use --plugins or --plugin_root
+#
+# --plugin takes comma-separated list of plugins to add or replace.
+#
+# Example: Adding a new plugin to the server response:
+# --plugins ~/gerrit-testsite/plugins/myplugin.html
+#
+# Example: Replace all matching plugins with local versions:
+# --plugins ~/gerrit-testsite/plugins/
+# Following files will be served if they exist for /plugins/tricium/static/tricium.html:
+# ~/gerrit-testsite/plugins/tricium.html
+# ~/gerrit-testsite/plugins/tricium/static/tricium.html
+#
+# --assets takes assets bundle.html, expecting rest of the assets files to be in the same folder
+#
+# Example:
+# --assets ~/gerrit-testsite/assets/a3be19f.html
+#
+
+from mitmproxy import http
+from mitmproxy.script import concurrent
+import argparse
+import json
+import mimetypes
+import os.path
+import re
+import zipfile
+
+class Server:
+ def __init__(self, devpath, components, plugins, pluginroot, assets, strip_assets, theme):
+ if devpath:
+ print("Serving app from " + devpath)
+ if components:
+ print("Serving components from " + components)
+ if pluginroot:
+ print("Serving plugins from " + pluginroot)
+ if assets:
+ self.assets_root, self.assets_file = os.path.split(assets)
+ print("Assets: using " + self.assets_file + " from " + self.assets_root)
+ else:
+ self.assets_root = None
+ if plugins:
+ self.plugins = {path.split("/")[-1:][0]: path for path in map(expandpath, plugins.split(","))}
+ for filename, path in self.plugins.items():
+ print("Serving " + filename + " from " + path)
+ else:
+ self.plugins = {}
+ self.devpath = devpath
+ self.components = components
+ self.pluginroot = pluginroot
+ self.strip_assets = strip_assets
+ self.theme = theme
+
+ def readfile(self, path):
+ with open(path, 'rb') as contentfile:
+ return contentfile.read()
+
+@concurrent
+def response(flow: http.HTTPFlow) -> None:
+ if server.strip_assets:
+ assets_bundle = 'googlesource.com/polygerrit_assets'
+ assets_pos = flow.response.text.find(assets_bundle)
+ if assets_pos != -1:
+ t = flow.response.text
+ flow.response.text = t[:t.rfind('<', 0, assets_pos)] + t[t.find('>', assets_pos) + 1:]
+ return
+
+ if server.assets_root:
+ marker = 'webcomponents-lite.js"></script>'
+ pos = flow.response.text.find(marker)
+ if pos != -1:
+ pos += len(marker)
+ flow.response.text = ''.join([
+ flow.response.text[:pos],
+ '<link rel="import" href="/gerrit_assets/123.0/' + server.assets_file + '">',
+ flow.response.text[pos:]
+ ])
+
+ assets_prefix = "/gerrit_assets/123.0/"
+ if flow.request.path.startswith(assets_prefix):
+ assets_file = flow.request.path[len(assets_prefix):]
+ flow.response.content = server.readfile(server.assets_root + '/' + assets_file)
+ flow.response.status_code = 200
+ if assets_file.endswith('.js'):
+ flow.response.headers['Content-type'] = 'text/javascript'
+ return
+ m = re.match(".+polygerrit_ui/\d+\.\d+/(.+)", flow.request.path)
+ pluginmatch = re.match("^/plugins/(.+)", flow.request.path)
+ localfile = ""
+ content = ""
+ if flow.request.path == "/config/server/info":
+ config = json.loads(flow.response.content[5:].decode('utf8'))
+ if server.theme:
+ config['default_theme'] = '/static/gerrit-theme.html'
+ for filename, path in server.plugins.items():
+ pluginname = filename.split(".")[0]
+ payload = config["plugin"]["js_resource_paths" if filename.endswith(".js") else "html_resource_paths"]
+ if list(filter(lambda url: filename in url, payload)):
+ continue
+ payload.append("plugins/" + pluginname + "/static/" + filename)
+ flow.response.content = str.encode(")]}'\n" + json.dumps(config))
+ if m is not None:
+ filepath = m.groups()[0]
+ if (filepath.startswith("bower_components/")):
+ with zipfile.ZipFile(server.components + "test_components.zip") as bower_zip:
+ content = bower_zip.read(filepath)
+ localfile = server.devpath + filepath
+ elif pluginmatch is not None:
+ pluginfile = flow.request.path_components[-1]
+ if server.plugins and pluginfile in server.plugins:
+ if os.path.isfile(server.plugins[pluginfile]):
+ localfile = server.plugins[pluginfile]
+ else:
+ print("Can't find file " + server.plugins[pluginfile] + " for " + flow.request.path)
+ elif server.pluginroot:
+ pluginurl = pluginmatch.groups()[0]
+ if os.path.isfile(server.pluginroot + pluginfile):
+ localfile = server.pluginroot + pluginfile
+ elif os.path.isfile(server.pluginroot + pluginurl):
+ localfile = server.pluginroot + pluginurl
+
+ if server.theme:
+ if flow.request.path.endswith('/gerrit-theme.html'):
+ localfile = server.theme
+ else:
+ match = re.match("^/static(/[\w\.]+)$", flow.request.path)
+ if match is not None:
+ localfile = os.path.dirname(server.theme) + match.group(1)
+
+ if localfile and os.path.isfile(localfile):
+ if pluginmatch is not None:
+ print("Serving " + flow.request.path + " from " + localfile)
+ content = server.readfile(localfile)
+
+ if content:
+ flow.response.content = content
+ flow.response.status_code = 200
+ localtype = mimetypes.guess_type(localfile)
+ if localtype and localtype[0]:
+ flow.response.headers['Content-type'] = localtype[0]
+
+def expandpath(path):
+ return os.path.realpath(os.path.expanduser(path))
+
+parser = argparse.ArgumentParser()
+parser.add_argument("--app", type=str, default="", help="Path to /polygerrit-ui/app/")
+parser.add_argument("--components", type=str, default="", help="Path to test_components.zip")
+parser.add_argument("--plugins", type=str, default="", help="Comma-separated list of plugin files to add/replace")
+parser.add_argument("--plugin_root", type=str, default="", help="Path containing individual plugin files to replace")
+parser.add_argument("--assets", type=str, default="", help="Path containing assets file to import.")
+parser.add_argument("--strip_assets", action="store_true", help="Strip plugin bundles from the response.")
+parser.add_argument("--theme", default="", type=str, help="Path to the default site theme to be used.")
+args = parser.parse_args()
+server = Server(expandpath(args.app) + '/',
+ expandpath(args.components) + '/',
+ args.plugins,
+ expandpath(args.plugin_root) + '/',
+ args.assets and expandpath(args.assets),
+ args.strip_assets,
+ expandpath(args.theme))
diff --git a/contrib/mitm-ui/serve-app-locally.py b/contrib/mitm-ui/serve-app-locally.py
new file mode 100644
index 0000000..636c684
--- /dev/null
+++ b/contrib/mitm-ui/serve-app-locally.py
@@ -0,0 +1,46 @@
+# bazel build polygerrit-ui/app:gr-app
+# mitmdump -s "serve-app-locally.py ~/gerrit/bazel-bin/polygerrit-ui/app"
+from mitmproxy import http
+import argparse
+import os
+import zipfile
+
+class Server:
+ def __init__(self, bundle):
+ self.bundle = bundle
+ self.bundlemtime = 0
+ self.files = {
+ 'polygerrit_ui/elements/gr-app.js': '',
+ 'polygerrit_ui/elements/gr-app.html': '',
+ 'polygerrit_ui/styles/main.css': '',
+ }
+ self.read_files()
+
+ def read_files(self):
+ if not os.path.isfile(self.bundle):
+ print("bundle not found!")
+ return
+ mtime = os.stat(self.bundle).st_mtime
+ if mtime <= self.bundlemtime:
+ return
+ self.bundlemtime = mtime
+ with zipfile.ZipFile(self.bundle) as z:
+ for fname in self.files:
+ print('Reading new content for ' + fname)
+ with z.open(fname, 'r') as content_file:
+ self.files[fname] = content_file.read()
+
+ def response(self, flow: http.HTTPFlow) -> None:
+ self.read_files()
+ for name in self.files:
+ if name.rsplit('/', 1)[1] in flow.request.pretty_url:
+ flow.response.content = self.files[name]
+
+def expandpath(path):
+ return os.path.expanduser(path)
+
+def start():
+ parser = argparse.ArgumentParser()
+ parser.add_argument("bundle", type=str)
+ args = parser.parse_args()
+ return Server(expandpath(args.bundle))
diff --git a/contrib/themes/diffy/etc/GerritSite.css b/contrib/themes/diffy/etc/GerritSite.css
deleted file mode 100644
index 76c595a..0000000
--- a/contrib/themes/diffy/etc/GerritSite.css
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Copyright (C) 2013 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.
- */
-#gerrit_topmenu {
- left: 60px;
- margin-right: 60px;
- position: relative;
- margin-bottom: 5px;
-}
-
-#diffy_logo {
- display: block !important;
- margin-bottom: -55px;
- padding-left: 10px;
- position: relative;
- top: -55px;
- width: 60px;
-}
diff --git a/contrib/themes/diffy/etc/GerritSiteHeader.html b/contrib/themes/diffy/etc/GerritSiteHeader.html
deleted file mode 100644
index 89b4db5..0000000
--- a/contrib/themes/diffy/etc/GerritSiteHeader.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<div>
- <div id="diffy_logo">
- <img width="50" height="46" src="static/logo.png"/>
- </div>
-</div>
diff --git a/contrib/themes/diffy/static/diffy.svg b/contrib/themes/diffy/static/diffy.svg
deleted file mode 100644
index 3e6e6c2..0000000
--- a/contrib/themes/diffy/static/diffy.svg
+++ /dev/null
@@ -1,326 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="600.06732"
- height="558.20709"
- id="svg2"
- version="1.1"
- inkscape:version="0.48.3.1 r9886"
- sodipodi:docname="diffy.svg"
- inkscape:export-filename="/home/sarah/art/diffy.png"
- inkscape:export-xdpi="500"
- inkscape:export-ydpi="500">
- <defs
- id="defs4" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="0.66618777"
- inkscape:cx="300.03365"
- inkscape:cy="258.35521"
- inkscape:document-units="px"
- inkscape:current-layer="layer1"
- showgrid="false"
- inkscape:window-width="1366"
- inkscape:window-height="744"
- inkscape:window-x="0"
- inkscape:window-y="24"
- inkscape:window-maximized="1"
- fit-margin-top="0"
- fit-margin-left="0"
- fit-margin-right="0"
- fit-margin-bottom="0" />
- <metadata
- id="metadata7">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title />
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:label="Layer 1"
- inkscape:groupmode="layer"
- id="layer1"
- transform="translate(-3069.8852,2251.5084)">
- <text
- xml:space="preserve"
- style="font-size:51.65934372px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans Bold"
- x="475.83173"
- y="900.47076"
- id="text4257"
- sodipodi:linespacing="125%"
- transform="scale(1.1411753,0.87628955)"><tspan
- sodipodi:role="line"
- x="475.83173"
- y="900.47076"
- style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:end;text-anchor:end;font-family:Acme;-inkscape-font-specification:Acme Bold"
- id="tspan3008" /></text>
- <flowRoot
- xml:space="preserve"
- id="flowRoot4263"
- style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"><flowRegion
- id="flowRegion4265"><rect
- id="rect4267"
- width="313.14728"
- height="343.45187"
- x="-335.37064"
- y="205.85435" /></flowRegion><flowPara
- id="flowPara4269" /></flowRoot> <g
- id="g10119"
- transform="matrix(0.99201906,-0.12608805,0.12608805,0.99201906,273.85438,408.58042)">
- <path
- sodipodi:nodetypes="csccscac"
- inkscape:connector-curvature="0"
- id="path4130"
- d="m 3378.9965,-2206.2972 c 0,0 13.4039,-8.8398 27.0022,-17.1718 13.5984,-8.3319 22.2322,-21.276 22.2322,-21.276 l 34.2799,28.1467 c 0,0 -16.0641,15.553 -24.7742,21.6893 -3.709,2.6129 -10.9463,9.1577 -10.9463,9.1577 0,0 -14.3617,-10.0769 -22.3623,-13.5225 -8.0773,-3.4786 -25.4315,-7.0234 -25.4315,-7.0234 z"
- style="fill:#ffffff;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- <path
- sodipodi:nodetypes="cac"
- inkscape:connector-curvature="0"
- d="m 3414.7387,-2204.9828 c 0,0 8.2233,-5.8571 11.9326,-9.2622 3.8224,-3.5089 10.5596,-11.437 10.5596,-11.437"
- style="fill:#ffffff;stroke:#ff0000;stroke-width:8.97858429;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- id="path4185" />
- <path
- sodipodi:nodetypes="cascacsc"
- inkscape:connector-curvature="0"
- id="path3307"
- d="m 3247.6516,-2171.4037 c 0,0 4.3348,-19.2835 10.7071,-26.2701 7.4284,-8.1446 19.072,-14.1542 29.3495,-15.24 27.8177,-2.9386 63.2371,6.1908 63.2371,6.1908 0,0 -30.8042,0.7262 -45.6022,4.5134 -5.1922,1.3289 -14.7941,6.2977 -14.7941,6.2977 0,0 -16.1166,0.8374 -29.8971,12.0927 -13.7804,11.2552 -3.0344,9.7831 -3.0344,9.7831"
- style="fill:#ffffff;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- <path
- sodipodi:nodetypes="ccsccscscccccscc"
- inkscape:connector-curvature="0"
- id="path3011"
- d="m 3332.9985,-2012.4352 -20.0742,24.9886 c 0,0 -16.3479,-5.082 -40.3255,4.9725 -23.9776,10.0546 -39.2193,26.4042 -39.2193,26.4042 l 7.8897,-0.7975 c 0,0 20.4818,-14.4371 31.9614,-17.1294 11.4796,-2.6923 23.6197,-2.8388 23.6197,-2.8388 0,0 -25.492,10.0264 -30.7497,12.3759 -6.2584,2.7968 -15.0874,9.199 -15.0874,9.199 l 10.4761,-0.2965 c 17.6867,-7.2528 41.3221,-16.0187 59.9685,-15.047 15.5919,1.1274 33.9405,16.7543 33.9405,16.7543 l -3.8165,-9.9895 c 0,0 -10.8307,-8.1932 -16.3866,-13.7491 -5.5558,-5.5558 17.5848,-25.8193 17.5848,-25.8193 -14.3098,-2.8351 -2.1172,-7.9424 -19.7815,-9.0274 z"
- style="fill:#ffff00;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- <path
- style="fill:#ffff00;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- d="m 3397.9929,-1984.0461 -15.5774,33.0846 c 0,0 -14.4499,-2.2165 -39.5097,4.7139 -25.0597,6.9303 -44.9575,20.0476 -44.9575,20.0476 l 10.5706,1.822 c 0,0 19.7276,-11.1182 30.516,-14.1955 7.747,-2.2097 23.9934,-2.9008 23.9934,-2.9008 0,0 -20.2687,6.6869 -30.057,10.9033 -5.4067,2.329 -15.7817,7.9273 -15.7817,7.9273 l 10.8391,1.5269 c 0,0 31.056,-11.8625 47.4047,-13.3504 11.1103,-1.0112 11.8331,-2.962 33.324,3.1079 10.0509,2.8388 16.3928,6.252 16.3928,6.252 l -3.3122,-5.8696 c 0,0 -5.3909,-4.5711 -8.2712,-6.6111 -3.5982,-2.5484 -11.2202,-7.0059 -11.2202,-7.0059 l 15.4484,-30.858 c -13.3255,-5.9362 -2.8177,-3.6211 -19.8021,-8.5942 z"
- id="path3013"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="ccsccacaccasccaccc" />
- <path
- sodipodi:nodetypes="aaczsccsssca"
- inkscape:connector-curvature="0"
- id="path3014"
- d="m 3138.8926,-2124.2277 c 9.8375,-20.5358 27.6337,-38.9533 48.4705,-48.136 22.7321,-10.018 51.1582,-10.0879 74.4382,-3.5941 7.6944,6.5 10.3115,-17.1804 46.9059,-27.4208 36.5944,-10.2403 91.6429,-6.509 142.1505,22.7854 54.0494,31.3487 -23.7386,41.9213 -8.0812,94.4492 32.3844,113.578 -63.1345,101.5204 -63.1345,101.5204 0,0 -25.2539,-16.1625 -35.3554,-17.1726 -10.1015,-1.0102 -46.6429,-25.1251 -68.8662,-28.6607 -22.2234,-3.5355 -36.9003,18.6222 -107.991,-9.9282 -24.3178,-9.7661 -33.8401,-33.335 -33.8401,-33.335 0,0 -2.0102,-35.2405 5.3033,-50.5076 z"
- style="fill:#0000ff;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- <path
- sodipodi:nodetypes="cssscscsac"
- inkscape:connector-curvature="0"
- id="path3028"
- d="m 3179.7636,-2035.4822 c 0,0 33.988,-7.9036 57.2215,-14.9746 23.2335,-7.0711 36.1637,-43.7474 71.519,-48.7981 35.3554,-5.0508 68.528,22.1624 80.6498,47.4162 12.1218,25.2539 50.6701,55.6193 50.6701,55.6193 0,0 1.0101,11.1117 -14.1422,18.1828 -15.1522,7.0711 -10.4989,7.6628 -10.4989,7.6628 0,0 -43.1103,-11.4139 -62.396,-21.4139 -19.2857,-10 -61.236,-23.044 -92.9377,-30.7963 -26.2653,-6.4228 -35.0334,2.5255 -80.0856,-12.8982 z"
- style="fill:#ff6600;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- <path
- sodipodi:nodetypes="cscccccscc"
- inkscape:connector-curvature="0"
- id="path3009"
- d="m 3470.1209,-2002.8128 c 0,0 13.8937,99.0002 33.6829,157.8517 19.7893,58.8514 78.4464,180.4742 78.4464,180.4742 l 28.1031,-31.8521 -52.5625,-109.7203 60.5152,95.9016 26.0124,-35.7271 c 0,0 -70.663,-88.4878 -93.8954,-140.4597 -23.2324,-51.9718 -37.4945,-152.9082 -37.4945,-152.9082 z"
- style="fill:#0000ff;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- <path
- sodipodi:nodetypes="csscsccccccccccsc"
- inkscape:connector-curvature="0"
- id="path3016"
- d="m 3359.2154,-2191.502 c 0,0 -40.7142,5 -57.1428,42.1428 -16.4286,37.1429 50.7143,115.7143 60.7143,132.1429 10,16.4286 24.2857,38.5714 24.2857,38.5714 0,0 47.6766,32.0335 82.9062,53.8444 32.6567,20.2179 65.2266,33.1109 65.2266,33.1109 0,0 1.1687,-0.4937 7.0265,-19.1963 -12.1218,-21.7183 -38.3216,-53.2543 -54.5036,-69.192 24.2792,14.1167 43.346,28.1254 60.1041,56.5482 0,0 4.9588,-21.3916 6.5659,-30.7894 -3.0357,-9.5763 -47.4771,-56.5685 -47.4771,-56.5685 20.5517,8.7613 33.7508,23.0255 50.0892,44.7732 0,0 3.3263,-21.5598 3.8366,-32.9472 -2.5253,-6.566 -33.7228,-35.0595 -33.7228,-35.0595 13.1654,6.6374 19.714,11.0661 34.4127,24.0476 0,0 -3.0357,-60.7142 -66.6072,-130.7142 -63.5714,-70 -135.7143,-50.7143 -135.7143,-50.7143 z"
- style="fill:#000080;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- <g
- transform="translate(2935.644,-2513.1499)"
- id="g3138">
- <path
- style="fill:#ff0000;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- d="m 337.66259,394.0585 c 0,0 -28.86328,-30.61257 -60.78781,-25.80202 -31.92454,4.81054 -41.10831,33.67382 -39.79634,39.79633 1.31197,6.12252 13.557,11.80771 22.30345,15.74361 8.74644,3.9359 32.79917,-0.43732 45.48152,-6.55984 12.68235,-6.12251 32.79918,-23.17808 32.79918,-23.17808 z"
- id="path3022"
- inkscape:connector-curvature="0" />
- <path
- style="fill:#ffff00;fill-opacity:1;stroke:#000000;stroke-width:3;stroke-miterlimit:4"
- d="m 286.65383,372.49887 c 12.50235,2.18615 20.86528,14.09354 18.67912,26.59589 -2.18615,12.50234 -14.09354,20.86527 -26.59589,18.67911 -12.50235,-2.18616 -20.86528,-14.09354 -18.67912,-26.59588 z"
- id="path3024"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="csscc" />
- <path
- sodipodi:type="arc"
- style="fill:#000000;fill-opacity:1;stroke:none"
- id="path3026"
- sodipodi:cx="229.64285"
- sodipodi:cy="403.79074"
- sodipodi:rx="8.2142859"
- sodipodi:ry="8.2142859"
- d="m 237.85714,403.79074 c 0,4.53663 -3.67766,8.21429 -8.21429,8.21429 -4.53662,0 -8.21428,-3.67766 -8.21428,-8.21429 0,-4.53662 3.67766,-8.21428 8.21428,-8.21428 4.53663,0 8.21429,3.67766 8.21429,8.21428 z"
- transform="matrix(1.5694327,0,0,1.5694327,-85.566867,-233.30737)" />
- </g>
- <path
- sodipodi:nodetypes="cssssssc"
- style="fill:#ffff00;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- d="m 3110.2692,-2103.8575 c -32.3249,20.7081 -31.4522,56.0845 -27.4116,60.6301 4.0406,4.5457 8.0812,1.0102 15.6574,-1.5152 7.5761,-2.5254 26.2639,-10.1015 42.4264,-11.1117 16.1624,-1.0101 21.2132,3.0305 23.7386,-0.505 2.5254,-3.5356 4.0406,-15.1523 3.0304,-25.7589 -1.0101,-10.6066 -1.0101,-23.2335 -7.071,-25.2538 -6.061,-2.0203 -38.2484,-5.0718 -50.3702,3.5145 z"
- id="path3296"
- inkscape:connector-curvature="0" />
- <path
- inkscape:connector-curvature="0"
- id="path3305"
- d="m 3251.1404,-2178.2729 c 0,0 12.1428,21.0714 67.1428,32.5 55,11.4286 125.7143,-38.2143 125.7143,-38.2143 l 38.7857,38.6429 c 0,0 -113.0714,25.6428 -150.2143,21 -37.1428,-4.6429 -81.4285,-50.3572 -81.4285,-50.3572"
- style="fill:#ffffff;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- <path
- sodipodi:nodetypes="ccccc"
- inkscape:connector-curvature="0"
- id="path4099"
- d="m 3453.1169,-2166.1191 -30.2186,14.3667 6.8378,5.5184 29.9689,-14.0733 z"
- style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#008000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans" />
- <path
- sodipodi:nodetypes="cacscacsc"
- inkscape:connector-curvature="0"
- id="path3303"
- d="m 3154.8351,-2149.0637 c 0,0 -6.1891,7.2925 -8.7928,11.2888 -2.8625,4.3936 -7.4472,13.8569 -7.4472,13.8569 0,0 49.8667,-24.0831 67.6065,-30.2972 18.2787,-6.4028 54.803,-21.7873 54.803,-21.7873 0,0 -3.8451,-1.8876 -5.9103,-2.3872 -3.1018,-0.7503 -9.5343,-0.868 -9.5343,-0.868 0,0 -25.7837,-0.1235 -42.8032,6.1343 -17.0196,6.2579 -47.9217,24.0597 -47.9217,24.0597 z"
- style="fill:#ffffff;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- <path
- style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#008000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
- d="m 3433.0379,-2169.2212 24.4739,22.8165 -8.1844,3.1976 -24.3243,-22.4616 z"
- id="path27241"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="ccccc" />
- </g>
- <g
- id="g10229"
- transform="translate(31.403024,6.4439689)">
- <g
- id="text4253"
- style="font-size:140.50161743px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans Bold"
- transform="scale(1.066563,0.93759113)">
- <path
- id="path10219"
- style="font-family:Acme;-inkscape-font-specification:Acme Bold"
- d="m 2917.8887,-1930.8568 c -6.6505,0 -16.2514,-0.5152 -28.8029,-1.5455 l 1.6861,-34.1419 -1.6861,-62.8043 37.514,0 c 12.645,10e-5 22.527,3.7937 29.6458,11.3807 7.1187,7.5871 10.678,18.1247 10.6781,31.6128 -10e-5,17.0476 -4.4024,30.5826 -13.2071,40.605 -8.8049,9.9288 -20.7475,14.8932 -35.8279,14.8932 m 3.653,-83.3175 c -6.1821,10e-5 -10.5376,0.047 -13.0666,0.1405 l -1.4051,45.101 0.9836,22.7613 c 7.868,0.562 13.1602,0.843 15.8766,0.843 7.3997,0 13.2071,-2.9973 17.4222,-8.9921 4.3087,-5.9947 6.463,-14.7058 6.4631,-26.1333 -1e-4,-11.4274 -2.1076,-19.9043 -6.3226,-25.4308 -4.1214,-5.5263 -10.7718,-8.2895 -19.9512,-8.2896"
- inkscape:connector-curvature="0" />
- <path
- id="path10221"
- style="font-family:Acme;-inkscape-font-specification:Acme Bold"
- d="m 3002.3389,-2030.051 -1.967,61.1182 1.686,36.5305 -19.6702,0 1.686,-34.1419 -1.686,-59.9942 19.9512,-3.5126"
- inkscape:connector-curvature="0" />
- <path
- id="path10223"
- style="font-family:Acme;-inkscape-font-specification:Acme Bold"
- d="m 3074.2384,-2014.3148 -29.9268,0 -0.843,25.8523 26.8358,0 -1.5455,14.8932 -25.7118,0 -0.1405,4.6365 1.686,36.5305 -19.6703,0 1.6861,-34.1419 -1.6861,-62.8043 50.8616,0 -1.5455,15.0337"
- inkscape:connector-curvature="0" />
- <path
- id="path10225"
- style="font-family:Acme;-inkscape-font-specification:Acme Bold"
- d="m 3136.2567,-2014.3148 -29.9268,0 -0.843,25.8523 26.8358,0 -1.5456,14.8932 -25.7117,0 -0.1405,4.6365 1.686,36.5305 -19.6703,0 1.6861,-34.1419 -1.6861,-62.8043 50.8616,0 -1.5455,15.0337"
- inkscape:connector-curvature="0" />
- <path
- id="path10227"
- style="font-family:Acme;-inkscape-font-specification:Acme Bold"
- d="m 3177.4808,-1987.9005 1.686,0 10.3971,-19.1082 10.5376,-23.1828 17.1412,2.5291 -12.9261,23.4637 -18.2652,35.6874 1.5455,36.109 -19.6702,0 1.405,-33.7204 -17.7032,-35.9684 -13.4882,-24.5878 19.8107,-3.5126 9.1326,21.3563 10.3972,20.9347"
- inkscape:connector-curvature="0" />
- </g>
- <g
- id="text3010"
- style="font-size:62.54807663px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Acme;-inkscape-font-specification:Acme"
- transform="scale(1.1647576,0.85854772)">
- <path
- id="path10175"
- d="m 2645.5222,-2090.4097 0.688,-7.1931 29.7104,0 -0.688,7.1931 -10.8834,-0.9382 -0.2502,20.6408 0.7506,16.2625 -8.7568,0 0.7506,-15.1992 -0.2502,-21.6416 -11.071,0.8757"
- inkscape:connector-curvature="0" />
- <path
- id="path10177"
- d="m 2697.8329,-2070.2692 c 0,-2.8772 -0.2502,-4.7954 -0.7505,-5.7545 -0.5005,-0.959 -1.668,-1.4385 -3.5027,-1.4386 -1.8348,1e-4 -3.9197,0.7298 -6.2548,2.1892 l 0,4.566 0.688,14.6988 -8.444,1.5637 0.7506,-15.1992 -0.7506,-31.6493 8.5691,-1.5637 -0.8131,16.2 0,7.3181 c 0.6254,-0.834 1.3343,-1.6471 2.1266,-2.4394 0.7923,-0.7922 2.0224,-1.6888 3.6903,-2.6896 1.668,-1.0007 3.4401,-1.5011 5.3166,-1.5011 1.9181,0 3.5235,0.7506 4.8162,2.2517 1.2926,1.4595 1.939,3.461 1.939,6.0046 l -0.3753,7.0054 0.688,15.0116 -8.4439,1.5637 0.7505,-16.1374"
- inkscape:connector-curvature="0" />
- <path
- id="path10179"
- d="m 2723.6897,-2060.8245 c 1.2093,0 2.4811,-0.3127 3.8155,-0.9382 1.3343,-0.6255 2.3768,-1.251 3.1274,-1.8764 l 1.1258,-0.9383 2.8772,3.5027 c -0.417,0.7089 -1.0633,1.522 -1.939,2.4394 -0.8757,0.9174 -1.7722,1.7096 -2.6895,2.3768 -0.8757,0.6255 -2.0641,1.2093 -3.5653,1.7514 -1.4594,0.5004 -2.9814,0.7505 -4.566,0.7505 -3.3776,0 -6.1297,-1.2718 -8.2563,-3.8154 -2.1267,-2.5853 -3.19,-5.9003 -3.19,-9.9451 0,-5.0873 1.4803,-9.549 4.4409,-13.3853 2.9606,-3.8363 6.4216,-5.7544 10.383,-5.7544 3.044,0 5.4,0.8548 7.068,2.5644 1.7096,1.7097 2.5644,4.1074 2.5644,7.1931 0,1.8347 -0.3127,3.9197 -0.9382,6.2548 l -1.251,1.3135 -15.637,1.4386 c 0.7089,4.7119 2.9189,7.0679 6.6301,7.0679 m 0,-19.3899 c -1.8347,0 -3.3776,0.7506 -4.6285,2.2517 -1.251,1.4595 -1.9807,3.336 -2.1892,5.6294 l 10.6332,-1.3135 c 0.125,-0.9591 0.1876,-1.7514 0.1876,-2.3769 0,-2.7938 -1.3344,-4.1907 -4.0031,-4.1907"
- inkscape:connector-curvature="0" />
- <path
- id="path10181"
- d="m 2760.1934,-2097.9155 -0.6881,20.3907 15.9498,-20.2656 6.3799,4.2533 -14.3861,16.7003 15.2618,18.0764 -8.0062,5.0038 -15.2617,-21.579 -0.1251,4.6285 0.7506,16.2625 -8.7568,0 0.7506,-15.1992 -0.7506,-26.708 8.8819,-1.5637"
- inkscape:connector-curvature="0" />
- <path
- id="path10183"
- d="m 2793.6018,-2054.4446 c -2.2517,0 -4.0864,-0.7297 -5.5042,-2.1892 -1.376,-1.5011 -2.0641,-3.461 -2.0641,-5.8795 l 0.3753,-7.193 -0.688,-15.0115 8.3814,-1.5638 -0.8131,19.0147 c 0,1.793 0.3127,3.1065 0.9382,3.9405 0.6672,0.834 1.7097,1.251 3.1274,1.251 1.4178,0 3.3776,-0.7089 5.8796,-2.1267 l 0,-3.7529 -0.6881,-16.4501 8.444,-1.5637 -0.7506,15.637 0.063,5.129 c 0,2.6687 0.688,5.3582 2.0641,8.0687 l -6.505,2.8772 c -1.3761,-2.7104 -2.2101,-4.8788 -2.502,-6.505 -3.7529,4.2115 -7.0053,6.3173 -9.7575,6.3173"
- inkscape:connector-curvature="0" />
- <path
- id="path10185"
- d="m 2836.1199,-2070.2692 c 0,-2.8772 -0.2502,-4.7954 -0.7506,-5.7545 -0.5004,-0.959 -1.668,-1.4385 -3.5027,-1.4386 -1.8347,1e-4 -3.9197,0.7298 -6.2548,2.1892 l 0,4.566 0.688,14.6988 -8.3814,1.5637 0.7506,-15.1992 c -0.1668,-5.5876 -0.6255,-10.5914 -1.3761,-15.0115 l 7.5683,-1.6263 c 0.2919,2.4186 0.5004,4.7746 0.6255,7.068 0.6255,-0.834 1.3344,-1.6471 2.1266,-2.4394 0.7923,-0.8339 2.0433,-1.7513 3.7529,-2.7521 1.7097,-1.0424 3.5027,-1.5637 5.3792,-1.5637 1.9181,0 3.5235,0.7506 4.8162,2.2517 1.2926,1.4595 1.9389,3.461 1.939,6.0046 l -0.3753,7.0054 0.688,15.0116 -8.444,1.5637 0.7506,-16.1374"
- inkscape:connector-curvature="0" />
- <path
- id="path10187"
- d="m 2848.5318,-2048.2523 c 0,-3.6695 3.4193,-6.5467 10.2579,-8.6317 -1.6263,-0.8339 -2.4394,-1.9181 -2.4394,-3.2525 0,-0.542 0.2085,-1.0841 0.6255,-1.6262 0.4169,-0.5421 1.0216,-1.105 1.8139,-1.6888 l 0,-0.5004 c -3.0024,0 -5.4,-0.834 -7.1931,-2.5019 -1.7513,-1.6679 -2.627,-3.8988 -2.627,-6.6927 0,-3.6277 1.4803,-6.776 4.4409,-9.4447 2.9606,-2.7104 6.4633,-4.0656 10.5081,-4.0656 1.0425,0 2.5645,0.2085 4.566,0.6254 2.0015,0.4171 3.9614,0.6256 5.8795,0.6255 l 4.8162,0 -0.6254,5.4417 -4.6912,-0.5629 c 0.417,1.2093 0.6255,2.5853 0.6255,4.1281 0,1.5429 -0.3753,3.0858 -1.1258,4.6286 -0.7089,1.5012 -1.5846,2.7104 -2.6271,3.6278 -1.0007,0.9174 -2.0224,1.7305 -3.0648,2.4394 -1.0008,0.6672 -1.8765,1.2718 -2.627,1.8139 -0.7089,0.5004 -1.0634,0.959 -1.0633,1.376 -1e-4,0.7923 0.8339,1.4803 2.5019,2.0641 4.42,1.7931 7.4015,3.3151 8.9443,4.566 1.5846,1.251 2.3768,2.7938 2.3769,4.6286 -10e-5,3.0857 -1.5638,5.6084 -4.6911,7.5683 -3.0858,2.0015 -6.7761,3.0023 -11.071,3.0023 -4.295,0 -7.6309,-0.688 -10.0077,-2.0641 -2.3352,-1.3761 -3.5027,-3.2108 -3.5027,-5.5042 m 18.8895,-26.2702 c 0,-2.0432 -0.4587,-3.5444 -1.3761,-4.5035 -0.9174,-0.959 -2.356,-1.4386 -4.3158,-1.4386 -3.7946,0 -5.6919,1.8765 -5.6919,5.6293 0,3.7112 2.0224,5.5668 6.0672,5.5668 3.5444,0 5.3166,-1.7513 5.3166,-5.254 m 2.2517,24.2061 c 0,-0.7506 -0.3961,-1.4595 -1.1884,-2.1266 -0.7923,-0.6255 -2.21,-1.3761 -4.2533,-2.2518 -3.044,0.834 -5.1498,1.6054 -6.3173,2.3143 -1.1259,0.7089 -1.6888,1.5846 -1.6888,2.627 0,1.0425 0.5629,1.8765 1.6888,2.5019 1.1675,0.6672 2.7729,1.0008 4.8162,1.0008 2.0432,0 3.7112,-0.3753 5.0038,-1.1258 1.2927,-0.7506 1.939,-1.7305 1.939,-2.9398"
- inkscape:connector-curvature="0" />
- <path
- id="path10189"
- d="m 2915.4651,-2090.9101 -13.3228,0 -0.3753,11.5088 11.9467,0 -0.688,6.6301 -11.4463,0 -0.063,2.0641 0.7506,16.2625 -8.7567,0 0.7506,-15.1992 -0.7506,-27.959 22.6424,0 -0.688,6.6927"
- inkscape:connector-curvature="0" />
- <path
- id="path10191"
- d="m 2927.2495,-2054.4446 c -2.2517,0 -4.0865,-0.7297 -5.5042,-2.1892 -1.3761,-1.5011 -2.0641,-3.461 -2.0641,-5.8795 l 0.3753,-7.193 -0.6881,-15.0115 8.3815,-1.5638 -0.8131,19.0147 c -10e-5,1.793 0.3127,3.1065 0.9382,3.9405 0.6671,0.834 1.7096,1.251 3.1274,1.251 1.4177,0 3.3776,-0.7089 5.8795,-2.1267 l 0,-3.7529 -0.688,-16.4501 8.444,-1.5637 -0.7506,15.637 0.063,5.129 c 0,2.6687 0.688,5.3582 2.0641,8.0687 l -6.505,2.8772 c -1.3761,-2.7104 -2.21,-4.8788 -2.5019,-6.505 -3.7529,4.2115 -7.0054,6.3173 -9.7575,6.3173"
- inkscape:connector-curvature="0" />
- </g>
- <g
- id="text3016"
- style="font-size:55.5345993px;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Acme;-inkscape-font-specification:Acme"
- transform="scale(1.0640965,0.93976441)">
- <path
- id="path10194"
- d="m 2910.1662,-1832.5692 -3.1655,0 0,0.3332 0.6664,14.439 -7.4416,0 0.6664,-13.4949 -0.6664,-24.8239 12.051,0 c 3.5542,0 6.3864,0.9626 8.4968,2.8878 2.1103,1.9252 3.1654,4.4798 3.1655,7.6637 -10e-5,2.4066 -0.6295,4.6094 -1.8882,6.6087 -1.2218,1.9622 -2.8878,3.5172 -4.9981,4.6649 l 9.663,13.6615 -6.7197,3.4431 -8.6634,-15.4386 c -0.2592,0.037 -0.6479,0.056 -1.1662,0.056 m 0.111,-17.9376 -2.7212,0 -0.3887,12.5508 3.7764,0 c 1.8511,0 3.2765,-0.6109 4.2761,-1.8327 1.0366,-1.2217 1.555,-2.9618 1.555,-5.2202 0,-3.6653 -2.1659,-5.4979 -6.4976,-5.4979"
- inkscape:connector-curvature="0" />
- <path
- id="path10196"
- d="m 2941.1059,-1823.4615 c 1.0736,0 2.2028,-0.2777 3.3876,-0.833 1.1847,-0.5553 2.1103,-1.1107 2.7767,-1.666 l 0.9997,-0.8331 2.5545,3.11 c -0.3702,0.6294 -0.9441,1.3513 -1.7215,2.1658 -0.7775,0.8145 -1.5735,1.518 -2.388,2.1103 -0.7775,0.5554 -1.8327,1.0737 -3.1655,1.555 -1.2958,0.4443 -2.6471,0.6664 -4.054,0.6664 -2.9989,0 -5.4424,-1.1292 -7.3306,-3.3876 -1.8882,-2.2954 -2.8322,-5.2387 -2.8322,-8.83 0,-4.5168 1.3143,-8.4783 3.9429,-11.8844 2.6286,-3.4061 5.7016,-5.1092 9.2188,-5.1092 2.7026,0 4.7944,0.759 6.2754,2.2769 1.5179,1.518 2.2769,3.6468 2.2769,6.3865 0,1.6291 -0.2777,3.4802 -0.833,5.5535 l -1.1107,1.1662 -13.8837,1.2773 c 0.6294,4.1836 2.5916,6.2754 5.8867,6.2754 m 0,-17.2157 c -1.629,0 -2.9989,0.6664 -4.1096,1.9992 -1.1107,1.2959 -1.7586,2.9619 -1.9437,4.9981 l 9.4409,-1.1662 c 0.1111,-0.8515 0.1666,-1.5549 0.1666,-2.1103 0,-2.4805 -1.1847,-3.7208 -3.5542,-3.7208"
- inkscape:connector-curvature="0" />
- <path
- id="path10198"
- d="m 2965.2808,-1824.7388 0.7219,0 1.8327,-7.6082 2.9989,-13.7171 6.8862,0.833 -4.165,13.7726 -3.4987,12.9951 -9.4964,0.833 -3.2766,-13.4949 -3.9985,-13.4949 7.5527,-1.3883 2.388,12.2176 2.0548,9.0521"
- inkscape:connector-curvature="0" />
- <path
- id="path10200"
- d="m 2988.8795,-1846.0641 -0.6664,13.8281 0.6109,13.0507 -7.4416,1.3883 0.6664,-13.4949 -0.6109,-13.3838 7.4416,-1.3884 m -7.8303,-8.108 c 0,-1.2588 0.4812,-2.3695 1.4439,-3.3321 0.9625,-0.9996 2.0732,-1.4994 3.332,-1.4994 1.2588,0 2.2214,0.3517 2.8878,1.0551 0.6664,0.6665 0.9996,1.6846 0.9997,3.0544 -10e-5,1.3699 -0.4814,2.5547 -1.4439,3.5542 -0.9256,0.9627 -2.0178,1.444 -3.2766,1.4439 -1.2218,10e-5 -2.1844,-0.4072 -2.8878,-1.2217 -0.7034,-0.8145 -1.0551,-1.8326 -1.0551,-3.0544"
- inkscape:connector-curvature="0" />
- <path
- id="path10202"
- d="m 3004.9924,-1823.4615 c 1.0736,0 2.2028,-0.2777 3.3876,-0.833 1.1847,-0.5553 2.1103,-1.1107 2.7767,-1.666 l 0.9996,-0.8331 2.5546,3.11 c -0.3702,0.6294 -0.9441,1.3513 -1.7215,2.1658 -0.7775,0.8145 -1.5735,1.518 -2.388,2.1103 -0.7775,0.5554 -1.8327,1.0737 -3.1655,1.555 -1.2958,0.4443 -2.6472,0.6664 -4.054,0.6664 -2.9989,0 -5.4424,-1.1292 -7.3306,-3.3876 -1.8882,-2.2954 -2.8323,-5.2387 -2.8323,-8.83 0,-4.5168 1.3144,-8.4783 3.943,-11.8844 2.6286,-3.4061 5.7015,-5.1092 9.2187,-5.1092 2.7027,0 4.7945,0.759 6.2754,2.2769 1.518,1.518 2.2769,3.6468 2.277,6.3865 -1e-4,1.6291 -0.2777,3.4802 -0.8331,5.5535 l -1.1106,1.1662 -13.8837,1.2773 c 0.6294,4.1836 2.5916,6.2754 5.8867,6.2754 m 0,-17.2157 c -1.6291,0 -2.9989,0.6664 -4.1096,1.9992 -1.1107,1.2959 -1.7586,2.9619 -1.9437,4.9981 l 9.4409,-1.1662 c 0.111,-0.8515 0.1666,-1.5549 0.1666,-2.1103 0,-2.4805 -1.1848,-3.7208 -3.5542,-3.7208"
- inkscape:connector-curvature="0" />
- <path
- id="path10204"
- d="m 3044.4948,-1824.7388 0.722,0 1.7771,-7.6082 2.8878,-13.7171 6.7752,0.833 -4.054,13.7726 -3.3876,12.9951 -9.1077,0.833 -3.0544,-13.4949 -0.2777,-0.8885 -3.7208,13.5504 -8.83,0.833 -3.221,-13.4949 -3.8319,-13.4949 7.275,-1.3883 2.277,12.2176 1.9992,9.0521 0.7219,0 4.776,-15.8273 -1.1662,-4.0541 7.164,-1.3883 2.3324,12.2176 1.9437,9.0521"
- inkscape:connector-curvature="0" />
- <path
- id="path10206"
- d="m 3081.9121,-1817.1861 c -4.1095,0 -7.5712,-1.7216 -10.3849,-5.1647 -2.8138,-3.4431 -4.2207,-7.6638 -4.2207,-12.6619 0,-6.1088 1.6846,-11.255 5.0537,-15.4386 3.4061,-4.1836 7.5712,-6.2754 12.4953,-6.2754 1.9251,0 3.7022,0.2037 5.3313,0.6109 1.666,0.3702 2.8507,0.759 3.5542,1.1662 l 0.9996,0.6109 -3.7763,7.7193 c -0.8516,-0.7404 -2.0548,-1.4254 -3.6098,-2.0548 -1.555,-0.6664 -2.9618,-0.9996 -4.2206,-0.9996 -2.5546,0 -4.6094,1.0552 -6.1644,3.1655 -1.5179,2.1103 -2.2769,5.1277 -2.2769,9.0521 0,3.8874 0.796,7.0899 2.388,9.6075 1.592,2.4805 3.7578,3.7208 6.4976,3.7208 1.7771,0 3.3876,-0.5553 4.8315,-1.666 1.4438,-1.1107 2.462,-2.5916 3.0544,-4.4428 l 4.6093,2.6656 c -1.2217,3.2581 -3.0914,5.8127 -5.6089,7.6638 -2.5176,1.8142 -5.3684,2.7212 -8.5524,2.7212"
- inkscape:connector-curvature="0" />
- <path
- id="path10208"
- d="m 3106.1131,-1817.797 c -1.9993,0 -3.6283,-0.6479 -4.8871,-1.9437 -1.2217,-1.3328 -1.8326,-3.0729 -1.8326,-5.2202 l 0.3332,-6.3865 -0.6109,-13.3283 7.4416,-1.3884 -0.7219,16.8825 c 0,1.592 0.2777,2.7583 0.833,3.4987 0.5924,0.7405 1.5179,1.1107 2.7767,1.1107 1.2588,0 2.9989,-0.6294 5.2203,-1.8882 l 0,-3.332 -0.6109,-14.6056 7.4972,-1.3884 -0.6664,13.8837 0.055,4.5538 c 0,2.3695 0.6109,4.7575 1.8326,7.164 l -5.7756,2.5545 c -1.2217,-2.4065 -1.9622,-4.3317 -2.2213,-5.7756 -3.3321,3.7394 -6.2199,5.609 -8.6634,5.609"
- inkscape:connector-curvature="0" />
- <path
- id="path10210"
- d="m 3137.3105,-1839.1778 c -1.629,0 -2.8878,0.5924 -3.7764,1.7771 -0.8885,1.1478 -1.3328,2.9249 -1.3328,5.3313 0,2.4066 0.4443,4.3503 1.3328,5.8312 0.9256,1.4439 2.2584,2.1658 3.9985,2.1658 0.8886,0 1.7586,-0.2776 2.6102,-0.833 0.8515,-0.5553 1.4994,-1.1107 1.9437,-1.666 l 0.6109,-0.8886 2.7767,2.8878 c -0.1111,0.1851 -0.2592,0.4443 -0.4443,0.7775 -0.1481,0.3332 -0.5554,0.9256 -1.2218,1.7771 -0.6294,0.8515 -1.3143,1.6105 -2.0547,2.2769 -0.7035,0.6294 -1.6291,1.2218 -2.7768,1.7771 -1.1477,0.5184 -2.3509,0.7775 -3.6097,0.7775 -2.7768,0 -5.0352,-1.1292 -6.7752,-3.3876 -1.7401,-2.2584 -2.6102,-5.2017 -2.6102,-8.83 0,-4.5168 1.3144,-8.4783 3.943,-11.8844 2.6286,-3.4061 5.7015,-5.1092 9.2187,-5.1092 1.0737,0 2.1474,0.1667 3.221,0.4998 1.0737,0.2962 2.1659,0.7775 3.2766,1.4439 l -3.8874,6.8308 c -1.3329,-1.0366 -2.8138,-1.555 -4.4428,-1.555"
- inkscape:connector-curvature="0" />
- <path
- id="path10212"
- d="m 3166.4532,-1817.2416 -10.4406,-15.3831 0,0.3887 0.6109,13.0507 -7.4971,1.3883 0.6664,-13.4949 -0.6664,-28.1005 7.6082,-1.3883 -0.722,26.8232 11.107,-12.1621 5.2202,3.5542 -9.7185,9.1077 10.1628,11.9955 -6.3309,4.2206"
- inkscape:connector-curvature="0" />
- <path
- id="path10214"
- d="m 3174.2514,-1829.4037 c 0,-4.7389 1.2773,-8.7559 3.8319,-12.051 2.5546,-3.295 5.5349,-4.9426 8.9411,-4.9426 3.4431,0 6.1088,1.1107 7.997,3.3321 1.9251,2.2214 2.8877,5.1647 2.8877,8.83 0,4.8871 -1.2402,8.9596 -3.7208,12.2176 -2.4435,3.221 -5.5349,4.8315 -9.2742,4.8315 -3.073,0 -5.6276,-1.1477 -7.6638,-3.4431 -1.9993,-2.3325 -2.9989,-5.2573 -2.9989,-8.7745 m 17.4379,-1.9437 c 0,-5.3683 -1.8327,-8.0525 -5.498,-8.0525 -3.8133,0 -5.72,2.5176 -5.72,7.5527 0,2.6286 0.5368,4.6834 1.6105,6.1643 1.0736,1.481 2.4805,2.2214 4.2206,2.2214 1.7771,0 3.1099,-0.6664 3.9985,-1.9992 0.9256,-1.3699 1.3884,-3.3321 1.3884,-5.8867"
- inkscape:connector-curvature="0" />
- <path
- id="path10216"
- d="m 3201.0425,-1829.4037 c 0,-4.7389 1.2773,-8.7559 3.8319,-12.051 2.5546,-3.295 5.5349,-4.9426 8.9411,-4.9426 3.4431,0 6.1088,1.1107 7.997,3.3321 1.9251,2.2214 2.8877,5.1647 2.8878,8.83 -10e-5,4.8871 -1.2403,8.9596 -3.7209,12.2176 -2.4435,3.221 -5.5349,4.8315 -9.2742,4.8315 -3.073,0 -5.6276,-1.1477 -7.6638,-3.4431 -1.9993,-2.3325 -2.9989,-5.2573 -2.9989,-8.7745 m 17.4379,-1.9437 c 0,-5.3683 -1.8327,-8.0525 -5.4979,-8.0525 -3.8134,0 -5.7201,2.5176 -5.7201,7.5527 0,2.6286 0.5368,4.6834 1.6105,6.1643 1.0737,1.481 2.4805,2.2214 4.2206,2.2214 1.7771,0 3.1099,-0.6664 3.9985,-1.9992 0.9256,-1.3699 1.3884,-3.3321 1.3884,-5.8867"
- inkscape:connector-curvature="0" />
- </g>
- </g>
- </g>
-</svg>
diff --git a/contrib/themes/diffy/static/diffymute.svg b/contrib/themes/diffy/static/diffymute.svg
deleted file mode 100644
index 6833ba6..0000000
--- a/contrib/themes/diffy/static/diffymute.svg
+++ /dev/null
@@ -1,198 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="600.06732"
- height="558.20709"
- id="svg2"
- version="1.1"
- inkscape:version="0.48.3.1 r9886"
- sodipodi:docname="diffy.svg"
- inkscape:export-filename="/home/sarah/art/diffy.png"
- inkscape:export-xdpi="500"
- inkscape:export-ydpi="500">
- <defs
- id="defs4" />
- <sodipodi:namedview
- id="base"
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1.0"
- inkscape:pageopacity="0.0"
- inkscape:pageshadow="2"
- inkscape:zoom="0.66618777"
- inkscape:cx="300.03365"
- inkscape:cy="258.35521"
- inkscape:document-units="px"
- inkscape:current-layer="g10119"
- showgrid="false"
- inkscape:window-width="1366"
- inkscape:window-height="744"
- inkscape:window-x="0"
- inkscape:window-y="24"
- inkscape:window-maximized="1"
- fit-margin-top="0"
- fit-margin-left="0"
- fit-margin-right="0"
- fit-margin-bottom="0" />
- <metadata
- id="metadata7">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <g
- inkscape:label="Layer 1"
- inkscape:groupmode="layer"
- id="layer1"
- transform="translate(-3069.8852,2251.5084)">
- <text
- xml:space="preserve"
- style="font-size:51.65934372px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:end;line-height:125%;letter-spacing:0px;word-spacing:0px;text-anchor:end;fill:#000000;fill-opacity:1;stroke:none;font-family:FreeSans;-inkscape-font-specification:FreeSans Bold"
- x="475.83173"
- y="900.47076"
- id="text4257"
- sodipodi:linespacing="125%"
- transform="scale(1.1411753,0.87628955)"><tspan
- sodipodi:role="line"
- x="475.83173"
- y="900.47076"
- style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;text-align:end;text-anchor:end;font-family:Acme;-inkscape-font-specification:Acme Bold"
- id="tspan3008" /></text>
- <flowRoot
- xml:space="preserve"
- id="flowRoot4263"
- style="font-size:12px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"><flowRegion
- id="flowRegion4265"><rect
- id="rect4267"
- width="313.14728"
- height="343.45187"
- x="-335.37064"
- y="205.85435" /></flowRegion><flowPara
- id="flowPara4269" /></flowRoot> <g
- id="g10119"
- transform="matrix(0.99201906,-0.12608805,0.12608805,0.99201906,273.85438,408.58042)">
- <path
- sodipodi:nodetypes="csccscac"
- inkscape:connector-curvature="0"
- id="path4130"
- d="m 3378.9965,-2206.2972 c 0,0 13.4039,-8.8398 27.0022,-17.1718 13.5984,-8.3319 22.2322,-21.276 22.2322,-21.276 l 34.2799,28.1467 c 0,0 -16.0641,15.553 -24.7742,21.6893 -3.709,2.6129 -10.9463,9.1577 -10.9463,9.1577 0,0 -14.3617,-10.0769 -22.3623,-13.5225 -8.0773,-3.4786 -25.4315,-7.0234 -25.4315,-7.0234 z"
- style="fill:#ffffff;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- <path
- sodipodi:nodetypes="cac"
- inkscape:connector-curvature="0"
- d="m 3414.7387,-2204.9828 c 0,0 8.2233,-5.8571 11.9326,-9.2622 3.8224,-3.5089 10.5596,-11.437 10.5596,-11.437"
- style="fill:#ffffff;stroke:#ff0000;stroke-width:8.97858429;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- id="path4185" />
- <path
- sodipodi:nodetypes="cascacsc"
- inkscape:connector-curvature="0"
- id="path3307"
- d="m 3247.6516,-2171.4037 c 0,0 4.3348,-19.2835 10.7071,-26.2701 7.4284,-8.1446 19.072,-14.1542 29.3495,-15.24 27.8177,-2.9386 63.2371,6.1908 63.2371,6.1908 0,0 -30.8042,0.7262 -45.6022,4.5134 -5.1922,1.3289 -14.7941,6.2977 -14.7941,6.2977 0,0 -16.1166,0.8374 -29.8971,12.0927 -13.7804,11.2552 -3.0344,9.7831 -3.0344,9.7831"
- style="fill:#ffffff;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- <path
- sodipodi:nodetypes="ccsccscscccccscc"
- inkscape:connector-curvature="0"
- id="path3011"
- d="m 3332.9985,-2012.4352 -20.0742,24.9886 c 0,0 -16.3479,-5.082 -40.3255,4.9725 -23.9776,10.0546 -39.2193,26.4042 -39.2193,26.4042 l 7.8897,-0.7975 c 0,0 20.4818,-14.4371 31.9614,-17.1294 11.4796,-2.6923 23.6197,-2.8388 23.6197,-2.8388 0,0 -25.492,10.0264 -30.7497,12.3759 -6.2584,2.7968 -15.0874,9.199 -15.0874,9.199 l 10.4761,-0.2965 c 17.6867,-7.2528 41.3221,-16.0187 59.9685,-15.047 15.5919,1.1274 33.9405,16.7543 33.9405,16.7543 l -3.8165,-9.9895 c 0,0 -10.8307,-8.1932 -16.3866,-13.7491 -5.5558,-5.5558 17.5848,-25.8193 17.5848,-25.8193 -14.3098,-2.8351 -2.1172,-7.9424 -19.7815,-9.0274 z"
- style="fill:#ffff00;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- <path
- style="fill:#ffff00;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- d="m 3397.9929,-1984.0461 -15.5774,33.0846 c 0,0 -14.4499,-2.2165 -39.5097,4.7139 -25.0597,6.9303 -44.9575,20.0476 -44.9575,20.0476 l 10.5706,1.822 c 0,0 19.7276,-11.1182 30.516,-14.1955 7.747,-2.2097 23.9934,-2.9008 23.9934,-2.9008 0,0 -20.2687,6.6869 -30.057,10.9033 -5.4067,2.329 -15.7817,7.9273 -15.7817,7.9273 l 10.8391,1.5269 c 0,0 31.056,-11.8625 47.4047,-13.3504 11.1103,-1.0112 11.8331,-2.962 33.324,3.1079 10.0509,2.8388 16.3928,6.252 16.3928,6.252 l -3.3122,-5.8696 c 0,0 -5.3909,-4.5711 -8.2712,-6.6111 -3.5982,-2.5484 -11.2202,-7.0059 -11.2202,-7.0059 l 15.4484,-30.858 c -13.3255,-5.9362 -2.8177,-3.6211 -19.8021,-8.5942 z"
- id="path3013"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="ccsccacaccasccaccc" />
- <path
- sodipodi:nodetypes="aaczsccsssca"
- inkscape:connector-curvature="0"
- id="path3014"
- d="m 3138.8926,-2124.2277 c 9.8375,-20.5358 27.6337,-38.9533 48.4705,-48.136 22.7321,-10.018 51.1582,-10.0879 74.4382,-3.5941 7.6944,6.5 10.3115,-17.1804 46.9059,-27.4208 36.5944,-10.2403 91.6429,-6.509 142.1505,22.7854 54.0494,31.3487 -23.7386,41.9213 -8.0812,94.4492 32.3844,113.578 -63.1345,101.5204 -63.1345,101.5204 0,0 -25.2539,-16.1625 -35.3554,-17.1726 -10.1015,-1.0102 -46.6429,-25.1251 -68.8662,-28.6607 -22.2234,-3.5355 -36.9003,18.6222 -107.991,-9.9282 -24.3178,-9.7661 -33.8401,-33.335 -33.8401,-33.335 0,0 -2.0102,-35.2405 5.3033,-50.5076 z"
- style="fill:#0000ff;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- <path
- sodipodi:nodetypes="cssscscsac"
- inkscape:connector-curvature="0"
- id="path3028"
- d="m 3179.7636,-2035.4822 c 0,0 33.988,-7.9036 57.2215,-14.9746 23.2335,-7.0711 36.1637,-43.7474 71.519,-48.7981 35.3554,-5.0508 68.528,22.1624 80.6498,47.4162 12.1218,25.2539 50.6701,55.6193 50.6701,55.6193 0,0 1.0101,11.1117 -14.1422,18.1828 -15.1522,7.0711 -10.4989,7.6628 -10.4989,7.6628 0,0 -43.1103,-11.4139 -62.396,-21.4139 -19.2857,-10 -61.236,-23.044 -92.9377,-30.7963 -26.2653,-6.4228 -35.0334,2.5255 -80.0856,-12.8982 z"
- style="fill:#ff6600;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- <path
- sodipodi:nodetypes="cscccccscc"
- inkscape:connector-curvature="0"
- id="path3009"
- d="m 3470.1209,-2002.8128 c 0,0 13.8937,99.0002 33.6829,157.8517 19.7893,58.8514 78.4464,180.4742 78.4464,180.4742 l 28.1031,-31.8521 -52.5625,-109.7203 60.5152,95.9016 26.0124,-35.7271 c 0,0 -70.663,-88.4878 -93.8954,-140.4597 -23.2324,-51.9718 -37.4945,-152.9082 -37.4945,-152.9082 z"
- style="fill:#0000ff;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- <path
- sodipodi:nodetypes="csscsccccccccccsc"
- inkscape:connector-curvature="0"
- id="path3016"
- d="m 3359.2154,-2191.502 c 0,0 -40.7142,5 -57.1428,42.1428 -16.4286,37.1429 50.7143,115.7143 60.7143,132.1429 10,16.4286 24.2857,38.5714 24.2857,38.5714 0,0 47.6766,32.0335 82.9062,53.8444 32.6567,20.2179 65.2266,33.1109 65.2266,33.1109 0,0 1.1687,-0.4937 7.0265,-19.1963 -12.1218,-21.7183 -38.3216,-53.2543 -54.5036,-69.192 24.2792,14.1167 43.346,28.1254 60.1041,56.5482 0,0 4.9588,-21.3916 6.5659,-30.7894 -3.0357,-9.5763 -47.4771,-56.5685 -47.4771,-56.5685 20.5517,8.7613 33.7508,23.0255 50.0892,44.7732 0,0 3.3263,-21.5598 3.8366,-32.9472 -2.5253,-6.566 -33.7228,-35.0595 -33.7228,-35.0595 13.1654,6.6374 19.714,11.0661 34.4127,24.0476 0,0 -3.0357,-60.7142 -66.6072,-130.7142 -63.5714,-70 -135.7143,-50.7143 -135.7143,-50.7143 z"
- style="fill:#000080;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- <g
- transform="translate(2935.644,-2513.1499)"
- id="g3138">
- <path
- style="fill:#ff0000;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- d="m 337.66259,394.0585 c 0,0 -28.86328,-30.61257 -60.78781,-25.80202 -31.92454,4.81054 -41.10831,33.67382 -39.79634,39.79633 1.31197,6.12252 13.557,11.80771 22.30345,15.74361 8.74644,3.9359 32.79917,-0.43732 45.48152,-6.55984 12.68235,-6.12251 32.79918,-23.17808 32.79918,-23.17808 z"
- id="path3022"
- inkscape:connector-curvature="0" />
- <path
- style="fill:#ffff00;fill-opacity:1;stroke:#000000;stroke-width:3;stroke-miterlimit:4"
- d="m 286.65383,372.49887 c 12.50235,2.18615 20.86528,14.09354 18.67912,26.59589 -2.18615,12.50234 -14.09354,20.86527 -26.59589,18.67911 -12.50235,-2.18616 -20.86528,-14.09354 -18.67912,-26.59588 z"
- id="path3024"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="csscc" />
- <path
- sodipodi:type="arc"
- style="fill:#000000;fill-opacity:1;stroke:none"
- id="path3026"
- sodipodi:cx="229.64285"
- sodipodi:cy="403.79074"
- sodipodi:rx="8.2142859"
- sodipodi:ry="8.2142859"
- d="m 237.85714,403.79074 c 0,4.53663 -3.67766,8.21429 -8.21429,8.21429 -4.53662,0 -8.21428,-3.67766 -8.21428,-8.21429 0,-4.53662 3.67766,-8.21428 8.21428,-8.21428 4.53663,0 8.21429,3.67766 8.21429,8.21428 z"
- transform="matrix(1.5694327,0,0,1.5694327,-85.566867,-233.30737)" />
- </g>
- <path
- sodipodi:nodetypes="cssssssc"
- style="fill:#ffff00;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
- d="m 3110.2692,-2103.8575 c -32.3249,20.7081 -31.4522,56.0845 -27.4116,60.6301 4.0406,4.5457 8.0812,1.0102 15.6574,-1.5152 7.5761,-2.5254 26.2639,-10.1015 42.4264,-11.1117 16.1624,-1.0101 21.2132,3.0305 23.7386,-0.505 2.5254,-3.5356 4.0406,-15.1523 3.0304,-25.7589 -1.0101,-10.6066 -1.0101,-23.2335 -7.071,-25.2538 -6.061,-2.0203 -38.2484,-5.0718 -50.3702,3.5145 z"
- id="path3296"
- inkscape:connector-curvature="0" />
- <path
- inkscape:connector-curvature="0"
- id="path3305"
- d="m 3251.1404,-2178.2729 c 0,0 12.1428,21.0714 67.1428,32.5 55,11.4286 125.7143,-38.2143 125.7143,-38.2143 l 38.7857,38.6429 c 0,0 -113.0714,25.6428 -150.2143,21 -37.1428,-4.6429 -81.4285,-50.3572 -81.4285,-50.3572"
- style="fill:#ffffff;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- <path
- sodipodi:nodetypes="ccccc"
- inkscape:connector-curvature="0"
- id="path4099"
- d="m 3453.1169,-2166.1191 -30.2186,14.3667 6.8378,5.5184 29.9689,-14.0733 z"
- style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#008000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans" />
- <path
- sodipodi:nodetypes="cacscacsc"
- inkscape:connector-curvature="0"
- id="path3303"
- d="m 3154.8351,-2149.0637 c 0,0 -6.1891,7.2925 -8.7928,11.2888 -2.8625,4.3936 -7.4472,13.8569 -7.4472,13.8569 0,0 49.8667,-24.0831 67.6065,-30.2972 18.2787,-6.4028 54.803,-21.7873 54.803,-21.7873 0,0 -3.8451,-1.8876 -5.9103,-2.3872 -3.1018,-0.7503 -9.5343,-0.868 -9.5343,-0.868 0,0 -25.7837,-0.1235 -42.8032,6.1343 -17.0196,6.2579 -47.9217,24.0597 -47.9217,24.0597 z"
- style="fill:#ffffff;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />
- <path
- style="font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;baseline-shift:baseline;color:#000000;fill:#008000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:4;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Sans;-inkscape-font-specification:Sans"
- d="m 3433.0379,-2169.2212 24.4739,22.8165 -8.1844,3.1976 -24.3243,-22.4616 z"
- id="path27241"
- inkscape:connector-curvature="0"
- sodipodi:nodetypes="ccccc" />
- </g>
- </g>
-</svg>
diff --git a/contrib/themes/diffy/static/logo.png b/contrib/themes/diffy/static/logo.png
deleted file mode 100644
index 989c303..0000000
--- a/contrib/themes/diffy/static/logo.png
+++ /dev/null
Binary files differ
diff --git a/contrib/themes/spotify/etc/GerritSite.css b/contrib/themes/spotify/etc/GerritSite.css
deleted file mode 100644
index 489452a..0000000
--- a/contrib/themes/spotify/etc/GerritSite.css
+++ /dev/null
@@ -1,113 +0,0 @@
-#gerrit_topmenu {
- font-size: 9pt !important;
- padding-top: 5px !important;
- padding-left: 15px !important;
- padding-right: 15px !important;
- background: url(static/background-spotigreen.jpg) !important;
- float: left !important;
- margin-left: 250px !important;
- margin-right: 150px !important;
- border-radius: 0 0 10px 10px !important;
- padding-bottom: 10px !important;
- border-bottom: 1px solid #abc506 !important;
- border-right: 1px solid #abc506 !important;
- border-left: 1px solid #abc506 !important;
-}
-
-body, .gwt-DialogBox .dialogMiddleCenter {
- background: #FFF url(static/background-gradient.png) no-repeat !important;
-}
-
-#logo-spotify {
- background: url(static/logo.png) no-repeat;
- height: 98px;
- width: 228px;
- margin-left: 2px;
-}
-
-#gerrit_header {
- background: #FCFEEF;
- padding-bottom: 10px;
- border-bottom: dashed 1px rgba(0, 0, 0, 0.05);
-}
-
-#gerrit_topmenu .gwt-TextBox {
- margin-top: 15px;
- width: 240px;
-}
-
-#gerrit_topmenu > table {
- float: left;
-}
-
-#gerrit_topmenu > table > tbody > tr > td:nth-child(3) a {
- margin-left: 5px;
- background-color: #FFC;
- border-radius: 3px;
- padding: 5px 5px;
- border-right: none !important;
-}
-
-.gwt-TabPanelBottom {
- background: #FFC !important;
- border-radius: 0 0 3px 3px !important;
- padding-bottom: 6px !important;
- padding-top: 6px !important;
-}
-
-.gwt-TabBar .gwt-TabBarItem, .gwt-TabBar .gwt-TabBarRest, .gwt-TabBar .gwt-TabPanelBottom {
- background: transparent !important;
-}
-
-.gwt-TabBarItem-wrapper {
- background: rgba(255, 255, 255, 0.2) !important;
-}
-
-#gerrit_topmenu .gwt-TabBar .gwt-TabBarItem-selected {
- background: #FFC !important;
- border-radius: 3px 3px 0 0 !important;
-}
-
-#gerrit_topmenu .gwt-TabBar .gwt-TabBarItem-selected:hover {
- background: #FFC !important;
-}
-
-#gerrit_topmenu .gwt-TabBar .gwt-TabBarItem-selected:focus {
- outline: none !important;
-}
-
-#gerrit_topmenu > table > tbody > tr > td > table {
- border: none !important;
-}
-
-.gwt-TabBar {
- border-bottom: 1px solid #E2E2AD !important;
-}
-
-.gwt-TabBarItem {
- border-right: 1px solid rgba(79, 58, 0, 0.3) !important;
- background: rgba(255, 255, 255, 0.2) !important;
-}
-
-.gwt-TabBarItem:hover {
- background: rgba(255, 255, 255, 0.1) !important;
-}
-
-a, a:visited {
- text-decoration: none !important;
- color: #3F4D00 !important;
-}
-
-a:hover {
- color: #5d7200 !important;
- text-decoration: underline !important;
-}
-
-.gwt-Label {
-height: 30px !important;
-line-height: 30px !important;
-}
-
-#gerrit_btmmenu > div {
- color: rgba(0, 0, 0, 0.3) !important;
-}
\ No newline at end of file
diff --git a/contrib/themes/spotify/etc/GerritSiteHeader.html b/contrib/themes/spotify/etc/GerritSiteHeader.html
deleted file mode 100644
index 8af84be..0000000
--- a/contrib/themes/spotify/etc/GerritSiteHeader.html
+++ /dev/null
@@ -1 +0,0 @@
-<div id="logo-spotify"></div>
\ No newline at end of file
diff --git a/contrib/themes/spotify/static/background-gradient.png b/contrib/themes/spotify/static/background-gradient.png
deleted file mode 100644
index 3b9422e..0000000
--- a/contrib/themes/spotify/static/background-gradient.png
+++ /dev/null
Binary files differ
diff --git a/contrib/themes/spotify/static/background-spotigreen.jpg b/contrib/themes/spotify/static/background-spotigreen.jpg
deleted file mode 100644
index fcc7983..0000000
--- a/contrib/themes/spotify/static/background-spotigreen.jpg
+++ /dev/null
Binary files differ
diff --git a/contrib/themes/spotify/static/logo.png b/contrib/themes/spotify/static/logo.png
deleted file mode 100644
index c231031..0000000
--- a/contrib/themes/spotify/static/logo.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtdebug/BUILD b/gerrit-gwtdebug/BUILD
deleted file mode 100644
index ecf525e..0000000
--- a/gerrit-gwtdebug/BUILD
+++ /dev/null
@@ -1,18 +0,0 @@
-load("@rules_java//java:defs.bzl", "java_library")
-
-java_library(
- name = "gwtdebug",
- srcs = glob(["src/main/java/**/*.java"]),
- visibility = ["//visibility:public"],
- deps = [
- "//java/com/google/gerrit/pgm",
- "//java/com/google/gerrit/pgm/util",
- "//java/com/google/gerrit/util/cli",
- "//lib/flogger:api",
- "//lib/gwt:dev",
- "//lib/jetty:server",
- "//lib/jetty:servlet",
- "//lib/jetty:servlets",
- "//lib/log:log4j",
- ],
-)
diff --git a/gerrit-gwtdebug/src/main/java/com/google/gerrit/gwtdebug/GerritGwtDebugLauncher.java b/gerrit-gwtdebug/src/main/java/com/google/gerrit/gwtdebug/GerritGwtDebugLauncher.java
deleted file mode 100644
index cf84919..0000000
--- a/gerrit-gwtdebug/src/main/java/com/google/gerrit/gwtdebug/GerritGwtDebugLauncher.java
+++ /dev/null
@@ -1,77 +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.gwtdebug;
-
-import com.google.common.flogger.FluentLogger;
-import com.google.gerrit.pgm.Daemon;
-import com.google.gwt.dev.codeserver.CodeServer;
-import com.google.gwt.dev.codeserver.Options;
-import java.util.ArrayList;
-import java.util.List;
-
-class GerritGwtDebugLauncher {
- private static final FluentLogger logger = FluentLogger.forEnclosingClass();
-
- public static void main(String[] argv) throws Exception {
- GerritGwtDebugLauncher launcher = new GerritGwtDebugLauncher();
- launcher.mainImpl(argv);
- }
-
- private int mainImpl(String[] argv) {
- List<String> sdmLauncherOptions = new ArrayList<>();
- List<String> daemonLauncherOptions = new ArrayList<>();
-
- // Separator between Daemon and Codeserver parameters is "--"
- boolean daemonArgumentSeparator = false;
- int i = 0;
- for (; i < argv.length; i++) {
- if (!argv[i].equals("--")) {
- sdmLauncherOptions.add(argv[i]);
- } else {
- daemonArgumentSeparator = true;
- break;
- }
- }
- if (daemonArgumentSeparator) {
- ++i;
- for (; i < argv.length; i++) {
- daemonLauncherOptions.add(argv[i]);
- }
- }
-
- Options options = new Options();
- if (!options.parseArgs(sdmLauncherOptions.toArray(new String[sdmLauncherOptions.size()]))) {
- logger.atSevere().log("Failed to parse codeserver arguments");
- return 1;
- }
-
- CodeServer.main(options);
-
- try {
- int r =
- new Daemon()
- .main(daemonLauncherOptions.toArray(new String[daemonLauncherOptions.size()]));
- if (r != 0) {
- logger.atSevere().log("Daemon exited with return code: %d", r);
- return 1;
- }
- } catch (Exception e) {
- logger.atSevere().withCause(e).log("Cannot start daemon");
- return 1;
- }
-
- return 0;
- }
-}
diff --git a/gerrit-gwtui-common/BUILD b/gerrit-gwtui-common/BUILD
deleted file mode 100644
index e9ed363..0000000
--- a/gerrit-gwtui-common/BUILD
+++ /dev/null
@@ -1,63 +0,0 @@
-load("@rules_java//java:defs.bzl", "java_library")
-load("//tools/bzl:gwt.bzl", "gwt_module")
-load("//tools/bzl:java.bzl", "java_library2")
-load("//tools/bzl:junit.bzl", "junit_tests")
-
-EXPORTED_DEPS = [
- "//java/com/google/gerrit/common:client",
- "//java/com/google/gwtexpui/clippy",
- "//java/com/google/gwtexpui/globalkey",
- "//java/com/google/gwtexpui/progress",
- "//java/com/google/gwtexpui/safehtml",
- "//java/com/google/gwtexpui/user:agent",
-]
-
-DEPS = ["//lib/gwt:user-neverlink"]
-
-SRC = "src/main/java/com/google/gerrit/"
-
-gwt_module(
- name = "client",
- srcs = glob(["src/main/**/*.java"]),
- exported_deps = EXPORTED_DEPS,
- gwt_xml = SRC + "GerritGwtUICommon.gwt.xml",
- resources = glob(
- ["src/main/**/*"],
- exclude = [SRC + "client/**/*.java"] + [
- SRC + "GerritGwtUICommon.gwt.xml",
- ],
- ),
- visibility = ["//visibility:public"],
- deps = DEPS,
-)
-
-java_library2(
- name = "client-lib",
- srcs = glob(["src/main/**/*.java"]),
- exported_deps = EXPORTED_DEPS,
- resources = glob(["src/main/**/*"]),
- visibility = ["//visibility:public"],
- deps = DEPS,
-)
-
-java_library(
- name = "diffy_logo",
- data = [
- "//lib:LICENSE-CC-BY3.0-unported",
- "//lib:LICENSE-diffy",
- ],
- resources = glob(["src/main/resources/com/google/gerrit/client/diffy*.png"]),
- visibility = ["//visibility:public"],
-)
-
-junit_tests(
- name = "client_tests",
- srcs = glob(["src/test/java/**/*.java"]),
- visibility = ["//visibility:public"],
- deps = [
- ":client",
- "//lib:junit",
- "//lib/gwt:dev",
- "//lib/jgit/org.eclipse.jgit:jgit",
- ],
-)
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/GerritGwtUICommon.gwt.xml b/gerrit-gwtui-common/src/main/java/com/google/gerrit/GerritGwtUICommon.gwt.xml
deleted file mode 100644
index dc478fc..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/GerritGwtUICommon.gwt.xml
+++ /dev/null
@@ -1,43 +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.
--->
-<module>
- <inherits name='org.eclipse.jgit.JGit'/>
- <inherits name='com.google.gerrit.common.Common'/>
- <inherits name='com.google.gerrit.extensions.Extensions'/>
- <inherits name='com.google.gerrit.prettify.PrettyFormatter'/>
- <inherits name='com.google.gwtexpui.clippy.Clippy'/>
- <inherits name='com.google.gwtexpui.globalkey.GlobalKey'/>
- <inherits name='com.google.gwtexpui.progress.Progress'/>
- <inherits name='com.google.gwtexpui.safehtml.SafeHtml'/>
- <source path='client'>
- <include name='AccountFormatter.java'/>
- <include name='CommonConstants.java'/>
- <include name='CommonMessages.java'/>
- <include name='DateFormatter.java'/>
- <include name='GerritUiExtensionPoint.java'/>
- <include name='RelativeDateFormatter.java'/>
- <include name='Resources.java'/>
- <include name='CommonConstants.properties'/>
- <include name='CommonMessages.properties'/>
- <include name='info/*.java'/>
- <include name='rpc/NativeMap.java'/>
- <include name='rpc/Natives.java'/>
- <include name='rpc/NativeString.java'/>
- <include name='rpc/TransformCallback.java'/>
- <include name='ui/HighlightSuggestion.java'/>
- <include name='ui/RemoteSuggestOracle.java'/>
- </source>
-</module>
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/AccountFormatter.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/AccountFormatter.java
deleted file mode 100644
index 3058971..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/AccountFormatter.java
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (C) 2015 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.client;
-
-import com.google.gerrit.client.info.AccountInfo;
-
-public class AccountFormatter {
- private final String anonymousCowardName;
-
- public AccountFormatter(String anonymousCowardName) {
- this.anonymousCowardName = anonymousCowardName;
- }
-
- /**
- * Formats an account as a name and an email address.
- *
- * <p>Example output:
- *
- * <ul>
- * <li>{@code A U. Thor <author@example.com>}: full populated
- * <li>{@code A U. Thor (12)}: missing email address
- * <li>{@code Anonymous Coward <author@example.com>}: missing name
- * <li>{@code Anonymous Coward (12)}: missing name and email address
- * </ul>
- */
- public String nameEmail(AccountInfo info) {
- String name = info.name();
- if (name == null || name.trim().isEmpty()) {
- name = anonymousCowardName;
- }
-
- StringBuilder b = new StringBuilder().append(name);
- if (info.email() != null) {
- b.append(" <").append(info.email()).append(">");
- } else if (info._accountId() > 0) {
- b.append(" (").append(info._accountId()).append(")");
- }
- return b.toString();
- }
-
- /**
- * Formats an account name.
- *
- * <p>If the account has a full name, it returns only the full name. Otherwise it returns a longer
- * form that includes the email address.
- */
- public String name(AccountInfo ai) {
- if (ai.name() != null && !ai.name().trim().isEmpty()) {
- return ai.name();
- }
- String email = ai.email();
- if (email != null) {
- int at = email.indexOf('@');
- return 0 < at ? email.substring(0, at) : email;
- }
- return nameEmail(ai);
- }
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/CommonConstants.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/CommonConstants.java
deleted file mode 100644
index e769730..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/CommonConstants.java
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (C) 2015 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.client;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.i18n.client.Constants;
-
-public interface CommonConstants extends Constants {
- CommonConstants C = GWT.create(CommonConstants.class);
-
- String inTheFuture();
-
- String month();
-
- String months();
-
- String year();
-
- String years();
-
- String oneSecondAgo();
-
- String oneMinuteAgo();
-
- String oneHourAgo();
-
- String oneDayAgo();
-
- String oneWeekAgo();
-
- String oneMonthAgo();
-
- String oneYearAgo();
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/CommonConstants.properties b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/CommonConstants.properties
deleted file mode 100644
index 3202bfc..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/CommonConstants.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-inTheFuture = in the future
-month = month
-months = months
-years = years
-year = year
-
-oneSecondAgo = 1 second ago
-oneMinuteAgo = 1 minute ago
-oneHourAgo = 1 hour ago
-oneDayAgo = 1 day ago
-oneWeekAgo = 1 week ago
-oneMonthAgo = 1 month ago
-oneYearAgo = 1 year ago
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/CommonMessages.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/CommonMessages.java
deleted file mode 100644
index 5314254..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/CommonMessages.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (C) 2015 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.client;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.i18n.client.Messages;
-
-public interface CommonMessages extends Messages {
- CommonMessages M = GWT.create(CommonMessages.class);
-
- String secondsAgo(long seconds);
-
- String minutesAgo(long minutes);
-
- String hoursAgo(long hours);
-
- String daysAgo(long days);
-
- String weeksAgo(long weeks);
-
- String monthsAgo(long months);
-
- String yearsAgo(long years);
-
- String years0MonthsAgo(long years, String yearLabel);
-
- String yearsMonthsAgo(long years, String yearLabel, long months, String monthLabel);
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/CommonMessages.properties b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/CommonMessages.properties
deleted file mode 100644
index 738602e..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/CommonMessages.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-secondsAgo = {0} seconds ago
-minutesAgo = {0} minutes ago
-hoursAgo = {0} hours ago
-daysAgo = {0} days ago
-weeksAgo = {0} weeks ago
-monthsAgo = {0} months ago
-years0MonthsAgo = {0} {1} ago
-yearsMonthsAgo = {0} {1}, {2} {3} ago
-yearsAgo = {0} years ago
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/DateFormatter.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/DateFormatter.java
deleted file mode 100644
index 4df2f5f..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/DateFormatter.java
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (C) 2015 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.client;
-
-import com.google.gerrit.client.info.GeneralPreferences;
-import com.google.gwt.i18n.client.DateTimeFormat;
-import java.util.Date;
-
-public class DateFormatter {
- private static final long ONE_YEAR = 182L * 24 * 60 * 60 * 1000;
-
- private final DateTimeFormat sTime;
- private final DateTimeFormat sDate;
- private final DateTimeFormat sdtFmt;
- private final DateTimeFormat mDate;
- private final DateTimeFormat dtfmt;
-
- public DateFormatter(GeneralPreferences prefs) {
- String fmt_sTime = prefs.timeFormat().getFormat();
- String fmt_sDate = prefs.dateFormat().getShortFormat();
- String fmt_mDate = prefs.dateFormat().getLongFormat();
-
- sTime = DateTimeFormat.getFormat(fmt_sTime);
- sDate = DateTimeFormat.getFormat(fmt_sDate);
- sdtFmt = DateTimeFormat.getFormat(fmt_sDate + " " + fmt_sTime);
- mDate = DateTimeFormat.getFormat(fmt_mDate);
- dtfmt = DateTimeFormat.getFormat(fmt_mDate + " " + fmt_sTime);
- }
-
- /** Format a date using a really short format. */
- public String shortFormat(Date dt) {
- if (dt == null) {
- return "";
- }
-
- Date now = new Date();
- dt = new Date(dt.getTime());
- if (mDate.format(now).equals(mDate.format(dt))) {
- // Same day as today, report only the time.
- //
- return sTime.format(dt);
-
- } else if (Math.abs(now.getTime() - dt.getTime()) < ONE_YEAR) {
- // Within the last year, show a shorter date.
- //
- return sDate.format(dt);
-
- } else {
- // Report only date and year, its far away from now.
- //
- return mDate.format(dt);
- }
- }
-
- /** Format a date using a really short format. */
- public String shortFormatDayTime(Date dt) {
- if (dt == null) {
- return "";
- }
-
- Date now = new Date();
- dt = new Date(dt.getTime());
- if (mDate.format(now).equals(mDate.format(dt))) {
- // Same day as today, report only the time.
- //
- return sTime.format(dt);
-
- } else if (Math.abs(now.getTime() - dt.getTime()) < ONE_YEAR) {
- // Within the last year, show a shorter date.
- //
- return sdtFmt.format(dt);
-
- } else {
- // Report only date and year, its far away from now.
- //
- return mDate.format(dt);
- }
- }
-
- /** Format a date using the locale's medium length format. */
- public String mediumFormat(Date dt) {
- if (dt == null) {
- return "";
- }
- return dtfmt.format(new Date(dt.getTime()));
- }
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/GerritUiExtensionPoint.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/GerritUiExtensionPoint.java
deleted file mode 100644
index 66a3b6b..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/GerritUiExtensionPoint.java
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (C) 2015 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.client;
-
-public enum GerritUiExtensionPoint {
- /* ChangeScreen */
- CHANGE_SCREEN_HEADER,
- CHANGE_SCREEN_HEADER_RIGHT_OF_BUTTONS,
- CHANGE_SCREEN_HEADER_RIGHT_OF_POP_DOWNS,
- CHANGE_SCREEN_BELOW_CHANGE_INFO_BLOCK,
- CHANGE_SCREEN_BELOW_RELATED_INFO_BLOCK,
- CHANGE_SCREEN_BELOW_COMMIT_INFO_BLOCK,
- CHANGE_SCREEN_HISTORY_RIGHT_OF_BUTTONS,
-
- /* MyPasswordScreen */
- PASSWORD_SCREEN_BOTTOM,
-
- /* MyPreferencesScreen */
- PREFERENCES_SCREEN_BOTTOM,
-
- /* MyProfileScreen */
- PROFILE_SCREEN_BOTTOM,
-
- /* ProjectInfoScreen */
- PROJECT_INFO_SCREEN_TOP,
- PROJECT_INFO_SCREEN_BOTTOM;
-
- public enum Key {
- ACCOUNT_INFO,
- CHANGE_INFO,
- PROJECT_NAME,
- REVISION_INFO
- }
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/RelativeDateFormatter.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/RelativeDateFormatter.java
deleted file mode 100644
index e0cc9ca..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/RelativeDateFormatter.java
+++ /dev/null
@@ -1,142 +0,0 @@
-// Copyright (C) 2013 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.client;
-
-import java.util.Date;
-
-/**
- * Formatter to format timestamps relative to the current time using time units in the format
- * defined by {@code git log --relative-date}.
- */
-public class RelativeDateFormatter {
- private static CommonConstants constants;
- private static CommonMessages messages;
-
- static final long SECOND_IN_MILLIS = 1000;
- static final long MINUTE_IN_MILLIS = 60 * SECOND_IN_MILLIS;
- static final long HOUR_IN_MILLIS = 60 * MINUTE_IN_MILLIS;
- static final long DAY_IN_MILLIS = 24 * HOUR_IN_MILLIS;
- static final long WEEK_IN_MILLIS = 7 * DAY_IN_MILLIS;
- static final long MONTH_IN_MILLIS = 30 * DAY_IN_MILLIS;
- static final long YEAR_IN_MILLIS = 365 * DAY_IN_MILLIS;
-
- static void setConstants(CommonConstants c, CommonMessages m) {
- constants = c;
- messages = m;
- }
-
- private static CommonConstants c() {
- return constants != null ? constants : CommonConstants.C;
- }
-
- private static CommonMessages m() {
- return messages != null ? messages : CommonMessages.M;
- }
-
- /**
- * @param when {@link Date} to format
- * @return age of given {@link Date} compared to now formatted in the same relative format as
- * returned by {@code git log --relative-date}
- */
- public static String format(Date when) {
- long ageMillis = (new Date()).getTime() - when.getTime();
-
- // shouldn't happen in a perfect world
- if (ageMillis < 0) {
- return c().inTheFuture();
- }
-
- // seconds
- if (ageMillis < upperLimit(MINUTE_IN_MILLIS)) {
- long seconds = round(ageMillis, SECOND_IN_MILLIS);
- if (seconds == 1) {
- return c().oneSecondAgo();
- }
- return m().secondsAgo(seconds);
- }
-
- // minutes
- if (ageMillis < upperLimit(HOUR_IN_MILLIS)) {
- long minutes = round(ageMillis, MINUTE_IN_MILLIS);
- if (minutes == 1) {
- return c().oneMinuteAgo();
- }
- return m().minutesAgo(minutes);
- }
-
- // hours
- if (ageMillis < upperLimit(DAY_IN_MILLIS)) {
- long hours = round(ageMillis, HOUR_IN_MILLIS);
- if (hours == 1) {
- return c().oneHourAgo();
- }
- return m().hoursAgo(hours);
- }
-
- // up to 14 days use days
- if (ageMillis < 14 * DAY_IN_MILLIS) {
- long days = round(ageMillis, DAY_IN_MILLIS);
- if (days == 1) {
- return c().oneDayAgo();
- }
- return m().daysAgo(days);
- }
-
- // up to 10 weeks use weeks
- if (ageMillis < 10 * WEEK_IN_MILLIS) {
- long weeks = round(ageMillis, WEEK_IN_MILLIS);
- if (weeks == 1) {
- return c().oneWeekAgo();
- }
- return m().weeksAgo(weeks);
- }
-
- // months
- if (ageMillis < YEAR_IN_MILLIS) {
- long months = round(ageMillis, MONTH_IN_MILLIS);
- if (months == 1) {
- return c().oneMonthAgo();
- }
- return m().monthsAgo(months);
- }
-
- // up to 5 years use "year, months" rounded to months
- if (ageMillis < 5 * YEAR_IN_MILLIS) {
- long years = round(ageMillis, MONTH_IN_MILLIS) / 12;
- String yearLabel = (years > 1) ? c().years() : c().year();
- long months = round(ageMillis - years * YEAR_IN_MILLIS, MONTH_IN_MILLIS);
- String monthLabel = (months > 1) ? c().months() : (months == 1 ? c().month() : "");
- if (months == 0) {
- return m().years0MonthsAgo(years, yearLabel);
- }
- return m().yearsMonthsAgo(years, yearLabel, months, monthLabel);
- }
-
- // years
- long years = round(ageMillis, YEAR_IN_MILLIS);
- if (years == 1) {
- return c().oneYearAgo();
- }
- return m().yearsAgo(years);
- }
-
- private static long upperLimit(long unit) {
- return unit + unit / 2;
- }
-
- private static long round(long n, long unit) {
- return (n + unit / 2) / unit;
- }
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/Resources.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/Resources.java
deleted file mode 100644
index 67627c3..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/Resources.java
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright (C) 2008 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.client;
-
-import com.google.gwt.resources.client.ClientBundle;
-import com.google.gwt.resources.client.ImageResource;
-
-public interface Resources extends ClientBundle {
- /** silk icons (CC-BY3.0): http://famfamfam.com/lab/icons/silk/ */
- @Source("note_add.png")
- ImageResource addFileComment();
-
- @Source("tag_blue_add.png")
- ImageResource addHashtag();
-
- @Source("user_add.png")
- ImageResource addUser();
-
- @Source("user_edit.png")
- ImageResource editUser();
-
- // derived from resultset_next.png
- @Source("resultset_down_gray.png")
- ImageResource arrowDown();
-
- // derived from resultset_next.png
- @Source("resultset_next_gray.png")
- ImageResource arrowRight();
-
- // derived from resultset_next.png
- @Source("resultset_up_gray.png")
- ImageResource arrowUp();
-
- @Source("lightbulb.png")
- ImageResource blame();
-
- @Source("page_white_put.png")
- ImageResource downloadIcon();
-
- // derived from comment.png
- @Source("comment_draft.png")
- ImageResource draftComments();
-
- @Source("page_edit.png")
- ImageResource edit();
-
- @Source("arrow_undo.png")
- ImageResource editUndo();
-
- @Source("cog.png")
- ImageResource gear();
-
- @Source("tick.png")
- ImageResource greenCheck();
-
- @Source("tag_blue.png")
- ImageResource hashtag();
-
- @Source("lightbulb.png")
- ImageResource info();
-
- @Source("find.png")
- ImageResource queryIcon();
-
- @Source("lock.png")
- ImageResource readOnly();
-
- @Source("cross.png")
- ImageResource redNot();
-
- @Source("disk.png")
- ImageResource save();
-
- @Source("star.png")
- ImageResource starFilled();
-
- // derived from star.png
- @Source("star-open.png")
- ImageResource starOpen();
-
- @Source("exclamation.png")
- ImageResource warning();
-
- @Source("help.png")
- ImageResource question();
-
- /** tango icon library (public domain): http://tango.freedesktop.org/Tango_Icon_Library */
- @Source("goNext.png")
- ImageResource goNext();
-
- @Source("goPrev.png")
- ImageResource goPrev();
-
- @Source("goUp.png")
- ImageResource goUp();
-
- @Source("listAdd.png")
- ImageResource listAdd();
-
- // derived from important.png
- @Source("merge.png")
- ImageResource merge();
-
- /** contributed by the artist under Apache2.0 */
- @Source("sideBySideDiff.png")
- ImageResource sideBySideDiff();
-
- @Source("unifiedDiff.png")
- ImageResource unifiedDiff();
-
- /** contributed by the artist under CC-BY3.0 */
- @Source("diffy26.png")
- ImageResource gerritAvatar26();
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/AccountInfo.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/AccountInfo.java
deleted file mode 100644
index e4c008c..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/AccountInfo.java
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (C) 2013 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.client.info;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwtjsonrpc.client.impl.ser.JavaSqlTimestamp_JsonSerializer;
-import java.sql.Timestamp;
-
-public class AccountInfo extends JavaScriptObject {
- public final native int _accountId() /*-{ return this._account_id || 0; }-*/;
-
- public final native String name() /*-{ return this.name; }-*/;
-
- public final native String email() /*-{ return this.email; }-*/;
-
- public final native JsArrayString secondaryEmails() /*-{ return this.secondary_emails; }-*/;
-
- public final native String username() /*-{ return this.username; }-*/;
-
- public final Timestamp registeredOn() {
- Timestamp ts = _getRegisteredOn();
- if (ts == null) {
- ts = JavaSqlTimestamp_JsonSerializer.parseTimestamp(registeredOnRaw());
- _setRegisteredOn(ts);
- }
- return ts;
- }
-
- private native String registeredOnRaw() /*-{ return this.registered_on; }-*/;
-
- private native Timestamp _getRegisteredOn() /*-{ return this._cts; }-*/;
-
- private native void _setRegisteredOn(Timestamp ts) /*-{ this._cts = ts; }-*/;
-
- /**
- * @return true if the server supplied avatar information about this account. The information may
- * be an empty list, indicating no avatars are available, such as when no plugin is installed.
- * This method returns false if the server did not check on avatars for the account.
- */
- public final native boolean hasAvatarInfo() /*-{ return this.hasOwnProperty('avatars') }-*/;
-
- public final AvatarInfo avatar(int sz) {
- JsArray<AvatarInfo> a = avatars();
- for (int i = 0; a != null && i < a.length(); i++) {
- AvatarInfo r = a.get(i);
- if (r.height() == sz) {
- return r;
- }
- }
- return null;
- }
-
- private native JsArray<AvatarInfo> avatars() /*-{ return this.avatars }-*/;
-
- public final native void name(String n) /*-{ this.name = n }-*/;
-
- public final native void email(String e) /*-{ this.email = e }-*/;
-
- public final native void username(String n) /*-{ this.username = n }-*/;
-
- public static native AccountInfo create(int id, String name, String email, String username) /*-{
- return {'_account_id': id, 'name': name, 'email': email,
- 'username': username};
- }-*/;
-
- protected AccountInfo() {}
-
- public static class AvatarInfo extends JavaScriptObject {
- public static final int DEFAULT_SIZE = 26;
-
- public final native String url() /*-{ return this.url }-*/;
-
- public final native int height() /*-{ return this.height || 0 }-*/;
-
- public final native int width() /*-{ return this.width || 0 }-*/;
-
- protected AvatarInfo() {}
- }
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/ActionInfo.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/ActionInfo.java
deleted file mode 100644
index d09d5b7..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/ActionInfo.java
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright (C) 2013 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.client.info;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class ActionInfo extends JavaScriptObject {
-
- public final native String id() /*-{ return this.id; }-*/;
-
- public final native String method() /*-{ return this.method; }-*/;
-
- public final native String label() /*-{ return this.label; }-*/;
-
- public final native String title() /*-{ return this.title; }-*/;
-
- public final native boolean enabled() /*-{ return this.enabled || false; }-*/;
-
- protected ActionInfo() {}
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/AgreementInfo.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/AgreementInfo.java
deleted file mode 100644
index 04fba4f..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/AgreementInfo.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) 2016 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.client.info;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class AgreementInfo extends JavaScriptObject {
- public final native String name() /*-{ return this.name; }-*/;
-
- public final native String description() /*-{ return this.description; }-*/;
-
- public final native String url() /*-{ return this.url; }-*/;
-
- public final native GroupInfo autoVerifyGroup() /*-{ return this.auto_verify_group; }-*/;
-
- protected AgreementInfo() {}
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/AuthInfo.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/AuthInfo.java
deleted file mode 100644
index 43281bd..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/AuthInfo.java
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright (C) 2015 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.client.info;
-
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.extensions.client.AccountFieldName;
-import com.google.gerrit.extensions.client.AuthType;
-import com.google.gerrit.extensions.client.GitBasicAuthPolicy;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.JsArrayString;
-import java.util.ArrayList;
-import java.util.List;
-
-public class AuthInfo extends JavaScriptObject {
- public final AuthType authType() {
- return AuthType.valueOf(authTypeRaw());
- }
-
- public final boolean isLdap() {
- return authType() == AuthType.LDAP || authType() == AuthType.LDAP_BIND;
- }
-
- public final boolean isOpenId() {
- return authType() == AuthType.OPENID;
- }
-
- public final boolean isOAuth() {
- return authType() == AuthType.OAUTH;
- }
-
- public final boolean isDev() {
- return authType() == AuthType.DEVELOPMENT_BECOME_ANY_ACCOUNT;
- }
-
- public final boolean isClientSslCertLdap() {
- return authType() == AuthType.CLIENT_SSL_CERT_LDAP;
- }
-
- public final boolean isCustomExtension() {
- return authType() == AuthType.CUSTOM_EXTENSION;
- }
-
- public final boolean canEdit(AccountFieldName f) {
- return editableAccountFields().contains(f);
- }
-
- public final List<AccountFieldName> editableAccountFields() {
- List<AccountFieldName> fields = new ArrayList<>();
- for (String f : Natives.asList(_editableAccountFields())) {
- fields.add(AccountFieldName.valueOf(f));
- }
- return fields;
- }
-
- public final List<AgreementInfo> contributorAgreements() {
- List<AgreementInfo> agreements = new ArrayList<>();
- JsArray<AgreementInfo> contributorAgreements = _contributorAgreements();
- if (contributorAgreements != null) {
- agreements.addAll(Natives.asList(contributorAgreements));
- }
- return agreements;
- }
-
- public final boolean siteHasUsernames() {
- if (isCustomExtension() && httpPasswordUrl() != null && !canEdit(AccountFieldName.USER_NAME)) {
- return false;
- }
- return true;
- }
-
- public final boolean isHttpPasswordSettingsEnabled() {
- return gitBasicAuthPolicy() == GitBasicAuthPolicy.HTTP
- || gitBasicAuthPolicy() == GitBasicAuthPolicy.HTTP_LDAP;
- }
-
- public final GitBasicAuthPolicy gitBasicAuthPolicy() {
- return GitBasicAuthPolicy.valueOf(gitBasicAuthPolicyRaw());
- }
-
- public final native boolean useContributorAgreements()
- /*-{ return this.use_contributor_agreements || false; }-*/ ;
-
- public final native String loginUrl() /*-{ return this.login_url; }-*/;
-
- public final native String loginText() /*-{ return this.login_text; }-*/;
-
- public final native String switchAccountUrl() /*-{ return this.switch_account_url; }-*/;
-
- public final native String registerUrl() /*-{ return this.register_url; }-*/;
-
- public final native String registerText() /*-{ return this.register_text; }-*/;
-
- public final native String editFullNameUrl() /*-{ return this.edit_full_name_url; }-*/;
-
- public final native String httpPasswordUrl() /*-{ return this.http_password_url; }-*/;
-
- private native String gitBasicAuthPolicyRaw() /*-{ return this.git_basic_auth_policy; }-*/;
-
- private native String authTypeRaw() /*-{ return this.auth_type; }-*/;
-
- private native JsArrayString _editableAccountFields()
- /*-{ return this.editable_account_fields; }-*/ ;
-
- private native JsArray<AgreementInfo> _contributorAgreements()
- /*-{ return this.contributor_agreements; }-*/ ;
-
- protected AuthInfo() {}
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/ChangeInfo.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/ChangeInfo.java
deleted file mode 100644
index 0f786a6..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/ChangeInfo.java
+++ /dev/null
@@ -1,575 +0,0 @@
-// Copyright (C) 2012 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.client.info;
-
-import static java.util.Comparator.comparing;
-
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.common.data.LabelValue;
-import com.google.gerrit.common.data.SubmitRecord;
-import com.google.gerrit.extensions.client.ReviewerState;
-import com.google.gerrit.extensions.client.SubmitType;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwtjsonrpc.client.impl.ser.JavaSqlTimestamp_JsonSerializer;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-public class ChangeInfo extends JavaScriptObject {
- public final void init() {
- if (allLabels() != null) {
- allLabels().copyKeysIntoChildren("_name");
- }
- }
-
- public final Project.NameKey projectNameKey() {
- return new Project.NameKey(project());
- }
-
- public final Change.Id legacyId() {
- return new Change.Id(_number());
- }
-
- public final Timestamp created() {
- Timestamp ts = _getCts();
- if (ts == null) {
- ts = JavaSqlTimestamp_JsonSerializer.parseTimestamp(createdRaw());
- _setCts(ts);
- }
- return ts;
- }
-
- public final boolean hasEditBasedOnCurrentPatchSet() {
- JsArray<RevisionInfo> revList = revisions().values();
- RevisionInfo.sortRevisionInfoByNumber(revList);
- return revList.get(revList.length() - 1).isEdit();
- }
-
- private native Timestamp _getCts() /*-{ return this._cts; }-*/;
-
- private native void _setCts(Timestamp ts) /*-{ this._cts = ts; }-*/;
-
- public final Timestamp updated() {
- return JavaSqlTimestamp_JsonSerializer.parseTimestamp(updatedRaw());
- }
-
- public final Timestamp submitted() {
- return JavaSqlTimestamp_JsonSerializer.parseTimestamp(submittedRaw());
- }
-
- public final String idAbbreviated() {
- return new Change.Key(changeId()).abbreviate();
- }
-
- public final Change.Status status() {
- return Change.Status.valueOf(statusRaw());
- }
-
- public final Set<String> labels() {
- return allLabels().keySet();
- }
-
- public final Set<Integer> removableReviewerIds() {
- Set<Integer> removable = new HashSet<>();
- if (removableReviewers() != null) {
- for (AccountInfo a : Natives.asList(removableReviewers())) {
- removable.add(a._accountId());
- }
- }
- return removable;
- }
-
- public final native String id() /*-{ return this.id; }-*/;
-
- public final native String project() /*-{ return this.project; }-*/;
-
- public final native String branch() /*-{ return this.branch; }-*/;
-
- public final native String topic() /*-{ return this.topic; }-*/;
-
- public final native String changeId() /*-{ return this.change_id; }-*/;
-
- public final native boolean mergeable() /*-{ return this.mergeable ? true : false; }-*/;
-
- public final native int insertions() /*-{ return this.insertions; }-*/;
-
- public final native int deletions() /*-{ return this.deletions; }-*/;
-
- private native String statusRaw() /*-{ return this.status; }-*/;
-
- public final native String subject() /*-{ return this.subject; }-*/;
-
- public final native AccountInfo owner() /*-{ return this.owner; }-*/;
-
- public final native AccountInfo assignee() /*-{ return this.assignee; }-*/;
-
- private native String createdRaw() /*-{ return this.created; }-*/;
-
- private native String updatedRaw() /*-{ return this.updated; }-*/;
-
- private native String submittedRaw() /*-{ return this.submitted; }-*/;
-
- public final native AccountInfo submitter() /*-{ return this.submitter; }-*/;
-
- public final native boolean starred() /*-{ return this.starred ? true : false; }-*/;
-
- public final native boolean reviewed() /*-{ return this.reviewed ? true : false; }-*/;
-
- public final native boolean isPrivate() /*-{ return this.is_private ? true : false; }-*/;
-
- public final native boolean
- isWorkInProgress() /*-{ return this.work_in_progress ? true : false; }-*/;
-
- public final native NativeMap<LabelInfo> allLabels() /*-{ return this.labels; }-*/;
-
- public final native LabelInfo label(String n) /*-{ return this.labels[n]; }-*/;
-
- public final native String currentRevision() /*-{ return this.current_revision; }-*/;
-
- public final native void setCurrentRevision(String r) /*-{ this.current_revision = r; }-*/;
-
- public final native NativeMap<RevisionInfo> revisions() /*-{ return this.revisions; }-*/;
-
- public final native RevisionInfo revision(String n) /*-{ return this.revisions[n]; }-*/;
-
- public final native JsArray<MessageInfo> messages() /*-{ return this.messages; }-*/;
-
- public final native void setEdit(EditInfo edit) /*-{ this.edit = edit; }-*/;
-
- public final native EditInfo edit() /*-{ return this.edit; }-*/;
-
- public final native boolean hasEdit() /*-{ return this.hasOwnProperty('edit') }-*/;
-
- public final native JsArrayString hashtags() /*-{ return this.hashtags; }-*/;
-
- public final native boolean hasPermittedLabels()
- /*-{ return this.hasOwnProperty('permitted_labels') }-*/ ;
-
- public final native NativeMap<JsArrayString> permittedLabels()
- /*-{ return this.permitted_labels; }-*/ ;
-
- public final native JsArrayString permittedValues(String n)
- /*-{ return this.permitted_labels[n]; }-*/ ;
-
- public final native JsArray<AccountInfo> removableReviewers()
- /*-{ return this.removable_reviewers; }-*/ ;
-
- private native NativeMap<JsArray<AccountInfo>> _reviewers() /*-{ return this.reviewers; }-*/;
-
- public final Map<ReviewerState, List<AccountInfo>> reviewers() {
- NativeMap<JsArray<AccountInfo>> reviewers = _reviewers();
- Map<ReviewerState, List<AccountInfo>> result = new HashMap<>();
- for (String k : reviewers.keySet()) {
- ReviewerState state = ReviewerState.valueOf(k.toUpperCase());
- List<AccountInfo> accounts = result.get(state);
- if (accounts == null) {
- accounts = new ArrayList<>();
- result.put(state, accounts);
- }
- accounts.addAll(Natives.asList(reviewers.get(k)));
- }
- return result;
- }
-
- public final native boolean hasActions() /*-{ return this.hasOwnProperty('actions') }-*/;
-
- public final native NativeMap<ActionInfo> actions() /*-{ return this.actions; }-*/;
-
- public final native int _number() /*-{ return this._number; }-*/;
-
- public final native boolean _more_changes() /*-{ return this._more_changes ? true : false; }-*/;
-
- public final SubmitType submitType() {
- String submitType = _submitType();
- if (submitType == null) {
- return null;
- }
- return SubmitType.valueOf(submitType);
- }
-
- private native String _submitType() /*-{ return this.submit_type; }-*/;
-
- public final boolean submittable() {
- init();
- return _submittable();
- }
-
- private native boolean _submittable() /*-{ return this.submittable ? true : false; }-*/;
-
- /**
- * @return the index of the missing label or -1 if no label is missing, or if more than one label
- * is missing.
- */
- public final int getMissingLabelIndex() {
- int i = -1;
- int ret = -1;
- List<LabelInfo> labels = Natives.asList(allLabels().values());
- for (LabelInfo label : labels) {
- i++;
- if (!permittedLabels().containsKey(label.name())) {
- continue;
- }
-
- JsArrayString values = permittedValues(label.name());
- if (values.length() == 0) {
- continue;
- }
-
- switch (label.status()) {
- case NEED: // Label is required for submit.
- if (ret != -1) {
- // more than one label is missing, so it's unclear which to quick
- // approve, return -1
- return -1;
- }
- ret = i;
- continue;
-
- case OK: // Label already applied.
- case MAY: // Label is not required.
- continue;
-
- case REJECT: // Submit cannot happen, do not quick approve.
- case IMPOSSIBLE:
- return -1;
- }
- }
- return ret;
- }
-
- protected ChangeInfo() {}
-
- public static class LabelInfo extends JavaScriptObject {
- public final SubmitRecord.Label.Status status() {
- if (approved() != null) {
- return SubmitRecord.Label.Status.OK;
- } else if (rejected() != null) {
- return SubmitRecord.Label.Status.REJECT;
- } else if (optional()) {
- return SubmitRecord.Label.Status.MAY;
- } else {
- return SubmitRecord.Label.Status.NEED;
- }
- }
-
- public final native String name() /*-{ return this._name; }-*/;
-
- public final native AccountInfo approved() /*-{ return this.approved; }-*/;
-
- public final native AccountInfo rejected() /*-{ return this.rejected; }-*/;
-
- public final native AccountInfo recommended() /*-{ return this.recommended; }-*/;
-
- public final native AccountInfo disliked() /*-{ return this.disliked; }-*/;
-
- public final native JsArray<ApprovalInfo> all() /*-{ return this.all; }-*/;
-
- public final ApprovalInfo forUser(int user) {
- JsArray<ApprovalInfo> all = all();
- for (int i = 0; all != null && i < all.length(); i++) {
- if (all.get(i)._accountId() == user) {
- return all.get(i);
- }
- }
- return null;
- }
-
- private native NativeMap<NativeString> _values() /*-{ return this.values; }-*/;
-
- public final Set<String> values() {
- return Natives.keys(_values());
- }
-
- public final native String valueText(String n) /*-{ return this.values[n]; }-*/;
-
- public final native boolean optional() /*-{ return this.optional ? true : false; }-*/;
-
- public final native boolean blocking() /*-{ return this.blocking ? true : false; }-*/;
-
- public final native short defaultValue() /*-{ return this.default_value; }-*/;
-
- public final native short _value() /*-{
- if (this.value) return this.value;
- if (this.disliked) return -1;
- if (this.recommended) return 1;
- return 0;
- }-*/;
-
- public final String maxValue() {
- return LabelValue.formatValue(valueSet().last());
- }
-
- public final SortedSet<Short> valueSet() {
- SortedSet<Short> values = new TreeSet<>();
- for (String v : values()) {
- values.add(parseValue(v));
- }
- return values;
- }
-
- public static final short parseValue(String formatted) {
- if (formatted.startsWith("+")) {
- formatted = formatted.substring(1);
- } else if (formatted.startsWith(" ")) {
- formatted = formatted.trim();
- }
- return Short.parseShort(formatted);
- }
-
- protected LabelInfo() {}
- }
-
- public static class ApprovalInfo extends AccountInfo {
- public final native boolean hasValue() /*-{ return this.hasOwnProperty('value'); }-*/;
-
- public final native short value() /*-{ return this.value || 0; }-*/;
-
- public final native VotingRangeInfo
- permittedVotingRange() /*-{ return this.permitted_voting_range; }-*/;
-
- protected ApprovalInfo() {}
- }
-
- public static class VotingRangeInfo extends AccountInfo {
- public final native short min() /*-{ return this.min || 0; }-*/;
-
- public final native short max() /*-{ return this.max || 0; }-*/;
-
- protected VotingRangeInfo() {}
- }
-
- public static class EditInfo extends JavaScriptObject {
- public final native String name() /*-{ return this.name; }-*/;
-
- public final native String setName(String n) /*-{ this.name = n; }-*/;
-
- public final native String baseRevision() /*-{ return this.base_revision; }-*/;
-
- public final native CommitInfo commit() /*-{ return this.commit; }-*/;
-
- public final native boolean hasActions() /*-{ return this.hasOwnProperty('actions') }-*/;
-
- public final native NativeMap<ActionInfo> actions() /*-{ return this.actions; }-*/;
-
- public final native boolean hasFetch() /*-{ return this.hasOwnProperty('fetch') }-*/;
-
- public final native NativeMap<FetchInfo> fetch() /*-{ return this.fetch; }-*/;
-
- public final native boolean hasFiles() /*-{ return this.hasOwnProperty('files') }-*/;
-
- public final native NativeMap<FileInfo> files() /*-{ return this.files; }-*/;
-
- protected EditInfo() {}
- }
-
- public static class RevisionInfo extends JavaScriptObject {
- public static RevisionInfo fromEdit(EditInfo edit) {
- RevisionInfo revisionInfo = createObject().cast();
- revisionInfo.takeFromEdit(edit);
- return revisionInfo;
- }
-
- public static RevisionInfo forParent(int number, CommitInfo commit) {
- RevisionInfo revisionInfo = createObject().cast();
- revisionInfo.takeFromParent(number, commit);
- return revisionInfo;
- }
-
- private native void takeFromEdit(EditInfo edit) /*-{
- this._number = 0;
- this.name = edit.name;
- this.commit = edit.commit;
- this.edit_base = edit.base_revision;
- }-*/;
-
- private native void takeFromParent(int number, CommitInfo commit) /*-{
- this._number = number;
- this.commit = commit;
- this.name = this._number;
- }-*/;
-
- public final native int _number() /*-{ return this._number; }-*/;
-
- public final native String name() /*-{ return this.name; }-*/;
-
- public final native AccountInfo uploader() /*-{ return this.uploader; }-*/;
-
- public final native boolean isEdit() /*-{ return this._number == 0; }-*/;
-
- public final native CommitInfo commit() /*-{ return this.commit; }-*/;
-
- public final native void setCommit(CommitInfo c) /*-{ this.commit = c; }-*/;
-
- public final native String editBase() /*-{ return this.edit_base; }-*/;
-
- public final native boolean hasFiles() /*-{ return this.hasOwnProperty('files') }-*/;
-
- public final native NativeMap<FileInfo> files() /*-{ return this.files; }-*/;
-
- public final native boolean hasActions() /*-{ return this.hasOwnProperty('actions') }-*/;
-
- public final native NativeMap<ActionInfo> actions() /*-{ return this.actions; }-*/;
-
- public final native boolean hasFetch() /*-{ return this.hasOwnProperty('fetch') }-*/;
-
- public final native NativeMap<FetchInfo> fetch() /*-{ return this.fetch; }-*/;
-
- public final native boolean
- hasPushCertificate() /*-{ return this.hasOwnProperty('push_certificate'); }-*/;
-
- public final native PushCertificateInfo
- pushCertificate() /*-{ return this.push_certificate; }-*/;
-
- public static void sortRevisionInfoByNumber(JsArray<RevisionInfo> list) {
- final int editParent = findEditParent(list);
- Natives.asList(list)
- .sort(comparing(r -> !r.isEdit() ? 2 * (r._number() - 1) + 1 : 2 * editParent));
- }
-
- public static int findEditParent(JsArray<RevisionInfo> list) {
- RevisionInfo r = findEditParentRevision(list);
- return r == null ? -1 : r._number();
- }
-
- public static RevisionInfo findEditParentRevision(JsArray<RevisionInfo> list) {
- for (int i = 0; i < list.length(); i++) {
- // edit under revisions?
- RevisionInfo editInfo = list.get(i);
- if (editInfo.isEdit()) {
- String parentRevision = editInfo.editBase();
- // find parent
- for (int j = 0; j < list.length(); j++) {
- RevisionInfo parentInfo = list.get(j);
- String name = parentInfo.name();
- if (name.equals(parentRevision)) {
- // found parent pacth set number
- return parentInfo;
- }
- }
- }
- }
- return null;
- }
-
- public final String id() {
- return PatchSet.Id.toId(_number());
- }
-
- public final boolean isMerge() {
- return commit().parents().length() > 1;
- }
-
- protected RevisionInfo() {}
- }
-
- public static class FetchInfo extends JavaScriptObject {
- public final native String url() /*-{ return this.url }-*/;
-
- public final native String ref() /*-{ return this.ref }-*/;
-
- public final native NativeMap<NativeString> commands() /*-{ return this.commands }-*/;
-
- public final native String command(String n) /*-{ return this.commands[n]; }-*/;
-
- protected FetchInfo() {}
- }
-
- public static class CommitInfo extends JavaScriptObject {
- public final native String commit() /*-{ return this.commit; }-*/;
-
- public final native JsArray<CommitInfo> parents() /*-{ return this.parents; }-*/;
-
- public final native GitPerson author() /*-{ return this.author; }-*/;
-
- public final native GitPerson committer() /*-{ return this.committer; }-*/;
-
- public final native String subject() /*-{ return this.subject; }-*/;
-
- public final native String message() /*-{ return this.message; }-*/;
-
- public final native JsArray<WebLinkInfo> webLinks() /*-{ return this.web_links; }-*/;
-
- protected CommitInfo() {}
- }
-
- public static class GitPerson extends JavaScriptObject {
- public final native String name() /*-{ return this.name; }-*/;
-
- public final native String email() /*-{ return this.email; }-*/;
-
- private native String dateRaw() /*-{ return this.date; }-*/;
-
- public final Timestamp date() {
- return JavaSqlTimestamp_JsonSerializer.parseTimestamp(dateRaw());
- }
-
- protected GitPerson() {}
- }
-
- public static class MessageInfo extends JavaScriptObject {
- public final native AccountInfo author() /*-{ return this.author; }-*/;
-
- public final native String message() /*-{ return this.message; }-*/;
-
- public final native int _revisionNumber() /*-{ return this._revision_number || 0; }-*/;
-
- public final native String tag() /*-{ return this.tag; }-*/;
-
- private native String dateRaw() /*-{ return this.date; }-*/;
-
- public final Timestamp date() {
- return JavaSqlTimestamp_JsonSerializer.parseTimestamp(dateRaw());
- }
-
- protected MessageInfo() {}
- }
-
- public static class MergeableInfo extends JavaScriptObject {
- public final native String submitType() /*-{ return this.submit_type }-*/;
-
- public final native boolean mergeable() /*-{ return this.mergeable }-*/;
-
- protected MergeableInfo() {}
- }
-
- public static class IncludedInInfo extends JavaScriptObject {
- public final Set<String> externalNames() {
- return Natives.keys(external());
- }
-
- public final native JsArrayString branches() /*-{ return this.branches; }-*/;
-
- public final native JsArrayString tags() /*-{ return this.tags; }-*/;
-
- public final native JsArrayString external(String n) /*-{ return this.external[n]; }-*/;
-
- private native NativeMap<JsArrayString> external() /*-{ return this.external; }-*/;
-
- protected IncludedInInfo() {}
- }
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/DownloadInfo.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/DownloadInfo.java
deleted file mode 100644
index a22a1e8..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/DownloadInfo.java
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright (C) 2015 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.client.info;
-
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArrayString;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public class DownloadInfo extends JavaScriptObject {
- public final List<String> schemes() {
- return _schemes().sortedKeys();
- }
-
- public final List<String> archives() {
- List<String> archives = new ArrayList<>();
- archives.addAll(Natives.asList(_archives()));
- return archives;
- }
-
- public final native DownloadSchemeInfo scheme(String n) /*-{ return this.schemes[n]; }-*/;
-
- private native NativeMap<DownloadSchemeInfo> _schemes() /*-{ return this.schemes; }-*/;
-
- private native JsArrayString _archives() /*-{ return this.archives; }-*/;
-
- protected DownloadInfo() {}
-
- public static class DownloadSchemeInfo extends JavaScriptObject {
- public final List<String> commandNames() {
- return _commands().sortedKeys();
- }
-
- public final Set<DownloadCommandInfo> commands(String project) {
- Set<DownloadCommandInfo> commands = new HashSet<>();
- for (String commandName : commandNames()) {
- commands.add(new DownloadCommandInfo(commandName, command(commandName, project)));
- }
- return commands;
- }
-
- public final String command(String commandName, String project) {
- return command(commandName).replaceAll("\\$\\{project\\}", project);
- }
-
- private static String projectBaseName(String project) {
- return project.substring(project.lastIndexOf('/') + 1);
- }
-
- public final List<String> cloneCommandNames() {
- return _cloneCommands().sortedKeys();
- }
-
- public final List<DownloadCommandInfo> cloneCommands(String project) {
- List<String> commandNames = cloneCommandNames();
- List<DownloadCommandInfo> commands = new ArrayList<>(commandNames.size());
- for (String commandName : commandNames) {
- commands.add(new DownloadCommandInfo(commandName, cloneCommand(commandName, project)));
- }
- return commands;
- }
-
- public final String cloneCommand(String commandName, String project) {
- return cloneCommand(commandName)
- .replaceAll("\\$\\{project\\}", project)
- .replaceAll("\\$\\{project-base-name\\}", projectBaseName(project));
- }
-
- public final String getUrl(String project) {
- return url().replaceAll("\\$\\{project\\}", project);
- }
-
- public final native String name() /*-{ return this.name; }-*/;
-
- public final native String url() /*-{ return this.url; }-*/;
-
- public final native boolean isAuthRequired() /*-{ return this.is_auth_required || false; }-*/;
-
- public final native boolean isAuthSupported() /*-{ return this.is_auth_supported || false; }-*/;
-
- public final native String command(String n) /*-{ return this.commands[n]; }-*/;
-
- public final native String cloneCommand(String n) /*-{ return this.clone_commands[n]; }-*/;
-
- private native NativeMap<NativeString> _commands() /*-{ return this.commands; }-*/;
-
- private native NativeMap<NativeString> _cloneCommands() /*-{ return this.clone_commands; }-*/;
-
- protected DownloadSchemeInfo() {}
- }
-
- public static class DownloadCommandInfo {
- private final String name;
- private final String command;
-
- DownloadCommandInfo(String name, String command) {
- this.name = name;
- this.command = command;
- }
-
- public String name() {
- return name;
- }
-
- public String command() {
- return command;
- }
- }
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/FileInfo.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/FileInfo.java
deleted file mode 100644
index fc3dbf1..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/FileInfo.java
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (C) 2013 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.client.info;
-
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.common.data.FilenameComparator;
-import com.google.gerrit.reviewdb.client.Patch;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import java.util.Comparator;
-
-public class FileInfo extends JavaScriptObject {
- public final native String path() /*-{ return this.path; }-*/;
-
- public final native String oldPath() /*-{ return this.old_path; }-*/;
-
- public final native int linesInserted() /*-{ return this.lines_inserted || 0; }-*/;
-
- public final native int linesDeleted() /*-{ return this.lines_deleted || 0; }-*/;
-
- public final native boolean binary() /*-{ return this.binary || false; }-*/;
-
- public final native String status() /*-{ return this.status; }-*/;
-
- // JSNI methods cannot have 'long' as a parameter type or a return type and
- // it's suggested to use double in this case:
- // http://www.gwtproject.org/doc/latest/DevGuideCodingBasicsJSNI.html#important
- public final long size() {
- return (long) _size();
- }
-
- private native double _size() /*-{ return this.size || 0; }-*/;
-
- public final long sizeDelta() {
- return (long) _sizeDelta();
- }
-
- private native double _sizeDelta() /*-{ return this.size_delta || 0; }-*/;
-
- public final native int _row() /*-{ return this._row }-*/;
-
- public final native void _row(int r) /*-{ this._row = r }-*/;
-
- public static void sortFileInfoByPath(JsArray<FileInfo> list) {
- Natives.asList(list).sort(Comparator.comparing(FileInfo::path, FilenameComparator.INSTANCE));
- }
-
- public static String getFileName(String path) {
- String fileName;
- if (Patch.COMMIT_MSG.equals(path)) {
- fileName = "Commit Message";
- } else if (Patch.MERGE_LIST.equals(path)) {
- fileName = "Merge List";
- } else {
- fileName = path;
- }
-
- int s = fileName.lastIndexOf('/');
- return s >= 0 ? fileName.substring(s + 1) : fileName;
- }
-
- protected FileInfo() {}
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/GeneralPreferences.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/GeneralPreferences.java
deleted file mode 100644
index fbdf52c..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/GeneralPreferences.java
+++ /dev/null
@@ -1,274 +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.client.info;
-
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.extensions.client.GeneralPreferencesInfo;
-import com.google.gerrit.extensions.client.GeneralPreferencesInfo.DateFormat;
-import com.google.gerrit.extensions.client.GeneralPreferencesInfo.DefaultBase;
-import com.google.gerrit.extensions.client.GeneralPreferencesInfo.DiffView;
-import com.google.gerrit.extensions.client.GeneralPreferencesInfo.DownloadCommand;
-import com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailFormat;
-import com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy;
-import com.google.gerrit.extensions.client.GeneralPreferencesInfo.ReviewCategoryStrategy;
-import com.google.gerrit.extensions.client.GeneralPreferencesInfo.TimeFormat;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class GeneralPreferences extends JavaScriptObject {
- public static GeneralPreferences create() {
- return createObject().cast();
- }
-
- public static GeneralPreferences createDefault() {
- GeneralPreferencesInfo d = GeneralPreferencesInfo.defaults();
- GeneralPreferences p = createObject().cast();
- p.changesPerPage(d.changesPerPage);
- p.showSiteHeader(d.showSiteHeader);
- p.useFlashClipboard(d.useFlashClipboard);
- p.downloadScheme(d.downloadScheme);
- p.downloadCommand(d.downloadCommand);
- p.dateFormat(d.getDateFormat());
- p.timeFormat(d.getTimeFormat());
- p.highlightAssigneeInChangeTable(d.highlightAssigneeInChangeTable);
- p.relativeDateInChangeTable(d.relativeDateInChangeTable);
- p.sizeBarInChangeTable(d.sizeBarInChangeTable);
- p.legacycidInChangeTable(d.legacycidInChangeTable);
- p.muteCommonPathPrefixes(d.muteCommonPathPrefixes);
- p.signedOffBy(d.signedOffBy);
- p.emailFormat(d.emailFormat);
- p.reviewCategoryStrategy(d.getReviewCategoryStrategy());
- p.diffView(d.getDiffView());
- p.emailStrategy(d.emailStrategy);
- p.defaultBaseForMerges(d.defaultBaseForMerges);
- return p;
- }
-
- public final int changesPerPage() {
- int changesPerPage = get("changes_per_page", GeneralPreferencesInfo.DEFAULT_PAGESIZE);
- return 0 < changesPerPage ? changesPerPage : GeneralPreferencesInfo.DEFAULT_PAGESIZE;
- }
-
- private native short get(String n, int d) /*-{ return this.hasOwnProperty(n) ? this[n] : d }-*/;
-
- public final native boolean showSiteHeader() /*-{ return this.show_site_header || false }-*/;
-
- public final native boolean useFlashClipboard()
- /*-{ return this.use_flash_clipboard || false }-*/ ;
-
- public final native String downloadScheme() /*-{ return this.download_scheme }-*/;
-
- public final DownloadCommand downloadCommand() {
- String s = downloadCommandRaw();
- return s != null ? DownloadCommand.valueOf(s) : null;
- }
-
- private native String downloadCommandRaw() /*-{ return this.download_command }-*/;
-
- public final DateFormat dateFormat() {
- String s = dateFormatRaw();
- return s != null ? DateFormat.valueOf(s) : null;
- }
-
- private native String dateFormatRaw() /*-{ return this.date_format }-*/;
-
- public final TimeFormat timeFormat() {
- String s = timeFormatRaw();
- return s != null ? TimeFormat.valueOf(s) : null;
- }
-
- private native String timeFormatRaw() /*-{ return this.time_format }-*/;
-
- public final native boolean highlightAssigneeInChangeTable()
- /*-{ return this.highlight_assignee_in_change_table || false }-*/ ;
-
- public final native boolean relativeDateInChangeTable()
- /*-{ return this.relative_date_in_change_table || false }-*/ ;
-
- public final native boolean sizeBarInChangeTable()
- /*-{ return this.size_bar_in_change_table || false }-*/ ;
-
- public final native boolean legacycidInChangeTable()
- /*-{ return this.legacycid_in_change_table || false }-*/ ;
-
- public final native boolean muteCommonPathPrefixes()
- /*-{ return this.mute_common_path_prefixes || false }-*/ ;
-
- public final native boolean signedOffBy() /*-{ return this.signed_off_by || false }-*/;
-
- public final ReviewCategoryStrategy reviewCategoryStrategy() {
- String s = reviewCategeoryStrategyRaw();
- return s != null ? ReviewCategoryStrategy.valueOf(s) : ReviewCategoryStrategy.NONE;
- }
-
- private native String reviewCategeoryStrategyRaw() /*-{ return this.review_category_strategy }-*/;
-
- public final DiffView diffView() {
- String s = diffViewRaw();
- return s != null ? DiffView.valueOf(s) : null;
- }
-
- private native String diffViewRaw() /*-{ return this.diff_view }-*/;
-
- public final EmailStrategy emailStrategy() {
- String s = emailStrategyRaw();
- return s != null ? EmailStrategy.valueOf(s) : null;
- }
-
- private native String emailStrategyRaw() /*-{ return this.email_strategy }-*/;
-
- public final EmailFormat emailFormat() {
- String s = emailFormatRaw();
- return s != null ? EmailFormat.valueOf(s) : null;
- }
-
- private native String emailFormatRaw() /*-{ return this.email_format }-*/;
-
- public final DefaultBase defaultBaseForMerges() {
- String s = defaultBaseForMergesRaw();
- return s != null ? DefaultBase.valueOf(s) : null;
- }
-
- private native String defaultBaseForMergesRaw() /*-{ return this.default_base_for_merges }-*/;
-
- public final native boolean
- publishCommentsOnPush() /*-{ return this.publish_comments_on_push || false }-*/;
-
- public final native boolean
- workInProgressByDefault() /*-{ return this.work_in_progress_by_default || false }-*/;
-
- public final native JsArray<TopMenuItem> my() /*-{ return this.my; }-*/;
-
- public final native void changesPerPage(int n) /*-{ this.changes_per_page = n }-*/;
-
- public final native void showSiteHeader(boolean s) /*-{ this.show_site_header = s }-*/;
-
- public final native void useFlashClipboard(boolean u) /*-{ this.use_flash_clipboard = u }-*/;
-
- public final native void downloadScheme(String d) /*-{ this.download_scheme = d }-*/;
-
- public final void downloadCommand(DownloadCommand d) {
- downloadCommandRaw(d != null ? d.toString() : null);
- }
-
- public final native void downloadCommandRaw(String d) /*-{ this.download_command = d }-*/;
-
- public final void dateFormat(DateFormat f) {
- dateFormatRaw(f != null ? f.toString() : null);
- }
-
- private native void dateFormatRaw(String f) /*-{ this.date_format = f }-*/;
-
- public final void timeFormat(TimeFormat f) {
- timeFormatRaw(f != null ? f.toString() : null);
- }
-
- private native void timeFormatRaw(String f) /*-{ this.time_format = f }-*/;
-
- public final native void highlightAssigneeInChangeTable(boolean d)
- /*-{ this.highlight_assignee_in_change_table = d }-*/ ;
-
- public final native void relativeDateInChangeTable(boolean d)
- /*-{ this.relative_date_in_change_table = d }-*/ ;
-
- public final native void sizeBarInChangeTable(boolean s)
- /*-{ this.size_bar_in_change_table = s }-*/ ;
-
- public final native void legacycidInChangeTable(boolean s)
- /*-{ this.legacycid_in_change_table = s }-*/ ;
-
- public final native void muteCommonPathPrefixes(boolean s)
- /*-{ this.mute_common_path_prefixes = s }-*/ ;
-
- public final native void signedOffBy(boolean s) /*-{ this.signed_off_by = s }-*/;
-
- public final void reviewCategoryStrategy(ReviewCategoryStrategy s) {
- reviewCategoryStrategyRaw(s != null ? s.toString() : null);
- }
-
- private native void reviewCategoryStrategyRaw(String s)
- /*-{ this.review_category_strategy = s }-*/ ;
-
- public final void diffView(DiffView d) {
- diffViewRaw(d != null ? d.toString() : null);
- }
-
- private native void diffViewRaw(String d) /*-{ this.diff_view = d }-*/;
-
- public final void emailStrategy(EmailStrategy s) {
- emailStrategyRaw(s != null ? s.toString() : null);
- }
-
- private native void emailStrategyRaw(String s) /*-{ this.email_strategy = s }-*/;
-
- public final void emailFormat(EmailFormat f) {
- emailFormatRaw(f != null ? f.toString() : null);
- }
-
- private native void emailFormatRaw(String s) /*-{ this.email_format = s }-*/;
-
- public final void defaultBaseForMerges(DefaultBase b) {
- defaultBaseForMergesRaw(b != null ? b.toString() : null);
- }
-
- private native void defaultBaseForMergesRaw(String b) /*-{ this.default_base_for_merges = b }-*/;
-
- public final native void publishCommentsOnPush(
- boolean p) /*-{ this.publish_comments_on_push = p }-*/;
-
- public final native void workInProgressByDefault(
- boolean p) /*-{ this.work_in_progress_by_default = p }-*/;
-
- public final void setMyMenus(List<TopMenuItem> myMenus) {
- initMy();
- for (TopMenuItem n : myMenus) {
- addMy(n);
- }
- }
-
- final native void initMy() /*-{ this.my = []; }-*/;
-
- final native void addMy(TopMenuItem m) /*-{ this.my.push(m); }-*/;
-
- public final Map<String, String> urlAliases() {
- Map<String, String> urlAliases = new HashMap<>();
- for (String k : Natives.keys(_urlAliases())) {
- urlAliases.put(k, urlAliasToken(k));
- }
- return urlAliases;
- }
-
- private native String urlAliasToken(String m) /*-{ return this.url_aliases[m]; }-*/;
-
- private native NativeMap<NativeString> _urlAliases() /*-{ return this.url_aliases; }-*/;
-
- public final void setUrlAliases(Map<String, String> urlAliases) {
- initUrlAliases();
- for (Map.Entry<String, String> e : urlAliases.entrySet()) {
- putUrlAlias(e.getKey(), e.getValue());
- }
- }
-
- private native void putUrlAlias(String m, String t) /*-{ this.url_aliases[m] = t; }-*/;
-
- private native void initUrlAliases() /*-{ this.url_aliases = {}; }-*/;
-
- protected GeneralPreferences() {}
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/GerritInfo.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/GerritInfo.java
deleted file mode 100644
index 78ca417..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/GerritInfo.java
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (C) 2015 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.client.info;
-
-import com.google.gerrit.extensions.client.UiType;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArrayString;
-import java.util.ArrayList;
-import java.util.List;
-
-public class GerritInfo extends JavaScriptObject {
- public final Project.NameKey allProjectsNameKey() {
- return new Project.NameKey(allProjects());
- }
-
- public final boolean isAllProjects(Project.NameKey p) {
- return allProjectsNameKey().equals(p);
- }
-
- public final Project.NameKey allUsersNameKey() {
- return new Project.NameKey(allUsers());
- }
-
- public final boolean isAllUsers(Project.NameKey p) {
- return allUsersNameKey().equals(p);
- }
-
- public final native String allProjects() /*-{ return this.all_projects; }-*/;
-
- public final native String allUsers() /*-{ return this.all_users; }-*/;
-
- public final native boolean docSearch() /*-{ return this.doc_search; }-*/;
-
- public final native String docUrl() /*-{ return this.doc_url; }-*/;
-
- public final native boolean editGpgKeys() /*-{ return this.edit_gpg_keys || false; }-*/;
-
- public final native String reportBugUrl() /*-{ return this.report_bug_url; }-*/;
-
- public final native String reportBugText() /*-{ return this.report_bug_text; }-*/;
-
- private native JsArrayString _webUis() /*-{ return this.web_uis; }-*/;
-
- public final List<UiType> webUis() {
- JsArrayString webUis = _webUis();
- List<UiType> result = new ArrayList<>(webUis.length());
- for (int i = 0; i < webUis.length(); i++) {
- UiType t = UiType.parse(webUis.get(i));
- if (t != null) {
- result.add(t);
- }
- }
- return result;
- }
-
- protected GerritInfo() {}
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/GpgKeyInfo.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/GpgKeyInfo.java
deleted file mode 100644
index fd4fde7..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/GpgKeyInfo.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (C) 2015 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.client.info;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArrayString;
-
-public class GpgKeyInfo extends JavaScriptObject {
- public enum Status {
- BAD,
- OK,
- TRUSTED;
- }
-
- public final native String id() /*-{ return this.id; }-*/;
-
- public final native String fingerprint() /*-{ return this.fingerprint; }-*/;
-
- public final native JsArrayString userIds() /*-{ return this.user_ids; }-*/;
-
- public final native String key() /*-{ return this.key; }-*/;
-
- private native String statusRaw() /*-{ return this.status; }-*/;
-
- public final Status status() {
- String s = statusRaw();
- if (s == null) {
- return null;
- }
- return Status.valueOf(s);
- }
-
- public final native boolean hasProblems() /*-{ return this.hasOwnProperty('problems'); }-*/;
-
- public final native JsArrayString problems() /*-{ return this.problems; }-*/;
-
- protected GpgKeyInfo() {}
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/GroupBaseInfo.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/GroupBaseInfo.java
deleted file mode 100644
index 94905c0..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/GroupBaseInfo.java
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (C) 2013 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.client.info;
-
-import com.google.gerrit.reviewdb.client.AccountGroup;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.http.client.URL;
-
-public class GroupBaseInfo extends JavaScriptObject {
- public final AccountGroup.UUID getGroupUUID() {
- return new AccountGroup.UUID(URL.decodeQueryString(id()));
- }
-
- public final native String id() /*-{ return this.id; }-*/;
-
- public final native String name() /*-{ return this.name; }-*/;
-
- protected GroupBaseInfo() {}
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/GroupInfo.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/GroupInfo.java
deleted file mode 100644
index 9bf3411a..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/GroupInfo.java
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (C) 2013 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.client.info;
-
-import com.google.gerrit.reviewdb.client.AccountGroup;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.http.client.URL;
-
-public class GroupInfo extends GroupBaseInfo {
- public final AccountGroup.Id getGroupId() {
- return new AccountGroup.Id(group_id());
- }
-
- public final native GroupOptionsInfo options() /*-{ return this.options; }-*/;
-
- public final native String description() /*-{ return this.description; }-*/;
-
- public final native String url() /*-{ return this.url; }-*/;
-
- public final native String owner() /*-{ return this.owner; }-*/;
-
- public final native void owner(String o) /*-{ if(o)this.owner=o; }-*/;
-
- public final native JsArray<AccountInfo> members() /*-{ return this.members; }-*/;
-
- public final native JsArray<GroupInfo> includes() /*-{ return this.includes; }-*/;
-
- private native int group_id() /*-{ return this.group_id; }-*/;
-
- private native String owner_id() /*-{ return this.owner_id; }-*/;
-
- private native void owner_id(String o) /*-{ if(o)this.owner_id=o; }-*/;
-
- public final AccountGroup.UUID getOwnerUUID() {
- String owner = owner_id();
- if (owner != null) {
- return new AccountGroup.UUID(URL.decodeQueryString(owner));
- }
- return null;
- }
-
- public final void setOwnerUUID(AccountGroup.UUID uuid) {
- owner_id(URL.encodeQueryString(uuid.get()));
- }
-
- protected GroupInfo() {}
-
- public static class GroupOptionsInfo extends JavaScriptObject {
- public final native boolean
- isVisibleToAll() /*-{ return this['visible_to_all'] ? true : false; }-*/;
-
- protected GroupOptionsInfo() {}
- }
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/OAuthTokenInfo.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/OAuthTokenInfo.java
deleted file mode 100644
index d96adaa..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/OAuthTokenInfo.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (C) 2016 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.client.info;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class OAuthTokenInfo extends JavaScriptObject {
-
- protected OAuthTokenInfo() {}
-
- public final native String username() /*-{ return this.username; }-*/;
-
- public final native String resourceHost() /*-{ return this.resource_host; }-*/;
-
- public final native String accessToken() /*-{ return this.access_token; }-*/;
-
- public final native String providerId() /*-{ return this.provider_id; }-*/;
-
- public final native String expiresAt() /*-{ return this.expires_at; }-*/;
-
- public final native String type() /*-{ return this.type; }-*/;
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/PushCertificateInfo.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/PushCertificateInfo.java
deleted file mode 100644
index fb5d932..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/PushCertificateInfo.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (C) 2015 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.client.info;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class PushCertificateInfo extends JavaScriptObject {
- public final native String certificate() /*-{ return this.certificate; }-*/;
-
- public final native GpgKeyInfo key() /*-{ return this.key; }-*/;
-
- protected PushCertificateInfo() {}
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/ServerInfo.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/ServerInfo.java
deleted file mode 100644
index d3274e6..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/ServerInfo.java
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright (C) 2015 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.client.info;
-
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArrayString;
-import java.util.HashMap;
-import java.util.Map;
-
-public class ServerInfo extends JavaScriptObject {
- public final native AuthInfo auth() /*-{ return this.auth; }-*/;
-
- public final native ChangeConfigInfo change() /*-{ return this.change; }-*/;
-
- public final native DownloadInfo download() /*-{ return this.download; }-*/;
-
- public final native GerritInfo gerrit() /*-{ return this.gerrit; }-*/;
-
- public final native PluginConfigInfo plugin() /*-{ return this.plugin; }-*/;
-
- public final native SshdInfo sshd() /*-{ return this.sshd; }-*/;
-
- public final native SuggestInfo suggest() /*-{ return this.suggest; }-*/;
-
- public final native UserConfigInfo user() /*-{ return this.user; }-*/;
-
- public final native ReceiveInfo receive() /*-{ return this.receive; }-*/;
-
- public final Map<String, String> urlAliases() {
- Map<String, String> urlAliases = new HashMap<>();
- for (String k : Natives.keys(_urlAliases())) {
- urlAliases.put(k, urlAliasToken(k));
- }
- return urlAliases;
- }
-
- public final native String urlAliasToken(String n) /*-{ return this.url_aliases[n]; }-*/;
-
- private native NativeMap<NativeString> _urlAliases() /*-{ return this.url_aliases; }-*/;
-
- public final boolean hasSshd() {
- return sshd() != null;
- }
-
- protected ServerInfo() {}
-
- public static class ChangeConfigInfo extends JavaScriptObject {
- public final native boolean allowBlame() /*-{ return this.allow_blame || false; }-*/;
-
- public final native int largeChange() /*-{ return this.large_change || 0; }-*/;
-
- public final native String replyLabel() /*-{ return this.reply_label; }-*/;
-
- public final native String replyTooltip() /*-{ return this.reply_tooltip; }-*/;
-
- public final native boolean
- showAssigneeInChangesTable() /*-{ return this.show_assignee_in_changes_table || false; }-*/;
-
- public final native int updateDelay() /*-{ return this.update_delay || 0; }-*/;
-
- public final native boolean isSubmitWholeTopicEnabled() /*-{
- return this.submit_whole_topic; }-*/;
-
- protected ChangeConfigInfo() {}
- }
-
- public static class PluginConfigInfo extends JavaScriptObject {
- public final native boolean hasAvatars() /*-{ return this.has_avatars || false; }-*/;
-
- public final native JsArrayString jsResourcePaths() /*-{
- return this.js_resource_paths || []; }-*/;
-
- protected PluginConfigInfo() {}
- }
-
- public static class SshdInfo extends JavaScriptObject {
- protected SshdInfo() {}
- }
-
- public static class SuggestInfo extends JavaScriptObject {
- public final native int from() /*-{ return this.from || 0; }-*/;
-
- protected SuggestInfo() {}
- }
-
- public static class UserConfigInfo extends JavaScriptObject {
- public final native String anonymousCowardName() /*-{ return this.anonymous_coward_name; }-*/;
-
- protected UserConfigInfo() {}
- }
-
- public static class ReceiveInfo extends JavaScriptObject {
- public final native boolean enableSignedPush()
- /*-{ return this.enable_signed_push || false; }-*/ ;
-
- protected ReceiveInfo() {}
- }
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/TopMenu.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/TopMenu.java
deleted file mode 100644
index 7e25af2..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/TopMenu.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) 2013 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.client.info;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-
-public class TopMenu extends JavaScriptObject {
-
- protected TopMenu() {}
-
- public final native String getName() /*-{ return this.name; }-*/;
-
- public final native JsArray<TopMenuItem> getItems() /*-{ return this.items; }-*/;
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/TopMenuItem.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/TopMenuItem.java
deleted file mode 100644
index 3a286a2..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/TopMenuItem.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (C) 2013 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.client.info;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class TopMenuItem extends JavaScriptObject {
- public static TopMenuItem create(String name, String url) {
- TopMenuItem i = createObject().cast();
- i.name(name);
- i.url(url);
- 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 }-*/;
-
- protected TopMenuItem() {}
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/TopMenuList.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/TopMenuList.java
deleted file mode 100644
index d7df1f7..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/TopMenuList.java
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (C) 2013 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.client.info;
-
-import com.google.gwt.core.client.JsArray;
-
-public class TopMenuList extends JsArray<TopMenu> {
-
- protected TopMenuList() {}
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/WebLinkInfo.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/WebLinkInfo.java
deleted file mode 100644
index bcf3dde..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/info/WebLinkInfo.java
+++ /dev/null
@@ -1,50 +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.client.info;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.Image;
-
-public class WebLinkInfo extends JavaScriptObject {
-
- public final native String name() /*-{ return this.name; }-*/;
-
- public final native String imageUrl() /*-{ return this.image_url; }-*/;
-
- public final native String url() /*-{ return this.url; }-*/;
-
- public final native String target() /*-{ return this.target; }-*/;
-
- protected WebLinkInfo() {}
-
- public final Anchor toAnchor() {
- Anchor a = new Anchor();
- a.setHref(url());
- if (target() != null && !target().isEmpty()) {
- a.setTarget(target());
- }
- if (imageUrl() != null && !imageUrl().isEmpty()) {
- Image img = new Image();
- img.setAltText(name());
- img.setUrl(imageUrl());
- img.setTitle(name());
- a.getElement().appendChild(img.getElement());
- } else {
- a.setText("(" + name() + ")");
- }
- return a;
- }
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/rpc/NativeMap.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/rpc/NativeMap.java
deleted file mode 100644
index 41306ff..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/rpc/NativeMap.java
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (C) 2012 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.client.rpc;
-
-import static java.util.stream.Collectors.toCollection;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-/** A map of native JSON objects, keyed by a string. */
-public class NativeMap<T extends JavaScriptObject> extends JavaScriptObject {
- public static <T extends JavaScriptObject> NativeMap<T> create() {
- return createObject().cast();
- }
-
- /**
- * Loop through the result map's entries and copy the key strings into the "name" property of the
- * corresponding child object. This only runs on the top level map of the result, and requires the
- * children to be JSON objects and not a JSON primitive (e.g. boolean or string).
- */
- public static <T extends JavaScriptObject, M extends NativeMap<T>>
- AsyncCallback<M> copyKeysIntoChildren(AsyncCallback<M> callback) {
- return copyKeysIntoChildren("name", callback);
- }
-
- /** Loop through the result map and set asProperty on the children. */
- public static <T extends JavaScriptObject, M extends NativeMap<T>>
- AsyncCallback<M> copyKeysIntoChildren(String asProperty, AsyncCallback<M> callback) {
- return new TransformCallback<M, M>(callback) {
- @Override
- protected M transform(M result) {
- result.copyKeysIntoChildren(asProperty);
- return result;
- }
- };
- }
-
- protected NativeMap() {}
-
- public final Set<String> keySet() {
- return Natives.keys(this);
- }
-
- public final List<String> sortedKeys() {
- return keySet().stream().sorted().collect(toCollection(ArrayList::new));
- }
-
- public final native JsArray<T> values() /*-{
- var s = this;
- var v = [];
- var i = 0;
- for (var k in s) {
- if (s.hasOwnProperty(k)) {
- v[i++] = s[k];
- }
- }
- return v;
- }-*/;
-
- public final int size() {
- return keySet().size();
- }
-
- public final boolean isEmpty() {
- return size() == 0;
- }
-
- public final boolean containsKey(String n) {
- return get(n) != null;
- }
-
- public final native T get(String n) /*-{ return this[n]; }-*/;
-
- public final native void put(String n, T v) /*-{ this[n] = v; }-*/;
-
- public final native void copyKeysIntoChildren(String p) /*-{
- var s = this;
- for (var k in s) {
- if (s.hasOwnProperty(k)) {
- var c = s[k];
- c[p] = k;
- }
- }
- }-*/;
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/rpc/NativeString.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/rpc/NativeString.java
deleted file mode 100644
index e0bca0e..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/rpc/NativeString.java
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (C) 2012 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.client.rpc;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-/** Wraps a String that was returned from a JSON API. */
-public final class NativeString extends JavaScriptObject {
- public static final JavaScriptObject TYPE = init();
-
- // Used from core and plugins
- private static native JavaScriptObject init() /*-{
- if ($wnd.Gerrit === undefined || $wnd.Gerrit.JsonString === undefined) {
- return function(s){this.s=s};
- } else {
- return $wnd.Gerrit.JsonString;
- }
- }-*/;
-
- static NativeString wrap(String s) {
- return wrap0(TYPE, s);
- }
-
- private static native NativeString wrap0(JavaScriptObject T, String s) /*-{ return new T(s) }-*/;
-
- public native String asString() /*-{ return this.s; }-*/;
-
- public static AsyncCallback<NativeString> unwrap(AsyncCallback<String> cb) {
- return new AsyncCallback<NativeString>() {
- @Override
- public void onSuccess(NativeString result) {
- cb.onSuccess(result != null ? result.asString() : null);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- cb.onFailure(caught);
- }
- };
- }
-
- public static boolean is(JavaScriptObject o) {
- return is(TYPE, o);
- }
-
- private static native boolean is(JavaScriptObject T, JavaScriptObject o)
- /*-{ return o instanceof T }-*/ ;
-
- protected NativeString() {}
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/rpc/Natives.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/rpc/Natives.java
deleted file mode 100644
index 1421386..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/rpc/Natives.java
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (C) 2012 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.client.rpc;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwt.json.client.JSONObject;
-import java.util.AbstractList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-
-public class Natives {
- /**
- * Get the names of defined properties on the object. The returned set iterates in the native
- * iteration order, which may match the source order.
- */
- public static Set<String> keys(JavaScriptObject obj) {
- if (obj != null) {
- return new JSONObject(obj).keySet();
- }
- return Collections.emptySet();
- }
-
- public static List<String> asList(JsArrayString arr) {
- if (arr == null) {
- return null;
- }
- return new AbstractList<String>() {
- @Override
- public String set(int index, String element) {
- String old = arr.get(index);
- arr.set(index, element);
- return old;
- }
-
- @Override
- public String get(int index) {
- return arr.get(index);
- }
-
- @Override
- public int size() {
- return arr.length();
- }
- };
- }
-
- public static <T extends JavaScriptObject> List<T> asList(JsArray<T> arr) {
- if (arr == null) {
- return null;
- }
- return new AbstractList<T>() {
- @Override
- public T set(int index, T element) {
- T old = arr.get(index);
- arr.set(index, element);
- return old;
- }
-
- @Override
- public T get(int index) {
- return arr.get(index);
- }
-
- @Override
- public int size() {
- return arr.length();
- }
- };
- }
-
- public static <T extends JavaScriptObject> JsArray<T> arrayOf(T element) {
- JsArray<T> arr = JavaScriptObject.createArray().cast();
- arr.push(element);
- return arr;
- }
-
- public static JsArrayString arrayOf(Iterable<String> elements) {
- JsArrayString arr = JavaScriptObject.createArray().cast();
- for (String elem : elements) {
- arr.push(elem);
- }
- return arr;
- }
-
- public static JsArrayString arrayOf(String element) {
- JsArrayString arr = JavaScriptObject.createArray().cast();
- arr.push(element);
- return arr;
- }
-
- private Natives() {}
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/rpc/TransformCallback.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/rpc/TransformCallback.java
deleted file mode 100644
index 00e6bb1..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/rpc/TransformCallback.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (C) 2012 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.client.rpc;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-/** Transforms a value and passes it on to another callback. */
-public abstract class TransformCallback<I, O> implements AsyncCallback<I> {
- private final AsyncCallback<O> callback;
-
- protected TransformCallback(AsyncCallback<O> callback) {
- this.callback = callback;
- }
-
- @Override
- public void onSuccess(I result) {
- callback.onSuccess(transform(result));
- }
-
- @Override
- public void onFailure(Throwable caught) {
- callback.onFailure(caught);
- }
-
- protected abstract O transform(I result);
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/ui/HighlightSuggestion.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/ui/HighlightSuggestion.java
deleted file mode 100644
index 513f570..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/ui/HighlightSuggestion.java
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (C) 2015 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.client.ui;
-
-import com.google.gwt.safehtml.shared.SafeHtmlBuilder;
-import com.google.gwt.user.client.ui.SuggestOracle.Suggestion;
-
-/** A {@code Suggestion} with highlights. */
-public class HighlightSuggestion implements Suggestion {
-
- private final String keyword;
- private final String value;
-
- public HighlightSuggestion(String keyword, String value) {
- this.keyword = keyword;
- this.value = value;
- }
-
- @Override
- public String getDisplayString() {
- int start = 0;
- int keyLen = keyword.length();
- SafeHtmlBuilder builder = new SafeHtmlBuilder();
- for (; ; ) {
- int index = value.indexOf(keyword, start);
- if (index == -1) {
- builder.appendEscaped(value.substring(start));
- break;
- }
- builder.appendEscaped(value.substring(start, index));
- builder.appendHtmlConstant("<strong>");
- start = index + keyLen;
- builder.appendEscaped(value.substring(index, start));
- builder.appendHtmlConstant("</strong>");
- }
- return builder.toSafeHtml().asString();
- }
-
- @Override
- public String getReplacementString() {
- return value;
- }
-}
diff --git a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/ui/RemoteSuggestOracle.java b/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/ui/RemoteSuggestOracle.java
deleted file mode 100644
index d66d6a6..0000000
--- a/gerrit-gwtui-common/src/main/java/com/google/gerrit/client/ui/RemoteSuggestOracle.java
+++ /dev/null
@@ -1,129 +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.google.gerrit.client.ui;
-
-import com.google.gwt.user.client.Timer;
-import com.google.gwt.user.client.ui.SuggestOracle;
-
-/**
- * Delegates to a slow SuggestOracle, such as a remote server API.
- *
- * <p>A response is only supplied to the UI if no requests were made after the oracle begin that
- * request.
- *
- * <p>When a request is made while the delegate is still processing a prior request all intermediate
- * requests are discarded and the most recent request is queued. The pending request's response is
- * discarded and the most recent request is started.
- */
-public class RemoteSuggestOracle extends SuggestOracle {
- private final SuggestOracle oracle;
- private Query query;
- private String last;
- private Timer requestRetentionTimer;
- private boolean cancelOutstandingRequest;
-
- private boolean serveSuggestions;
-
- public RemoteSuggestOracle(SuggestOracle src) {
- oracle = src;
- }
-
- public String getLast() {
- return last;
- }
-
- @Override
- public void requestSuggestions(Request req, Callback cb) {
- if (!serveSuggestions) {
- return;
- }
-
- // Use a timer for key stroke retention, such that we don't query the
- // backend for each and every keystroke we receive.
- if (requestRetentionTimer != null) {
- requestRetentionTimer.cancel();
- }
- requestRetentionTimer =
- new Timer() {
- @Override
- public void run() {
- Query q = new Query(req, cb);
- if (query == null) {
- query = q;
- q.start();
- } else {
- query = q;
- }
- }
- };
- requestRetentionTimer.schedule(200);
- }
-
- @Override
- public void requestDefaultSuggestions(Request req, Callback cb) {
- requestSuggestions(req, cb);
- }
-
- @Override
- public boolean isDisplayStringHTML() {
- return oracle.isDisplayStringHTML();
- }
-
- public void cancelOutstandingRequest() {
- if (requestRetentionTimer != null) {
- requestRetentionTimer.cancel();
- }
- if (query != null) {
- cancelOutstandingRequest = true;
- }
- }
-
- public void setServeSuggestions(boolean serveSuggestions) {
- this.serveSuggestions = serveSuggestions;
- }
-
- private class Query implements Callback {
- final Request request;
- final Callback callback;
-
- Query(Request req, Callback cb) {
- request = req;
- callback = cb;
- }
-
- void start() {
- oracle.requestSuggestions(request, this);
- }
-
- @Override
- public void onSuggestionsReady(Request req, Response res) {
- if (cancelOutstandingRequest || !serveSuggestions) {
- // If cancelOutstandingRequest() was called, we ignore this response
- cancelOutstandingRequest = false;
- query = null;
- } else if (query == this) {
- // No new request was started while this query was running.
- // Propose this request's response as the suggestions.
- query = null;
- last = request.getQuery();
- callback.onSuggestionsReady(req, res);
- } else {
- // Another query came in while this one was running. Skip
- // this response and start the most recent query.
- query.start();
- }
- }
- }
-}
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/arrow_undo.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/arrow_undo.png
deleted file mode 100644
index 6972c5e..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/arrow_undo.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/cog.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/cog.png
deleted file mode 100644
index 67de2c6..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/cog.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/comment_draft.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/comment_draft.png
deleted file mode 100644
index 3408ddf..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/comment_draft.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/cross.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/cross.png
deleted file mode 100644
index 1514d51..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/cross.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/diffy26.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/diffy26.png
deleted file mode 100644
index 88b59d8..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/diffy26.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/disk.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/disk.png
deleted file mode 100644
index 99d532e..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/disk.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/exclamation.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/exclamation.png
deleted file mode 100644
index c37bd06..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/exclamation.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/find.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/find.png
deleted file mode 100644
index 1547479..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/find.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/goDown.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/goDown.png
deleted file mode 100644
index 5d87e45..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/goDown.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/goNext.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/goNext.png
deleted file mode 100644
index 872c197..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/goNext.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/goPrev.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/goPrev.png
deleted file mode 100644
index d68f29b..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/goPrev.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/goUp.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/goUp.png
deleted file mode 100644
index f75bed4..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/goUp.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/help.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/help.png
deleted file mode 100644
index 5c87017..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/help.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/lightbulb.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/lightbulb.png
deleted file mode 100644
index d22fde8..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/lightbulb.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/listAdd.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/listAdd.png
deleted file mode 100644
index 1aa7f09..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/listAdd.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/lock.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/lock.png
deleted file mode 100644
index 2ebc4f6..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/lock.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/merge.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/merge.png
deleted file mode 100644
index 9c892db..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/merge.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/note_add.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/note_add.png
deleted file mode 100644
index abdad91..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/note_add.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/page_edit.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/page_edit.png
deleted file mode 100644
index 046811e..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/page_edit.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/page_white_put.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/page_white_put.png
deleted file mode 100644
index 884ffd6..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/page_white_put.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/resultset_down_gray.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/resultset_down_gray.png
deleted file mode 100644
index 7bdd8ea..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/resultset_down_gray.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/resultset_next_gray.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/resultset_next_gray.png
deleted file mode 100644
index 3049ef4..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/resultset_next_gray.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/resultset_up_gray.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/resultset_up_gray.png
deleted file mode 100644
index 966a25e..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/resultset_up_gray.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/sideBySideDiff.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/sideBySideDiff.png
deleted file mode 100755
index ee70080..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/sideBySideDiff.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/star-open.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/star-open.png
deleted file mode 100644
index edd577c..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/star-open.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/star.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/star.png
deleted file mode 100644
index b88c857..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/star.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/tag_blue.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/tag_blue.png
deleted file mode 100644
index 9757fc6..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/tag_blue.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/tag_blue_add.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/tag_blue_add.png
deleted file mode 100644
index f135248..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/tag_blue_add.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/tick.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/tick.png
deleted file mode 100644
index a9925a0..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/tick.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/unifiedDiff.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/unifiedDiff.png
deleted file mode 100755
index ec5f97a..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/unifiedDiff.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/user_add.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/user_add.png
deleted file mode 100644
index deae99b..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/user_add.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/user_edit.png b/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/user_edit.png
deleted file mode 100644
index c1974cd..0000000
--- a/gerrit-gwtui-common/src/main/resources/com/google/gerrit/client/user_edit.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui-common/src/test/java/com/google/gerrit/client/RelativeDateFormatterTest.java b/gerrit-gwtui-common/src/test/java/com/google/gerrit/client/RelativeDateFormatterTest.java
deleted file mode 100644
index 6915ba7..0000000
--- a/gerrit-gwtui-common/src/test/java/com/google/gerrit/client/RelativeDateFormatterTest.java
+++ /dev/null
@@ -1,216 +0,0 @@
-// Copyright (C) 2013 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.client;
-
-import static com.google.gerrit.client.RelativeDateFormatter.DAY_IN_MILLIS;
-import static com.google.gerrit.client.RelativeDateFormatter.HOUR_IN_MILLIS;
-import static com.google.gerrit.client.RelativeDateFormatter.MINUTE_IN_MILLIS;
-import static com.google.gerrit.client.RelativeDateFormatter.SECOND_IN_MILLIS;
-import static com.google.gerrit.client.RelativeDateFormatter.YEAR_IN_MILLIS;
-import static org.junit.Assert.assertEquals;
-
-import java.util.Date;
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.Test;
-
-public class RelativeDateFormatterTest {
-
- @BeforeClass
- public static void setConstants() {
- Constants c = new Constants();
- RelativeDateFormatter.setConstants(c, c);
- }
-
- @AfterClass
- public static void unsetConstants() {
- RelativeDateFormatter.setConstants(null, null);
- }
-
- private static void assertFormat(long ageFromNow, long timeUnit, String expectedFormat) {
- Date d = new Date(System.currentTimeMillis() - ageFromNow * timeUnit);
- String s = RelativeDateFormatter.format(d);
- assertEquals(expectedFormat, s);
- }
-
- @Test
- public void future() {
- assertFormat(-100, YEAR_IN_MILLIS, "in the future");
- assertFormat(-1, SECOND_IN_MILLIS, "in the future");
- }
-
- @Test
- public void formatSeconds() {
- assertFormat(1, SECOND_IN_MILLIS, "1 second ago");
- assertFormat(89, SECOND_IN_MILLIS, "89 seconds ago");
- }
-
- @Test
- public void formatMinutes() {
- assertFormat(90, SECOND_IN_MILLIS, "2 minutes ago");
- assertFormat(3, MINUTE_IN_MILLIS, "3 minutes ago");
- assertFormat(60, MINUTE_IN_MILLIS, "60 minutes ago");
- assertFormat(89, MINUTE_IN_MILLIS, "89 minutes ago");
- }
-
- @Test
- public void formatHours() {
- assertFormat(90, MINUTE_IN_MILLIS, "2 hours ago");
- assertFormat(149, MINUTE_IN_MILLIS, "2 hours ago");
- assertFormat(35, HOUR_IN_MILLIS, "35 hours ago");
- }
-
- @Test
- public void formatDays() {
- assertFormat(36, HOUR_IN_MILLIS, "2 days ago");
- assertFormat(13, DAY_IN_MILLIS, "13 days ago");
- }
-
- @Test
- public void formatWeeks() {
- assertFormat(14, DAY_IN_MILLIS, "2 weeks ago");
- assertFormat(69, DAY_IN_MILLIS, "10 weeks ago");
- }
-
- @Test
- public void formatMonths() {
- assertFormat(70, DAY_IN_MILLIS, "2 months ago");
- assertFormat(75, DAY_IN_MILLIS, "3 months ago");
- assertFormat(364, DAY_IN_MILLIS, "12 months ago");
- }
-
- @Test
- public void formatYearsMonths() {
- assertFormat(366, DAY_IN_MILLIS, "1 year ago");
- assertFormat(380, DAY_IN_MILLIS, "1 year, 1 month ago");
- assertFormat(410, DAY_IN_MILLIS, "1 year, 2 months ago");
- assertFormat(2, YEAR_IN_MILLIS, "2 years ago");
- assertFormat(1824, DAY_IN_MILLIS, "5 years ago");
- assertFormat(2 * 365 - 10, DAY_IN_MILLIS, "2 years ago");
- }
-
- @Test
- public void formatYears() {
- assertFormat(5, YEAR_IN_MILLIS, "5 years ago");
- assertFormat(60, YEAR_IN_MILLIS, "60 years ago");
- }
-
- private static class Constants implements CommonConstants, CommonMessages {
- @Override
- public String inTheFuture() {
- return "in the future";
- }
-
- @Override
- public String month() {
- return "month";
- }
-
- @Override
- public String months() {
- return "months";
- }
-
- @Override
- public String year() {
- return "year";
- }
-
- @Override
- public String years() {
- return "years";
- }
-
- @Override
- public String oneSecondAgo() {
- return "1 second ago";
- }
-
- @Override
- public String oneMinuteAgo() {
- return "1 minute ago";
- }
-
- @Override
- public String oneHourAgo() {
- return "1 hour ago";
- }
-
- @Override
- public String oneDayAgo() {
- return "1 day ago";
- }
-
- @Override
- public String oneWeekAgo() {
- return "1 week ago";
- }
-
- @Override
- public String oneMonthAgo() {
- return "1 month ago";
- }
-
- @Override
- public String oneYearAgo() {
- return "1 year ago";
- }
-
- @Override
- public String secondsAgo(long seconds) {
- return seconds + " seconds ago";
- }
-
- @Override
- public String minutesAgo(long minutes) {
- return minutes + " minutes ago";
- }
-
- @Override
- public String hoursAgo(long hours) {
- return hours + " hours ago";
- }
-
- @Override
- public String daysAgo(long days) {
- return days + " days ago";
- }
-
- @Override
- public String weeksAgo(long weeks) {
- return weeks + " weeks ago";
- }
-
- @Override
- public String monthsAgo(long months) {
- return months + " months ago";
- }
-
- @Override
- public String yearsAgo(long years) {
- return years + " years ago";
- }
-
- @Override
- public String years0MonthsAgo(long years, String yearLabel) {
- return years + " " + yearLabel + " ago";
- }
-
- @Override
- public String yearsMonthsAgo(long years, String yearLabel, long months, String monthLabel) {
- return years + " " + yearLabel + ", " + months + " " + monthLabel + " ago";
- }
- }
-}
diff --git a/gerrit-gwtui-common/src/test/java/com/google/gerrit/client/ui/HighlightSuggestionTest.java b/gerrit-gwtui-common/src/test/java/com/google/gerrit/client/ui/HighlightSuggestionTest.java
deleted file mode 100644
index 9bf2d95..0000000
--- a/gerrit-gwtui-common/src/test/java/com/google/gerrit/client/ui/HighlightSuggestionTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (C) 2015 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.client.ui;
-
-import static org.junit.Assert.assertEquals;
-
-import org.junit.Test;
-
-public class HighlightSuggestionTest {
-
- @Test
- public void singleHighlight() throws Exception {
- String keyword = "key";
- String value = "somethingkeysomething";
- HighlightSuggestion suggestion = new HighlightSuggestion(keyword, value);
- assertEquals("something<strong>key</strong>something", suggestion.getDisplayString());
- assertEquals(value, suggestion.getReplacementString());
- }
-
- @Test
- public void noHighlight() throws Exception {
- String keyword = "key";
- String value = "something";
- HighlightSuggestion suggestion = new HighlightSuggestion(keyword, value);
- assertEquals(value, suggestion.getDisplayString());
- assertEquals(value, suggestion.getReplacementString());
- }
-
- @Test
- public void doubleHighlight() throws Exception {
- String keyword = "key";
- String value = "somethingkeysomethingkeysomething";
- HighlightSuggestion suggestion = new HighlightSuggestion(keyword, value);
- assertEquals(
- "something<strong>key</strong>something<strong>key</strong>something",
- suggestion.getDisplayString());
- assertEquals(value, suggestion.getReplacementString());
- }
-}
diff --git a/gerrit-gwtui/BUILD b/gerrit-gwtui/BUILD
deleted file mode 100644
index 24718e5..0000000
--- a/gerrit-gwtui/BUILD
+++ /dev/null
@@ -1,55 +0,0 @@
-load(
- "//tools/bzl:gwt.bzl",
- "gen_ui_module",
- "gwt_genrule",
- "gwt_user_agent_permutations",
-)
-load("//tools/bzl:java.bzl", "java_library2")
-load("//tools/bzl:junit.bzl", "junit_tests")
-load("//tools/bzl:license.bzl", "license_test")
-
-gwt_genrule()
-
-gwt_genrule(suffix = "_r")
-
-gen_ui_module(name = "ui_module")
-
-gen_ui_module(
- name = "ui_module",
- suffix = "_r",
-)
-
-gwt_user_agent_permutations()
-
-java_library2(
- name = "client-lib",
- srcs = glob(["src/main/**/*.java"]),
- exported_deps = [":ui_module"],
- resources = glob(["src/main/**/*"]),
- visibility = ["//visibility:public"],
- deps = [
- "//gerrit-gwtui-common:client-lib",
- "//lib/gwt:dev",
- "//lib/gwt:user",
- ],
-)
-
-license_test(
- name = "ui_module_license_test",
- target = ":ui_module",
-)
-
-junit_tests(
- name = "ui_tests",
- srcs = glob(["src/test/java/**/*.java"]),
- visibility = ["//visibility:public"],
- deps = [
- ":ui_module",
- "//java/com/google/gerrit/common:client",
- "//java/com/google/gerrit/extensions:client",
- "//lib:junit",
- "//lib/gwt:dev",
- "//lib/gwt:user",
- "//lib/truth",
- ],
-)
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/GerritGwtUI.gwt.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/GerritGwtUI.gwt.xml
deleted file mode 100644
index 9ac919b..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/GerritGwtUI.gwt.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-<!--
- Copyright (C) 2008 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="gerrit_ui">
- <inherits name='com.google.gwt.editor.Editor'/>
- <inherits name='com.google.gwt.user.User'/>
- <inherits name='com.google.gwt.resources.Resources'/>
- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/>
- <inherits name='com.google.gwtexpui.css.CSS'/>
- <inherits name='com.google.gerrit.GerritGwtUICommon'/>
- <inherits name='com.google.gerrit.UserAgent'/>
- <inherits name='net.codemirror.CodeMirror'/>
-
- <extend-property name='locale' values='en'/>
- <set-property-fallback name='locale' value='en'/>
- <set-property name='locale' value='en'/>
- <set-configuration-property name='UiBinder.useSafeHtmlTemplates' value='true'/>
- <set-configuration-property name='CssResource.style' value='stable'/>
- <add-linker name='xsiframe'/>
-
- <set-property name='gwt.logging.logLevel' value='SEVERE'/>
-
- <!-- Disable GSS -->
- <set-configuration-property name='CssResource.enableGss' value='false'/>
-
- <entry-point class='com.google.gerrit.client.Gerrit'/>
-</module>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/UserAgent.gwt.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/UserAgent.gwt.xml
deleted file mode 100644
index 9644093..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/UserAgent.gwt.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<!--
- Copyright (C) 2009 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>
- <replace-with class="com.google.gerrit.client.api.PluginName.PluginNameMoz">
- <when-type-is class="com.google.gerrit.client.api.PluginName" />
- <when-property-is name="compiler.stackMode" value="native" />
- <when-property-is name="user.agent" value="safari" />
- <when-property-is name="user.agent" value="gecko1_8" />
- </replace-with>
-
- <replace-with class="com.google.gerrit.client.ui.FancyFlexTableImplIE8">
- <when-type-is class="com.google.gerrit.client.ui.FancyFlexTableImpl" />
- <any>
- <when-property-is name="user.agent" value="ie8"/>
- </any>
- </replace-with>
-
- <replace-with class="com.google.gerrit.client.Themer.ThemerIE">
- <when-type-is class="com.google.gerrit.client.Themer" />
- <any>
- <when-property-is name="user.agent" value="ie8"/>
- <when-property-is name="user.agent" value="ie9"/>
- <when-property-is name="user.agent" value="ie10"/>
- <when-property-is name="user.agent" value="ie11"/>
- <when-property-is name="user.agent" value="edge"/>
- </any>
- </replace-with>
-</module>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/AvatarImage.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/AvatarImage.java
deleted file mode 100644
index 107d663..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/AvatarImage.java
+++ /dev/null
@@ -1,202 +0,0 @@
-// Copyright (C) 2013 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.client;
-
-import com.google.gerrit.client.changes.Util;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.info.AccountInfo.AvatarInfo;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gwt.event.dom.client.LoadEvent;
-import com.google.gwt.event.dom.client.LoadHandler;
-import com.google.gwt.event.dom.client.MouseOutEvent;
-import com.google.gwt.event.dom.client.MouseOutHandler;
-import com.google.gwt.event.dom.client.MouseOverEvent;
-import com.google.gwt.event.dom.client.MouseOverHandler;
-import com.google.gwt.user.client.Timer;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.UIObject;
-
-public class AvatarImage extends Image implements LoadHandler {
- public AvatarImage() {
- setVisible(false);
- addLoadHandler(this);
- }
-
- /** A default sized avatar image. */
- public AvatarImage(AccountInfo account) {
- this(account, AccountInfo.AvatarInfo.DEFAULT_SIZE, true);
- }
-
- /**
- * An avatar image for the given account using the requested size.
- *
- * @param account The account in which we are interested
- * @param size A requested size. Note that the size can be ignored depending on the avatar
- * provider. A size <= 0 indicates to let the provider decide a default size.
- * @param addPopup show avatar popup with user info on hovering over the avatar image
- */
- public AvatarImage(AccountInfo account, int size, boolean addPopup) {
- addLoadHandler(this);
- setAccount(account, size, addPopup);
- }
-
- public void setAccount(AccountInfo account, int size, boolean addPopup) {
- if (account == null) {
- setVisible(false);
- } else if (isGerritServer(account)) {
- setVisible(true);
- setResource(Gerrit.RESOURCES.gerritAvatar26());
- } else if (account.hasAvatarInfo()) {
- setVisible(false);
- AvatarInfo info = account.avatar(size);
- if (info != null) {
- setWidth(info.width() > 0 ? info.width() + "px" : "");
- setHeight(info.height() > 0 ? info.height() + "px" : "");
- setUrl(info.url());
- popup(account, addPopup);
- } else if (account.email() != null) {
- loadAvatar(account, size, addPopup);
- }
- } else if (account.email() != null) {
- loadAvatar(account, size, addPopup);
- } else {
- setVisible(false);
- }
- }
-
- private void loadAvatar(AccountInfo account, int size, boolean addPopup) {
- if (!Gerrit.info().plugin().hasAvatars()) {
- setVisible(false);
- return;
- }
-
- // TODO Kill /accounts/*/avatar URL.
- String u = account.email();
- if (Gerrit.isSignedIn() && u.equals(Gerrit.getUserAccount().email())) {
- u = "self";
- }
- RestApi api = new RestApi("/accounts/").id(u).view("avatar");
- if (size > 0) {
- api.addParameter("s", size);
- setSize("", size + "px");
- }
- setVisible(false);
- setUrl(api.url());
- popup(account, addPopup);
- }
-
- private void popup(AccountInfo account, boolean addPopup) {
- if (addPopup) {
- PopupHandler popupHandler = new PopupHandler(account, this);
- addMouseOverHandler(popupHandler);
- addMouseOutHandler(popupHandler);
- }
- }
-
- @Override
- public void onLoad(LoadEvent event) {
- setVisible(true);
- }
-
- private static boolean isGerritServer(AccountInfo account) {
- return account._accountId() == 0 && Util.C.messageNoAuthor().equals(account.name());
- }
-
- private static class PopupHandler implements MouseOverHandler, MouseOutHandler {
- private final AccountInfo account;
- private final UIObject target;
-
- private UserPopupPanel popup;
- private Timer showTimer;
- private Timer hideTimer;
-
- PopupHandler(AccountInfo account, UIObject target) {
- this.account = account;
- this.target = target;
- }
-
- private UserPopupPanel createPopupPanel(AccountInfo account) {
- UserPopupPanel popup = new UserPopupPanel(account, false, false);
- popup.addDomHandler(
- new MouseOverHandler() {
- @Override
- public void onMouseOver(MouseOverEvent event) {
- scheduleShow();
- }
- },
- MouseOverEvent.getType());
- popup.addDomHandler(
- new MouseOutHandler() {
- @Override
- public void onMouseOut(MouseOutEvent event) {
- scheduleHide();
- }
- },
- MouseOutEvent.getType());
- return popup;
- }
-
- @Override
- public void onMouseOver(MouseOverEvent event) {
- scheduleShow();
- }
-
- @Override
- public void onMouseOut(MouseOutEvent event) {
- scheduleHide();
- }
-
- private void scheduleShow() {
- if (hideTimer != null) {
- hideTimer.cancel();
- hideTimer = null;
- }
- if ((popup != null && popup.isShowing() && popup.isVisible()) || showTimer != null) {
- return;
- }
- showTimer =
- new Timer() {
- @Override
- public void run() {
- if (popup == null) {
- popup = createPopupPanel(account);
- }
- if (!popup.isShowing() || !popup.isVisible()) {
- popup.showRelativeTo(target);
- }
- }
- };
- showTimer.schedule(600);
- }
-
- private void scheduleHide() {
- if (showTimer != null) {
- showTimer.cancel();
- showTimer = null;
- }
- if (popup == null || !popup.isShowing() || !popup.isVisible() || hideTimer != null) {
- return;
- }
- hideTimer =
- new Timer() {
- @Override
- public void run() {
- popup.hide();
- }
- };
- hideTimer.schedule(50);
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ConfirmationCallback.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ConfirmationCallback.java
deleted file mode 100644
index cc30873..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ConfirmationCallback.java
+++ /dev/null
@@ -1,33 +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.google.gerrit.client;
-
-/**
- * Interface that a caller must implement to react on the result of a {@link ConfirmationDialog}.
- */
-public abstract class ConfirmationCallback {
-
- /**
- * Called when the {@link ConfirmationDialog} is finished with OK. To be overwritten by
- * subclasses.
- */
- public abstract void onOk();
-
- /**
- * Called when the {@link ConfirmationDialog} is finished with Cancel. To be overwritten by
- * subclasses.
- */
- public void onCancel() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ConfirmationDialog.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ConfirmationDialog.java
deleted file mode 100644
index 438df34..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ConfirmationDialog.java
+++ /dev/null
@@ -1,88 +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.google.gerrit.client;
-
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.safehtml.client.SafeHtml;
-import com.google.gwtexpui.user.client.AutoCenterDialogBox;
-
-public class ConfirmationDialog extends AutoCenterDialogBox {
-
- private Button cancelButton;
- private Button okButton;
-
- public ConfirmationDialog(
- final String dialogTitle, SafeHtml message, ConfirmationCallback callback) {
- super(/* auto hide */ false, /* modal */ true);
- setGlassEnabled(true);
- setText(dialogTitle);
-
- final FlowPanel buttons = new FlowPanel();
-
- okButton = new Button();
- okButton.setText(Gerrit.C.confirmationDialogOk());
- okButton.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- hide();
- callback.onOk();
- }
- });
- buttons.add(okButton);
-
- cancelButton = new Button();
- cancelButton.getElement().getStyle().setProperty("marginLeft", "300px");
- cancelButton.setText(Gerrit.C.confirmationDialogCancel());
- cancelButton.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- hide();
- callback.onCancel();
- }
- });
- buttons.add(cancelButton);
-
- final FlowPanel center = new FlowPanel();
- final Widget msgWidget = message.toBlockWidget();
- center.add(msgWidget);
- center.add(buttons);
- add(center);
-
- msgWidget.setWidth("400px");
-
- setWidget(center);
- }
-
- @Override
- public void center() {
- super.center();
- GlobalKey.dialog(this);
- cancelButton.setFocus(true);
- }
-
- public void setCancelVisible(boolean visible) {
- cancelButton.setVisible(visible);
- if (!visible) {
- okButton.setFocus(true);
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/DiffObject.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/DiffObject.java
deleted file mode 100644
index 21ced4c..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/DiffObject.java
+++ /dev/null
@@ -1,183 +0,0 @@
-// Copyright (C) 2016 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.client;
-
-import com.google.gerrit.extensions.client.GeneralPreferencesInfo.DefaultBase;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.PatchSet;
-
-/**
- * Represent an object that can be diffed. This can be either a regular patch set, the base of a
- * patch set, the parent of a merge, the auto-merge of a merge or an edit patch set.
- */
-public class DiffObject {
- public static final String AUTO_MERGE = "AutoMerge";
-
- /**
- * Parses a string that represents a diff object.
- *
- * <p>The following string representations are supported:
- *
- * <ul>
- * <li>a positive integer: represents a patch set
- * <li>a negative integer: represents a parent of a merge patch set
- * <li>'0': represents the edit patch set
- * <li>empty string or null: represents the parent of a 1-parent patch set, also called base
- * <li>'AutoMerge': represents the auto-merge of a merge patch set
- * </ul>
- *
- * @param changeId the ID of the change to which the diff object belongs
- * @param str the string representation of the diff object
- * @return the parsed diff object, {@code null} if str cannot be parsed as diff object
- */
- public static DiffObject parse(Change.Id changeId, String str) {
- if (str == null || str.isEmpty()) {
- return new DiffObject(false);
- }
-
- if (AUTO_MERGE.equals(str)) {
- return new DiffObject(true);
- }
-
- return new DiffObject(Dispatcher.toPsId(changeId, str));
- }
-
- /** Create a DiffObject that represents the parent of a 1-parent patch set. */
- public static DiffObject base() {
- return new DiffObject(false);
- }
-
- /** Create a DiffObject that represents the auto-merge for a merge patch set. */
- public static DiffObject autoMerge() {
- return new DiffObject(true);
- }
-
- /** Create a DiffObject that represents a patch set. */
- public static DiffObject patchSet(PatchSet.Id psId) {
- return new DiffObject(psId);
- }
-
- private final PatchSet.Id psId;
- private final boolean autoMerge;
-
- private DiffObject(PatchSet.Id psId) {
- this.psId = psId;
- this.autoMerge = false;
- }
-
- private DiffObject(boolean autoMerge) {
- this.psId = null;
- this.autoMerge = autoMerge;
- }
-
- public boolean isBase() {
- return psId == null && !autoMerge;
- }
-
- public boolean isAutoMerge() {
- return psId == null && autoMerge;
- }
-
- public boolean isBaseOrAutoMerge() {
- return psId == null;
- }
-
- public boolean isPatchSet() {
- return psId != null && psId.get() > 0;
- }
-
- public boolean isParent() {
- return psId != null && psId.get() < 0;
- }
-
- public boolean isEdit() {
- return psId != null && psId.get() == 0;
- }
-
- /**
- * Returns the DiffObject as PatchSet.Id.
- *
- * @return PatchSet.Id with an id > 0 for a regular patch set; PatchSet.Id with an id < 0 for a
- * parent of a merge; PatchSet.Id with id == 0 for an edit patch set; {@code null} for the
- * base of a 1-parent patch set and for the auto-merge of a merge patch set
- */
- public PatchSet.Id asPatchSetId() {
- return psId;
- }
-
- /**
- * Returns the parent number for a parent of a merge.
- *
- * @return 1-based parent number, 0 if this DiffObject is not a parent of a merge
- */
- public int getParentNum() {
- if (!isParent()) {
- return 0;
- }
-
- return -psId.get();
- }
-
- /**
- * Returns a string representation of this DiffObject that can be used in URLs.
- *
- * <p>The following string representations are returned:
- *
- * <ul>
- * <li>a positive integer for a patch set
- * <li>a negative integer for a parent of a merge patch set
- * <li>'0' for the edit patch set
- * <li>{@code null} for the parent of a 1-parent patch set, also called base
- * <li>'AutoMerge' for the auto-merge of a merge patch set
- * </ul>
- *
- * @return string representation of this DiffObject
- */
- public String asString() {
- if (autoMerge) {
- if (Gerrit.getUserPreferences().defaultBaseForMerges() != DefaultBase.AUTO_MERGE) {
- return AUTO_MERGE;
- }
- return null;
- }
-
- if (psId != null) {
- return psId.getId();
- }
-
- return null;
- }
-
- @Override
- public String toString() {
- if (isPatchSet()) {
- return "Patch Set " + psId.getId();
- }
-
- if (isParent()) {
- return "Parent " + psId.getId();
- }
-
- if (isEdit()) {
- return "Edit Patch Set";
- }
-
- if (isAutoMerge()) {
- return "Auto Merge";
- }
-
- return "Base";
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/DiffWebLinkInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/DiffWebLinkInfo.java
deleted file mode 100644
index fe7016f..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/DiffWebLinkInfo.java
+++ /dev/null
@@ -1,27 +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.client;
-
-import com.google.gerrit.client.info.WebLinkInfo;
-
-public class DiffWebLinkInfo extends WebLinkInfo {
- public final native boolean showOnSideBySideDiffView()
- /*-{ return this.show_on_side_by_side_diff_view || false; }-*/ ;
-
- public final native boolean showOnUnifiedDiffView()
- /*-{ return this.show_on_unified_diff_view || false; }-*/ ;
-
- protected DiffWebLinkInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Dispatcher.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Dispatcher.java
deleted file mode 100644
index 4b84864..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Dispatcher.java
+++ /dev/null
@@ -1,879 +0,0 @@
-// Copyright (C) 2008 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.client;
-
-import static com.google.gerrit.common.PageLinks.ADMIN_CREATE_GROUP;
-import static com.google.gerrit.common.PageLinks.ADMIN_CREATE_PROJECT;
-import static com.google.gerrit.common.PageLinks.ADMIN_GROUPS;
-import static com.google.gerrit.common.PageLinks.ADMIN_PLUGINS;
-import static com.google.gerrit.common.PageLinks.ADMIN_PROJECTS;
-import static com.google.gerrit.common.PageLinks.DASHBOARDS;
-import static com.google.gerrit.common.PageLinks.MINE;
-import static com.google.gerrit.common.PageLinks.MY_GROUPS;
-import static com.google.gerrit.common.PageLinks.PROJECTS;
-import static com.google.gerrit.common.PageLinks.QUERY;
-import static com.google.gerrit.common.PageLinks.REGISTER;
-import static com.google.gerrit.common.PageLinks.SETTINGS;
-import static com.google.gerrit.common.PageLinks.SETTINGS_AGREEMENTS;
-import static com.google.gerrit.common.PageLinks.SETTINGS_CONTACT;
-import static com.google.gerrit.common.PageLinks.SETTINGS_DIFF_PREFERENCES;
-import static com.google.gerrit.common.PageLinks.SETTINGS_EDIT_PREFERENCES;
-import static com.google.gerrit.common.PageLinks.SETTINGS_EXTENSION;
-import static com.google.gerrit.common.PageLinks.SETTINGS_GPGKEYS;
-import static com.google.gerrit.common.PageLinks.SETTINGS_HTTP_PASSWORD;
-import static com.google.gerrit.common.PageLinks.SETTINGS_MYGROUPS;
-import static com.google.gerrit.common.PageLinks.SETTINGS_NEW_AGREEMENT;
-import static com.google.gerrit.common.PageLinks.SETTINGS_OAUTH_TOKEN;
-import static com.google.gerrit.common.PageLinks.SETTINGS_PREFERENCES;
-import static com.google.gerrit.common.PageLinks.SETTINGS_PROJECTS;
-import static com.google.gerrit.common.PageLinks.SETTINGS_SSHKEYS;
-import static com.google.gerrit.common.PageLinks.SETTINGS_WEBIDENT;
-
-import com.google.gerrit.client.account.MyAgreementsScreen;
-import com.google.gerrit.client.account.MyContactInformationScreen;
-import com.google.gerrit.client.account.MyDiffPreferencesScreen;
-import com.google.gerrit.client.account.MyEditPreferencesScreen;
-import com.google.gerrit.client.account.MyGpgKeysScreen;
-import com.google.gerrit.client.account.MyGroupsScreen;
-import com.google.gerrit.client.account.MyIdentitiesScreen;
-import com.google.gerrit.client.account.MyOAuthTokenScreen;
-import com.google.gerrit.client.account.MyPasswordScreen;
-import com.google.gerrit.client.account.MyPreferencesScreen;
-import com.google.gerrit.client.account.MyProfileScreen;
-import com.google.gerrit.client.account.MySshKeysScreen;
-import com.google.gerrit.client.account.MyWatchedProjectsScreen;
-import com.google.gerrit.client.account.NewAgreementScreen;
-import com.google.gerrit.client.account.RegisterScreen;
-import com.google.gerrit.client.account.ValidateEmailScreen;
-import com.google.gerrit.client.admin.AccountGroupAuditLogScreen;
-import com.google.gerrit.client.admin.AccountGroupInfoScreen;
-import com.google.gerrit.client.admin.AccountGroupMembersScreen;
-import com.google.gerrit.client.admin.AccountGroupScreen;
-import com.google.gerrit.client.admin.CreateGroupScreen;
-import com.google.gerrit.client.admin.CreateProjectScreen;
-import com.google.gerrit.client.admin.GroupListScreen;
-import com.google.gerrit.client.admin.PluginListScreen;
-import com.google.gerrit.client.admin.ProjectAccessScreen;
-import com.google.gerrit.client.admin.ProjectBranchesScreen;
-import com.google.gerrit.client.admin.ProjectDashboardsScreen;
-import com.google.gerrit.client.admin.ProjectInfoScreen;
-import com.google.gerrit.client.admin.ProjectListScreen;
-import com.google.gerrit.client.admin.ProjectScreen;
-import com.google.gerrit.client.admin.ProjectTagsScreen;
-import com.google.gerrit.client.api.ExtensionScreen;
-import com.google.gerrit.client.api.ExtensionSettingsScreen;
-import com.google.gerrit.client.change.ChangeScreen;
-import com.google.gerrit.client.change.FileTable;
-import com.google.gerrit.client.change.ProjectChangeId;
-import com.google.gerrit.client.changes.AccountDashboardScreen;
-import com.google.gerrit.client.changes.CustomDashboardScreen;
-import com.google.gerrit.client.changes.ProjectDashboardScreen;
-import com.google.gerrit.client.changes.QueryScreen;
-import com.google.gerrit.client.dashboards.DashboardInfo;
-import com.google.gerrit.client.dashboards.DashboardList;
-import com.google.gerrit.client.diff.DisplaySide;
-import com.google.gerrit.client.diff.SideBySide;
-import com.google.gerrit.client.diff.Unified;
-import com.google.gerrit.client.documentation.DocScreen;
-import com.google.gerrit.client.editor.EditScreen;
-import com.google.gerrit.client.groups.GroupApi;
-import com.google.gerrit.client.info.GroupInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.client.ui.Screen;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.extensions.client.GeneralPreferencesInfo.DiffView;
-import com.google.gerrit.reviewdb.client.AccountGroup;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Patch;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.RunAsyncCallback;
-import com.google.gwt.http.client.URL;
-import com.google.gwtexpui.user.client.UserAgent;
-import com.google.gwtorm.client.KeyUtil;
-
-public class Dispatcher {
- public static String toPatch(
- @Nullable Project.NameKey project,
- DiffObject diffBase,
- PatchSet.Id revision,
- String fileName) {
- return toPatch("", project, diffBase, revision, fileName, null, 0);
- }
-
- public static String toPatch(
- @Nullable Project.NameKey project,
- DiffObject diffBase,
- PatchSet.Id revision,
- String fileName,
- DisplaySide side,
- int line) {
- return toPatch("", project, diffBase, revision, fileName, side, line);
- }
-
- public static String toSideBySide(
- @Nullable Project.NameKey project,
- DiffObject diffBase,
- PatchSet.Id revision,
- String fileName) {
- return toPatch("sidebyside", project, diffBase, revision, fileName, null, 0);
- }
-
- public static String toUnified(
- @Nullable Project.NameKey project,
- DiffObject diffBase,
- PatchSet.Id revision,
- String fileName) {
- return toPatch("unified", project, diffBase, revision, fileName, null, 0);
- }
-
- public static String toPatch(
- @Nullable Project.NameKey project, String type, DiffObject diffBase, Patch.Key id) {
- return toPatch(type, project, diffBase, id.getParentKey(), id.get(), null, 0);
- }
-
- public static String toEditScreen(
- @Nullable Project.NameKey project, PatchSet.Id revision, String fileName) {
- return toEditScreen(project, revision, fileName, 0);
- }
-
- public static String toEditScreen(
- @Nullable Project.NameKey project, PatchSet.Id revision, String fileName, int line) {
- return toPatch("edit", project, DiffObject.base(), revision, fileName, null, line);
- }
-
- private static String toPatch(
- String type,
- @Nullable Project.NameKey project,
- DiffObject diffBase,
- PatchSet.Id revision,
- String fileName,
- DisplaySide side,
- int line) {
- Change.Id c = revision.getParentKey();
- StringBuilder p = new StringBuilder(PageLinks.toChange(project, c));
- if (diffBase != null && diffBase.asString() != null) {
- p.append(diffBase.asString()).append("..");
- }
- p.append(revision.getId()).append("/").append(KeyUtil.encode(fileName));
- if (type != null && !type.isEmpty() && (!"sidebyside".equals(type) || preferUnified())) {
- p.append(",").append(type);
- }
- if (side == DisplaySide.A && line > 0) {
- p.append("@a").append(line);
- } else if (line > 0) {
- p.append("@").append(line);
- }
- return p.toString();
- }
-
- public static String toGroup(AccountGroup.Id id) {
- return ADMIN_GROUPS + id.toString();
- }
-
- public static String toGroup(AccountGroup.Id id, String panel) {
- return ADMIN_GROUPS + id.toString() + "," + panel;
- }
-
- public static String toGroup(AccountGroup.UUID uuid) {
- return PageLinks.toGroup(uuid);
- }
-
- public static String toGroup(AccountGroup.UUID uuid, String panel) {
- return toGroup(uuid) + "," + panel;
- }
-
- public static String toProject(Project.NameKey n) {
- return toProjectAdmin(n, ProjectScreen.getSavedPanel());
- }
-
- public static String toProjectAdmin(Project.NameKey n, String panel) {
- if (panel == null || ProjectScreen.INFO.equals(panel)) {
- return ADMIN_PROJECTS + n.toString();
- }
- return ADMIN_PROJECTS + n.toString() + "," + panel;
- }
-
- static final String RELOAD_UI = "/reload-ui/";
- private static boolean wasStartedByReloadUI;
-
- void display(String token) {
- assert token != null;
- try {
- try {
- if (matchPrefix(RELOAD_UI, token)) {
- wasStartedByReloadUI = true;
- token = skip(token);
- }
- select(token);
- } finally {
- wasStartedByReloadUI = false;
- }
- } catch (RuntimeException err) {
- GWT.log("Error parsing history token: " + token, err);
- Gerrit.display(token, new NotFoundScreen());
- }
- }
-
- private static void select(String token) {
- token = Gerrit.getUrlAliasMatcher().replace(token);
-
- if (matchPrefix(QUERY, token)) {
- query(token);
-
- } else if (matchPrefix("/Documentation/q/", token)) {
- docSearch(token);
-
- } else if (matchPrefix("/c/", token)) {
- change(token);
-
- } else if (matchPrefix("/x/", token)) {
- extension(token);
-
- } else if (matchExact(MINE, token)) {
- String defaultScreenToken = Gerrit.getDefaultScreenToken();
- if (defaultScreenToken != null && !MINE.equals(defaultScreenToken)) {
- select(defaultScreenToken);
- } else {
- Gerrit.display(token, mine());
- }
-
- } else if (matchPrefix("/dashboard/", token)) {
- dashboard(token);
-
- } else if (matchPrefix(PROJECTS, token)) {
- projects(token);
-
- } else if (matchExact(SETTINGS, token)
- || matchPrefix("/settings/", token)
- || matchExact(MY_GROUPS, token)
- || matchExact("register", token)
- || matchExact(REGISTER, token)
- || matchPrefix("/register/", token)
- || matchPrefix("/VE/", token)
- || matchPrefix("VE,", token)
- || matchPrefix("/SignInFailure,", token)) {
- settings(token);
-
- } else if (matchPrefix("/admin/", token)) {
- admin(token);
-
- } else {
- Gerrit.display(token, new NotFoundScreen());
- }
- }
-
- private static void query(String token) {
- String s = skip(token);
- int c = s.indexOf(',');
- Screen screen;
- if (c >= 0) {
- String prefix = s.substring(0, c);
- if (s.substring(c).equals(",n,z")) {
- // Respect legacy token with max sortkey.
- screen = new QueryScreen(prefix, 0);
- } else {
- screen = new QueryScreen(prefix, Integer.parseInt(s.substring(c + 1)));
- }
- } else {
- screen = new QueryScreen(s, 0);
- }
- Gerrit.display(token, screen);
- }
-
- private static Screen mine() {
- if (Gerrit.isSignedIn()) {
- return new AccountDashboardScreen(Gerrit.getUserAccount()._accountId());
- }
- Screen r = new AccountDashboardScreen(null);
- r.setRequiresSignIn(true);
- return r;
- }
-
- private static void dashboard(String token) {
- String rest = skip(token);
- if (rest.matches("[0-9]+")) {
- int accountId = Integer.parseInt(rest);
- Gerrit.display(token, new AccountDashboardScreen(accountId));
- return;
- }
-
- if (rest.equals("self")) {
- if (Gerrit.isSignedIn()) {
- Gerrit.display(token, new AccountDashboardScreen(Gerrit.getUserAccount()._accountId()));
- } else {
- Screen s = new AccountDashboardScreen(null);
- s.setRequiresSignIn(true);
- Gerrit.display(token, s);
- }
- return;
- }
-
- if (rest.startsWith("?")) {
- Gerrit.display(token, new CustomDashboardScreen(rest.substring(1)));
- return;
- }
-
- Gerrit.display(token, new NotFoundScreen());
- }
-
- private static void projects(String token) {
- String rest = skip(token);
- int c = rest.indexOf(DASHBOARDS);
- if (0 <= c) {
- final String project = URL.decodePathSegment(rest.substring(0, c));
- rest = rest.substring(c);
- if (matchPrefix(DASHBOARDS, rest)) {
- final String dashboardId = skip(rest);
- GerritCallback<DashboardInfo> cb =
- new GerritCallback<DashboardInfo>() {
- @Override
- public void onSuccess(DashboardInfo result) {
- if (matchPrefix("/dashboard/", result.url())) {
- String params = skip(result.url()).substring(1);
- ProjectDashboardScreen dash =
- new ProjectDashboardScreen(new Project.NameKey(project), params);
- Gerrit.display(token, dash);
- }
- }
-
- @Override
- public void onFailure(Throwable caught) {
- if ("default".equals(dashboardId) && RestApi.isNotFound(caught)) {
- Gerrit.display(
- PageLinks.toChangeQuery(
- PageLinks.projectQuery(new Project.NameKey(project))));
- } else {
- super.onFailure(caught);
- }
- }
- };
- if ("default".equals(dashboardId)) {
- DashboardList.getDefault(new Project.NameKey(project), cb);
- return;
- }
- c = dashboardId.indexOf(":");
- if (0 <= c) {
- final String ref = URL.decodeQueryString(dashboardId.substring(0, c));
- final String path = URL.decodeQueryString(dashboardId.substring(c + 1));
- DashboardList.get(new Project.NameKey(project), ref + ":" + path, cb);
- return;
- }
- }
- }
-
- Gerrit.display(token, new NotFoundScreen());
- }
-
- private static void change(String token) {
- String rest = skip(token);
- int c = rest.lastIndexOf(',');
- String panel = null;
- if (0 <= c) {
- panel = rest.substring(c + 1);
- rest = rest.substring(0, c);
- int at = panel.lastIndexOf('@');
- if (at > 0) {
- rest += panel.substring(at);
- panel = panel.substring(0, at);
- }
- }
-
- ProjectChangeId id = ProjectChangeId.create(rest);
- rest = rest.length() > id.identifierLength() ? rest.substring(id.identifierLength() + 1) : "";
-
- if (rest.isEmpty()) {
- FileTable.Mode mode = FileTable.Mode.REVIEW;
- if (panel != null && (panel.equals("edit") || panel.startsWith("edit/"))) {
- mode = FileTable.Mode.EDIT;
- panel = null;
- }
- Gerrit.display(
- token,
- panel == null
- ? new ChangeScreen(
- id.getProject(), id.getChangeId(), DiffObject.base(), null, false, mode)
- : new NotFoundScreen());
- return;
- }
-
- String psIdStr;
- int s = rest.indexOf('/');
- if (0 <= s) {
- psIdStr = rest.substring(0, s);
- rest = rest.substring(s + 1);
- } else {
- psIdStr = rest;
- rest = "";
- }
-
- DiffObject base = DiffObject.base();
- PatchSet.Id ps;
- int dotdot = psIdStr.indexOf("..");
- if (1 <= dotdot) {
- base = DiffObject.parse(id.getChangeId(), psIdStr.substring(0, dotdot));
- if (base == null) {
- Gerrit.display(token, new NotFoundScreen());
- }
- psIdStr = psIdStr.substring(dotdot + 2);
- }
- ps = toPsId(id.getChangeId(), psIdStr);
-
- if (!rest.isEmpty()) {
- DisplaySide side = DisplaySide.B;
- int line = 0;
- int at = rest.lastIndexOf('@');
- if (at > 0) {
- String l = rest.substring(at + 1);
- if (l.startsWith("a")) {
- side = DisplaySide.A;
- l = l.substring(1);
- }
- line = Integer.parseInt(l);
- rest = rest.substring(0, at);
- }
- Patch.Key p = new Patch.Key(ps, KeyUtil.decode(rest));
- patch(token, id.getProject(), base, p, side, line, panel);
- } else {
- if (panel == null) {
- Gerrit.display(
- token,
- new ChangeScreen(
- id.getProject(),
- id.getChangeId(),
- base,
- String.valueOf(ps.get()),
- false,
- FileTable.Mode.REVIEW));
- } else {
- Gerrit.display(token, new NotFoundScreen());
- }
- }
- }
-
- public static PatchSet.Id toPsId(Change.Id id, String psIdStr) {
- return new PatchSet.Id(id, psIdStr.equals("edit") ? 0 : Integer.parseInt(psIdStr));
- }
-
- private static void extension(String token) {
- ExtensionScreen view = new ExtensionScreen(skip(token));
- if (view.isFound()) {
- Gerrit.display(token, view);
- } else {
- Gerrit.display(token, new NotFoundScreen());
- }
- }
-
- private static void patch(
- String token,
- @Nullable Project.NameKey project,
- DiffObject base,
- Patch.Key id,
- DisplaySide side,
- int line,
- String panelType) {
- String panel = panelType;
- if (panel == null) {
- int c = token.lastIndexOf(',');
- panel = 0 <= c ? token.substring(c + 1) : "";
- }
-
- if ("".equals(panel) || /* DEPRECATED URL */ "cm".equals(panel)) {
- if (preferUnified()) {
- unified(token, project, base, id, side, line);
- } else {
- codemirror(token, base, project, id, side, line);
- }
- } else if ("sidebyside".equals(panel)) {
- codemirror(token, base, project, id, side, line);
- } else if ("unified".equals(panel)) {
- unified(token, project, base, id, side, line);
- } else if ("edit".equals(panel)) {
- if (!Patch.isMagic(id.get()) || Patch.COMMIT_MSG.equals(id.get())) {
- codemirrorForEdit(token, project, id, line);
- } else {
- Gerrit.display(token, new NotFoundScreen());
- }
- } else {
- Gerrit.display(token, new NotFoundScreen());
- }
- }
-
- private static boolean preferUnified() {
- return DiffView.UNIFIED_DIFF.equals(Gerrit.getUserPreferences().diffView())
- || (UserAgent.isPortrait() && UserAgent.isMobile());
- }
-
- private static void unified(
- final String token,
- final Project.NameKey project,
- final DiffObject base,
- final Patch.Key id,
- final DisplaySide side,
- final int line) {
- GWT.runAsync(
- new AsyncSplit(token) {
- @Override
- public void onSuccess() {
- Gerrit.display(
- token,
- new Unified(
- project, base, DiffObject.patchSet(id.getParentKey()), id.get(), side, line));
- }
- });
- }
-
- private static void codemirror(
- final String token,
- final DiffObject base,
- @Nullable final Project.NameKey project,
- final Patch.Key id,
- final DisplaySide side,
- final int line) {
- GWT.runAsync(
- new AsyncSplit(token) {
- @Override
- public void onSuccess() {
- Gerrit.display(
- token,
- new SideBySide(
- project, base, DiffObject.patchSet(id.getParentKey()), id.get(), side, line));
- }
- });
- }
-
- private static void codemirrorForEdit(
- final String token,
- @Nullable final Project.NameKey project,
- final Patch.Key id,
- final int line) {
- GWT.runAsync(
- new AsyncSplit(token) {
- @Override
- public void onSuccess() {
- Gerrit.display(token, new EditScreen(project, id, line));
- }
- });
- }
-
- private static void settings(String token) {
- GWT.runAsync(
- new AsyncSplit(token) {
- @Override
- public void onSuccess() {
- Gerrit.display(token, select());
- }
-
- private Screen select() {
- if (matchExact(SETTINGS, token)) {
- return new MyProfileScreen();
- }
-
- if (matchExact(SETTINGS_PREFERENCES, token)) {
- return new MyPreferencesScreen();
- }
-
- if (matchExact(SETTINGS_DIFF_PREFERENCES, token)) {
- return new MyDiffPreferencesScreen();
- }
-
- if (matchExact(SETTINGS_EDIT_PREFERENCES, token)) {
- return new MyEditPreferencesScreen();
- }
-
- if (matchExact(SETTINGS_PROJECTS, token)) {
- return new MyWatchedProjectsScreen();
- }
-
- if (matchExact(SETTINGS_CONTACT, token)) {
- return new MyContactInformationScreen();
- }
-
- if (matchExact(SETTINGS_SSHKEYS, token)) {
- return new MySshKeysScreen();
- }
-
- if (matchExact(SETTINGS_GPGKEYS, token) && Gerrit.info().gerrit().editGpgKeys()) {
- return new MyGpgKeysScreen();
- }
-
- if (matchExact(SETTINGS_WEBIDENT, token)) {
- return new MyIdentitiesScreen();
- }
-
- if (matchExact(SETTINGS_HTTP_PASSWORD, token)) {
- return new MyPasswordScreen();
- }
-
- if (matchExact(SETTINGS_OAUTH_TOKEN, token) && Gerrit.info().auth().isOAuth()) {
- return new MyOAuthTokenScreen();
- }
-
- if (matchExact(MY_GROUPS, token) || matchExact(SETTINGS_MYGROUPS, token)) {
- return new MyGroupsScreen();
- }
-
- if (matchExact(SETTINGS_AGREEMENTS, token)
- && Gerrit.info().auth().useContributorAgreements()) {
- return new MyAgreementsScreen();
- }
-
- if (matchExact(REGISTER, token)
- || matchExact("/register/", token)
- || matchExact("register", token)) {
- return new RegisterScreen(MINE);
- } else if (matchPrefix("/register/", token)) {
- return new RegisterScreen("/" + skip(token));
- }
-
- if (matchPrefix("/VE/", token) || matchPrefix("VE,", token)) {
- return new ValidateEmailScreen(skip(token));
- }
-
- if (matchExact(SETTINGS_NEW_AGREEMENT, token)) {
- return new NewAgreementScreen();
- }
-
- if (matchPrefix(SETTINGS_NEW_AGREEMENT + "/", token)) {
- return new NewAgreementScreen(skip(token));
- }
-
- if (matchPrefix(SETTINGS_EXTENSION, token)) {
- ExtensionSettingsScreen view = new ExtensionSettingsScreen(skip(token));
- if (view.isFound()) {
- return view;
- }
- return new NotFoundScreen();
- }
-
- return new NotFoundScreen();
- }
- });
- }
-
- private static void admin(String token) {
- GWT.runAsync(
- new AsyncSplit(token) {
- @Override
- public void onSuccess() {
- if (matchExact(ADMIN_GROUPS, token) || matchExact("/admin/groups", token)) {
- Gerrit.display(token, new GroupListScreen());
-
- } else if (matchPrefix(ADMIN_GROUPS, token)) {
- String rest = skip(token);
- if (rest.startsWith("?")) {
- Gerrit.display(token, new GroupListScreen(rest.substring(1)));
- } else {
- group();
- }
-
- } else if (matchPrefix("/admin/groups", token)) {
- String rest = skip(token);
- if (rest.startsWith("?")) {
- Gerrit.display(token, new GroupListScreen(rest.substring(1)));
- }
-
- } else if (matchExact(ADMIN_PROJECTS, token) || matchExact("/admin/projects", token)) {
- Gerrit.display(token, new ProjectListScreen());
-
- } else if (matchPrefix(ADMIN_PROJECTS, token)) {
- String rest = skip(token);
- if (rest.startsWith("?")) {
- Gerrit.display(token, new ProjectListScreen(rest.substring(1)));
- } else {
- Gerrit.display(token, selectProject());
- }
-
- } else if (matchPrefix("/admin/projects", token)) {
- String rest = skip(token);
- if (rest.startsWith("?")) {
- Gerrit.display(token, new ProjectListScreen(rest.substring(1)));
- }
-
- } else if (matchPrefix(ADMIN_PLUGINS, token) || matchExact("/admin/plugins", token)) {
- Gerrit.display(token, new PluginListScreen());
-
- } else if (matchExact(ADMIN_CREATE_PROJECT, token)
- || matchExact("/admin/create-project", token)) {
- Gerrit.display(token, new CreateProjectScreen());
-
- } else if (matchExact(ADMIN_CREATE_GROUP, token)
- || matchExact("/admin/create-group", token)) {
- Gerrit.display(token, new CreateGroupScreen());
-
- } else {
- Gerrit.display(token, new NotFoundScreen());
- }
- }
-
- private void group() {
- final String panel;
- final String group;
-
- if (matchPrefix("/admin/groups/uuid-", token)) {
- String p = skip(token);
- int c = p.indexOf(',');
- if (c < 0) {
- group = p;
- panel = null;
- } else {
- group = p.substring(0, c);
- panel = p.substring(c + 1);
- }
- } else if (matchPrefix(ADMIN_GROUPS, token)) {
- String p = skip(token);
- int c = p.indexOf(',');
- if (c < 0) {
- group = p;
- panel = null;
- } else {
- group = p.substring(0, c);
- panel = p.substring(c + 1);
- }
- } else {
- Gerrit.display(token, new NotFoundScreen());
- return;
- }
-
- GroupApi.getGroupDetail(
- group,
- new GerritCallback<GroupInfo>() {
- @Override
- public void onSuccess(GroupInfo group) {
- if (panel == null || panel.isEmpty()) {
- // The token does not say which group screen should be shown,
- // as default for internal groups show the members, as default
- // for external and system groups show the info screen (since
- // for external and system groups the members cannot be
- // shown in the web UI).
- //
- if (AccountGroup.isInternalGroup(group.getGroupUUID())) {
- String newToken = toGroup(group.getGroupId(), AccountGroupScreen.MEMBERS);
- Gerrit.display(newToken, new AccountGroupMembersScreen(group, newToken));
- } else {
- String newToken = toGroup(group.getGroupId(), AccountGroupScreen.INFO);
- Gerrit.display(newToken, new AccountGroupInfoScreen(group, newToken));
- }
- } else if (AccountGroupScreen.INFO.equals(panel)) {
- Gerrit.display(token, new AccountGroupInfoScreen(group, token));
- } else if (AccountGroupScreen.MEMBERS.equals(panel)) {
- Gerrit.display(token, new AccountGroupMembersScreen(group, token));
- } else if (AccountGroupScreen.AUDIT_LOG.equals(panel)) {
- Gerrit.display(token, new AccountGroupAuditLogScreen(group, token));
- } else {
- Gerrit.display(token, new NotFoundScreen());
- }
- }
- });
- }
-
- private Screen selectProject() {
- if (matchPrefix(ADMIN_PROJECTS, token)) {
- String rest = skip(token);
- int c = rest.lastIndexOf(',');
- if (c < 0) {
- return new ProjectInfoScreen(Project.NameKey.parse(rest));
- } else if (c == 0) {
- return new NotFoundScreen();
- }
-
- int q = rest.lastIndexOf('?');
- if (q > 0 && rest.lastIndexOf(',', q) > 0) {
- c = rest.substring(0, q - 1).lastIndexOf(',');
- }
-
- Project.NameKey k = Project.NameKey.parse(rest.substring(0, c));
- String panel = rest.substring(c + 1);
-
- if (ProjectScreen.INFO.equals(panel)) {
- return new ProjectInfoScreen(k);
- }
-
- if (ProjectScreen.BRANCHES.equals(panel)
- || matchPrefix(ProjectScreen.BRANCHES, panel)) {
- return new ProjectBranchesScreen(k);
- }
-
- if (ProjectScreen.TAGS.equals(panel) || matchPrefix(ProjectScreen.TAGS, panel)) {
- return new ProjectTagsScreen(k);
- }
-
- if (ProjectScreen.ACCESS.equals(panel)) {
- return new ProjectAccessScreen(k);
- }
-
- if (ProjectScreen.DASHBOARDS.equals(panel)) {
- return new ProjectDashboardsScreen(k);
- }
- }
- return new NotFoundScreen();
- }
- });
- }
-
- private static boolean matchExact(String want, String token) {
- return token.equals(want);
- }
-
- private static int prefixlen;
-
- private static boolean matchPrefix(String want, String token) {
- if (token.startsWith(want)) {
- prefixlen = want.length();
- return true;
- }
- return false;
- }
-
- private static String skip(String token) {
- return token.substring(prefixlen);
- }
-
- private abstract static class AsyncSplit implements RunAsyncCallback {
- private final boolean isReloadUi;
- protected final String token;
-
- protected AsyncSplit(String token) {
- this.isReloadUi = wasStartedByReloadUI;
- this.token = token;
- }
-
- @Override
- public final void onFailure(Throwable reason) {
- if (!isReloadUi && "HTTP download failed with status 404".equals(reason.getMessage())) {
- // The server was upgraded since we last download the main script,
- // so the pointers to the splits aren't valid anymore. Force the
- // page to reload itself and pick up the new code.
- //
- Gerrit.upgradeUI(token);
- } else {
- new ErrorDialog(reason).center();
- }
- }
- }
-
- private static void docSearch(String token) {
- GWT.runAsync(
- new AsyncSplit(token) {
- @Override
- public void onSuccess() {
- Gerrit.display(token, new DocScreen(skip(token)));
- }
- });
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ErrorDialog.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ErrorDialog.java
deleted file mode 100644
index c116d76..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ErrorDialog.java
+++ /dev/null
@@ -1,168 +0,0 @@
-// Copyright (C) 2008 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.client;
-
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.client.rpc.RpcConstants;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.event.dom.client.KeyPressHandler;
-import com.google.gwt.http.client.Response;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.rpc.StatusCodeException;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwtexpui.safehtml.client.SafeHtml;
-import com.google.gwtjsonrpc.client.RemoteJsonException;
-
-/** A dialog box showing an error message, when bad things happen. */
-public class ErrorDialog extends PopupPanel {
- private final Label text;
- private final FlowPanel body;
- private final Button closey;
-
- protected ErrorDialog() {
- super(/* auto hide */ false, /* modal */ true);
- setGlassEnabled(true);
- getGlassElement().addClassName(Gerrit.RESOURCES.css().errorDialogGlass());
-
- text = new Label();
- text.setStyleName(Gerrit.RESOURCES.css().errorDialogTitle());
-
- body = new FlowPanel();
-
- final FlowPanel buttons = new FlowPanel();
- buttons.setStyleName(Gerrit.RESOURCES.css().errorDialogButtons());
-
- closey = new Button();
- closey.setText(Gerrit.C.errorDialogContinue());
- closey.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- hide();
- }
- });
- closey.addKeyPressHandler(
- new KeyPressHandler() {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- // if the close button is triggered by a key we need to consume the key
- // event, otherwise the key event would be propagated to the parent
- // screen and eventually trigger some unwanted action there after the
- // error dialog was closed
- event.stopPropagation();
- }
- });
- buttons.add(closey);
-
- final FlowPanel center = new FlowPanel();
- center.add(text);
- center.add(body);
- center.add(buttons);
-
- setText(Gerrit.C.errorTitle());
- addStyleName(Gerrit.RESOURCES.css().errorDialog());
- add(center);
-
- int l = Window.getScrollLeft() + 20;
- int t = Window.getScrollTop() + 20;
- setPopupPosition(l, t);
- }
-
- /** Create a dialog box to show a single message string. */
- public ErrorDialog(String message) {
- this();
- body.add(createErrorMsgLabel(message));
- }
-
- /** Create a dialog box to show a single message string. */
- public ErrorDialog(SafeHtml message) {
- this();
- body.add(message.toBlockWidget());
- }
-
- /** Create a dialog box to nicely format an exception. */
- public ErrorDialog(Throwable what) {
- this();
-
- String hdr;
- String msg;
-
- if (what instanceof StatusCodeException) {
- StatusCodeException sc = (StatusCodeException) what;
- if (RestApi.isExpected(sc.getStatusCode())) {
- hdr = null;
- msg = sc.getEncodedResponse();
- } else if (sc.getStatusCode() == Response.SC_INTERNAL_SERVER_ERROR) {
- hdr = null;
- msg = what.getMessage();
- } else {
- hdr = RpcConstants.C.errorServerUnavailable();
- msg = what.getMessage();
- }
-
- } else if (what instanceof RemoteJsonException) {
- // TODO Remove RemoteJsonException from Gerrit sources.
- hdr = RpcConstants.C.errorRemoteJsonException();
- msg = what.getMessage();
-
- } else {
- // TODO Fix callers of ErrorDialog to stop passing random types.
- hdr = what.getClass().getName();
- if (hdr.startsWith("java.lang.")) {
- hdr = hdr.substring("java.lang.".length());
- } else if (hdr.startsWith("com.google.gerrit.")) {
- hdr = hdr.substring(hdr.lastIndexOf('.') + 1);
- }
- if (hdr.endsWith("Exception")) {
- hdr = hdr.substring(0, hdr.length() - "Exception".length());
- } else if (hdr.endsWith("Error")) {
- hdr = hdr.substring(0, hdr.length() - "Error".length());
- }
- msg = what.getMessage();
- }
-
- if (hdr != null) {
- final Label r = new Label(hdr);
- r.setStyleName(Gerrit.RESOURCES.css().errorDialogErrorType());
- body.add(r);
- }
-
- if (msg != null) {
- body.add(createErrorMsgLabel(msg));
- }
- }
-
- private Label createErrorMsgLabel(String message) {
- Label m = new Label(message);
- m.getElement().getStyle().setProperty("white-space", "pre");
- return m;
- }
-
- public ErrorDialog setText(String t) {
- text.setText(t);
- return this;
- }
-
- @Override
- public void center() {
- show();
- closey.setFocus(true);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/FormatUtil.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/FormatUtil.java
deleted file mode 100644
index c8d052e..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/FormatUtil.java
+++ /dev/null
@@ -1,132 +0,0 @@
-// Copyright (C) 2008 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.client;
-
-import com.google.gerrit.client.change.Resources;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.info.GeneralPreferences;
-import com.google.gwt.i18n.client.NumberFormat;
-import java.util.Date;
-
-/** Misc. formatting functions. */
-public class FormatUtil {
- private static DateFormatter dateFormatter;
-
- public static void setPreferences(GeneralPreferences prefs) {
- dateFormatter = new DateFormatter(prefs);
- }
-
- /** Format a date using a really short format. */
- public static String shortFormat(Date dt) {
- ensureInited();
- return dateFormatter.shortFormat(dt);
- }
-
- /** Format a date using a really short format. */
- public static String shortFormatDayTime(Date dt) {
- ensureInited();
- return dateFormatter.shortFormatDayTime(dt);
- }
-
- /** Format a date using the locale's medium length format. */
- public static String mediumFormat(Date dt) {
- ensureInited();
- return dateFormatter.mediumFormat(dt);
- }
-
- private static void ensureInited() {
- if (dateFormatter == null) {
- setPreferences(Gerrit.getUserPreferences());
- }
- }
-
- /** Format a date using git log's relative date format. */
- public static String relativeFormat(Date dt) {
- return RelativeDateFormatter.format(dt);
- }
-
- /**
- * Formats an account as a name and an email address.
- *
- * <p>Example output:
- *
- * <ul>
- * <li>{@code A U. Thor <author@example.com>}: full populated
- * <li>{@code A U. Thor (12)}: missing email address
- * <li>{@code Anonymous Coward <author@example.com>}: missing name
- * <li>{@code Anonymous Coward (12)}: missing name and email address
- * </ul>
- */
- public static String nameEmail(AccountInfo info) {
- return createAccountFormatter().nameEmail(info);
- }
-
- /**
- * Formats an account name.
- *
- * <p>If the account has a full name, it returns only the full name. Otherwise it returns a longer
- * form that includes the email address.
- */
- public static String name(AccountInfo info) {
- return createAccountFormatter().name(info);
- }
-
- private static AccountFormatter createAccountFormatter() {
- return new AccountFormatter(Gerrit.info().user().anonymousCowardName());
- }
-
- /** The returned format string doesn't contain any +/- sign. */
- public static String formatAbsBytes(long bytes) {
- return formatBytes(bytes, true);
- }
-
- public static String formatBytes(long bytes) {
- return formatBytes(bytes, false);
- }
-
- private static String formatBytes(long bytes, boolean abs) {
- bytes = abs ? Math.abs(bytes) : bytes;
-
- if (bytes == 0) {
- return abs ? "0 B" : "+/- 0 B";
- }
-
- if (Math.abs(bytes) < 1024) {
- return (bytes > 0 && !abs ? "+" : "") + bytes + " B";
- }
-
- int exp = (int) (Math.log(Math.abs(bytes)) / Math.log(1024));
- return (bytes > 0 && !abs ? "+" : "")
- + NumberFormat.getFormat("#.0").format(bytes / Math.pow(1024, exp))
- + " "
- + "KMGTPE".charAt(exp - 1)
- + "iB";
- }
-
- public static String formatPercentage(long size, long delta) {
- if (size == 0) {
- return Resources.C.notAvailable();
- }
- return (delta > 0 ? "+" : "-") + formatAbsPercentage(size, delta);
- }
-
- public static String formatAbsPercentage(long size, long delta) {
- if (size == 0) {
- return Resources.C.notAvailable();
- }
- long percentage = Math.abs(Math.round(delta * 100.0 / size));
- return percentage + "%";
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java
deleted file mode 100644
index afc65c9..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Gerrit.java
+++ /dev/null
@@ -1,1134 +0,0 @@
-// Copyright (C) 2008 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.client;
-
-import static com.google.gerrit.common.data.GlobalCapability.CREATE_GROUP;
-import static com.google.gerrit.common.data.GlobalCapability.CREATE_PROJECT;
-import static com.google.gerrit.common.data.GlobalCapability.VIEW_PLUGINS;
-import static com.google.gerrit.common.data.HostPageData.XSRF_COOKIE_NAME;
-
-import com.google.gerrit.client.account.AccountApi;
-import com.google.gerrit.client.account.AccountCapabilities;
-import com.google.gerrit.client.account.EditPreferences;
-import com.google.gerrit.client.admin.ProjectScreen;
-import com.google.gerrit.client.api.ApiGlue;
-import com.google.gerrit.client.api.PluginLoader;
-import com.google.gerrit.client.change.LocalComments;
-import com.google.gerrit.client.changes.ChangeListScreen;
-import com.google.gerrit.client.config.ConfigServerApi;
-import com.google.gerrit.client.documentation.DocInfo;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.info.AuthInfo;
-import com.google.gerrit.client.info.GeneralPreferences;
-import com.google.gerrit.client.info.ServerInfo;
-import com.google.gerrit.client.info.TopMenu;
-import com.google.gerrit.client.info.TopMenuItem;
-import com.google.gerrit.client.info.TopMenuList;
-import com.google.gerrit.client.rpc.CallbackGroup;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.LinkMenuBar;
-import com.google.gerrit.client.ui.LinkMenuItem;
-import com.google.gerrit.client.ui.MorphingTabPanel;
-import com.google.gerrit.client.ui.ProjectLinkMenuItem;
-import com.google.gerrit.client.ui.Screen;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.common.data.HostPageData;
-import com.google.gerrit.common.data.SystemInfoService;
-import com.google.gerrit.extensions.client.DiffPreferencesInfo;
-import com.google.gerrit.extensions.client.EditPreferencesInfo;
-import com.google.gerrit.extensions.client.GerritTopMenu;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.aria.client.Roles;
-import com.google.gwt.core.client.EntryPoint;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Document;
-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.KeyDownEvent;
-import com.google.gwt.event.dom.client.KeyDownHandler;
-import com.google.gwt.event.logical.shared.ValueChangeEvent;
-import com.google.gwt.event.logical.shared.ValueChangeHandler;
-import com.google.gwt.event.shared.EventBus;
-import com.google.gwt.event.shared.SimpleEventBus;
-import com.google.gwt.http.client.Request;
-import com.google.gwt.http.client.RequestBuilder;
-import com.google.gwt.http.client.RequestCallback;
-import com.google.gwt.http.client.RequestException;
-import com.google.gwt.http.client.Response;
-import com.google.gwt.http.client.URL;
-import com.google.gwt.http.client.UrlBuilder;
-import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.Cookies;
-import com.google.gwt.user.client.History;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.Window.Location;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.FocusPanel;
-import com.google.gwt.user.client.ui.Grid;
-import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
-import com.google.gwt.user.client.ui.InlineHTML;
-import com.google.gwt.user.client.ui.InlineLabel;
-import com.google.gwt.user.client.ui.RootPanel;
-import com.google.gwtexpui.clippy.client.CopyableLabel;
-import com.google.gwtexpui.user.client.UserAgent;
-import com.google.gwtexpui.user.client.ViewSite;
-import com.google.gwtjsonrpc.client.JsonDefTarget;
-import com.google.gwtjsonrpc.client.JsonUtil;
-import com.google.gwtjsonrpc.client.XsrfManager;
-import com.google.gwtorm.client.KeyUtil;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class Gerrit implements EntryPoint {
- public static final GerritConstants C = GWT.create(GerritConstants.class);
- public static final GerritMessages M = GWT.create(GerritMessages.class);
- public static final GerritResources RESOURCES = GWT.create(GerritResources.class);
- public static final SystemInfoService SYSTEM_SVC;
- public static final EventBus EVENT_BUS = GWT.create(SimpleEventBus.class);
- public static final Themer THEMER = GWT.create(Themer.class);
- public static final String PROJECT_NAME_MENU_VAR = "${projectName}";
- public static final String INDEX = "Documentation/index.html";
-
- private static String myHost;
- private static ServerInfo myServerInfo;
- private static AccountInfo myAccount;
- private static GeneralPreferences myPrefs;
- private static UrlAliasMatcher urlAliasMatcher;
- private static boolean hasDocumentation;
- private static boolean docSearch;
- private static String docUrl;
- private static HostPageData.Theme myTheme;
- private static String defaultScreenToken;
- private static DiffPreferencesInfo myAccountDiffPref;
- private static EditPreferencesInfo editPrefs;
- private static String xGerritAuth;
- private static boolean isNoteDbEnabled;
-
- private static Map<String, LinkMenuBar> menuBars;
-
- private static MorphingTabPanel menuLeft;
- private static LinkMenuBar menuRight;
- private static RootPanel topMenu;
- private static RootPanel siteHeader;
- private static RootPanel siteFooter;
- private static RootPanel bottomMenu;
- private static SearchPanel searchPanel;
- private static final Dispatcher dispatcher = new Dispatcher();
- private static ViewSite<Screen> body;
- private static String lastChangeListToken;
- private static String lastViewToken;
- private static Anchor uiSwitcherLink;
-
- static {
- SYSTEM_SVC = GWT.create(SystemInfoService.class);
- JsonUtil.bind(SYSTEM_SVC, "rpc/SystemInfoService");
- }
-
- static void upgradeUI(String token) {
- History.newItem(Dispatcher.RELOAD_UI + token, false);
- Window.Location.reload();
- }
-
- public static void displayLastChangeList() {
- if (lastChangeListToken != null) {
- display(lastChangeListToken);
- } else if (isSignedIn()) {
- display(PageLinks.MINE);
- } else {
- display(PageLinks.toChangeQuery("status:open"));
- }
- }
-
- public static String getPriorView() {
- return lastViewToken;
- }
-
- /**
- * Load the screen at the given location, displaying when ready.
- *
- * <p>If the URL is not already pointing at this location, a new item will be added to the
- * browser's history when the screen is fully loaded and displayed on the UI.
- *
- * @param token location to parse, load, and render.
- */
- public static void display(String token) {
- if (body.getView() == null || !body.getView().displayToken(token)) {
- dispatcher.display(token);
- updateUiLink(token);
- }
- }
-
- /**
- * Load the screen passed, assuming token can be used to locate it.
- *
- * <p>The screen is loaded in the background. When it is ready to be visible a new item will be
- * added to the browser's history, the screen will be made visible, and the window title may be
- * updated.
- *
- * <p>If {@link Screen#isRequiresSignIn()} is true and the user is not signed in yet the screen
- * instance will be discarded, sign-in will take place, and will redirect to this location upon
- * success.
- *
- * @param token location that refers to {@code view}.
- * @param view the view to load.
- */
- public static void display(String token, Screen view) {
- if (view.isRequiresSignIn() && !isSignedIn()) {
- doSignIn(token);
- } else {
- view.setToken(token);
- if (isSignedIn()) {
- LocalComments.saveInlineComments();
- }
- body.setView(view);
- updateUiLink(token);
- }
- }
-
- public static void selectMenu(LinkMenuBar bar) {
- menuLeft.selectTab(menuLeft.getWidgetIndex(bar));
- }
-
- /**
- * Update the current history token after a screen change.
- *
- * <p>The caller has already updated the UI, but wants to publish a different history token for
- * the current browser state. This really only makes sense if the caller is a {@code TabPanel} and
- * is firing an event when the tab changed to a different part.
- *
- * @param token new location that is already visible.
- */
- public static void updateImpl(String token) {
- History.newItem(token, false);
- dispatchHistoryHooks(token);
- }
-
- public static void setQueryString(String query) {
- searchPanel.setText(query);
- }
-
- public static void setWindowTitle(Screen screen, String text) {
- if (screen == body.getView()) {
- if (text == null || text.length() == 0) {
- Window.setTitle(M.windowTitle1(myHost));
- } else {
- Window.setTitle(M.windowTitle2(text, myHost));
- }
- }
- }
-
- public static int getHeaderFooterHeight() {
- int h = bottomMenu.getOffsetHeight();
- if (topMenu.isVisible()) {
- h += topMenu.getOffsetHeight();
- }
- if (siteHeader.isVisible()) {
- h += siteHeader.getOffsetHeight();
- }
- if (siteFooter.isVisible()) {
- h += siteFooter.getOffsetHeight();
- }
- return h;
- }
-
- public static void setHeaderVisible(boolean visible) {
- topMenu.setVisible(visible);
- siteHeader.setVisible(visible && getUserPreferences().showSiteHeader());
- }
-
- public static boolean isHeaderVisible() {
- return topMenu.isVisible();
- }
-
- public static String getDefaultScreenToken() {
- return defaultScreenToken;
- }
-
- public static RootPanel getBottomMenu() {
- return bottomMenu;
- }
-
- /** Get the public configuration data used by this Gerrit instance. */
- public static ServerInfo info() {
- return myServerInfo;
- }
-
- public static UrlAliasMatcher getUrlAliasMatcher() {
- return urlAliasMatcher;
- }
-
- /** Site theme information (site specific colors)/ */
- public static HostPageData.Theme getTheme() {
- return myTheme;
- }
-
- /** @return the currently signed in user's account data; empty account data if no account */
- public static AccountInfo getUserAccount() {
- return myAccount;
- }
-
- /** @return access token to prove user identity during REST API calls. */
- @Nullable
- public static String getXGerritAuth() {
- return xGerritAuth;
- }
-
- /**
- * @return the preferences of the currently signed in user, the default preferences if not signed
- * in
- */
- public static GeneralPreferences getUserPreferences() {
- return myPrefs;
- }
-
- /** @return the currently signed in users's diff preferences, or default values */
- public static DiffPreferencesInfo getDiffPreferences() {
- return myAccountDiffPref;
- }
-
- public static void setDiffPreferences(DiffPreferencesInfo accountDiffPref) {
- myAccountDiffPref = accountDiffPref;
- }
-
- /** @return the edit preferences of the current user, null if not signed-in */
- public static EditPreferencesInfo getEditPreferences() {
- return editPrefs;
- }
-
- public static void setEditPreferences(EditPreferencesInfo p) {
- editPrefs = p;
- }
-
- /** @return true if the user is currently authenticated */
- public static boolean isSignedIn() {
- return xGerritAuth != null;
- }
-
- /** Sign the user into the application. */
- public static void doSignIn(String token) {
- Location.assign(loginRedirect(token));
- }
-
- public static boolean isNoteDbEnabled() {
- return isNoteDbEnabled;
- }
-
- public static String loginRedirect(String token) {
- if (token == null) {
- token = "";
- } else if (token.startsWith("/")) {
- token = token.substring(1);
- }
-
- return selfRedirect("login/") + URL.encodePathSegment("#/" + token);
- }
-
- public static String selfRedirect(String suffix) {
- // Clean up the path. Users seem to like putting extra slashes into the URL
- // which can break redirections by misinterpreting at either client or server.
- String path = Location.getPath();
- if (path == null || path.isEmpty()) {
- path = "/";
- } else {
- while (path.startsWith("//")) {
- path = path.substring(1);
- }
- while (path.endsWith("//")) {
- path = path.substring(0, path.length() - 1);
- }
- if (!path.endsWith("/")) {
- path = path + "/";
- }
- }
-
- if (suffix != null) {
- while (suffix.startsWith("/")) {
- suffix = suffix.substring(1);
- }
- path += suffix;
- }
-
- UrlBuilder builder = new UrlBuilder();
- builder.setProtocol(Location.getProtocol());
- builder.setHost(Location.getHost());
- String port = Location.getPort();
- if (port != null && !port.isEmpty()) {
- builder.setPort(Integer.parseInt(port));
- }
- builder.setPath(path);
- return builder.buildString();
- }
-
- static void deleteSessionCookie() {
- myAccount = AccountInfo.create(0, null, null, null);
- myAccountDiffPref = null;
- editPrefs = null;
- myPrefs = GeneralPreferences.createDefault();
- urlAliasMatcher.clearUserAliases();
- xGerritAuth = null;
- refreshMenuBar();
-
- // If the cookie was HttpOnly, this request to delete it will
- // most likely not be successful. We can try anyway though.
- //
- Cookies.removeCookie("GerritAccount");
- }
-
- private void setXsrfToken() {
- xGerritAuth = Cookies.getCookie(XSRF_COOKIE_NAME);
- JsonUtil.setDefaultXsrfManager(
- new XsrfManager() {
- @Override
- public String getToken(JsonDefTarget proxy) {
- return xGerritAuth;
- }
-
- @Override
- public void setToken(JsonDefTarget proxy, String token) {
- // Ignore the request, we always rely upon the cookie.
- }
- });
- }
-
- @Override
- public void onModuleLoad() {
- if (!canLoadInIFrame()) {
- UserAgent.assertNotInIFrame();
- }
- setXsrfToken();
-
- KeyUtil.setEncoderImpl(
- new KeyUtil.Encoder() {
- @Override
- public String encode(String e) {
- e = URL.encodeQueryString(e);
- e = fixPathImpl(e);
- e = fixColonImpl(e);
- e = fixDoubleQuote(e);
- return e;
- }
-
- @Override
- public String decode(String e) {
- return URL.decodeQueryString(e);
- }
-
- private native String fixPathImpl(String path)
- /*-{ return path.replace(/%2F/g, "/"); }-*/ ;
-
- private native String fixColonImpl(String path)
- /*-{ return path.replace(/%3A/g, ":"); }-*/ ;
-
- private native String fixDoubleQuote(String path)
- /*-{ return path.replace(/%22/g, '"'); }-*/ ;
- });
-
- initHostname();
- Window.setTitle(M.windowTitle1(myHost));
-
- RpcStatus.INSTANCE = new RpcStatus();
- CallbackGroup cbg = new CallbackGroup();
- getDocIndex(
- cbg.add(
- new GerritCallback<DocInfo>() {
- @Override
- public void onSuccess(DocInfo indexInfo) {
- hasDocumentation = indexInfo != null;
- docUrl = selfRedirect("/Documentation/");
- }
- }));
- ConfigServerApi.serverInfo(
- cbg.add(
- new GerritCallback<ServerInfo>() {
- @Override
- public void onSuccess(ServerInfo info) {
- myServerInfo = info;
- urlAliasMatcher = new UrlAliasMatcher(info.urlAliases());
- String du = info.gerrit().docUrl();
- if (du != null && !du.isEmpty()) {
- hasDocumentation = true;
- docUrl = du;
- }
- docSearch = info.gerrit().docSearch();
- }
- }));
- HostPageDataService hpd = GWT.create(HostPageDataService.class);
- hpd.load(
- cbg.addFinal(
- new GerritCallback<HostPageData>() {
- @Override
- public void onSuccess(HostPageData result) {
- Document.get().getElementById("gerrit_hostpagedata").removeFromParent();
- myTheme = result.theme;
- isNoteDbEnabled = result.isNoteDbEnabled;
- if (result.accountDiffPref != null) {
- myAccountDiffPref = result.accountDiffPref;
- }
- if (result.accountDiffPref != null) {
- // TODO: Support options on the GetDetail REST endpoint so that it can
- // also return the preferences. Then we can fetch everything with a
- // single request and we don't need the callback group anymore.
- CallbackGroup cbg = new CallbackGroup();
- AccountApi.self()
- .view("detail")
- .get(
- cbg.add(
- new GerritCallback<AccountInfo>() {
- @Override
- public void onSuccess(AccountInfo result) {
- myAccount = result;
- }
- }));
- AccountApi.self()
- .view("preferences")
- .get(
- cbg.add(
- new GerritCallback<GeneralPreferences>() {
- @Override
- public void onSuccess(GeneralPreferences prefs) {
- myPrefs = prefs;
- onModuleLoad2(result);
- }
- }));
- AccountApi.getEditPreferences(
- cbg.addFinal(
- new GerritCallback<EditPreferences>() {
- @Override
- public void onSuccess(EditPreferences prefs) {
- EditPreferencesInfo prefsInfo = new EditPreferencesInfo();
- prefs.copyTo(prefsInfo);
- editPrefs = prefsInfo;
- }
- }));
- } else {
- myAccount = AccountInfo.create(0, null, null, null);
- myPrefs = GeneralPreferences.createDefault();
- editPrefs = null;
- onModuleLoad2(result);
- }
- }
- }));
- }
-
- private native boolean canLoadInIFrame() /*-{
- return $wnd.gerrit_hostpagedata.canLoadInIFrame || false;
- }-*/;
-
- private static void initHostname() {
- myHost = Location.getHostName();
- final int d1 = myHost.indexOf('.');
- if (d1 < 0) {
- return;
- }
- final int d2 = myHost.indexOf('.', d1 + 1);
- if (d2 >= 0) {
- myHost = myHost.substring(0, d2);
- }
- }
-
- private static void dispatchHistoryHooks(String token) {
- ApiGlue.fireEvent("history", token);
- }
-
- private static String getUiSwitcherUrl(String token) {
- UrlBuilder builder = new UrlBuilder();
- builder.setProtocol(Location.getProtocol());
- builder.setHost(Location.getHost());
- String port = Location.getPort();
- if (port != null && !port.isEmpty()) {
- builder.setPort(Integer.parseInt(port));
- }
- String[] tokens = token.split("@", 2);
- if (Location.getPath().endsWith("/") && tokens[0].startsWith("/")) {
- tokens[0] = tokens[0].substring(1);
- }
- if (tokens[0].startsWith("projects/") && tokens[0].contains(",dashboards/")) {
- // Rewrite project dashboard URIs to a new format, because otherwise
- // "/projects/..." would be served as an API request.
- tokens[0] = "p/" + tokens[0].substring("projects/".length());
- tokens[0] = tokens[0].replace(",dashboards/", "/+/dashboard/");
- }
- builder.setPath(Location.getPath() + tokens[0]);
- if (tokens.length == 2) {
- builder.setHash(tokens[1]);
- }
- builder.setParameter("polygerrit", "1");
- return builder.buildString();
- }
-
- private static void populateBottomMenu(RootPanel btmmenu, HostPageData hpd) {
- String vs = hpd.version;
- if (vs == null || vs.isEmpty()) {
- vs = "dev";
- }
-
- btmmenu.add(new InlineHTML(M.poweredBy(vs)));
-
- btmmenu.add(new InlineLabel(" | "));
- uiSwitcherLink = new Anchor(C.newUi(), getUiSwitcherUrl(History.getToken()));
- uiSwitcherLink.setStyleName("");
- btmmenu.add(uiSwitcherLink);
-
- String reportBugUrl = info().gerrit().reportBugUrl();
- if (reportBugUrl != null) {
- String reportBugText = info().gerrit().reportBugText();
- Anchor a = new Anchor(reportBugText == null ? C.reportBug() : reportBugText, reportBugUrl);
- a.setTarget("_blank");
- a.setStyleName("");
- btmmenu.add(new InlineLabel(" | "));
- btmmenu.add(a);
- }
- btmmenu.add(new InlineLabel(" | "));
- btmmenu.add(new InlineLabel(C.keyHelp()));
- }
-
- private static void updateUiLink(String token) {
- if (uiSwitcherLink != null) {
- uiSwitcherLink.setHref(getUiSwitcherUrl(token));
- }
- }
-
- private void onModuleLoad2(HostPageData hpd) {
- RESOURCES.gwt_override().ensureInjected();
- RESOURCES.css().ensureInjected();
-
- topMenu = RootPanel.get("gerrit_topmenu");
- final RootPanel gStarting = RootPanel.get("gerrit_startinggerrit");
- final RootPanel gBody = RootPanel.get("gerrit_body");
- bottomMenu = RootPanel.get("gerrit_btmmenu");
-
- topMenu.setStyleName(RESOURCES.css().gerritTopMenu());
- gBody.setStyleName(RESOURCES.css().gerritBody());
-
- final Grid menuLine = new Grid(1, 3);
- menuLeft = new MorphingTabPanel();
- menuRight = new LinkMenuBar();
- searchPanel = new SearchPanel();
- menuLeft.setStyleName(RESOURCES.css().topmenuMenuLeft());
- menuLine.setStyleName(RESOURCES.css().topmenu());
- topMenu.add(menuLine);
- final FlowPanel menuRightPanel = new FlowPanel();
- menuRightPanel.setStyleName(RESOURCES.css().topmenuMenuRight());
- menuRightPanel.add(searchPanel);
- menuRightPanel.add(menuRight);
- menuLine.setWidget(0, 0, menuLeft);
- menuLine.setWidget(0, 1, new FlowPanel());
- menuLine.setWidget(0, 2, menuRightPanel);
- final CellFormatter fmt = menuLine.getCellFormatter();
- fmt.setStyleName(0, 0, RESOURCES.css().topmenuTDmenu());
- fmt.setStyleName(0, 1, RESOURCES.css().topmenuTDglue());
- fmt.setStyleName(0, 2, RESOURCES.css().topmenuTDmenu());
-
- siteHeader = RootPanel.get("gerrit_header");
- siteFooter = RootPanel.get("gerrit_footer");
-
- body =
- new ViewSite<Screen>() {
- @Override
- protected void onShowView(Screen view) {
- String token = view.getToken();
- History.newItem(token, false);
- dispatchHistoryHooks(token);
-
- if (view instanceof ChangeListScreen) {
- lastChangeListToken = token;
- }
-
- super.onShowView(view);
- view.onShowView();
- lastViewToken = token;
- }
- };
- gBody.add(body);
-
- JsonUtil.addRpcStartHandler(RpcStatus.INSTANCE);
- JsonUtil.addRpcCompleteHandler(RpcStatus.INSTANCE);
-
- gStarting.getElement().getParentElement().removeChild(gStarting.getElement());
- RootPanel.detachNow(gStarting);
- ApiGlue.init();
-
- applyUserPreferences();
- populateBottomMenu(bottomMenu, hpd);
- refreshMenuBar();
-
- History.addValueChangeHandler(
- new ValueChangeHandler<String>() {
- @Override
- public void onValueChange(ValueChangeEvent<String> event) {
- display(event.getValue());
- }
- });
- JumpKeys.register(body);
-
- saveDefaultTheme();
- if (hpd.messages != null) {
- new MessageOfTheDayBar(hpd.messages).show();
- }
- PluginLoader.load(
- hpd.plugins,
- hpd.pluginsLoadTimeout,
- new GerritCallback<VoidResult>() {
- @Override
- public void onSuccess(VoidResult result) {
- String token = History.getToken();
- if (token.isEmpty()) {
- token = isSignedIn() ? PageLinks.MINE : PageLinks.toChangeQuery("status:open");
- }
- display(token);
- }
- });
- }
-
- private void saveDefaultTheme() {
- THEMER.init(
- Document.get().getElementById("gerrit_sitecss"),
- Document.get().getElementById("gerrit_header"),
- Document.get().getElementById("gerrit_footer"));
- }
-
- public static void refreshMenuBar() {
- menuLeft.clear();
- menuRight.clear();
-
- menuBars = new HashMap<>();
-
- boolean signedIn = isSignedIn();
- AuthInfo authInfo = info().auth();
- LinkMenuBar m;
-
- m = new LinkMenuBar();
- menuBars.put(GerritTopMenu.ALL.menuName, m);
- addLink(m, C.menuAllOpen(), PageLinks.toChangeQuery("status:open"));
- addLink(m, C.menuAllMerged(), PageLinks.toChangeQuery("status:merged"));
- addLink(m, C.menuAllAbandoned(), PageLinks.toChangeQuery("status:abandoned"));
- menuLeft.add(m, C.menuAll());
-
- if (signedIn) {
- LinkMenuBar myBar = new LinkMenuBar();
- menuBars.put(GerritTopMenu.MY.menuName, myBar);
-
- if (myPrefs.my() != null) {
- myBar.clear();
- String url = null;
- List<TopMenuItem> myMenuItems = Natives.asList(myPrefs.my());
- if (!myMenuItems.isEmpty()) {
- if (myMenuItems.get(0).getUrl().startsWith("#")) {
- url = myMenuItems.get(0).getUrl().substring(1);
- }
- for (TopMenuItem item : myMenuItems) {
- addExtensionLink(myBar, item);
- }
- }
- defaultScreenToken = url;
- }
-
- menuLeft.add(myBar, C.menuMine());
- menuLeft.selectTab(1);
- } else {
- menuLeft.selectTab(0);
- }
-
- final LinkMenuBar projectsBar = new LinkMenuBar();
- menuBars.put(GerritTopMenu.PROJECTS.menuName, projectsBar);
- addLink(projectsBar, C.menuProjectsList(), PageLinks.ADMIN_PROJECTS);
- projectsBar.addItem(new ProjectLinkMenuItem(C.menuProjectsInfo(), ProjectScreen.INFO));
- projectsBar.addItem(new ProjectLinkMenuItem(C.menuProjectsBranches(), ProjectScreen.BRANCHES));
- projectsBar.addItem(new ProjectLinkMenuItem(C.menuProjectsTags(), ProjectScreen.TAGS));
- projectsBar.addItem(new ProjectLinkMenuItem(C.menuProjectsAccess(), ProjectScreen.ACCESS));
- final LinkMenuItem dashboardsMenuItem =
- new ProjectLinkMenuItem(C.menuProjectsDashboards(), ProjectScreen.DASHBOARDS) {
- @Override
- protected boolean match(String token) {
- return super.match(token)
- || (!getTargetHistoryToken().isEmpty()
- && ("/admin" + token).startsWith(getTargetHistoryToken()));
- }
- };
- projectsBar.addItem(dashboardsMenuItem);
- menuLeft.add(projectsBar, C.menuProjects());
-
- if (signedIn) {
- final LinkMenuBar peopleBar = new LinkMenuBar();
- menuBars.put(GerritTopMenu.PEOPLE.menuName, peopleBar);
- final LinkMenuItem groupsListMenuItem =
- addLink(peopleBar, C.menuPeopleGroupsList(), PageLinks.ADMIN_GROUPS);
- menuLeft.add(peopleBar, C.menuPeople());
-
- final LinkMenuBar pluginsBar = new LinkMenuBar();
- menuBars.put(GerritTopMenu.PLUGINS.menuName, pluginsBar);
- AccountCapabilities.all(
- new GerritCallback<AccountCapabilities>() {
- @Override
- public void onSuccess(AccountCapabilities result) {
- if (result.canPerform(CREATE_PROJECT)) {
- insertLink(
- projectsBar,
- C.menuProjectsCreate(),
- PageLinks.ADMIN_CREATE_PROJECT,
- projectsBar.getWidgetIndex(dashboardsMenuItem) + 1);
- }
- if (result.canPerform(CREATE_GROUP)) {
- insertLink(
- peopleBar,
- C.menuPeopleGroupsCreate(),
- PageLinks.ADMIN_CREATE_GROUP,
- peopleBar.getWidgetIndex(groupsListMenuItem) + 1);
- }
- if (result.canPerform(VIEW_PLUGINS)) {
- insertLink(pluginsBar, C.menuPluginsInstalled(), PageLinks.ADMIN_PLUGINS, 0);
- menuLeft.insert(
- pluginsBar, C.menuPlugins(), menuLeft.getWidgetIndex(peopleBar) + 1);
- }
- }
- },
- CREATE_PROJECT,
- CREATE_GROUP,
- VIEW_PLUGINS);
- }
-
- if (hasDocumentation) {
- m = new LinkMenuBar();
- menuBars.put(GerritTopMenu.DOCUMENTATION.menuName, m);
- addDocLink(m, C.menuDocumentationTOC(), "index.html");
- addDocLink(m, C.menuDocumentationSearch(), "user-search.html");
- addDocLink(m, C.menuDocumentationUpload(), "user-upload.html");
- addDocLink(m, C.menuDocumentationAccess(), "access-control.html");
- addDocLink(m, C.menuDocumentationAPI(), "rest-api.html");
- addDocLink(m, C.menuDocumentationProjectOwnerGuide(), "intro-project-owner.html");
- menuLeft.add(m, C.menuDocumentation());
- }
-
- if (signedIn) {
- whoAmI(!authInfo.isClientSslCertLdap());
- } else {
- switch (authInfo.authType()) {
- case CLIENT_SSL_CERT_LDAP:
- break;
-
- case OPENID:
- menuRight.addItem(
- C.menuRegister(),
- new Command() {
- @Override
- public void execute() {
- String t = History.getToken();
- if (t == null) {
- t = "";
- }
- doSignIn(PageLinks.REGISTER + t);
- }
- });
- menuRight.addItem(
- C.menuSignIn(),
- new Command() {
- @Override
- public void execute() {
- doSignIn(History.getToken());
- }
- });
- break;
-
- case OAUTH:
- menuRight.addItem(
- C.menuSignIn(),
- new Command() {
- @Override
- public void execute() {
- doSignIn(History.getToken());
- }
- });
- break;
-
- case OPENID_SSO:
- menuRight.addItem(
- C.menuSignIn(),
- new Command() {
- @Override
- public void execute() {
- doSignIn(History.getToken());
- }
- });
- break;
-
- case HTTP:
- case HTTP_LDAP:
- if (authInfo.loginUrl() != null) {
- String signinText =
- authInfo.loginText() == null ? C.menuSignIn() : authInfo.loginText();
- menuRight.add(anchor(signinText, authInfo.loginUrl()));
- }
- break;
-
- case LDAP:
- case LDAP_BIND:
- case CUSTOM_EXTENSION:
- if (authInfo.registerUrl() != null) {
- String registerText =
- authInfo.registerText() == null ? C.menuRegister() : authInfo.registerText();
- menuRight.add(anchor(registerText, authInfo.registerUrl()));
- }
- menuRight.addItem(
- C.menuSignIn(),
- new Command() {
- @Override
- public void execute() {
- doSignIn(History.getToken());
- }
- });
- break;
-
- case DEVELOPMENT_BECOME_ANY_ACCOUNT:
- menuRight.add(anchor("Become", loginRedirect("")));
- break;
- }
- }
- ConfigServerApi.topMenus(
- new GerritCallback<TopMenuList>() {
- @Override
- public void onSuccess(TopMenuList result) {
- List<TopMenu> topMenuExtensions = Natives.asList(result);
- for (TopMenu menu : topMenuExtensions) {
- String name = menu.getName();
- LinkMenuBar existingBar = menuBars.get(name);
- LinkMenuBar bar = existingBar != null ? existingBar : new LinkMenuBar();
- for (TopMenuItem item : Natives.asList(menu.getItems())) {
- addMenuLink(bar, item);
- }
- if (existingBar == null) {
- menuBars.put(name, bar);
- menuLeft.add(bar, name);
- }
- }
- }
- });
- }
-
- public static void refreshUserPreferences() {
- if (isSignedIn()) {
- AccountApi.self()
- .view("preferences")
- .get(
- new GerritCallback<GeneralPreferences>() {
- @Override
- public void onSuccess(GeneralPreferences prefs) {
- setUserPreferences(prefs);
- }
- });
- } else {
- setUserPreferences(GeneralPreferences.createDefault());
- }
- }
-
- public static void setUserPreferences(GeneralPreferences prefs) {
- myPrefs = prefs;
- applyUserPreferences();
- refreshMenuBar();
- }
-
- private static void applyUserPreferences() {
- CopyableLabel.setFlashEnabled(myPrefs.useFlashClipboard());
- if (siteHeader != null) {
- siteHeader.setVisible(myPrefs.showSiteHeader());
- }
- if (siteFooter != null) {
- siteFooter.setVisible(myPrefs.showSiteHeader());
- }
- FormatUtil.setPreferences(myPrefs);
- urlAliasMatcher.updateUserAliases(myPrefs.urlAliases());
- }
-
- public static boolean hasDocSearch() {
- return docSearch;
- }
-
- private static void getDocIndex(AsyncCallback<DocInfo> cb) {
- RequestBuilder req = new RequestBuilder(RequestBuilder.HEAD, GWT.getHostPageBaseURL() + INDEX);
- req.setCallback(
- new RequestCallback() {
- @Override
- public void onResponseReceived(Request req, Response resp) {
- switch (resp.getStatusCode()) {
- case Response.SC_OK:
- case Response.SC_MOVED_PERMANENTLY:
- case Response.SC_MOVED_TEMPORARILY:
- cb.onSuccess(DocInfo.create());
- break;
- default:
- cb.onSuccess(null);
- break;
- }
- }
-
- @Override
- public void onError(Request request, Throwable e) {
- cb.onFailure(e);
- }
- });
- try {
- req.send();
- } catch (RequestException e) {
- cb.onFailure(e);
- }
- }
-
- private static void whoAmI(boolean canLogOut) {
- AccountInfo account = getUserAccount();
- final UserPopupPanel userPopup = new UserPopupPanel(account, canLogOut, true);
- final FlowPanel userSummaryPanel = new FlowPanel();
- class PopupHandler implements KeyDownHandler, ClickHandler {
- private void showHidePopup() {
- if (userPopup.isShowing() && userPopup.isVisible()) {
- userPopup.hide();
- } else {
- userPopup.showRelativeTo(userSummaryPanel);
- }
- }
-
- @Override
- public void onClick(ClickEvent event) {
- showHidePopup();
- }
-
- @Override
- public void onKeyDown(KeyDownEvent event) {
- if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
- showHidePopup();
- event.preventDefault();
- }
- }
- }
- final PopupHandler popupHandler = new PopupHandler();
- final InlineLabel l = new InlineLabel(FormatUtil.name(account));
- l.setStyleName(RESOURCES.css().menuBarUserName());
- final AvatarImage avatar = new AvatarImage(account, 26, false);
- avatar.setStyleName(RESOURCES.css().menuBarUserNameAvatar());
- userSummaryPanel.setStyleName(RESOURCES.css().menuBarUserNamePanel());
- userSummaryPanel.add(l);
- userSummaryPanel.add(avatar);
- // "BLACK DOWN-POINTING SMALL TRIANGLE"
- userSummaryPanel.add(new InlineLabel(" \u25be"));
- userPopup.addAutoHidePartner(userSummaryPanel.getElement());
- FocusPanel fp = new FocusPanel(userSummaryPanel);
- fp.setStyleName(RESOURCES.css().menuBarUserNameFocusPanel());
- fp.addKeyDownHandler(popupHandler);
- fp.addClickHandler(popupHandler);
- menuRight.add(fp);
- }
-
- private static Anchor anchor(String text, String to) {
- final Anchor a = new Anchor(text, to);
- a.setStyleName(RESOURCES.css().menuItem());
- Roles.getMenuitemRole().set(a.getElement());
- return a;
- }
-
- private static LinkMenuItem addLink(final LinkMenuBar m, String text, String historyToken) {
- LinkMenuItem i = new LinkMenuItem(text, historyToken);
- m.addItem(i);
- return i;
- }
-
- private static void insertLink(
- final LinkMenuBar m, String text, String historyToken, int beforeIndex) {
- m.insertItem(new LinkMenuItem(text, historyToken), beforeIndex);
- }
-
- private static LinkMenuItem addProjectLink(LinkMenuBar m, TopMenuItem item) {
- LinkMenuItem i =
- new ProjectLinkMenuItem(item.getName(), item.getUrl()) {
- @Override
- protected void onScreenLoad(Project.NameKey project) {
- String p = panel.replace(PROJECT_NAME_MENU_VAR, URL.encodeQueryString(project.get()));
- if (!panel.startsWith("/x/") && !isAbsolute(panel)) {
- UrlBuilder builder = new UrlBuilder();
- builder.setProtocol(Location.getProtocol());
- builder.setHost(Location.getHost());
- String port = Location.getPort();
- if (port != null && !port.isEmpty()) {
- builder.setPort(Integer.parseInt(port));
- }
- builder.setPath(Location.getPath());
- p = builder.buildString() + p;
- }
- getElement().setPropertyString("href", p);
- }
-
- @Override
- public void go() {
- String href = getElement().getPropertyString("href");
- if (href.startsWith("#")) {
- super.go();
- } else {
- Window.open(href, getElement().getPropertyString("target"), "");
- }
- }
- };
- if (item.getTarget() != null && !item.getTarget().isEmpty()) {
- i.getElement().setAttribute("target", item.getTarget());
- }
- if (item.getId() != null) {
- i.getElement().setAttribute("id", item.getId());
- }
- m.addItem(i);
- return i;
- }
-
- private static void addDocLink(LinkMenuBar m, String text, String href) {
- final Anchor atag = anchor(text, docUrl + href);
- atag.setTarget("_blank");
- m.add(atag);
- }
-
- private static void addMenuLink(LinkMenuBar m, TopMenuItem item) {
- if (item.getUrl().contains(PROJECT_NAME_MENU_VAR)) {
- addProjectLink(m, item);
- } else {
- addExtensionLink(m, item);
- }
- }
-
- private static void addExtensionLink(LinkMenuBar m, TopMenuItem item) {
- if (item.getUrl().startsWith("#") && (item.getTarget() == null || item.getTarget().isEmpty())) {
- LinkMenuItem a = new LinkMenuItem(item.getName(), item.getUrl().substring(1));
- if (item.getId() != null) {
- a.getElement().setAttribute("id", item.getId());
- }
- m.addItem(a);
- } else {
- Anchor atag =
- anchor(
- item.getName(),
- isAbsolute(item.getUrl()) ? item.getUrl() : selfRedirect(item.getUrl()));
- if (item.getTarget() != null && !item.getTarget().isEmpty()) {
- atag.setTarget(item.getTarget());
- }
- if (item.getId() != null) {
- atag.getElement().setAttribute("id", item.getId());
- }
- m.add(atag);
- }
- }
-
- private static boolean isAbsolute(String url) {
- return url.matches("^https?://.*");
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritConstants.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritConstants.java
deleted file mode 100644
index eae3431..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritConstants.java
+++ /dev/null
@@ -1,199 +0,0 @@
-// Copyright (C) 2008 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.client;
-
-import com.google.gwt.i18n.client.Constants;
-
-public interface GerritConstants extends Constants {
- String menuSignIn();
-
- String menuRegister();
-
- String reportBug();
-
- String loadingPlugins();
-
- String signInDialogTitle();
-
- String signInDialogGoAnonymous();
-
- String linkIdentityDialogTitle();
-
- String registerDialogTitle();
-
- String loginTypeUnsupported();
-
- String errorTitle();
-
- String errorDialogContinue();
-
- String warnTitle();
-
- String confirmationDialogOk();
-
- String confirmationDialogCancel();
-
- String branchCreationDialogTitle();
-
- String branchCreationConfirmationMessage();
-
- String tagCreationDialogTitle();
-
- String tagCreationConfirmationMessage();
-
- String branchDeletionDialogTitle();
-
- String branchDeletionConfirmationMessage();
-
- String tagDeletionDialogTitle();
-
- String tagDeletionConfirmationMessage();
-
- String newUi();
-
- String notSignedInTitle();
-
- String notSignedInBody();
-
- String notFoundTitle();
-
- String notFoundBody();
-
- String noSuchAccountTitle();
-
- String noSuchGroupTitle();
-
- String inactiveAccountBody();
-
- String labelNotApplicable();
-
- String menuAll();
-
- String menuAllOpen();
-
- String menuAllMerged();
-
- String menuAllAbandoned();
-
- String menuMine();
-
- String menuMyChanges();
-
- String menuMyWatchedChanges();
-
- String menuMyStarredChanges();
-
- String menuMyDraftComments();
-
- String menuDiff();
-
- String menuDiffCommit();
-
- String menuDiffPreferences();
-
- String menuDiffPatchSets();
-
- String menuDiffFiles();
-
- String menuProjects();
-
- String menuProjectsList();
-
- String menuProjectsInfo();
-
- String menuProjectsBranches();
-
- String menuProjectsTags();
-
- String menuProjectsAccess();
-
- String menuProjectsDashboards();
-
- String menuProjectsCreate();
-
- String menuPeople();
-
- String menuPeopleGroupsList();
-
- String menuPeopleGroupsCreate();
-
- String menuPlugins();
-
- String menuPluginsInstalled();
-
- String menuDocumentation();
-
- String menuDocumentationTOC();
-
- String menuDocumentationSearch();
-
- String menuDocumentationUpload();
-
- String menuDocumentationAccess();
-
- String menuDocumentationAPI();
-
- String menuDocumentationProjectOwnerGuide();
-
- String searchHint();
-
- String searchButton();
-
- String rpcStatusWorking();
-
- String sectionNavigation();
-
- String sectionActions();
-
- String keySearch();
-
- String keyEditor();
-
- String keyHelp();
-
- String sectionJumping();
-
- String jumpAllOpen();
-
- String jumpAllMerged();
-
- String jumpAllAbandoned();
-
- String jumpMine();
-
- String jumpMineWatched();
-
- String jumpMineStarred();
-
- String jumpMineDraftComments();
-
- String projectAccessError();
-
- String projectAccessProposeForReviewHint();
-
- String userCannotVoteToolTip();
-
- String stringListPanelAdd();
-
- String stringListPanelDelete();
-
- String stringListPanelUp();
-
- String stringListPanelDown();
-
- String searchDropdownChanges();
-
- String searchDropdownDoc();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritConstants.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritConstants.properties
deleted file mode 100644
index 2819d22..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritConstants.properties
+++ /dev/null
@@ -1,121 +0,0 @@
-menuSignIn = Sign In
-menuRegister = Register
-reportBug = Report Bug
-loadingPlugins = Loading plugins ...
-
-signInDialogTitle = Code Review - Sign In
-signInDialogGoAnonymous = Go Anonymous
-
-linkIdentityDialogTitle = Code Review - Link Identity
-registerDialogTitle = Code Review - Register New Account
-loginTypeUnsupported = Sign in is not available.
-
-errorTitle = Code Review - Error
-errorDialogContinue = Continue
-warnTitle = Code Review - Warning
-
-confirmationDialogOk = OK
-confirmationDialogCancel = Cancel
-
-branchCreationDialogTitle = Branch Creation
-branchCreationConfirmationMessage = The following branch was successfully created:
-
-tagCreationDialogTitle = Tag Creation
-tagCreationConfirmationMessage = The following tag was successfully created:
-
-branchDeletionDialogTitle = Branch Deletion
-branchDeletionConfirmationMessage = Do you really want to delete the following branches?
-
-tagDeletionDialogTitle = Tag Deletion
-tagDeletionConfirmationMessage = Do you really want to delete the following tags?
-
-newUi = Switch to New UI
-
-notSignedInTitle = Code Review - Session Expired
-notSignedInBody = <b>Session Expired</b>\
-<p>You are no longer signed in to Gerrit Code Review.</p>\
-<p>To continue, please sign-in again.</p>
-
-notFoundTitle = Not Found
-notFoundBody = The page you requested was not found, or you do not have permission to view this page.
-noSuchAccountTitle = Code Review - Unknown User
-
-noSuchGroupTitle = Code Review - Unknown Group
-
-inactiveAccountBody = This user is currently inactive.
-
-labelNotApplicable = Label not applicable
-
-menuAll = All
-menuAllOpen = Open
-menuAllMerged = Merged
-menuAllAbandoned = Abandoned
-
-menuMine = My
-menuMyChanges = Changes
-menuMyStarredChanges = Starred Changes
-menuMyWatchedChanges = Watched Changes
-menuMyDraftComments = Draft Comments
-
-menuDiff = Differences
-menuDiffCommit = Commit Message
-menuDiffPreferences = Preferences
-menuDiffPatchSets = Patch Sets
-menuDiffFiles = Files
-
-menuProjects = Projects
-menuProjectsList = List
-menuProjectsInfo = General
-menuProjectsBranches = Branches
-menuProjectsTags = Tags
-menuProjectsAccess = Access
-menuProjectsDashboards = Dashboards
-menuProjectsCreate = Create New Project
-
-menuPeople = People
-menuPeopleGroupsList = List Groups
-menuPeopleGroupsCreate = Create New Group
-
-menuPlugins = Plugins
-menuPluginsInstalled = Installed
-
-menuDocumentation = Documentation
-menuDocumentationTOC = Table of Contents
-menuDocumentationSearch = Searching
-menuDocumentationUpload = Uploading
-menuDocumentationAccess = Access Controls
-menuDocumentationAPI = REST API
-menuDocumentationProjectOwnerGuide = Project Owner Guide
-
-searchHint = Search term
-searchButton = Search
-
-rpcStatusWorking = Working ...
-
-sectionNavigation = Navigation
-sectionActions = Actions
-keySearch = Search
-keyEditor = Open Inline Editor
-keyHelp = Press '?' to view keyboard shortcuts
-
-sectionJumping = Jumping
-jumpAllOpen = Go to all open changes
-jumpAllMerged = Go to all merged changes
-jumpAllAbandoned = Go to all abandoned changes
-jumpMine = Go to my dashboard
-jumpMineWatched = Go to watched changes
-jumpMineStarred = Go to starred changes
-jumpMineDraftComments = Go to draft comments
-
-projectAccessError = You don't have permissions to modify the access rights for the following refs:
-projectAccessProposeForReviewHint = You may propose these modifications to the project owners by clicking on 'Save for Review'.
-
-userCannotVoteToolTip = User cannot vote in this category
-
-stringListPanelAdd = Add
-stringListPanelDelete = Delete
-stringListPanelUp = Up
-stringListPanelDown = Down
-
-searchDropdownChanges = Changes
-searchDropdownDoc = Docs
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritCss.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritCss.java
deleted file mode 100644
index 968104c..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritCss.java
+++ /dev/null
@@ -1,299 +0,0 @@
-// Copyright (C) 2009 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.client;
-
-import com.google.gwt.resources.client.CssResource;
-
-public interface GerritCss extends CssResource {
- String accountDashboard();
-
- String accountInfoBlock();
-
- String accountLinkPanel();
-
- String accountPassword();
-
- String accountUsername();
-
- String activeRow();
-
- String addBranch();
-
- String addMemberTextBox();
-
- String addSshKeyPanel();
-
- String addWatchPanel();
-
- String avatarInfoPanel();
-
- String bottomheader();
-
- String branchTableDeleteButton();
-
- String branchTablePrevNextLinks();
-
- String cAPPROVAL();
-
- String cASSIGNEE();
-
- String cASSIGNEDTOME();
-
- String cLastUpdate();
-
- String cOWNER();
-
- String cSIZE();
-
- String cSUBJECT();
-
- String cSTATUS();
-
- String changeSize();
-
- String changeTable();
-
- String changeTablePrevNextLinks();
-
- String commentedActionDialog();
-
- String commentedActionMessage();
-
- String contributorAgreementAlreadySubmitted();
-
- String contributorAgreementButton();
-
- String contributorAgreementLegal();
-
- String contributorAgreementShortDescription();
-
- String createProjectPanel();
-
- String dataCell();
-
- String dataCellHidden();
-
- String dataHeader();
-
- String dataHeaderHidden();
-
- String downloadBox();
-
- String downloadBoxTable();
-
- String downloadBoxTableCommandColumn();
-
- String downloadBoxSpacer();
-
- String downloadBoxScheme();
-
- String downloadBoxCopyLabel();
-
- String downloadLink();
-
- String downloadLinkCopyLabel();
-
- String downloadLinkHeader();
-
- String downloadLinkHeaderGap();
-
- String downloadLinkList();
-
- String downloadLink_Active();
-
- String editHeadButton();
-
- String emptySection();
-
- String errorDialog();
-
- String errorDialogButtons();
-
- String errorDialogErrorType();
-
- String errorDialogGlass();
-
- String errorDialogTitle();
-
- String extensionPanel();
-
- String loadingPluginsDialog();
-
- String gerritBody();
-
- String gerritTopMenu();
-
- String greenCheckClass();
-
- String groupDescriptionPanel();
-
- String groupIncludesTable();
-
- String groupMembersTable();
-
- String groupName();
-
- String groupNamePanel();
-
- String groupNameTextBox();
-
- String groupOptionsPanel();
-
- String groupOwnerPanel();
-
- String groupOwnerTextBox();
-
- String groupUUIDPanel();
-
- String header();
-
- String iconCell();
-
- String iconHeader();
-
- String identityUntrustedExternalId();
-
- String infoBlock();
-
- String inputFieldTypeHint();
-
- String labelNotApplicable();
-
- String leftMostCell();
-
- String link();
-
- String linkMenuBar();
-
- String linkMenuItemNotLast();
-
- String maxObjectSizeLimitEffectiveLabel();
-
- String menuBarUserName();
-
- String menuBarUserNameAvatar();
-
- String menuBarUserNameFocusPanel();
-
- String menuBarUserNamePanel();
-
- String menuItem();
-
- String menuScreenMenuBar();
-
- String needsReview();
-
- String negscore();
-
- String oauthExpires();
-
- String oauthInfoBlock();
-
- String oauthPanel();
-
- String oauthPanelCookieEntry();
-
- String oauthPanelCookieHeading();
-
- String oauthPanelNetRCEntry();
-
- String oauthPanelNetRCHeading();
-
- String oauthToken();
-
- String pagingLink();
-
- String patchSetActions();
-
- String pluginProjectConfigInheritedValue();
-
- String pluginsTable();
-
- String posscore();
-
- String projectActions();
-
- String projectFilterLabel();
-
- String projectFilterPanel();
-
- String projectNameColumn();
-
- String queryIcon();
-
- String rebaseContentPanel();
-
- String rebaseSuggestBox();
-
- String registerScreenExplain();
-
- String registerScreenNextLinks();
-
- String registerScreenSection();
-
- String rpcStatus();
-
- String screen();
-
- String screenHeader();
-
- String searchPanel();
-
- String suggestBoxPopup();
-
- String sectionHeader();
-
- String singleLine();
-
- String smallHeading();
-
- String specialBranchDataCell();
-
- String specialBranchIconCell();
-
- String sshHostKeyPanel();
-
- String sshHostKeyPanelFingerprintData();
-
- String sshHostKeyPanelHeading();
-
- String sshHostKeyPanelKnownHostEntry();
-
- String sshKeyPanelEncodedKey();
-
- String sshKeyPanelInvalid();
-
- String sshKeyTable();
-
- String stringListPanelButtons();
-
- String topmenu();
-
- String topmenuMenuLeft();
-
- String topmenuMenuRight();
-
- String topmenuTDglue();
-
- String topmenuTDmenu();
-
- String topmost();
-
- String userInfoPopup();
-
- String usernameField();
-
- String watchedProjectFilter();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritMessages.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritMessages.java
deleted file mode 100644
index 980529a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritMessages.java
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (C) 2009 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.client;
-
-import com.google.gwt.i18n.client.Messages;
-
-public interface GerritMessages extends Messages {
- String windowTitle1(String hostname);
-
- String windowTitle2(String section, String hostname);
-
- String poweredBy(String version);
-
- String noSuchAccountMessage(String who);
-
- String noSuchGroupMessage(String who);
-
- String nameAlreadyUsedBody(String alreadyUsedName);
-
- String branchCreationFailed(String branchName, String error);
-
- String invalidBranchName(String branchName);
-
- String invalidRevision(String revision);
-
- String branchCreationNotAllowedUnderRefnamePrefix(String refnamePrefix);
-
- String branchAlreadyExists(String branchName);
-
- String branchCreationConflict(String branchName, String existingBranchName);
-
- String pluginFailed(String scriptPath);
-
- String cannotDownloadPlugin(String scriptPath);
-
- String parentUpdateFailed(String message);
-
- String fileCount(int fileNumber, int fileCount);
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritMessages.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritMessages.properties
deleted file mode 100644
index b2d67b8..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritMessages.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-windowTitle1 = {0} Code Review
-windowTitle2 = {0} | {1} Code Review
-poweredBy = Powered by <a href="https://www.gerritcodereview.com/" target="_blank">Gerrit Code Review</a> ({0})
-
-noSuchAccountMessage = {0} is not a registered user.
-noSuchGroupMessage = Group {0} does not exist or is not visible to you.
-nameAlreadyUsedBody = The name {0} is already in use.
-
-branchCreationFailed = Creating branch {0} failed. Error: {1}
-invalidBranchName = The branch name {0} is not valid.
-invalidRevision = The revision {0} is not valid.
-branchCreationNotAllowedUnderRefnamePrefix = Branch creation is not allowed under {0}.
-branchAlreadyExists = A branch with the name {0} already exists.
-branchCreationConflict = Cannot create branch {0} since it conflicts with branch {1}.
-
-pluginFailed = Plugin "{0}" failed to load
-cannotDownloadPlugin = Cannot load plugin from {0}
-
-parentUpdateFailed = Setting parent project failed: {0}
-
-fileCount = File {0} of {1}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritResources.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritResources.java
deleted file mode 100644
index 01be2f2..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/GerritResources.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (C) 2008 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.client;
-
-import com.google.gwt.resources.client.CssResource;
-
-public interface GerritResources extends Resources {
- @Source("gerrit.css")
- GerritCss css();
-
- @Source("gwt_override.css")
- CssResource gwt_override();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/HostPageDataService.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/HostPageDataService.java
deleted file mode 100644
index bd3d483..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/HostPageDataService.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (C) 2009 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.client;
-
-import com.google.gerrit.common.data.HostPageData;
-import com.google.gwtjsonrpc.common.AsyncCallback;
-import com.google.gwtjsonrpc.common.HostPageCache;
-import com.google.gwtjsonrpc.common.RemoteJsonService;
-import com.google.gwtjsonrpc.common.RpcImpl;
-import com.google.gwtjsonrpc.common.RpcImpl.Version;
-
-@RpcImpl(version = Version.V2_0)
-interface HostPageDataService extends RemoteJsonService {
- @HostPageCache(name = "gerrit_hostpagedata", once = true)
- void load(AsyncCallback<HostPageData> callback);
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/JumpKeys.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/JumpKeys.java
deleted file mode 100644
index a4879ca..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/JumpKeys.java
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright (C) 2009 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.client;
-
-import com.google.gerrit.common.PageLinks;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.globalkey.client.CompoundKeyCommand;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.globalkey.client.KeyCommand;
-import com.google.gwtexpui.globalkey.client.KeyCommandSet;
-
-public class JumpKeys {
- private static HandlerRegistration activeHandler;
- private static KeyCommandSet keys;
- private static Widget bodyWidget;
-
- public static void enable(boolean enable) {
- if (enable && activeHandler == null) {
- activeHandler = GlobalKey.add(bodyWidget, keys);
- } else if (!enable && activeHandler != null) {
- activeHandler.removeHandler();
- activeHandler = null;
- }
- }
-
- static void register(Widget body) {
- final KeyCommandSet jumps = new KeyCommandSet();
-
- jumps.add(
- new KeyCommand(0, 'o', Gerrit.C.jumpAllOpen()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- Gerrit.display(PageLinks.toChangeQuery("status:open"));
- }
- });
- jumps.add(
- new KeyCommand(0, 'm', Gerrit.C.jumpAllMerged()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- Gerrit.display(PageLinks.toChangeQuery("status:merged"));
- }
- });
- jumps.add(
- new KeyCommand(0, 'a', Gerrit.C.jumpAllAbandoned()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- Gerrit.display(PageLinks.toChangeQuery("status:abandoned"));
- }
- });
-
- if (Gerrit.isSignedIn()) {
- jumps.add(
- new KeyCommand(0, 'i', Gerrit.C.jumpMine()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- Gerrit.display(PageLinks.MINE);
- }
- });
- jumps.add(
- new KeyCommand(0, 'c', Gerrit.C.jumpMineDraftComments()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- Gerrit.display(PageLinks.toChangeQuery("has:draft"));
- }
- });
- jumps.add(
- new KeyCommand(0, 'w', Gerrit.C.jumpMineWatched()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- Gerrit.display(PageLinks.toChangeQuery("is:watched status:open"));
- }
- });
- jumps.add(
- new KeyCommand(0, 's', Gerrit.C.jumpMineStarred()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- Gerrit.display(PageLinks.toChangeQuery("is:starred"));
- }
- });
- }
-
- keys = new KeyCommandSet(Gerrit.C.sectionJumping());
- keys.add(new CompoundKeyCommand(0, 'g', "", jumps));
- bodyWidget = body;
- activeHandler = GlobalKey.add(body, keys);
- }
-
- private JumpKeys() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/MessageOfTheDayBar.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/MessageOfTheDayBar.java
deleted file mode 100644
index 36fa6e8..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/MessageOfTheDayBar.java
+++ /dev/null
@@ -1,91 +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.client;
-
-import com.google.gerrit.common.data.HostPageData;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.Cookies;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.RootPanel;
-import com.google.gwtexpui.safehtml.client.SafeHtml;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-import java.util.ArrayList;
-import java.util.List;
-
-/** Displays pending messages from the server. */
-class MessageOfTheDayBar extends Composite {
- interface Binder extends UiBinder<HTMLPanel, MessageOfTheDayBar> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- private final List<HostPageData.Message> motd;
- @UiField HTML message;
- @UiField Anchor dismiss;
-
- MessageOfTheDayBar(List<HostPageData.Message> motd) {
- this.motd = filter(motd);
- initWidget(uiBinder.createAndBindUi(this));
-
- SafeHtmlBuilder b = new SafeHtmlBuilder();
- if (this.motd.size() == 1) {
- b.append(SafeHtml.asis(this.motd.get(0).html));
- } else {
- for (HostPageData.Message m : this.motd) {
- b.openDiv();
- b.append(SafeHtml.asis(m.html));
- b.openElement("hr");
- b.closeSelf();
- b.closeDiv();
- }
- }
- message.setHTML(b);
- }
-
- void show() {
- if (!motd.isEmpty()) {
- RootPanel.get().add(this);
- }
- }
-
- @UiHandler("dismiss")
- void onDismiss(@SuppressWarnings("unused") ClickEvent e) {
- removeFromParent();
-
- for (HostPageData.Message m : motd) {
- Cookies.setCookie(cookieName(m), "1", m.redisplay);
- }
- }
-
- private static List<HostPageData.Message> filter(List<HostPageData.Message> in) {
- List<HostPageData.Message> show = new ArrayList<>();
- for (HostPageData.Message m : in) {
- if (Cookies.getCookie(cookieName(m)) == null) {
- show.add(m);
- }
- }
- return show;
- }
-
- private static String cookieName(HostPageData.Message m) {
- return "msg-" + m.id;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/MessageOfTheDayBar.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/MessageOfTheDayBar.ui.xml
deleted file mode 100644
index 36d08b1..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/MessageOfTheDayBar.ui.xml
+++ /dev/null
@@ -1,71 +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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:c='urn:import:com.google.gwtexpui.globalkey.client'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:style gss='false'>
- .popup {
- position: fixed;
- top: 5px;
- left: 50%;
- margin-left: -200px;
- z-index: 201;
- padding-top: 5px;
- padding-bottom: 5px;
- padding-left: 12px;
- padding-right: 12px;
- background: #FFF1A8;
- border-radius: 10px;
- }
-
- @if user.agent safari {
- .popup {
- \-webkit-border-radius: 10px;
- }
- }
- @if user.agent gecko1_8 {
- .popup {
- \-moz-border-radius: 10px;
- }
- }
-
- .message {
- display: inline;
- }
- .message a {
- color: #222;
- text-decoration: underline;
- }
- a.action {
- color: #222;
- text-decoration: underline;
- display: inline-block;
- margin-left: 0.5em;
- }
- </ui:style>
- <g:HTMLPanel styleName='{style.popup}'>
- <g:HTML ui:field='message' styleName='{style.message}'/>
- <g:Anchor ui:field='dismiss'
- styleName='{style.action}'
- href='javascript:;'
- title='Hide this message'>
- <ui:attribute name='title'/>
- Dismiss
- </g:Anchor>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/NotFoundScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/NotFoundScreen.java
deleted file mode 100644
index 29bbf85..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/NotFoundScreen.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (C) 2008 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.client;
-
-import com.google.gerrit.client.ui.Screen;
-import com.google.gwt.user.client.ui.Label;
-
-/** Displays an error message letting the user know the page doesn't exist. */
-public class NotFoundScreen extends Screen {
- @Override
- protected void onInitUI() {
- super.onInitUI();
- setPageTitle(Gerrit.C.notFoundTitle());
- add(new Label(Gerrit.C.notFoundBody()));
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- display();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/NotSignedInDialog.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/NotSignedInDialog.java
deleted file mode 100644
index cd5197a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/NotSignedInDialog.java
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (C) 2009 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.client;
-
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.user.client.History;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-
-/** A dialog box telling the user they are not signed in. */
-public class NotSignedInDialog extends PopupPanel implements CloseHandler<PopupPanel> {
- private Button signin;
- private boolean buttonClicked;
-
- public NotSignedInDialog() {
- super(/* auto hide */ false, /* modal */ true);
- setGlassEnabled(true);
- getGlassElement().addClassName(Gerrit.RESOURCES.css().errorDialogGlass());
- addStyleName(Gerrit.RESOURCES.css().errorDialog());
-
- final FlowPanel buttons = new FlowPanel();
- signin = new Button();
- signin.setText(Gerrit.C.menuSignIn());
- signin.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- buttonClicked = true;
- hide();
- Gerrit.doSignIn(History.getToken());
- }
- });
- buttons.add(signin);
-
- final Button close = new Button();
- close.getElement().getStyle().setProperty("marginLeft", "200px");
- close.setText(Gerrit.C.signInDialogGoAnonymous());
- close.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- buttonClicked = true;
- Gerrit.deleteSessionCookie();
- hide();
- }
- });
- buttons.add(close);
-
- Label title = new Label(Gerrit.C.notSignedInTitle());
- title.setStyleName(Gerrit.RESOURCES.css().errorDialogTitle());
-
- FlowPanel center = new FlowPanel();
- center.add(title);
- center.add(new HTML(Gerrit.C.notSignedInBody()));
- center.add(buttons);
- add(center);
-
- int l = Window.getScrollLeft() + 20;
- int t = Window.getScrollTop() + 20;
- setPopupPosition(l, t);
- addCloseHandler(this);
- }
-
- @Override
- public void onClose(CloseEvent<PopupPanel> event) {
- if (!buttonClicked) {
- // the dialog was closed without one of the buttons being pressed
- // e.g. the user pressed ESC to close the dialog
- Gerrit.deleteSessionCookie();
- }
- }
-
- @Override
- public void center() {
- show();
- GlobalKey.dialog(this);
- signin.setFocus(true);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/RangeInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/RangeInfo.java
deleted file mode 100644
index 42454a3..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/RangeInfo.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (C) 2016 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.client;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class RangeInfo extends JavaScriptObject {
- public final native int start() /*-{ return this.start; }-*/;
-
- public final native int end() /*-{ return this.end; }-*/;
-
- protected RangeInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/RpcStatus.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/RpcStatus.java
deleted file mode 100644
index 4153439..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/RpcStatus.java
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (C) 2008 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.client;
-
-import com.google.gwt.user.client.ui.InlineLabel;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.RootPanel;
-import com.google.gwtjsonrpc.client.event.RpcCompleteEvent;
-import com.google.gwtjsonrpc.client.event.RpcCompleteHandler;
-import com.google.gwtjsonrpc.client.event.RpcStartEvent;
-import com.google.gwtjsonrpc.client.event.RpcStartHandler;
-
-public class RpcStatus implements RpcStartHandler, RpcCompleteHandler {
- public static RpcStatus INSTANCE;
-
- private static int hideDepth;
-
- /** Execute code, hiding the RPCs they execute from being shown visually. */
- public static void hide(Runnable run) {
- try {
- hideDepth++;
- run.run();
- } finally {
- hideDepth--;
- }
- }
-
- private final Label loading;
- private int activeCalls;
-
- RpcStatus() {
- loading = new InlineLabel();
- loading.setText(Gerrit.C.rpcStatusWorking());
- loading.setStyleName(Gerrit.RESOURCES.css().rpcStatus());
- loading.setVisible(false);
- RootPanel.get().add(loading);
- }
-
- @Override
- public void onRpcStart(RpcStartEvent event) {
- onRpcStart();
- }
-
- public void onRpcStart() {
- if (++activeCalls == 1) {
- if (hideDepth == 0) {
- loading.setVisible(true);
- }
- }
- }
-
- @Override
- public void onRpcComplete(RpcCompleteEvent event) {
- onRpcComplete();
- }
-
- public void onRpcComplete() {
- if (--activeCalls == 0) {
- loading.setVisible(false);
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/SearchPanel.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/SearchPanel.java
deleted file mode 100644
index 406ab4e..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/SearchPanel.java
+++ /dev/null
@@ -1,163 +0,0 @@
-// Copyright (C) 2009 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.client;
-
-import com.google.gerrit.client.changes.QueryScreen;
-import com.google.gerrit.client.ui.HintTextBox;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-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.shared.HandlerRegistration;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.ListBox;
-import com.google.gwt.user.client.ui.SuggestBox;
-import com.google.gwt.user.client.ui.SuggestOracle.Suggestion;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.globalkey.client.KeyCommand;
-
-class SearchPanel extends Composite {
- private final HintTextBox searchBox;
- private final ListBox dropdown;
- private HandlerRegistration regFocus;
-
- SearchPanel() {
- final FlowPanel body = new FlowPanel();
- initWidget(body);
- setStyleName(Gerrit.RESOURCES.css().searchPanel());
-
- searchBox = new HintTextBox();
- final MySuggestionDisplay suggestionDisplay = new MySuggestionDisplay();
- searchBox.addKeyPressHandler(
- new KeyPressHandler() {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
- if (!suggestionDisplay.isSuggestionSelected) {
- doSearch();
- }
- }
- }
- });
-
- if (Gerrit.hasDocSearch()) {
- dropdown = new ListBox();
- dropdown.setStyleName("searchDropdown");
- dropdown.addItem(Gerrit.C.searchDropdownChanges());
- dropdown.addItem(Gerrit.C.searchDropdownDoc());
- dropdown.setVisibleItemCount(1);
- dropdown.setSelectedIndex(0);
- } else {
- // Doc search is NOT available.
- dropdown = null;
- }
-
- final SuggestBox suggestBox =
- new SuggestBox(new SearchSuggestOracle(), searchBox, suggestionDisplay);
- searchBox.setStyleName("searchTextBox");
- searchBox.setVisibleLength(70);
- searchBox.setHintText(Gerrit.C.searchHint());
-
- final Button searchButton = new Button(Gerrit.C.searchButton());
- searchButton.setStyleName("searchButton");
- searchButton.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- doSearch();
- }
- });
-
- body.add(suggestBox);
- if (dropdown != null) {
- body.add(dropdown);
- }
- body.add(searchButton);
- }
-
- void setText(String query) {
- searchBox.setText(query);
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- if (regFocus == null) {
- regFocus =
- GlobalKey.addApplication(
- this,
- new KeyCommand(0, '/', Gerrit.C.keySearch()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- event.preventDefault();
- searchBox.setFocus(true);
- searchBox.selectAll();
- }
- });
- }
- }
-
- @Override
- protected void onUnload() {
- if (regFocus != null) {
- regFocus.removeHandler();
- regFocus = null;
- }
- }
-
- private void doSearch() {
- final String query = searchBox.getText().trim();
- if ("".equals(query)) {
- return;
- }
-
- searchBox.setFocus(false);
-
- if (dropdown != null && dropdown.getSelectedValue().equals(Gerrit.C.searchDropdownDoc())) {
- // doc
- Gerrit.display(PageLinks.toDocumentationQuery(query));
- } else {
- // changes
- if (query.matches("^[1-9][0-9]*$")) {
- // Query is a change number. Project can't be supplied.
- Gerrit.display(PageLinks.toChange(null, Change.Id.parse(query)));
- } else {
- Gerrit.display(PageLinks.toChangeQuery(query), QueryScreen.forQuery(query));
- }
- }
- }
-
- private static class MySuggestionDisplay extends SuggestBox.DefaultSuggestionDisplay {
- private boolean isSuggestionSelected;
-
- private MySuggestionDisplay() {
- super();
-
- getPopupPanel().addStyleName(Gerrit.RESOURCES.css().suggestBoxPopup());
- }
-
- @Override
- protected Suggestion getCurrentSelection() {
- Suggestion currentSelection = super.getCurrentSelection();
- isSuggestionSelected = currentSelection != null;
- return currentSelection;
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/SearchSuggestOracle.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/SearchSuggestOracle.java
deleted file mode 100644
index e74ed71..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/SearchSuggestOracle.java
+++ /dev/null
@@ -1,312 +0,0 @@
-// Copyright (C) 2012 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.client;
-
-import com.google.gerrit.client.ui.AccountGroupSuggestOracle;
-import com.google.gerrit.client.ui.AccountSuggestOracle;
-import com.google.gerrit.client.ui.ProjectNameSuggestOracle;
-import com.google.gwt.user.client.ui.SuggestOracle;
-import com.google.gwtexpui.safehtml.client.HighlightSuggestOracle;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.TreeSet;
-
-public class SearchSuggestOracle extends HighlightSuggestOracle {
- private static final List<ParamSuggester> paramSuggester =
- Arrays.asList(
- new ParamSuggester(
- Arrays.asList("project:", "p:", "parentproject:"), new ProjectNameSuggestOracle()),
- new ParamSuggester(
- Arrays.asList(
- "owner:",
- "o:",
- "reviewer:",
- "r:",
- "commentby:",
- "reviewedby:",
- "author:",
- "committer:",
- "from:",
- "assignee:",
- "cc:"),
- new AccountSuggestOracle() {
- @Override
- public void onRequestSuggestions(Request request, Callback done) {
- super.onRequestSuggestions(
- request,
- new Callback() {
- @Override
- public void onSuggestionsReady(final Request request, Response response) {
- if ("self".startsWith(request.getQuery())) {
- final ArrayList<SuggestOracle.Suggestion> r =
- new ArrayList<>(response.getSuggestions().size() + 1);
- r.add(
- new SuggestOracle.Suggestion() {
- @Override
- public String getDisplayString() {
- return getReplacementString();
- }
-
- @Override
- public String getReplacementString() {
- return "self";
- }
- });
- r.addAll(response.getSuggestions());
- response.setSuggestions(r);
- }
- done.onSuggestionsReady(request, response);
- }
- });
- }
- }),
- new ParamSuggester(
- Arrays.asList("ownerin:", "reviewerin:"), new AccountGroupSuggestOracle()));
-
- private static final TreeSet<String> suggestions = new TreeSet<>();
-
- static {
- suggestions.add("age:");
- suggestions.add("age:1week"); // Give an example age
-
- suggestions.add("change:");
-
- suggestions.add("owner:");
- suggestions.add("owner:self");
- suggestions.add("ownerin:");
- suggestions.add("author:");
- suggestions.add("committer:");
- suggestions.add("assignee:");
-
- suggestions.add("reviewer:");
- suggestions.add("reviewer:self");
- suggestions.add("reviewerin:");
- suggestions.add("reviewedby:");
-
- suggestions.add("commit:");
- suggestions.add("comment:");
- suggestions.add("message:");
- suggestions.add("commentby:");
- suggestions.add("from:");
- suggestions.add("file:");
- suggestions.add("conflicts:");
- suggestions.add("project:");
- suggestions.add("projects:");
- suggestions.add("parentproject:");
- suggestions.add("branch:");
- suggestions.add("topic:");
- suggestions.add("intopic:");
- suggestions.add("ref:");
- suggestions.add("tr:");
- suggestions.add("bug:");
- suggestions.add("label:");
- suggestions.add("query:");
- suggestions.add("has:");
- suggestions.add("has:draft");
- suggestions.add("has:edit");
- suggestions.add("has:star");
- suggestions.add("has:stars");
- suggestions.add("has:unresolved");
- suggestions.add("star:");
-
- suggestions.add("is:");
- suggestions.add("is:starred");
- suggestions.add("is:watched");
- suggestions.add("is:reviewed");
- suggestions.add("is:owner");
- suggestions.add("is:reviewer");
- suggestions.add("is:open");
- suggestions.add("is:pending");
- suggestions.add("is:private");
- suggestions.add("is:closed");
- suggestions.add("is:merged");
- suggestions.add("is:abandoned");
- suggestions.add("is:mergeable");
- suggestions.add("is:ignored");
- suggestions.add("is:wip");
- suggestions.add("is:assigned");
- suggestions.add("is:submittable");
-
- suggestions.add("status:");
- suggestions.add("status:open");
- suggestions.add("status:pending");
- suggestions.add("status:reviewed");
- suggestions.add("status:closed");
- suggestions.add("status:merged");
- suggestions.add("status:abandoned");
-
- suggestions.add("added:");
- suggestions.add("deleted:");
- suggestions.add("delta:");
- suggestions.add("size:");
-
- suggestions.add("unresolved:");
-
- suggestions.add("revertof:");
-
- if (Gerrit.isNoteDbEnabled()) {
- suggestions.add("cc:");
- suggestions.add("hashtag:");
- }
-
- suggestions.add("is:assigned");
- suggestions.add("is:unassigned");
- suggestions.add("assignee:");
-
- suggestions.add("AND");
- suggestions.add("OR");
- suggestions.add("NOT");
- }
-
- @Override
- public void requestDefaultSuggestions(Request request, Callback done) {
- final ArrayList<SearchSuggestion> r = new ArrayList<>();
- // No text - show some default suggestions.
- r.add(new SearchSuggestion("status:open", "status:open"));
- r.add(new SearchSuggestion("age:1week", "age:1week"));
- if (Gerrit.isSignedIn()) {
- r.add(new SearchSuggestion("owner:self", "owner:self"));
- }
- done.onSuggestionsReady(request, new Response(r));
- }
-
- @Override
- protected void onRequestSuggestions(Request request, Callback done) {
- final String query = request.getQuery();
-
- final String lastWord = getLastWord(query);
- if (lastWord == null) {
- // Starting a new word - don't show suggestions yet.
- done.onSuggestionsReady(request, null);
- return;
- }
-
- for (ParamSuggester ps : paramSuggester) {
- if (ps.applicable(lastWord)) {
- ps.suggest(lastWord, request, done);
- return;
- }
- }
-
- final ArrayList<SearchSuggestion> r = new ArrayList<>();
- for (String suggestion : suggestions.tailSet(lastWord)) {
- if ((lastWord.length() < suggestion.length()) && suggestion.startsWith(lastWord)) {
- if (suggestion.contains("self") && !Gerrit.isSignedIn()) {
- continue;
- }
- r.add(new SearchSuggestion(suggestion, query + suggestion.substring(lastWord.length())));
- }
- }
- done.onSuggestionsReady(request, new Response(r));
- }
-
- private String getLastWord(String query) {
- final int lastSpace = query.lastIndexOf(' ');
- if (lastSpace == query.length() - 1) {
- return null;
- }
- if (lastSpace == -1) {
- return query;
- }
- return query.substring(lastSpace + 1);
- }
-
- @Override
- protected String getQueryPattern(String query) {
- return super.getQueryPattern(getLastWord(query));
- }
-
- @Override
- protected boolean isHTML() {
- return true;
- }
-
- private static class SearchSuggestion implements SuggestOracle.Suggestion {
- private final String suggestion;
- private final String fullQuery;
-
- SearchSuggestion(String suggestion, String fullQuery) {
- this.suggestion = suggestion;
- // Add a space to the query if it is a complete operation (e.g.
- // "status:open") so the user can keep on typing.
- this.fullQuery = fullQuery.endsWith(":") ? fullQuery : fullQuery + " ";
- }
-
- @Override
- public String getDisplayString() {
- return suggestion;
- }
-
- @Override
- public String getReplacementString() {
- return fullQuery;
- }
- }
-
- private static class ParamSuggester {
- private final List<String> operators;
- private final SuggestOracle parameterSuggestionOracle;
-
- ParamSuggester(List<String> operators, SuggestOracle parameterSuggestionOracle) {
- this.operators = operators;
- this.parameterSuggestionOracle = parameterSuggestionOracle;
- }
-
- boolean applicable(String query) {
- final String operator = getApplicableOperator(query, operators);
- return operator != null && query.length() > operator.length();
- }
-
- private String getApplicableOperator(String lastWord, List<String> operators) {
- for (String operator : operators) {
- if (lastWord.startsWith(operator)) {
- return operator;
- }
- }
- return null;
- }
-
- void suggest(String lastWord, Request request, Callback done) {
- final String operator = getApplicableOperator(lastWord, operators);
- parameterSuggestionOracle.requestSuggestions(
- new Request(lastWord.substring(operator.length()), request.getLimit()),
- new Callback() {
- @Override
- public void onSuggestionsReady(Request req, Response response) {
- final String query = request.getQuery();
- final List<SearchSuggestOracle.Suggestion> r =
- new ArrayList<>(response.getSuggestions().size());
- for (SearchSuggestOracle.Suggestion s : response.getSuggestions()) {
- r.add(
- new SearchSuggestion(
- s.getDisplayString(),
- query.substring(0, query.length() - lastWord.length())
- + operator
- + quoteIfNeeded(s.getReplacementString())));
- }
- done.onSuggestionsReady(request, new Response(r));
- }
-
- private String quoteIfNeeded(String s) {
- if (!s.matches("^\\S*$")) {
- return "\"" + s + "\"";
- }
- return s;
- }
- });
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/StringListPanel.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/StringListPanel.java
deleted file mode 100644
index f771fee..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/StringListPanel.java
+++ /dev/null
@@ -1,359 +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.client;
-
-import com.google.gerrit.client.ui.NavigationTable;
-import com.google.gerrit.client.ui.OnEditEnabler;
-import com.google.gerrit.client.ui.SmallHeading;
-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.Event;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.FocusWidget;
-import com.google.gwt.user.client.ui.HasEnabled;
-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.gwtexpui.globalkey.client.NpTextBox;
-import java.util.ArrayList;
-import java.util.List;
-
-public class StringListPanel extends FlowPanel implements HasEnabled {
- private final StringListTable t;
- private 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;
- if (title != null) {
- titlePanel = new HorizontalPanel();
- SmallHeading titleLabel = new SmallHeading(title);
- titlePanel.add(titleLabel);
- add(titlePanel);
- }
-
- t = new StringListTable(fieldNames, autoSort);
- add(t);
-
- buttonPanel = new HorizontalPanel();
- buttonPanel.setStyleName(Gerrit.RESOURCES.css().stringListPanelButtons());
- deleteButton = new Button(Gerrit.C.stringListPanelDelete());
- 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 && titlePanel != null) {
- info = new Image(Gerrit.RESOURCES.info());
- titlePanel.add(info);
- }
- if (info != null) {
- info.setTitle(msg);
- }
- }
-
- public List<List<String>> getValues() {
- return t.getValues();
- }
-
- public List<String> getValues(int i) {
- List<List<String>> allValuesList = getValues();
- List<String> singleValueList = new ArrayList<>(allValuesList.size());
- for (List<String> values : allValuesList) {
- singleValueList.add(values.get(i));
- }
- return singleValueList;
- }
-
- private class StringListTable extends NavigationTable<List<String>> {
- private final Button addButton;
- private final List<NpTextBox> inputs;
- private final boolean autoSort;
-
- StringListTable(List<String> names, boolean autoSort) {
- this.autoSort = autoSort;
-
- addButton = new Button(new ImageResourceRenderer().render(Gerrit.RESOURCES.listAdd()));
- addButton.setTitle(Gerrit.C.stringListPanelAdd());
- OnEditEnabler e = new OnEditEnabler(addButton);
- inputs = new ArrayList<>();
-
- FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().iconHeader());
- fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().leftMostCell());
- for (int i = 0; i < names.size(); i++) {
- fmt.addStyleName(0, i + 1, Gerrit.RESOURCES.css().dataHeader());
- table.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, Gerrit.RESOURCES.css().dataHeader());
- table.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, Gerrit.RESOURCES.css().iconHeader());
- fmt.addStyleName(1, 0, Gerrit.RESOURCES.css().leftMostCell());
- table.setWidget(1, 0, addButton);
-
- if (!autoSort) {
- fmt.addStyleName(0, names.size() + 1, Gerrit.RESOURCES.css().iconHeader());
- fmt.addStyleName(0, names.size() + 2, Gerrit.RESOURCES.css().iconHeader());
- fmt.addStyleName(1, names.size() + 1, Gerrit.RESOURCES.css().iconHeader());
- fmt.addStyleName(1, names.size() + 2, Gerrit.RESOURCES.css().iconHeader());
- }
- }
-
- void display(List<List<String>> values) {
- for (int row = 2; row < table.getRowCount(); row++) {
- table.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 < table.getRowCount(); row++) {
- values.add(getRowItem(row));
- }
- return values;
- }
-
- @Override
- protected List<String> getRowItem(int row) {
- List<String> v = new ArrayList<>();
- for (int i = 0; i < inputs.size(); i++) {
- v.add(table.getText(row, i + 1));
- }
- return v;
- }
-
- private void populate(int row, List<String> values) {
- FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().iconCell());
- fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().leftMostCell());
- CheckBox checkBox = new CheckBox();
- checkBox.addValueChangeHandler(
- new ValueChangeHandler<Boolean>() {
- @Override
- public void onValueChange(ValueChangeEvent<Boolean> event) {
- enableDelete();
- }
- });
- table.setWidget(row, 0, checkBox);
- for (int i = 0; i < values.size(); i++) {
- fmt.addStyleName(row, i + 1, Gerrit.RESOURCES.css().dataCell());
- table.setText(row, i + 1, values.get(i));
- }
- if (!autoSort) {
- fmt.addStyleName(row, values.size() + 1, Gerrit.RESOURCES.css().iconCell());
- fmt.addStyleName(row, values.size() + 2, Gerrit.RESOURCES.css().dataCell());
-
- Image down = new Image(Gerrit.RESOURCES.arrowDown());
- down.setTitle(Gerrit.C.stringListPanelDown());
- down.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- moveDown(row);
- }
- });
- table.setWidget(row, values.size() + 1, down);
-
- Image up = new Image(Gerrit.RESOURCES.arrowUp());
- up.setTitle(Gerrit.C.stringListPanelUp());
- up.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- moveUp(row);
- }
- });
- table.setWidget(row, values.size() + 2, up);
- }
- }
-
- @Override
- protected void onCellSingleClick(Event event, int row, int column) {
- if (column == inputs.size() + 1 && row >= 2 && row < table.getRowCount() - 2) {
- moveDown(row);
- } else if (column == inputs.size() + 2 && row > 2) {
- moveUp(row);
- }
- }
-
- void moveDown(int row) {
- if (row < table.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 < table.getRowCount(); row++) {
- table.getWidget(row, inputs.size() + 1).setVisible(row < table.getRowCount() - 1);
- table.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 = table.getRowCount();
- if (autoSort) {
- for (int row = 1; row < table.getRowCount(); row++) {
- int compareResult = v.get(0).compareTo(table.getText(row, 1));
- if (compareResult < 0) {
- insertPos = row;
- break;
- } else if (compareResult == 0) {
- return;
- }
- }
- }
- table.insertRow(insertPos);
- populate(insertPos, v);
- updateNavigationLinks();
- }
-
- void enableDelete() {
- for (int row = 2; row < table.getRowCount(); row++) {
- if (((CheckBox) table.getWidget(row, 0)).getValue()) {
- deleteButton.setEnabled(true);
- return;
- }
- }
- deleteButton.setEnabled(false);
- }
-
- void deleteChecked() {
- deleteButton.setEnabled(false);
- for (int row = 2; row < table.getRowCount(); row++) {
- if (((CheckBox) table.getWidget(row, 0)).getValue()) {
- table.removeRow(row--);
- }
- }
- updateNavigationLinks();
- }
-
- @Override
- protected void onOpenRow(int row) {}
-
- @Override
- protected Object getRowItemKey(List<String> item) {
- return item.get(0);
- }
-
- void setEnabled(boolean enabled) {
- addButton.setVisible(enabled);
- for (NpTextBox input : inputs) {
- input.setEnabled(enabled);
- }
- for (int row = 2; row < table.getRowCount(); row++) {
- table.getWidget(row, 0).setVisible(enabled);
- if (!autoSort) {
- table.getWidget(row, inputs.size() + 1).setVisible(enabled);
- table.getWidget(row, inputs.size() + 2).setVisible(enabled);
- }
- }
- if (enabled) {
- updateNavigationLinks();
- }
- }
- }
-
- @Override
- public boolean isEnabled() {
- return deleteButton.isVisible();
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- t.setEnabled(enabled);
- deleteButton.setVisible(enabled);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Themer.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/Themer.java
deleted file mode 100644
index d87c0b8..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/Themer.java
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (C) 2013 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.client;
-
-import com.google.gerrit.client.projects.ThemeInfo;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.StyleElement;
-
-public class Themer {
- public static class ThemerIE extends Themer {
- protected ThemerIE() {}
-
- @Override
- protected String getCssText(StyleElement el) {
- return el.getCssText();
- }
-
- @Override
- protected void setCssText(StyleElement el, String css) {
- el.setCssText(css);
- }
- }
-
- protected StyleElement cssElement;
- protected Element headerElement;
- protected Element footerElement;
- protected String cssText;
- protected String headerHtml;
- protected String footerHtml;
-
- protected Themer() {}
-
- public void set(ThemeInfo theme) {
- if (theme != null) {
- set(
- theme.css() != null ? theme.css() : cssText,
- theme.header() != null ? theme.header() : headerHtml,
- theme.footer() != null ? theme.footer() : footerHtml);
- } else {
- set(cssText, headerHtml, footerHtml);
- }
- }
-
- public void clear() {
- set(null);
- }
-
- void init(Element css, Element header, Element footer) {
- cssElement = StyleElement.as(css);
- headerElement = header;
- footerElement = footer;
-
- cssText = getCssText(this.cssElement);
- headerHtml = header.getInnerHTML();
- footerHtml = footer.getInnerHTML();
- }
-
- protected String getCssText(StyleElement el) {
- return el.getInnerHTML();
- }
-
- protected void setCssText(StyleElement el, String css) {
- el.setInnerHTML(css);
- }
-
- private void set(String css, String header, String footer) {
- setCssText(cssElement, css);
- headerElement.setInnerHTML(header);
- footerElement.setInnerHTML(footer);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/UrlAliasMatcher.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/UrlAliasMatcher.java
deleted file mode 100644
index acaaf46..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/UrlAliasMatcher.java
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (C) 2015 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.client;
-
-import com.google.gwt.regexp.shared.RegExp;
-import java.util.HashMap;
-import java.util.Map;
-
-public class UrlAliasMatcher {
- private final Map<RegExp, String> userUrlAliases;
- private final Map<RegExp, String> globalUrlAliases;
-
- UrlAliasMatcher(Map<String, String> globalUrlAliases) {
- this.globalUrlAliases = compile(globalUrlAliases);
- this.userUrlAliases = new HashMap<>();
- }
-
- private static Map<RegExp, String> compile(Map<String, String> urlAliases) {
- Map<RegExp, String> compiledUrlAliases = new HashMap<>();
- if (urlAliases != null) {
- for (Map.Entry<String, String> e : urlAliases.entrySet()) {
- compiledUrlAliases.put(RegExp.compile(e.getKey()), e.getValue());
- }
- }
- return compiledUrlAliases;
- }
-
- void clearUserAliases() {
- this.userUrlAliases.clear();
- }
-
- void updateUserAliases(Map<String, String> userUrlAliases) {
- clearUserAliases();
- this.userUrlAliases.putAll(compile(userUrlAliases));
- }
-
- public String replace(String token) {
- for (Map.Entry<RegExp, String> e : userUrlAliases.entrySet()) {
- RegExp pat = e.getKey();
- if (pat.exec(token) != null) {
- return pat.replace(token, e.getValue());
- }
- }
-
- for (Map.Entry<RegExp, String> e : globalUrlAliases.entrySet()) {
- RegExp pat = e.getKey();
- if (pat.exec(token) != null) {
- return pat.replace(token, e.getValue());
- }
- }
- return token;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/UserPopupPanel.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/UserPopupPanel.java
deleted file mode 100644
index cb529f4..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/UserPopupPanel.java
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (C) 2012 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.client;
-
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.ui.InlineHyperlink;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.AnchorElement;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.Widget;
-
-public class UserPopupPanel extends PopupPanel {
- interface Binder extends UiBinder<Widget, UserPopupPanel> {}
-
- private static final Binder binder = GWT.create(Binder.class);
-
- @UiField(provided = true)
- AvatarImage avatar;
-
- @UiField Label userName;
- @UiField Label userEmail;
- @UiField Element userLinks;
- @UiField AnchorElement switchAccount;
- @UiField AnchorElement logout;
- @UiField InlineHyperlink settings;
-
- public UserPopupPanel(AccountInfo account, boolean canLogOut, boolean showSettingsLink) {
- super(/* auto hide */ true, /* modal */ false);
- avatar = new AvatarImage(account, 100, false);
- setWidget(binder.createAndBindUi(this));
- setStyleName(Gerrit.RESOURCES.css().userInfoPopup());
- if (account.name() != null) {
- userName.setText(account.name());
- }
- if (account.email() != null) {
- userEmail.setText(account.email());
- }
- if (showSettingsLink) {
- String switchAccountUrl = Gerrit.info().auth().switchAccountUrl();
- if (switchAccountUrl != null) {
- switchAccount.setHref(switchAccountUrl.replace("${path}", "/"));
- } else if (Gerrit.info().auth().isDev() || Gerrit.info().auth().isOpenId()) {
- switchAccount.setHref(Gerrit.selfRedirect("/login"));
- } else {
- switchAccount.removeFromParent();
- switchAccount = null;
- }
- if (canLogOut) {
- logout.setHref(Gerrit.selfRedirect("/logout"));
- } else {
- logout.removeFromParent();
- logout = null;
- }
-
- } else {
- settings.removeFromParent();
- settings = null;
- userLinks.removeFromParent();
- userLinks = null;
- logout = null;
- }
-
- // We must show and then hide this popup so that it is part of the DOM.
- // Otherwise the image does not get any events. Calling hide() would
- // remove it from the DOM so we use setVisible(false) instead.
- show();
- setVisible(false);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/UserPopupPanel.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/UserPopupPanel.ui.xml
deleted file mode 100644
index 8f5073d..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/UserPopupPanel.ui.xml
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2012 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.
--->
-<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">
-<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:gerrit='urn:import:com.google.gerrit.client'
- xmlns:u='urn:import:com.google.gerrit.client.ui'>
- <ui:style gss='false'>
- .panel {
- padding: 8px;
- }
- .avatar {
- padding-right: 4px;
- width: 100px;
- height: 100px;
- }
- .infoCell {
- vertical-align: top;
- }
- .userName {
- font-weight: bold;
- }
- .email {
- padding-bottom: 6px;
- }
- .userLinks {
- min-width: 250px;
- }
- .userLinksRight {
- float: right;
- }
- .switchAccount {
- border-right: 1px solid black;
- padding-right: 0.5em;
- margin-right: 0.5em;
- }
- </ui:style>
-
- <g:HTMLPanel styleName='{style.panel}'>
- <table><tr><td>
- <gerrit:AvatarImage ui:field='avatar' styleName='{style.avatar}' />
- </td><td class='{style.infoCell}'>
- <g:Label ui:field='userName' styleName="{style.userName}" />
- <g:Label ui:field='userEmail' styleName="{style.email}" />
- </td></tr></table>
- <div ui:field='userLinks' class='{style.userLinks}'>
- <u:InlineHyperlink ui:field='settings' targetHistoryToken='/settings/'>
- <ui:msg>Settings</ui:msg>
- </u:InlineHyperlink>
- <span class='{style.userLinksRight}'>
- <a ui:field='switchAccount' class='{style.switchAccount}'><ui:msg>Switch Account</ui:msg></a
- ><a ui:field='logout'><ui:msg>Sign Out</ui:msg></a>
- </span>
- </div>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/VoidResult.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/VoidResult.java
deleted file mode 100644
index 810ebe7..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/VoidResult.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (C) 2013 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.client;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-public final class VoidResult extends JavaScriptObject {
- protected VoidResult() {}
-
- public static VoidResult create() {
- return createObject().cast();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/access/AccessMap.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/access/AccessMap.java
deleted file mode 100644
index a0060d5..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/access/AccessMap.java
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright (C) 2013 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.client.access;
-
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import java.util.Collections;
-import java.util.Set;
-
-/** Access rights available from {@code /access/}. */
-public class AccessMap extends NativeMap<ProjectAccessInfo> {
- public static void get(Set<Project.NameKey> projects, AsyncCallback<AccessMap> callback) {
- RestApi api = new RestApi("/access/");
- for (Project.NameKey p : projects) {
- api.addParameter("project", p.get());
- }
- api.get(NativeMap.copyKeysIntoChildren(callback));
- }
-
- public static void get(Project.NameKey project, AsyncCallback<ProjectAccessInfo> cb) {
- get(
- Collections.singleton(project),
- new AsyncCallback<AccessMap>() {
- @Override
- public void onSuccess(AccessMap result) {
- cb.onSuccess(result.get(project.get()));
- }
-
- @Override
- public void onFailure(Throwable caught) {
- cb.onFailure(caught);
- }
- });
- }
-
- protected AccessMap() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/access/ProjectAccessInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/access/ProjectAccessInfo.java
deleted file mode 100644
index 88635df..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/access/ProjectAccessInfo.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) 2013 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.client.access;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class ProjectAccessInfo extends JavaScriptObject {
- public final native boolean canAddRefs() /*-{ return this.can_add ? true : false; }-*/;
-
- public final native boolean canAddTagRefs() /*-{ return this.can_add_tags ? true : false; }-*/;
-
- public final native boolean isOwner() /*-{ return this.is_owner ? true : false; }-*/;
-
- public final native boolean configVisible() /*-{ return this.config_visible ? true : false; }-*/;
-
- protected ProjectAccessInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountApi.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountApi.java
deleted file mode 100644
index 7f4522f..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountApi.java
+++ /dev/null
@@ -1,287 +0,0 @@
-// Copyright (C) 2013 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.client.account;
-
-import com.google.gerrit.client.VoidResult;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.info.AgreementInfo;
-import com.google.gerrit.client.info.GpgKeyInfo;
-import com.google.gerrit.client.rpc.CallbackGroup;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwtorm.client.KeyUtil;
-import java.util.HashSet;
-import java.util.Set;
-
-/** A collection of static methods which work on the Gerrit REST API for specific accounts. */
-public class AccountApi {
- public static RestApi self() {
- return new RestApi("/accounts/").view("self");
- }
-
- /** Retrieve the account edit preferences */
- public static void getEditPreferences(AsyncCallback<EditPreferences> cb) {
- self().view("preferences.edit").get(cb);
- }
-
- /** Put the account edit preferences */
- public static void putEditPreferences(EditPreferences in, AsyncCallback<EditPreferences> cb) {
- self().view("preferences.edit").put(in, cb);
- }
-
- public static void suggest(String query, int limit, AsyncCallback<JsArray<AccountInfo>> cb) {
- new RestApi("/accounts/")
- .addParameterTrue("suggest")
- .addParameterRaw("q", KeyUtil.encode(query))
- .addParameter("n", limit)
- .background()
- .get(cb);
- }
-
- public static void putDiffPreferences(DiffPreferences in, AsyncCallback<DiffPreferences> cb) {
- self().view("preferences.diff").put(in, cb);
- }
-
- /** Retrieve the username */
- public static void getUsername(String account, AsyncCallback<NativeString> cb) {
- new RestApi("/accounts/").id(account).view("username").get(cb);
- }
-
- /** Set the username */
- public static void setUsername(String account, String username, AsyncCallback<NativeString> cb) {
- UsernameInput input = UsernameInput.create();
- input.username(username);
- new RestApi("/accounts/").id(account).view("username").put(input, cb);
- }
-
- /** Retrieve the account name */
- public static void getName(String account, AsyncCallback<NativeString> cb) {
- new RestApi("/accounts/").id(account).view("name").get(cb);
- }
-
- /** Set the account name */
- public static void setName(String account, String name, AsyncCallback<NativeString> cb) {
- AccountNameInput input = AccountNameInput.create();
- input.name(name);
- new RestApi("/accounts/").id(account).view("name").put(input, cb);
- }
-
- /** Retrieve email addresses */
- public static void getEmails(String account, AsyncCallback<JsArray<EmailInfo>> cb) {
- new RestApi("/accounts/").id(account).view("emails").get(cb);
- }
-
- /** Register a new email address */
- public static void registerEmail(String account, String email, AsyncCallback<EmailInfo> cb) {
- JavaScriptObject in = JavaScriptObject.createObject();
- new RestApi("/accounts/").id(account).view("emails").id(email).ifNoneMatch().put(in, cb);
- }
-
- /** Set preferred email address */
- public static void setPreferredEmail(
- String account, String email, AsyncCallback<NativeString> cb) {
- new RestApi("/accounts/").id(account).view("emails").id(email).view("preferred").put(cb);
- }
-
- /** Retrieve SSH keys */
- public static void getSshKeys(String account, AsyncCallback<JsArray<SshKeyInfo>> cb) {
- new RestApi("/accounts/").id(account).view("sshkeys").get(cb);
- }
-
- /** Add a new SSH keys */
- public static void addSshKey(String account, String sshPublicKey, AsyncCallback<SshKeyInfo> cb) {
- new RestApi("/accounts/").id(account).view("sshkeys").post(sshPublicKey, cb);
- }
-
- /** Retrieve Watched Projects */
- public static void getWatchedProjects(
- String account, AsyncCallback<JsArray<ProjectWatchInfo>> cb) {
- new RestApi("/accounts/").id(account).view("watched.projects").get(cb);
- }
-
- /** Create/Update Watched Project */
- public static void updateWatchedProject(
- String account,
- ProjectWatchInfo watchedProjectInfo,
- AsyncCallback<JsArray<ProjectWatchInfo>> cb) {
- Set<ProjectWatchInfo> watchedProjectInfos = new HashSet<>();
- watchedProjectInfos.add(watchedProjectInfo);
- updateWatchedProjects(account, watchedProjectInfos, cb);
- }
-
- /** Create/Update Watched Projects */
- public static void updateWatchedProjects(
- String account,
- Set<ProjectWatchInfo> watchedProjectInfos,
- AsyncCallback<JsArray<ProjectWatchInfo>> cb) {
- new RestApi("/accounts/")
- .id(account)
- .view("watched.projects")
- .post(projectWatchArrayFromSet(watchedProjectInfos), cb);
- }
-
- /** Delete Watched Project */
- public static void deleteWatchedProject(
- String account,
- ProjectWatchInfo watchedProjectInfo,
- AsyncCallback<JsArray<ProjectWatchInfo>> cb) {
- Set<ProjectWatchInfo> watchedProjectInfos = new HashSet<>();
- watchedProjectInfos.add(watchedProjectInfo);
- deleteWatchedProjects(account, watchedProjectInfos, cb);
- }
-
- /** Delete Watched Projects */
- public static void deleteWatchedProjects(
- String account,
- Set<ProjectWatchInfo> watchedProjectInfos,
- AsyncCallback<JsArray<ProjectWatchInfo>> cb) {
- new RestApi("/accounts/")
- .id(account)
- .view("watched.projects:delete")
- .post(projectWatchArrayFromSet(watchedProjectInfos), cb);
- }
-
- /**
- * Delete SSH keys. For each key to be deleted a separate DELETE request is fired to the server.
- * The {@code onSuccess} method of the provided callback is invoked once after all requests
- * succeeded. If any request fails the callbacks' {@code onFailure} method is invoked. In a
- * failure case it can be that still some of the keys were successfully deleted.
- */
- public static void deleteSshKeys(
- String account, Set<Integer> sequenceNumbers, AsyncCallback<VoidResult> cb) {
- CallbackGroup group = new CallbackGroup();
- for (int seq : sequenceNumbers) {
- new RestApi("/accounts/").id(account).view("sshkeys").id(seq).delete(group.add(cb));
- cb = CallbackGroup.emptyCallback();
- }
- group.done();
- }
-
- /** Generate a new HTTP password */
- public static void generateHttpPassword(String account, AsyncCallback<NativeString> cb) {
- HttpPasswordInput in = HttpPasswordInput.create();
- in.generate(true);
- new RestApi("/accounts/").id(account).view("password.http").put(in, cb);
- }
-
- /** Retrieve account external ids */
- public static void getExternalIds(AsyncCallback<JsArray<ExternalIdInfo>> cb) {
- self().view("external.ids").get(cb);
- }
-
- /** Delete account external ids */
- public static void deleteExternalIds(Set<String> ids, AsyncCallback<VoidResult> cb) {
- self().view("external.ids:delete").post(Natives.arrayOf(ids), cb);
- }
-
- /** Enter a contributor agreement */
- public static void enterAgreement(String account, String name, AsyncCallback<NativeString> cb) {
- AgreementInput in = AgreementInput.create();
- in.name(name);
- new RestApi("/accounts/").id(account).view("agreements").put(in, cb);
- }
-
- private static JsArray<ProjectWatchInfo> projectWatchArrayFromSet(Set<ProjectWatchInfo> set) {
- JsArray<ProjectWatchInfo> jsArray = JsArray.createArray().cast();
- for (ProjectWatchInfo p : set) {
- jsArray.push(p);
- }
- return jsArray;
- }
-
- private static class AgreementInput extends JavaScriptObject {
- final native void name(String n) /*-{ if(n)this.name=n; }-*/;
-
- static AgreementInput create() {
- return createObject().cast();
- }
-
- protected AgreementInput() {}
- }
-
- private static class HttpPasswordInput extends JavaScriptObject {
- final native void generate(boolean g) /*-{ if(g)this.generate=g; }-*/;
-
- static HttpPasswordInput create() {
- return createObject().cast();
- }
-
- protected HttpPasswordInput() {}
- }
-
- private static class UsernameInput extends JavaScriptObject {
- final native void username(String u) /*-{ if(u)this.username=u; }-*/;
-
- static UsernameInput create() {
- return createObject().cast();
- }
-
- protected UsernameInput() {}
- }
-
- private static class AccountNameInput extends JavaScriptObject {
- final native void name(String n) /*-{ if(n)this.name=n; }-*/;
-
- static AccountNameInput create() {
- return createObject().cast();
- }
-
- protected AccountNameInput() {}
- }
-
- public static void addGpgKey(
- String account, String armored, AsyncCallback<NativeMap<GpgKeyInfo>> cb) {
- new RestApi("/accounts/").id(account).view("gpgkeys").post(GpgKeysInput.add(armored), cb);
- }
-
- public static void deleteGpgKeys(
- String account, Iterable<String> fingerprints, AsyncCallback<NativeMap<GpgKeyInfo>> cb) {
- new RestApi("/accounts/")
- .id(account)
- .view("gpgkeys")
- .post(GpgKeysInput.delete(fingerprints), cb);
- }
-
- /** List contributor agreements */
- public static void getAgreements(String account, AsyncCallback<JsArray<AgreementInfo>> cb) {
- new RestApi("/accounts/").id(account).view("agreements").get(cb);
- }
-
- private static class GpgKeysInput extends JavaScriptObject {
- static GpgKeysInput add(String key) {
- return createWithAdd(Natives.arrayOf(key));
- }
-
- static GpgKeysInput delete(Iterable<String> fingerprints) {
- return createWithDelete(Natives.arrayOf(fingerprints));
- }
-
- private static native GpgKeysInput createWithAdd(JsArrayString keys) /*-{
- return {'add': keys};
- }-*/;
-
- private static native GpgKeysInput createWithDelete(JsArrayString fingerprints) /*-{
- return {'delete': fingerprints};
- }-*/;
-
- protected GpgKeysInput() {}
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountCapabilities.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountCapabilities.java
deleted file mode 100644
index d317881..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountCapabilities.java
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (C) 2012 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.client.account;
-
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-/** Capabilities the caller has from {@code /accounts/self/capabilities}. */
-public class AccountCapabilities extends JavaScriptObject {
- public static void all(AsyncCallback<AccountCapabilities> cb, String... filter) {
- new RestApi("/accounts/self/capabilities").addParameter("q", filter).get(cb);
- }
-
- protected AccountCapabilities() {}
-
- public final native boolean canPerform(String name) /*-{ return this[name] ? true : false; }-*/;
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.java
deleted file mode 100644
index 3e21619..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.java
+++ /dev/null
@@ -1,311 +0,0 @@
-// Copyright (C) 2008 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.client.account;
-
-import com.google.gwt.i18n.client.Constants;
-
-public interface AccountConstants extends Constants {
- String settingsHeading();
-
- String changeAvatar();
-
- String fullName();
-
- String preferredEmail();
-
- String registeredOn();
-
- String accountId();
-
- String diffViewLabel();
-
- String maximumPageSizeFieldLabel();
-
- String dateFormatLabel();
-
- String contextWholeFile();
-
- String showSiteHeader();
-
- String useFlashClipboard();
-
- String reviewCategoryLabel();
-
- String messageShowInReviewCategoryNone();
-
- String messageShowInReviewCategoryName();
-
- String messageShowInReviewCategoryEmail();
-
- String messageShowInReviewCategoryUsername();
-
- String messageShowInReviewCategoryAbbrev();
-
- String buttonSaveChanges();
-
- String highlightAssigneeInChangeTable();
-
- String showRelativeDateInChangeTable();
-
- String showSizeBarInChangeTable();
-
- String showLegacycidInChangeTable();
-
- String muteCommonPathPrefixes();
-
- String signedOffBy();
-
- String publishCommentsOnPush();
-
- String workInProgressByDefault();
-
- String myMenu();
-
- String myMenuInfo();
-
- String myMenuName();
-
- String myMenuUrl();
-
- String myMenuReset();
-
- String tabAccountSummary();
-
- String tabAgreements();
-
- String tabContactInformation();
-
- String tabDiffPreferences();
-
- String tabEditPreferences();
-
- String tabGpgKeys();
-
- String tabHttpAccess();
-
- String tabMyGroups();
-
- String tabOAuthToken();
-
- String tabPreferences();
-
- String tabSshKeys();
-
- String tabWatchedProjects();
-
- String tabWebIdentities();
-
- String buttonShowAddSshKey();
-
- String buttonCloseAddSshKey();
-
- String buttonDeleteSshKey();
-
- String buttonClearSshKeyInput();
-
- String buttonAddSshKey();
-
- String userName();
-
- String password();
-
- String buttonSetUserName();
-
- String confirmSetUserNameTitle();
-
- String confirmSetUserName();
-
- String buttonClearPassword();
-
- String buttonGeneratePassword();
-
- String revokePassword();
-
- String linkObtainPassword();
-
- String linkEditFullName();
-
- String linkReloadContact();
-
- String invalidUserName();
-
- String invalidUserEmail();
-
- String labelOAuthToken();
-
- String labelOAuthExpires();
-
- String labelOAuthNetRCEntry();
-
- String labelOAuthGitCookie();
-
- String labelOAuthExpired();
-
- String sshKeyInvalid();
-
- String sshKeyAlgorithm();
-
- String sshKeyKey();
-
- String sshKeyComment();
-
- String sshKeyStatus();
-
- String addSshKeyPanelHeader();
-
- String addSshKeyHelpTitle();
-
- String addSshKeyHelp();
-
- String sshJavaAppletNotAvailable();
-
- String invalidSshKeyError();
-
- String sshHostKeyTitle();
-
- String sshHostKeyFingerprint();
-
- String sshHostKeyKnownHostEntry();
-
- String gpgKeyId();
-
- String gpgKeyFingerprint();
-
- String gpgKeyUserIds();
-
- String webIdStatus();
-
- String webIdEmail();
-
- String webIdIdentity();
-
- String untrustedProvider();
-
- String buttonDeleteIdentity();
-
- String buttonLinkIdentity();
-
- String buttonWatchProject();
-
- String defaultProjectName();
-
- String defaultFilter();
-
- String buttonBrowseProjects();
-
- String projects();
-
- String projectsClose();
-
- String projectListOpen();
-
- String watchedProjectName();
-
- String watchedProjectFilter();
-
- String watchedProjectColumnEmailNotifications();
-
- String watchedProjectColumnNewChanges();
-
- String watchedProjectColumnNewPatchSets();
-
- String watchedProjectColumnAllComments();
-
- String watchedProjectColumnSubmittedChanges();
-
- String watchedProjectColumnAbandonedChanges();
-
- String contactFieldFullName();
-
- String contactFieldEmail();
-
- String buttonOpenRegisterNewEmail();
-
- String buttonSendRegisterNewEmail();
-
- String buttonCancel();
-
- String titleRegisterNewEmail();
-
- String descRegisterNewEmail();
-
- String errorDialogTitleRegisterNewEmail();
-
- String emailFilterHelpTitle();
-
- String emailFilterHelp();
-
- String newAgreement();
-
- String agreementName();
-
- String agreementDescription();
-
- String newAgreementSelectTypeHeading();
-
- String newAgreementNoneAvailable();
-
- String newAgreementReviewLegalHeading();
-
- String newAgreementReviewContactHeading();
-
- String newAgreementCompleteHeading();
-
- String newAgreementIAGREE();
-
- String newAgreementAlreadySubmitted();
-
- String buttonSubmitNewAgreement();
-
- String welcomeToGerritCodeReview();
-
- String welcomeReviewContact();
-
- String welcomeContactFrom();
-
- String welcomeUsernameHeading();
-
- String welcomeSshKeyHeading();
-
- String welcomeSshKeyText();
-
- String welcomeAgreementHeading();
-
- String welcomeAgreementText();
-
- String welcomeAgreementLater();
-
- String welcomeContinue();
-
- String messageEnabled();
-
- String messageCCMeOnMyComments();
-
- String messageDisabled();
-
- String emailFieldLabel();
-
- String emailFormatFieldLabel();
-
- String messagePlaintextOnly();
-
- String messageHtmlPlaintext();
-
- String defaultBaseForMerges();
-
- String autoMerge();
-
- String firstParent();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.properties
deleted file mode 100644
index c32efed..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountConstants.properties
+++ /dev/null
@@ -1,274 +0,0 @@
-settingsHeading = Settings
-
-changeAvatar = Change Avatar
-fullName = Full Name
-preferredEmail = Email Address
-registeredOn = Registered
-accountId = Account ID
-showSiteHeader = Show Site Header / Footer
-useFlashClipboard = Use Flash Clipboard Widget
-reviewCategoryLabel = Display In Review Category
-messageShowInReviewCategoryNone = None (default)
-messageShowInReviewCategoryName = Show Name
-messageShowInReviewCategoryEmail = Show Email
-messageShowInReviewCategoryUsername = Show Username
-messageShowInReviewCategoryAbbrev = Show Abbreviated Name
-
-emailFieldLabel = Email Notifications:
-messageCCMeOnMyComments = Every Comment
-messageEnabled = Only Comments Left By Others
-messageDisabled = None
-
-emailFormatFieldLabel = Email Format:
-messagePlaintextOnly = Plaintext Only
-messageHtmlPlaintext = HTML and Plaintext
-
-defaultBaseForMerges = Default Base For Merges:
-autoMerge = Auto Merge
-firstParent = First Parent
-
-maximumPageSizeFieldLabel = Maximum Page Size:
-diffViewLabel = Diff View:
-dateFormatLabel = Date/Time Format:
-contextWholeFile = Whole File
-buttonSaveChanges = Save Changes
-highlightAssigneeInChangeTable = Highlight Changes Assigned To Me In Changes Table
-showRelativeDateInChangeTable = Show Relative Dates In Changes Table
-showSizeBarInChangeTable = Show Change Sizes As Colored Bars
-showLegacycidInChangeTable = Show Change Number In Changes Table
-muteCommonPathPrefixes = Mute Common Path Prefixes In File List
-signedOffBy = Insert Signed-off-by Footer For Inline Edit Changes
-publishCommentsOnPush = Publish Comments On Push
-workInProgressByDefault = Set all new changes work-in-progress by default
-myMenu = My Menu
-myMenuInfo = \
- Menu items for the 'My' top level menu. \
- The first menu item defines the default screen.
-myMenuName = Name
-myMenuUrl = URL
-myMenuReset = Reset
-
-tabAccountSummary = Profile
-tabAgreements = Agreements
-tabContactInformation = Contact Information
-tabDiffPreferences = Diff Preferences
-tabEditPreferences = Edit Preferences
-tabGpgKeys = GPG Public Keys
-tabHttpAccess = HTTP Password
-tabOAuthToken = OAuth Token
-tabMyGroups = Groups
-tabPreferences = Preferences
-tabSshKeys = SSH Public Keys
-tabWatchedProjects = Watched Projects
-tabWebIdentities = Identities
-
-buttonShowAddSshKey = Add Key ...
-buttonCloseAddSshKey = Close
-buttonDeleteSshKey = Delete
-buttonClearSshKeyInput = Clear
-buttonAddSshKey = Add
-
-userName = Username
-password = Password
-buttonSetUserName = Select Username
-confirmSetUserNameTitle = Confirm Setting the Username
-confirmSetUserName = Setting the Username is permanent. Are you sure?
-buttonClearPassword = Clear Password
-buttonGeneratePassword = Generate Password
-revokePassword = (click 'Generate Password' to revoke an old password)
-linkObtainPassword = Obtain Password
-linkEditFullName = Edit
-linkReloadContact = Reload
-invalidUserName = Username must contain only letters, numbers, _, - or .
-invalidUserEmail = Email format is wrong.
-
-labelOAuthToken = Access Token
-labelOAuthExpires = Expires
-labelOAuthNetRCEntry = Entry for ~/.netrc
-labelOAuthGitCookie = Entry for ~/.gitcookies
-labelOAuthExpired = To obtain an access token please sign out and sign in again.
-
-sshKeyInvalid = Invalid Key
-sshKeyAlgorithm = Algorithm
-sshKeyKey = Key
-sshKeyComment = Comment
-sshKeyStatus = Status
-
-sshHostKeyTitle = Server Host Key
-sshHostKeyFingerprint = Fingerprint:
-sshHostKeyKnownHostEntry = Entry for <code>~/.ssh/known_hosts</code>:
-
-gpgKeyId = ID
-gpgKeyFingerprint = Fingerprint
-gpgKeyUserIds = User IDs
-
-webIdStatus = Status
-webIdEmail = Email Address
-webIdIdentity = Identity
-untrustedProvider = Untrusted
-buttonDeleteIdentity = Delete
-buttonLinkIdentity = Link Another Identity
-
-addSshKeyPanelHeader = Add SSH Public Key
-addSshKeyHelpTitle = How to Generate an SSH Key
-addSshKeyHelp = \
- <ol>\
- <li>\
- From the Terminal or Git Bash, run <em>ssh-keygen</em>\
- </li>\
- <li>\
- Confirm the default path <em>.ssh/id_rsa</em>\
- </li>\
- <li>\
- Enter a passphrase (recommended) or leave it blank.<br />\
- Remember this passphrase, as you will need it to unlock the<br />\
- key whenever you use it.\
- </li>\
- <li>\
- Open <em>~/.ssh/id_rsa.pub</em> and copy & paste the contents into<br />\
- the box below, then click on "Add".<br />\
- Note that <em>id_rsa.pub</em> is your public key and can be shared,<br />\
- while <em>id_rsa</em> is your private key and should be kept secret.\
- </li>\
- <\ol>
-invalidSshKeyError = Invalid SSH Key
-sshJavaAppletNotAvailable = Open Key Unavailable: Java not enabled
-
-buttonWatchProject = Watch
-defaultProjectName = Project Name
-defaultFilter = branch:name, or other search expression
-projects = All Watchable Projects
-projectsClose = Close
-buttonBrowseProjects = Browse
-projectListOpen = Watch Selected project
-watchedProjectName = Project Name
-watchedProjectFilter = Only If
-watchedProjectColumnEmailNotifications = Email Notifications
-watchedProjectColumnNewChanges = New Changes
-watchedProjectColumnNewPatchSets = New Patch Sets
-watchedProjectColumnAllComments = All Comments
-watchedProjectColumnSubmittedChanges = Submitted Changes
-watchedProjectColumnAbandonedChanges = Abandoned Changes
-
-contactFieldFullName = Full Name
-contactFieldEmail = Preferred Email
-buttonOpenRegisterNewEmail = Register New Email ...
-buttonSendRegisterNewEmail = Register
-buttonCancel = Cancel
-titleRegisterNewEmail = Register Email Address
-descRegisterNewEmail = \
- <p>A confirmation link will be sent by email to this address.</p>\
- <p>You must click on the link to complete the registration and make the address available for selection.</p>
-errorDialogTitleRegisterNewEmail = Email Registration Failed
-emailFilterHelpTitle = Mail Filters
-emailFilterHelp = \
- <p>\
- Gerrit emails include metadata about the change to support \
- writing mail filters.\
- </p>\
- <p>\
- Here are some example Gmail queries that can be used for filters or \
- for searching through archived messages. View the \
- <a href="https://gerrit-review.googlesource.com/Documentation/user-notify.html"\
- target="_blank" rel="nofollow">Gerrit documentation</a> for \
- the complete set of footers.\
- </p>\
- <table>\
- <tbody>\
- <tr><th>Name</th><th>Query</th></tr>\
- <tr>\
- <td>Changes requesting my review</td>\
- <td>\
- <code>\
- "Gerrit-Reviewer: <em>Your Name</em>\
- <<em>your.email@example.com</em>>"\
- </code>\
- </td>\
- </tr>\
- <tr>\
- <td>Changes from a specific owner</td>\
- <td>\
- <code>\
- "Gerrit-Owner: <em>Owner name</em>\
- <<em>owner.email@example.com</em>>"\
- </code>\
- </td>\
- </tr>\
- <tr>\
- <td>Changes targeting a specific branch</td>\
- <td>\
- <code>\
- "Gerrit-Branch: <em>branch-name</em>"\
- </code>\
- </td>\
- </tr>\
- <tr>\
- <td>Changes in a specific project</td>\
- <td>\
- <code>\
- "Gerrit-Project: <em>project-name</em>"\
- </code>\
- </td>\
- </tr>\
- <tr>\
- <td>Messages related to a specific Change ID</td>\
- <td>\
- <code>\
- "Gerrit-Change-Id: <em>Change ID</em>"\
- </code>\
- </td>\
- </tr>\
- <tr>\
- <td>Messages related to a specific change number</td>\
- <td>\
- <code>\
- "Gerrit-Change-Number: <em>change number</em>"\
- </code>\
- </td>\
- </tr>\
- </tbody>\
- </table>
-
-newAgreement = New Contributor Agreement
-agreementName = Name
-agreementDescription = Description
-
-newAgreementSelectTypeHeading = Select an agreement type:
-newAgreementNoneAvailable = No contributor agreements are configured.
-newAgreementReviewLegalHeading = Review the agreement:
-newAgreementReviewContactHeading = Review your contact information:
-newAgreementCompleteHeading = Complete the agreement:
-newAgreementIAGREE = I AGREE
-newAgreementAlreadySubmitted = Agreement already submitted.
-buttonSubmitNewAgreement = Submit Agreement
-
-welcomeToGerritCodeReview = Welcome to Gerrit Code Review
-welcomeReviewContact = Please review your contact information:
-welcomeContactFrom = \
- <p>The following contact information was automatically obtained when \
- you signed-in to the site. This information is used to display who \
- you are to others, and to send updates to code reviews you have either \
- started or subscribed to.</p>
-
-welcomeUsernameHeading = Select a unique username:
-
-welcomeSshKeyHeading = Register an SSH public key:
-welcomeSshKeyText = \
- <p>Gerrit Code Review uses \
- <a href="http://en.wikipedia.org/wiki/Public-key_cryptography" target="_blank">public-key cryptography</a> \
- and \
- <a href="http://en.wikipedia.org/wiki/Secure_Shell" target="_blank">SSH</a> \
- to authenticate \
- you during git's push and pull commands to hosted projects. Registering \
- your public key allows Gerrit to identify you whenever you connect through \
- SSH.</p>\
- <p>This step can also be completed at a later time.</p>
-
-welcomeAgreementHeading = Complete a contributor agreement:
-welcomeAgreementText = \
- <p>If you will be contributing code or documentation changes to projects \
- hosted here, please consider taking a minute to review and complete \
- a contributor agreement.</p>\
- <p>This step can also be completed at a later time.</p>
-welcomeAgreementLater = Continue Without Agreement
-welcomeContinue = Continue
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountMessages.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountMessages.java
deleted file mode 100644
index 4cff1e2..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountMessages.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) 2008 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.client.account;
-
-import com.google.gwt.i18n.client.Messages;
-
-public interface AccountMessages extends Messages {
- String lines(short cnt);
-
- String rowsPerPage(int cnt);
-
- String changeScreenServerDefault(String d);
-
- String enterIAGREE(String iagree);
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountMessages.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountMessages.properties
deleted file mode 100644
index a8d61cf..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/AccountMessages.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-lines = {0} lines
-rowsPerPage = {0} rows per page
-changeScreenServerDefault = Server Default ({0})
-enterIAGREE = (enter {0} in the box to the left)
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/ContactPanelShort.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/ContactPanelShort.java
deleted file mode 100644
index a537063..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/ContactPanelShort.java
+++ /dev/null
@@ -1,484 +0,0 @@
-// Copyright (C) 2008 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.client.account;
-
-import com.google.gerrit.client.ErrorDialog;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.rpc.CallbackGroup;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.ComplexDisclosurePanel;
-import com.google.gerrit.client.ui.OnEditEnabler;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.common.errors.EmailException;
-import com.google.gerrit.extensions.client.AccountFieldName;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.event.dom.client.ChangeEvent;
-import com.google.gwt.event.dom.client.ChangeHandler;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.i18n.client.LocaleInfo;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.FormPanel;
-import com.google.gwt.user.client.ui.FormPanel.SubmitEvent;
-import com.google.gwt.user.client.ui.Grid;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.ListBox;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.globalkey.client.NpTextBox;
-import com.google.gwtexpui.user.client.AutoCenterDialogBox;
-
-class ContactPanelShort extends Composite {
- protected final FlowPanel body;
- protected int labelIdx;
- protected int fieldIdx;
- protected Button save;
-
- private String currentEmail;
- protected boolean haveAccount;
- private boolean haveEmails;
-
- NpTextBox nameTxt;
- private ListBox emailPick;
- private Button registerNewEmail;
- private OnEditEnabler onEditEnabler;
-
- ContactPanelShort() {
- body = new FlowPanel();
- initWidget(body);
- }
-
- protected void onInitUI() {
- if (LocaleInfo.getCurrentLocale().isRTL()) {
- labelIdx = 1;
- fieldIdx = 0;
- } else {
- labelIdx = 0;
- fieldIdx = 1;
- }
-
- nameTxt = new NpTextBox();
- nameTxt.setVisibleLength(60);
- nameTxt.setReadOnly(!canEditFullName());
-
- emailPick = new ListBox();
-
- final Grid infoPlainText = new Grid(2, 2);
- infoPlainText.setStyleName(Gerrit.RESOURCES.css().infoBlock());
- infoPlainText.addStyleName(Gerrit.RESOURCES.css().accountInfoBlock());
-
- body.add(infoPlainText);
-
- registerNewEmail = new Button(Util.C.buttonOpenRegisterNewEmail());
- registerNewEmail.setEnabled(false);
- registerNewEmail.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- doRegisterNewEmail();
- }
- });
- final FlowPanel emailLine = new FlowPanel();
- emailLine.add(emailPick);
- if (canRegisterNewEmail()) {
- emailLine.add(registerNewEmail);
- }
-
- int row = 0;
- if (!Gerrit.info().auth().canEdit(AccountFieldName.USER_NAME)
- && Gerrit.info().auth().siteHasUsernames()) {
- infoPlainText.resizeRows(infoPlainText.getRowCount() + 1);
- row(infoPlainText, row++, Util.C.userName(), new UsernameField());
- }
-
- if (!canEditFullName()) {
- FlowPanel nameLine = new FlowPanel();
- nameLine.add(nameTxt);
- if (Gerrit.info().auth().editFullNameUrl() != null) {
- Button edit = new Button(Util.C.linkEditFullName());
- edit.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- Window.open(Gerrit.info().auth().editFullNameUrl(), "_blank", null);
- }
- });
- nameLine.add(edit);
- }
- Button reload = new Button(Util.C.linkReloadContact());
- reload.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- Window.Location.replace(Gerrit.loginRedirect(PageLinks.SETTINGS_CONTACT));
- }
- });
- nameLine.add(reload);
- row(infoPlainText, row++, Util.C.contactFieldFullName(), nameLine);
- } else {
- row(infoPlainText, row++, Util.C.contactFieldFullName(), nameTxt);
- }
- row(infoPlainText, row++, Util.C.contactFieldEmail(), emailLine);
-
- infoPlainText.getCellFormatter().addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
- infoPlainText.getCellFormatter().addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
- infoPlainText
- .getCellFormatter()
- .addStyleName(row - 1, 0, Gerrit.RESOURCES.css().bottomheader());
-
- save = new Button(Util.C.buttonSaveChanges());
- save.setEnabled(false);
- save.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- doSave();
- }
- });
-
- final ComplexDisclosurePanel mailFilterHelp =
- new ComplexDisclosurePanel(Util.C.emailFilterHelpTitle(), false);
- mailFilterHelp.setContent(new HTML(Util.C.emailFilterHelp()));
- body.add(mailFilterHelp);
-
- emailPick.addChangeHandler(
- new ChangeHandler() {
- @Override
- public void onChange(ChangeEvent event) {
- final int idx = emailPick.getSelectedIndex();
- final String v = 0 <= idx ? emailPick.getValue(idx) : null;
- if (Util.C.buttonOpenRegisterNewEmail().equals(v)) {
- for (int i = 0; i < emailPick.getItemCount(); i++) {
- if (currentEmail.equals(emailPick.getValue(i))) {
- emailPick.setSelectedIndex(i);
- break;
- }
- }
- doRegisterNewEmail();
- } else {
- save.setEnabled(true);
- }
- }
- });
-
- onEditEnabler = new OnEditEnabler(save, nameTxt);
- }
-
- private boolean canEditFullName() {
- return Gerrit.info().auth().canEdit(AccountFieldName.FULL_NAME);
- }
-
- private boolean canRegisterNewEmail() {
- return Gerrit.info().auth().canEdit(AccountFieldName.REGISTER_NEW_EMAIL);
- }
-
- void hideSaveButton() {
- save.setVisible(false);
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
-
- onInitUI();
- body.add(save);
- display(Gerrit.getUserAccount());
-
- emailPick.clear();
- emailPick.setEnabled(false);
- registerNewEmail.setEnabled(false);
-
- haveAccount = false;
- haveEmails = false;
-
- CallbackGroup group = new CallbackGroup();
- AccountApi.getName(
- "self",
- group.add(
- new GerritCallback<NativeString>() {
-
- @Override
- public void onSuccess(NativeString result) {
- nameTxt.setText(result.asString());
- haveAccount = true;
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- }));
-
- AccountApi.getEmails(
- "self",
- group.addFinal(
- new GerritCallback<JsArray<EmailInfo>>() {
- @Override
- public void onSuccess(JsArray<EmailInfo> result) {
- for (EmailInfo i : Natives.asList(result)) {
- emailPick.addItem(i.email());
- if (i.isPreferred()) {
- currentEmail = i.email();
- }
- }
- haveEmails = true;
- postLoad();
- }
- }));
- }
-
- private void postLoad() {
- if (haveAccount && haveEmails) {
- updateEmailList();
- registerNewEmail.setEnabled(true);
- save.setEnabled(false);
- onEditEnabler.updateOriginalValue(nameTxt);
- }
- display();
- }
-
- void display() {}
-
- protected void row(Grid info, int row, String name, Widget field) {
- info.setText(row, labelIdx, name);
- info.setWidget(row, fieldIdx, field);
- info.getCellFormatter().addStyleName(row, 0, Gerrit.RESOURCES.css().header());
- }
-
- protected void display(AccountInfo account) {
- currentEmail = account.email();
- nameTxt.setText(account.name());
- save.setEnabled(false);
- onEditEnabler.updateOriginalValue(nameTxt);
- }
-
- private void doRegisterNewEmail() {
- if (!canRegisterNewEmail()) {
- return;
- }
-
- final AutoCenterDialogBox box = new AutoCenterDialogBox(true, true);
- final VerticalPanel body = new VerticalPanel();
-
- final NpTextBox inEmail = new NpTextBox();
- inEmail.setVisibleLength(60);
-
- final Button register = new Button(Util.C.buttonSendRegisterNewEmail());
- final Button cancel = new Button(Util.C.buttonCancel());
- final FormPanel form = new FormPanel();
- form.addSubmitHandler(
- new FormPanel.SubmitHandler() {
- @Override
- public void onSubmit(SubmitEvent event) {
- event.cancel();
- final String addr = inEmail.getText().trim();
- if (!addr.contains("@")) {
- new ErrorDialog(Util.C.invalidUserEmail()).center();
- return;
- }
-
- inEmail.setEnabled(false);
- register.setEnabled(false);
- AccountApi.registerEmail(
- "self",
- addr,
- new GerritCallback<EmailInfo>() {
- @Override
- public void onSuccess(EmailInfo result) {
- box.hide();
- if (Gerrit.info().auth().isDev()) {
- currentEmail = addr;
- if (emailPick.getItemCount() == 0) {
- AccountInfo me = Gerrit.getUserAccount();
- me.email(addr);
- onSaveSuccess(me);
- } else {
- save.setEnabled(true);
- }
- updateEmailList();
- }
- }
-
- @Override
- public void onFailure(Throwable caught) {
- inEmail.setEnabled(true);
- register.setEnabled(true);
- if (caught.getMessage().startsWith(EmailException.MESSAGE)) {
- final ErrorDialog d =
- new ErrorDialog(
- caught.getMessage().substring(EmailException.MESSAGE.length()));
- d.setText(Util.C.errorDialogTitleRegisterNewEmail());
- d.center();
- } else {
- super.onFailure(caught);
- }
- }
- });
- }
- });
- form.setWidget(body);
-
- register.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- form.submit();
- }
- });
- cancel.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- box.hide();
- }
- });
-
- final FlowPanel buttons = new FlowPanel();
- buttons.setStyleName(Gerrit.RESOURCES.css().patchSetActions());
- buttons.add(register);
- buttons.add(cancel);
-
- if (!Gerrit.info().auth().isDev()) {
- body.add(new HTML(Util.C.descRegisterNewEmail()));
- }
- body.add(inEmail);
- body.add(buttons);
-
- box.setText(Util.C.titleRegisterNewEmail());
- box.setWidget(form);
- box.center();
- inEmail.setFocus(true);
- }
-
- void doSave() {
- final String newName;
- String name = canEditFullName() ? nameTxt.getText() : null;
- if (name != null && name.trim().isEmpty()) {
- newName = null;
- } else {
- newName = name;
- }
-
- final String newEmail;
- if (emailPick.isEnabled() && emailPick.getSelectedIndex() >= 0) {
- final String v = emailPick.getValue(emailPick.getSelectedIndex());
- if (Util.C.buttonOpenRegisterNewEmail().equals(v)) {
- newEmail = currentEmail;
- } else {
- newEmail = v;
- }
- } else {
- newEmail = currentEmail;
- }
-
- save.setEnabled(false);
- registerNewEmail.setEnabled(false);
-
- CallbackGroup group = new CallbackGroup();
- if (currentEmail != null && !newEmail.equals(currentEmail)) {
- AccountApi.setPreferredEmail(
- "self",
- newEmail,
- group.add(
- new GerritCallback<NativeString>() {
- @Override
- public void onSuccess(NativeString result) {}
- }));
- }
- AccountApi.setName(
- "self",
- newName,
- group.add(
- new GerritCallback<NativeString>() {
- @Override
- public void onSuccess(NativeString result) {}
-
- @Override
- public void onFailure(Throwable caught) {
- save.setEnabled(true);
- registerNewEmail.setEnabled(true);
- super.onFailure(caught);
- }
- }));
- group.done();
- group.addListener(
- new GerritCallback<Void>() {
- @Override
- public void onSuccess(Void result) {
- currentEmail = newEmail;
- AccountInfo me = Gerrit.getUserAccount();
- me.email(currentEmail);
- me.name(newName);
- onSaveSuccess(me);
- registerNewEmail.setEnabled(true);
- }
- });
- }
-
- void onSaveSuccess(AccountInfo result) {
- AccountInfo me = Gerrit.getUserAccount();
- me.name(result.name());
- me.email(result.email());
- Gerrit.refreshMenuBar();
- display(me);
- }
-
- private int emailListIndexOf(String value) {
- for (int i = 0; i < emailPick.getItemCount(); i++) {
- if (value.equalsIgnoreCase(emailPick.getValue(i))) {
- return i;
- }
- }
- return -1;
- }
-
- private void updateEmailList() {
- if (currentEmail != null) {
- int index = emailListIndexOf(currentEmail);
- if (index == -1) {
- emailPick.addItem(currentEmail);
- emailPick.setSelectedIndex(emailPick.getItemCount() - 1);
- } else {
- emailPick.setSelectedIndex(index);
- }
- }
- if (emailPick.getItemCount() > 0) {
- if (currentEmail == null) {
- int index = emailListIndexOf("");
- if (index != -1) {
- emailPick.removeItem(index);
- }
- emailPick.insertItem("", 0);
- emailPick.setSelectedIndex(0);
- }
- emailPick.setVisible(true);
- emailPick.setEnabled(true);
- if (canRegisterNewEmail()) {
- final String t = Util.C.buttonOpenRegisterNewEmail();
- int index = emailListIndexOf(t);
- if (index != -1) {
- emailPick.removeItem(index);
- }
- emailPick.addItem("... " + t + " ", t);
- }
- } else {
- emailPick.setVisible(false);
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/DiffPreferences.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/DiffPreferences.java
deleted file mode 100644
index 286d29a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/DiffPreferences.java
+++ /dev/null
@@ -1,226 +0,0 @@
-// Copyright (C) 2013 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.client.account;
-
-import com.google.gerrit.extensions.client.DiffPreferencesInfo;
-import com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace;
-import com.google.gerrit.extensions.client.Theme;
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class DiffPreferences extends JavaScriptObject {
- public static DiffPreferences create(DiffPreferencesInfo in) {
- if (in == null) {
- in = DiffPreferencesInfo.defaults();
- }
- DiffPreferences p = createObject().cast();
- p.ignoreWhitespace(in.ignoreWhitespace);
- p.tabSize(in.tabSize);
- p.lineLength(in.lineLength);
- p.cursorBlinkRate(in.cursorBlinkRate);
- p.context(in.context);
- p.intralineDifference(in.intralineDifference);
- p.showLineEndings(in.showLineEndings);
- p.showTabs(in.showTabs);
- p.showWhitespaceErrors(in.showWhitespaceErrors);
- p.syntaxHighlighting(in.syntaxHighlighting);
- p.hideTopMenu(in.hideTopMenu);
- p.autoHideDiffTableHeader(in.autoHideDiffTableHeader);
- p.hideLineNumbers(in.hideLineNumbers);
- p.expandAllComments(in.expandAllComments);
- p.manualReview(in.manualReview);
- p.renderEntireFile(in.renderEntireFile);
- p.theme(in.theme);
- p.hideEmptyPane(in.hideEmptyPane);
- p.retainHeader(in.retainHeader);
- p.skipUnchanged(in.skipUnchanged);
- p.skipUncommented(in.skipUncommented);
- p.skipDeleted(in.skipDeleted);
- p.matchBrackets(in.matchBrackets);
- p.lineWrapping(in.lineWrapping);
- return p;
- }
-
- public final void copyTo(DiffPreferencesInfo p) {
- p.context = context();
- p.tabSize = tabSize();
- p.lineLength = lineLength();
- p.cursorBlinkRate = cursorBlinkRate();
- p.expandAllComments = expandAllComments();
- p.intralineDifference = intralineDifference();
- p.manualReview = manualReview();
- p.retainHeader = retainHeader();
- p.showLineEndings = showLineEndings();
- p.showTabs = showTabs();
- p.showWhitespaceErrors = showWhitespaceErrors();
- p.skipDeleted = skipDeleted();
- p.skipUnchanged = skipUnchanged();
- p.skipUncommented = skipUncommented();
- p.syntaxHighlighting = syntaxHighlighting();
- p.hideTopMenu = hideTopMenu();
- p.autoHideDiffTableHeader = autoHideDiffTableHeader();
- p.hideLineNumbers = hideLineNumbers();
- p.renderEntireFile = renderEntireFile();
- p.hideEmptyPane = hideEmptyPane();
- p.matchBrackets = matchBrackets();
- p.lineWrapping = lineWrapping();
- p.theme = theme();
- p.ignoreWhitespace = ignoreWhitespace();
- }
-
- public final void ignoreWhitespace(Whitespace i) {
- setIgnoreWhitespaceRaw(i.toString());
- }
-
- public final void theme(Theme i) {
- setThemeRaw(i != null ? i.toString() : Theme.DEFAULT.toString());
- }
-
- public final void showLineNumbers(boolean s) {
- hideLineNumbers(!s);
- }
-
- public final Whitespace ignoreWhitespace() {
- String s = ignoreWhitespaceRaw();
- return s != null ? Whitespace.valueOf(s) : Whitespace.IGNORE_NONE;
- }
-
- public final Theme theme() {
- String s = themeRaw();
- return s != null ? Theme.valueOf(s) : Theme.DEFAULT;
- }
-
- public final int tabSize() {
- return get("tab_size", 8);
- }
-
- public final int context() {
- return get("context", 10);
- }
-
- public final int lineLength() {
- return get("line_length", 100);
- }
-
- public final int cursorBlinkRate() {
- return get("cursor_blink_rate", 0);
- }
-
- public final boolean showLineNumbers() {
- return !hideLineNumbers();
- }
-
- public final boolean autoReview() {
- return !manualReview();
- }
-
- public final native void tabSize(int t) /*-{ this.tab_size = t }-*/;
-
- public final native void lineLength(int c) /*-{ this.line_length = c }-*/;
-
- public final native void context(int c) /*-{ this.context = c }-*/;
-
- public final native void cursorBlinkRate(int r) /*-{ this.cursor_blink_rate = r }-*/;
-
- public final native void intralineDifference(Boolean i) /*-{ this.intraline_difference = i }-*/;
-
- public final native void showLineEndings(Boolean s) /*-{ this.show_line_endings = s }-*/;
-
- public final native void showTabs(Boolean s) /*-{ this.show_tabs = s }-*/;
-
- public final native void showWhitespaceErrors(
- Boolean s) /*-{ this.show_whitespace_errors = s }-*/;
-
- public final native void syntaxHighlighting(Boolean s) /*-{ this.syntax_highlighting = s }-*/;
-
- public final native void hideTopMenu(Boolean s) /*-{ this.hide_top_menu = s }-*/;
-
- public final native void autoHideDiffTableHeader(
- Boolean s) /*-{ this.auto_hide_diff_table_header = s }-*/;
-
- public final native void hideLineNumbers(Boolean s) /*-{ this.hide_line_numbers = s }-*/;
-
- public final native void expandAllComments(Boolean e) /*-{ this.expand_all_comments = e }-*/;
-
- public final native void manualReview(Boolean r) /*-{ this.manual_review = r }-*/;
-
- public final native void renderEntireFile(Boolean r) /*-{ this.render_entire_file = r }-*/;
-
- public final native void retainHeader(Boolean r) /*-{ this.retain_header = r }-*/;
-
- public final native void hideEmptyPane(Boolean s) /*-{ this.hide_empty_pane = s }-*/;
-
- public final native void skipUnchanged(Boolean s) /*-{ this.skip_unchanged = s }-*/;
-
- public final native void skipUncommented(Boolean s) /*-{ this.skip_uncommented = s }-*/;
-
- public final native void skipDeleted(Boolean s) /*-{ this.skip_deleted = s }-*/;
-
- public final native void matchBrackets(Boolean m) /*-{ this.match_brackets = m }-*/;
-
- public final native void lineWrapping(Boolean w) /*-{ this.line_wrapping = w }-*/;
-
- public final native boolean
- intralineDifference() /*-{ return this.intraline_difference || false }-*/;
-
- public final native boolean showLineEndings() /*-{ return this.show_line_endings || false }-*/;
-
- public final native boolean showTabs() /*-{ return this.show_tabs || false }-*/;
-
- public final native boolean
- showWhitespaceErrors() /*-{ return this.show_whitespace_errors || false }-*/;
-
- public final native boolean
- syntaxHighlighting() /*-{ return this.syntax_highlighting || false }-*/;
-
- public final native boolean hideTopMenu() /*-{ return this.hide_top_menu || false }-*/;
-
- public final native boolean
- autoHideDiffTableHeader() /*-{ return this.auto_hide_diff_table_header || false }-*/;
-
- public final native boolean hideLineNumbers() /*-{ return this.hide_line_numbers || false }-*/;
-
- public final native boolean
- expandAllComments() /*-{ return this.expand_all_comments || false }-*/;
-
- public final native boolean manualReview() /*-{ return this.manual_review || false }-*/;
-
- public final native boolean renderEntireFile() /*-{ return this.render_entire_file || false }-*/;
-
- public final native boolean hideEmptyPane() /*-{ return this.hide_empty_pane || false }-*/;
-
- public final native boolean retainHeader() /*-{ return this.retain_header || false }-*/;
-
- public final native boolean skipUnchanged() /*-{ return this.skip_unchanged || false }-*/;
-
- public final native boolean skipUncommented() /*-{ return this.skip_uncommented || false }-*/;
-
- public final native boolean skipDeleted() /*-{ return this.skip_deleted || false }-*/;
-
- public final native boolean matchBrackets() /*-{ return this.match_brackets || false }-*/;
-
- public final native boolean lineWrapping() /*-{ return this.line_wrapping || false }-*/;
-
- private native void setThemeRaw(String i) /*-{ this.theme = i }-*/;
-
- private native void setIgnoreWhitespaceRaw(String i) /*-{ this.ignore_whitespace = i }-*/;
-
- private native String ignoreWhitespaceRaw() /*-{ return this.ignore_whitespace }-*/;
-
- private native String themeRaw() /*-{ return this.theme }-*/;
-
- private native int get(String n, int d) /*-{ return this.hasOwnProperty(n) ? this[n] : d }-*/;
-
- protected DiffPreferences() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/EditPreferences.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/EditPreferences.java
deleted file mode 100644
index 9cd2f17..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/EditPreferences.java
+++ /dev/null
@@ -1,161 +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.client.account;
-
-import com.google.gerrit.extensions.client.EditPreferencesInfo;
-import com.google.gerrit.extensions.client.KeyMapType;
-import com.google.gerrit.extensions.client.Theme;
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class EditPreferences extends JavaScriptObject {
- public static EditPreferences create(EditPreferencesInfo in) {
- EditPreferences p = createObject().cast();
- p.tabSize(in.tabSize);
- p.lineLength(in.lineLength);
- p.indentUnit(in.indentUnit);
- p.cursorBlinkRate(in.cursorBlinkRate);
- p.hideTopMenu(in.hideTopMenu);
- p.showTabs(in.showTabs);
- p.showWhitespaceErrors(in.showWhitespaceErrors);
- p.syntaxHighlighting(in.syntaxHighlighting);
- p.hideLineNumbers(in.hideLineNumbers);
- p.matchBrackets(in.matchBrackets);
- p.lineWrapping(in.lineWrapping);
- p.indentWithTabs(in.indentWithTabs);
- p.autoCloseBrackets(in.autoCloseBrackets);
- p.showBase(in.showBase);
- p.theme(in.theme);
- p.keyMapType(in.keyMapType);
- return p;
- }
-
- public final EditPreferencesInfo copyTo(EditPreferencesInfo p) {
- p.tabSize = tabSize();
- p.lineLength = lineLength();
- p.indentUnit = indentUnit();
- p.cursorBlinkRate = cursorBlinkRate();
- p.hideTopMenu = hideTopMenu();
- p.showTabs = showTabs();
- p.showWhitespaceErrors = showWhitespaceErrors();
- p.syntaxHighlighting = syntaxHighlighting();
- p.hideLineNumbers = hideLineNumbers();
- p.matchBrackets = matchBrackets();
- p.lineWrapping = lineWrapping();
- p.indentWithTabs = indentWithTabs();
- p.autoCloseBrackets = autoCloseBrackets();
- p.showBase = showBase();
- p.theme = theme();
- p.keyMapType = keyMapType();
- return p;
- }
-
- public final void theme(Theme i) {
- setThemeRaw(i != null ? i.toString() : Theme.DEFAULT.toString());
- }
-
- private native void setThemeRaw(String i) /*-{ this.theme = i }-*/;
-
- public final void keyMapType(KeyMapType i) {
- setkeyMapTypeRaw(i != null ? i.toString() : KeyMapType.DEFAULT.toString());
- }
-
- private native void setkeyMapTypeRaw(String i) /*-{ this.key_map_type = i }-*/;
-
- public final native void tabSize(int t) /*-{ this.tab_size = t }-*/;
-
- public final native void lineLength(int c) /*-{ this.line_length = c }-*/;
-
- public final native void indentUnit(int c) /*-{ this.indent_unit = c }-*/;
-
- public final native void cursorBlinkRate(int r) /*-{ this.cursor_blink_rate = r }-*/;
-
- public final native void hideTopMenu(boolean s) /*-{ this.hide_top_menu = s }-*/;
-
- public final native void showTabs(boolean s) /*-{ this.show_tabs = s }-*/;
-
- public final native void showWhitespaceErrors(
- boolean s) /*-{ this.show_whitespace_errors = s }-*/;
-
- public final native void syntaxHighlighting(boolean s) /*-{ this.syntax_highlighting = s }-*/;
-
- public final native void hideLineNumbers(boolean s) /*-{ this.hide_line_numbers = s }-*/;
-
- public final native void matchBrackets(boolean m) /*-{ this.match_brackets = m }-*/;
-
- public final native void lineWrapping(boolean w) /*-{ this.line_wrapping = w }-*/;
-
- public final native void indentWithTabs(boolean w) /*-{ this.indent_with_tabs = w }-*/;
-
- public final native void autoCloseBrackets(boolean c) /*-{ this.auto_close_brackets = c }-*/;
-
- public final native void showBase(boolean s) /*-{ this.show_base = s }-*/;
-
- public final Theme theme() {
- String s = themeRaw();
- return s != null ? Theme.valueOf(s) : Theme.DEFAULT;
- }
-
- private native String themeRaw() /*-{ return this.theme }-*/;
-
- public final KeyMapType keyMapType() {
- String s = keyMapTypeRaw();
- return s != null ? KeyMapType.valueOf(s) : KeyMapType.DEFAULT;
- }
-
- private native String keyMapTypeRaw() /*-{ return this.key_map_type }-*/;
-
- public final int tabSize() {
- return get("tab_size", 8);
- }
-
- public final int lineLength() {
- return get("line_length", 100);
- }
-
- public final int indentUnit() {
- return get("indent_unit", 2);
- }
-
- public final int cursorBlinkRate() {
- return get("cursor_blink_rate", 0);
- }
-
- public final native boolean hideTopMenu() /*-{ return this.hide_top_menu || false }-*/;
-
- public final native boolean showTabs() /*-{ return this.show_tabs || false }-*/;
-
- public final native boolean
- showWhitespaceErrors() /*-{ return this.show_whitespace_errors || false }-*/;
-
- public final native boolean
- syntaxHighlighting() /*-{ return this.syntax_highlighting || false }-*/;
-
- public final native boolean hideLineNumbers() /*-{ return this.hide_line_numbers || false }-*/;
-
- public final native boolean matchBrackets() /*-{ return this.match_brackets || false }-*/;
-
- public final native boolean lineWrapping() /*-{ return this.line_wrapping || false }-*/;
-
- public final native boolean indentWithTabs() /*-{ return this.indent_with_tabs || false }-*/;
-
- public final native boolean
- autoCloseBrackets() /*-{ return this.auto_close_brackets || false }-*/;
-
- public final native boolean showBase() /*-{ return this.show_base || false }-*/;
-
- private native int get(String n, int d) /*-{ return this.hasOwnProperty(n) ? this[n] : d }-*/;
-
- protected EditPreferences() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/EmailInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/EmailInfo.java
deleted file mode 100644
index 9c324be..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/EmailInfo.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (C) 2013 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.client.account;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class EmailInfo extends JavaScriptObject {
- public final native String email() /*-{ return this.email; }-*/;
-
- public final native boolean isPreferred() /*-{ return this['preferred'] ? true : false; }-*/;
-
- public final native boolean
- isConfirmationPending() /*-{ return this['pending_confirmation'] ? true : false; }-*/;
-
- protected EmailInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/ExternalIdInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/ExternalIdInfo.java
deleted file mode 100644
index 4ac0716..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/ExternalIdInfo.java
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright (C) 2017 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.client.account;
-
-import com.google.gerrit.client.auth.openid.OpenIdUtil;
-import com.google.gerrit.common.auth.openid.OpenIdUrls;
-import com.google.gerrit.extensions.client.AuthType;
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class ExternalIdInfo extends JavaScriptObject implements Comparable<ExternalIdInfo> {
- /**
- * Scheme used for {@link AuthType#LDAP}, {@link AuthType#CLIENT_SSL_CERT_LDAP}, {@link
- * AuthType#HTTP_LDAP}, and {@link AuthType#LDAP_BIND} usernames.
- *
- * <p>The name {@code gerrit:} was a very poor choice.
- */
- private static final String SCHEME_GERRIT = "gerrit:";
-
- /** Scheme used to represent only an email address. */
- private static final String SCHEME_MAILTO = "mailto:";
-
- /** Scheme for the username used to authenticate an account, e.g. over SSH. */
- private static final String SCHEME_USERNAME = "username:";
-
- public final native String identity() /*-{ return this.identity; }-*/;
-
- public final native String emailAddress() /*-{ return this.email_address; }-*/;
-
- public final native boolean isTrusted() /*-{ return this['trusted'] ? true : false; }-*/;
-
- public final native boolean canDelete() /*-{ return this['can_delete'] ? true : false; }-*/;
-
- public final boolean isUsername() {
- return isScheme(SCHEME_USERNAME);
- }
-
- public final String describe() {
- if (isScheme(SCHEME_GERRIT)) {
- // A local user identity should just be itself.
- return getSchemeRest();
- } else if (isScheme(SCHEME_USERNAME)) {
- // A local user identity should just be itself.
- return getSchemeRest();
- } else if (isScheme(SCHEME_MAILTO)) {
- // Describe a mailto address as just its email address,
- // which is already shown in the email address field.
- return "";
- } else if (isScheme(OpenIdUrls.URL_LAUNCHPAD)) {
- return OpenIdUtil.C.nameLaunchpad();
- } else if (isScheme(OpenIdUrls.URL_YAHOO)) {
- return OpenIdUtil.C.nameYahoo();
- }
-
- return identity();
- }
-
- @Override
- public final int compareTo(ExternalIdInfo a) {
- return emailOf(this).compareTo(emailOf(a));
- }
-
- private boolean isScheme(String scheme) {
- return identity() != null && identity().startsWith(scheme);
- }
-
- private String getSchemeRest() {
- int colonIdx = identity().indexOf(':');
- String scheme = (colonIdx > 0) ? identity().substring(0, colonIdx) : null;
- return scheme != null ? identity().substring(scheme.length() + 1) : null;
- }
-
- private String emailOf(ExternalIdInfo a) {
- return a.emailAddress() != null ? a.emailAddress() : "";
- }
-
- protected ExternalIdInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyAgreementsScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyAgreementsScreen.java
deleted file mode 100644
index 4592b62..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyAgreementsScreen.java
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (C) 2008 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.client.account;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.info.AgreementInfo;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.rpc.ScreenLoadCallback;
-import com.google.gerrit.client.ui.FancyFlexTable;
-import com.google.gerrit.client.ui.Hyperlink;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.common.data.ContributorAgreement;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
-import java.util.List;
-
-public class MyAgreementsScreen extends SettingsScreen {
- private AgreementTable agreements;
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
-
- agreements = new AgreementTable();
- add(agreements);
- add(new Hyperlink(Util.C.newAgreement(), PageLinks.SETTINGS_NEW_AGREEMENT));
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- AccountApi.getAgreements(
- "self",
- new ScreenLoadCallback<JsArray<AgreementInfo>>(this) {
- @Override
- public void preDisplay(JsArray<AgreementInfo> result) {
- agreements.display(Natives.asList(result));
- }
- });
- }
-
- private static class AgreementTable extends FancyFlexTable<ContributorAgreement> {
- AgreementTable() {
- table.setWidth("");
- table.setText(0, 1, Util.C.agreementName());
- table.setText(0, 2, Util.C.agreementDescription());
-
- FlexCellFormatter fmt = table.getFlexCellFormatter();
- for (int c = 1; c < 3; c++) {
- fmt.addStyleName(0, c, Gerrit.RESOURCES.css().dataHeader());
- }
- }
-
- void display(List<AgreementInfo> result) {
- while (1 < table.getRowCount()) {
- table.removeRow(table.getRowCount() - 1);
- }
-
- for (AgreementInfo info : result) {
- addOne(info);
- }
- }
-
- void addOne(AgreementInfo info) {
- int row = table.getRowCount();
- table.insertRow(row);
- applyDataRowStyle(row);
-
- String url = info.url();
- if (url != null && url.length() > 0) {
- Anchor a = new Anchor(info.name(), url);
- a.setTarget("_blank");
- table.setWidget(row, 1, a);
- } else {
- table.setText(row, 1, info.name());
- }
- table.setText(row, 2, info.description());
- FlexCellFormatter fmt = table.getFlexCellFormatter();
- for (int c = 1; c < 3; c++) {
- fmt.addStyleName(row, c, Gerrit.RESOURCES.css().dataCell());
- }
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyContactInformationScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyContactInformationScreen.java
deleted file mode 100644
index d5884f4..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyContactInformationScreen.java
+++ /dev/null
@@ -1,32 +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.google.gerrit.client.account;
-
-public class MyContactInformationScreen extends SettingsScreen {
- private ContactPanelShort panel;
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- panel =
- new ContactPanelShort() {
- @Override
- void display() {
- MyContactInformationScreen.this.display();
- }
- };
- add(panel);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyDiffPreferencesScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyDiffPreferencesScreen.java
deleted file mode 100644
index a721441..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyDiffPreferencesScreen.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (C) 2015 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.client.account;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.diff.PreferencesBox;
-import com.google.gwt.user.client.ui.FlowPanel;
-
-public class MyDiffPreferencesScreen extends SettingsScreen {
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
-
- PreferencesBox pb = new PreferencesBox(null);
- pb.set(DiffPreferences.create(Gerrit.getDiffPreferences()));
- FlowPanel p = new FlowPanel();
- p.setStyleName(pb.getStyle().dialog());
- p.add(pb);
- add(p);
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- display();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyEditPreferencesScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyEditPreferencesScreen.java
deleted file mode 100644
index 424b5d5..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyEditPreferencesScreen.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (C) 2015 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.client.account;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.editor.EditPreferencesBox;
-import com.google.gwt.user.client.ui.FlowPanel;
-
-public class MyEditPreferencesScreen extends SettingsScreen {
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
-
- EditPreferencesBox pb = new EditPreferencesBox(null);
- pb.set(EditPreferences.create(Gerrit.getEditPreferences()));
- FlowPanel p = new FlowPanel();
- p.setStyleName(pb.getStyle().dialog());
- p.add(pb);
- add(p);
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- display();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyGpgKeysScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyGpgKeysScreen.java
deleted file mode 100644
index 1a0090a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyGpgKeysScreen.java
+++ /dev/null
@@ -1,289 +0,0 @@
-// Copyright (C) 2015 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.client.account;
-
-import static java.util.Comparator.comparing;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.info.GpgKeyInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.FancyFlexTable;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.logical.shared.ValueChangeEvent;
-import com.google.gwt.event.logical.shared.ValueChangeHandler;
-import com.google.gwt.http.client.Response;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.rpc.StatusCodeException;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.InlineLabel;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwtexpui.clippy.client.CopyableLabel;
-import com.google.gwtexpui.globalkey.client.NpTextArea;
-import java.util.ArrayList;
-import java.util.List;
-
-public class MyGpgKeysScreen extends SettingsScreen {
- interface Binder extends UiBinder<HTMLPanel, MyGpgKeysScreen> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- @UiField(provided = true)
- GpgKeyTable keys;
-
- @UiField Button deleteKey;
- @UiField Button addKey;
-
- @UiField VerticalPanel addKeyBlock;
- @UiField NpTextArea keyText;
-
- @UiField VerticalPanel errorPanel;
- @UiField Label errorText;
-
- @UiField Button clearButton;
- @UiField Button addButton;
- @UiField Button closeButton;
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- keys = new GpgKeyTable();
- add(uiBinder.createAndBindUi(this));
- keys.updateDeleteButton();
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- refreshKeys();
- }
-
- @UiHandler("deleteKey")
- void onDeleteKey(@SuppressWarnings("unused") ClickEvent e) {
- keys.deleteChecked();
- }
-
- @UiHandler("addKey")
- void onAddKey(@SuppressWarnings("unused") ClickEvent e) {
- showAddKeyBlock(true);
- }
-
- @UiHandler("clearButton")
- void onClearButton(@SuppressWarnings("unused") ClickEvent e) {
- keyText.setText("");
- keyText.setFocus(true);
- errorPanel.setVisible(false);
- }
-
- @UiHandler("closeButton")
- void onCloseButton(@SuppressWarnings("unused") ClickEvent e) {
- showAddKeyBlock(false);
- }
-
- @UiHandler("addButton")
- void onAddButton(@SuppressWarnings("unused") ClickEvent e) {
- doAddKey();
- }
-
- private void refreshKeys() {
- AccountApi.self()
- .view("gpgkeys")
- .get(
- NativeMap.copyKeysIntoChildren(
- "id",
- new GerritCallback<NativeMap<GpgKeyInfo>>() {
- @Override
- public void onSuccess(NativeMap<GpgKeyInfo> result) {
- List<GpgKeyInfo> list = Natives.asList(result.values());
- // TODO(dborowitz): Sort on something more meaningful, like
- // created date?
- list.sort(comparing(GpgKeyInfo::id));
- keys.clear();
- keyText.setText("");
- errorPanel.setVisible(false);
- addButton.setEnabled(true);
- if (!list.isEmpty()) {
- keys.setVisible(true);
- for (GpgKeyInfo k : list) {
- keys.addOneKey(k);
- }
- showKeyTable(true);
- showAddKeyBlock(false);
- } else {
- keys.setVisible(false);
- showAddKeyBlock(true);
- showKeyTable(false);
- }
-
- display();
- }
- }));
- }
-
- private void showAddKeyBlock(boolean show) {
- addKey.setVisible(!show);
- addKeyBlock.setVisible(show);
- }
-
- private void showKeyTable(boolean show) {
- keys.setVisible(show);
- deleteKey.setVisible(show);
- addKey.setVisible(show);
- }
-
- private void doAddKey() {
- if (keyText.getText().isEmpty()) {
- return;
- }
- addButton.setEnabled(false);
- keyText.setEnabled(false);
- AccountApi.addGpgKey(
- "self",
- keyText.getText(),
- new AsyncCallback<NativeMap<GpgKeyInfo>>() {
- @Override
- public void onSuccess(NativeMap<GpgKeyInfo> result) {
- keyText.setEnabled(true);
- refreshKeys();
- }
-
- @Override
- public void onFailure(Throwable caught) {
- keyText.setEnabled(true);
- addButton.setEnabled(true);
- if (caught instanceof StatusCodeException) {
- StatusCodeException sce = (StatusCodeException) caught;
- if (sce.getStatusCode() == Response.SC_CONFLICT
- || sce.getStatusCode() == Response.SC_BAD_REQUEST) {
- errorText.setText(sce.getEncodedResponse());
- } else {
- errorText.setText(sce.getMessage());
- }
- } else {
- errorText.setText("Unexpected error saving key: " + caught.getMessage());
- }
- errorPanel.setVisible(true);
- }
- });
- }
-
- private class GpgKeyTable extends FancyFlexTable<GpgKeyInfo> {
- private final ValueChangeHandler<Boolean> updateDeleteHandler;
-
- GpgKeyTable() {
- table.setWidth("");
- table.setText(0, 1, Util.C.gpgKeyId());
- table.setText(0, 2, Util.C.gpgKeyFingerprint());
- table.setText(0, 3, Util.C.gpgKeyUserIds());
-
- FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().iconHeader());
- fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 2, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 3, Gerrit.RESOURCES.css().dataHeader());
-
- updateDeleteHandler =
- new ValueChangeHandler<Boolean>() {
- @Override
- public void onValueChange(ValueChangeEvent<Boolean> event) {
- updateDeleteButton();
- }
- };
- }
-
- private void addOneKey(GpgKeyInfo k) {
- int row = table.getRowCount();
- table.insertRow(row);
- applyDataRowStyle(row);
-
- CheckBox sel = new CheckBox();
- sel.addValueChangeHandler(updateDeleteHandler);
- table.setWidget(row, 0, sel);
- table.setWidget(row, 1, new CopyableLabel(k.id()));
- table.setText(row, 2, k.fingerprint());
-
- VerticalPanel userIds = new VerticalPanel();
- for (int i = 0; i < k.userIds().length(); i++) {
- userIds.add(new InlineLabel(k.userIds().get(i)));
- }
- table.setWidget(row, 3, userIds);
-
- FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().iconCell());
- fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell());
-
- setRowItem(row, k);
- }
-
- private void updateDeleteButton() {
- for (int row = 1; row < table.getRowCount(); row++) {
- if (isChecked(row)) {
- deleteKey.setEnabled(true);
- return;
- }
- }
- deleteKey.setEnabled(false);
- }
-
- private void deleteChecked() {
- deleteKey.setEnabled(false);
- List<String> toDelete = new ArrayList<>(table.getRowCount());
- for (int row = 1; row < table.getRowCount(); row++) {
- if (isChecked(row)) {
- toDelete.add(getRowItem(row).fingerprint());
- }
- }
- AccountApi.deleteGpgKeys(
- "self",
- toDelete,
- new GerritCallback<NativeMap<GpgKeyInfo>>() {
- @Override
- public void onSuccess(NativeMap<GpgKeyInfo> result) {
- refreshKeys();
- }
-
- @Override
- public void onFailure(Throwable caught) {
- deleteKey.setEnabled(true);
- super.onFailure(caught);
- }
- });
- }
-
- private boolean isChecked(int row) {
- return ((CheckBox) table.getWidget(row, 0)).getValue();
- }
-
- private void clear() {
- while (table.getRowCount() > 1) {
- table.removeRow(1);
- }
- for (int i = table.getRowCount() - 1; i >= 1; i++) {
- table.removeRow(i);
- }
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyGpgKeysScreen.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyGpgKeysScreen.ui.xml
deleted file mode 100644
index dc73736..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyGpgKeysScreen.ui.xml
+++ /dev/null
@@ -1,94 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2015 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.
--->
-<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:expui='urn:import:com.google.gwtexpui.globalkey.client'>
- <ui:with field='res' type='com.google.gerrit.client.GerritResources'/>
-
- <ui:style gss='false'>
- .errorHeader {
- font-weight: bold;
- }
- .errorText {
- white-space: pre-wrap;
- padding-bottom: 6px;
- }
- </ui:style>
-
- <g:HTMLPanel>
- <g:Widget ui:field='keys' addStyleNames='{res.css.sshKeyTable}'/>
- <g:FlowPanel>
- <g:Button ui:field='deleteKey'>
- <div><ui:msg>Delete</ui:msg></div>
- </g:Button>
- <g:Button ui:field='addKey'>
- <div><ui:msg>Add Key ...</ui:msg></div>
- </g:Button>
- </g:FlowPanel>
- <g:VerticalPanel ui:field='addKeyBlock'
- styleName='{res.css.addSshKeyPanel}'
- visible='false'>
- <g:Label>Add GPG Public Key</g:Label>
- <g:DisclosurePanel>
- <g:header>How to generate a GPG key</g:header>
- <g:HTMLPanel>
- <ol>
- <li>
- From the Terminal or Git Bash, run <em>gpg --gen-key</em> and
- follow the prompts to create the key.
- </li>
- <li>
- Use the default kind. Use the default (or higher) keysize. Choose
- any value for your expiration.
- </li>
- <li>
- The user ID should contain one of your registered email addresses.
- </li>
- <li>Setting a passphrase is strongly recommended.</li>
- <li>Note the ID of your new key.</li>
- <li>
- To export your key, run the following and paste the full output
- into the text box:
- <br/>
- <code>gpg --export -a <key ID></code>
- </li>
- </ol>
- </g:HTMLPanel>
- </g:DisclosurePanel>
- <expui:NpTextArea
- visibleLines='12'
- characterWidth='80'
- spellCheck='false'
- ui:field='keyText'/>
- <g:VerticalPanel ui:field='errorPanel' visible='false'>
- <g:Label styleName='{style.errorHeader}'>Error adding GPG key:</g:Label>
- <g:Label styleName='{style.errorText}' ui:field='errorText'/>
- </g:VerticalPanel>
- <g:FlowPanel>
- <g:Button ui:field='clearButton'>
- <div><ui:msg>Clear</ui:msg></div>
- </g:Button>
- <g:Button ui:field='addButton'>
- <div><ui:msg>Add</ui:msg></div>
- </g:Button>
- <g:Button ui:field='closeButton'>
- <div><ui:msg>Close</ui:msg></div>
- </g:Button>
- </g:FlowPanel>
- </g:VerticalPanel>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyGroupsScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyGroupsScreen.java
deleted file mode 100644
index e9112de..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyGroupsScreen.java
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (C) 2009 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.client.account;
-
-import com.google.gerrit.client.admin.GroupTable;
-import com.google.gerrit.client.groups.GroupList;
-import com.google.gerrit.client.rpc.ScreenLoadCallback;
-
-public class MyGroupsScreen extends SettingsScreen {
- private GroupTable groups;
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- groups = new GroupTable();
- add(groups);
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- GroupList.my(
- new ScreenLoadCallback<GroupList>(this) {
- @Override
- protected void preDisplay(GroupList result) {
- groups.display(result);
- groups.finishDisplay();
- }
- });
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyIdentitiesScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyIdentitiesScreen.java
deleted file mode 100644
index 730d98e..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyIdentitiesScreen.java
+++ /dev/null
@@ -1,224 +0,0 @@
-// Copyright (C) 2008 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.client.account;
-
-import static java.util.Comparator.naturalOrder;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.VoidResult;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.FancyFlexTable;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.logical.shared.ValueChangeEvent;
-import com.google.gwt.event.logical.shared.ValueChangeHandler;
-import com.google.gwt.user.client.History;
-import com.google.gwt.user.client.Window.Location;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
-import java.util.HashSet;
-import java.util.List;
-
-public class MyIdentitiesScreen extends SettingsScreen {
- private IdTable identites;
- private Button deleteIdentity;
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
-
- identites = new IdTable();
- add(identites);
-
- deleteIdentity = new Button(Util.C.buttonDeleteIdentity());
- deleteIdentity.setEnabled(false);
- deleteIdentity.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- identites.deleteChecked();
- }
- });
- add(deleteIdentity);
-
- if (Gerrit.info().auth().isOpenId() || Gerrit.info().auth().isOAuth()) {
- Button linkIdentity = new Button(Util.C.buttonLinkIdentity());
- linkIdentity.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- Location.assign(Gerrit.loginRedirect(History.getToken()) + "?link");
- }
- });
- add(linkIdentity);
- }
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- AccountApi.getExternalIds(
- new GerritCallback<JsArray<ExternalIdInfo>>() {
- @Override
- public void onSuccess(JsArray<ExternalIdInfo> results) {
- identites.display(results);
- display();
- }
- });
- }
-
- private class IdTable extends FancyFlexTable<ExternalIdInfo> {
- private ValueChangeHandler<Boolean> updateDeleteHandler;
-
- IdTable() {
- table.setWidth("");
- table.setText(0, 2, Util.C.webIdStatus());
- table.setText(0, 3, Util.C.webIdEmail());
- table.setText(0, 4, Util.C.webIdIdentity());
-
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().iconHeader());
- fmt.addStyleName(0, 2, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 3, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 4, Gerrit.RESOURCES.css().dataHeader());
-
- updateDeleteHandler =
- new ValueChangeHandler<Boolean>() {
- @Override
- public void onValueChange(ValueChangeEvent<Boolean> event) {
- updateDeleteButton();
- }
- };
- }
-
- void deleteChecked() {
- final HashSet<String> keys = new HashSet<>();
- for (int row = 1; row < table.getRowCount(); row++) {
- final ExternalIdInfo k = getRowItem(row);
- if (k == null) {
- continue;
- }
- final CheckBox cb = (CheckBox) table.getWidget(row, 1);
- if (cb == null) {
- continue;
- }
- if (cb.getValue()) {
- keys.add(k.identity());
- }
- }
- if (keys.isEmpty()) {
- updateDeleteButton();
- } else {
- deleteIdentity.setEnabled(false);
- AccountApi.deleteExternalIds(
- keys,
- new GerritCallback<VoidResult>() {
- @Override
- public void onSuccess(VoidResult result) {
- for (int row = 1; row < table.getRowCount(); ) {
- final ExternalIdInfo k = getRowItem(row);
- if (k != null && keys.contains(k.identity())) {
- table.removeRow(row);
- } else {
- row++;
- }
- }
- updateDeleteButton();
- }
-
- @Override
- public void onFailure(Throwable caught) {
- updateDeleteButton();
- super.onFailure(caught);
- }
- });
- }
- }
-
- void updateDeleteButton() {
- int off = 0;
- boolean on = false;
- for (int row = 1; row < table.getRowCount(); row++) {
- if (table.getWidget(row, 1) == null) {
- off++;
- } else {
- CheckBox sel = (CheckBox) table.getWidget(row, 1);
- if (sel.getValue()) {
- on = true;
- break;
- }
- }
- }
- deleteIdentity.setVisible(off < table.getRowCount() - 1);
- deleteIdentity.setEnabled(on);
- }
-
- void display(JsArray<ExternalIdInfo> results) {
- List<ExternalIdInfo> idList = Natives.asList(results);
- idList.sort(naturalOrder());
-
- while (1 < table.getRowCount()) {
- table.removeRow(table.getRowCount() - 1);
- }
-
- for (ExternalIdInfo k : idList) {
- addOneId(k);
- }
- updateDeleteButton();
- }
-
- void addOneId(ExternalIdInfo k) {
- if (k.isUsername()) {
- // Don't display the username as an identity here.
- return;
- }
-
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- final int row = table.getRowCount();
- table.insertRow(row);
- applyDataRowStyle(row);
-
- if (k.canDelete()) {
- final CheckBox sel = new CheckBox();
- sel.addValueChangeHandler(updateDeleteHandler);
- table.setWidget(row, 1, sel);
- } else {
- table.setText(row, 1, "");
- }
- if (k.isTrusted()) {
- table.setText(row, 2, "");
- } else {
- table.setText(row, 2, Util.C.untrustedProvider());
- fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().identityUntrustedExternalId());
- }
- if (k.emailAddress() != null && k.emailAddress().length() > 0) {
- table.setText(row, 3, k.emailAddress());
- } else {
- table.setText(row, 3, "");
- }
- table.setText(row, 4, k.describe());
-
- fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().iconCell());
- fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 4, Gerrit.RESOURCES.css().dataCell());
-
- setRowItem(row, k);
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyOAuthTokenScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyOAuthTokenScreen.java
deleted file mode 100644
index 173dba6..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyOAuthTokenScreen.java
+++ /dev/null
@@ -1,198 +0,0 @@
-// Copyright (C) 2016 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.client.account;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.info.GeneralPreferences;
-import com.google.gerrit.client.info.OAuthTokenInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.ScreenLoadCallback;
-import com.google.gwt.i18n.client.DateTimeFormat;
-import com.google.gwt.i18n.client.LocaleInfo;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Grid;
-import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.clippy.client.CopyableLabel;
-import java.util.Date;
-
-public class MyOAuthTokenScreen extends SettingsScreen {
- private CopyableLabel tokenLabel;
- private Label expiresLabel;
- private Label expiredNote;
- private CopyableLabel netrcValue;
- private CopyableLabel cookieValue;
- private FlowPanel flow;
- private Grid grid;
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
-
- tokenLabel = new CopyableLabel("");
- tokenLabel.addStyleName(Gerrit.RESOURCES.css().oauthToken());
-
- expiresLabel = new Label("");
- expiresLabel.addStyleName(Gerrit.RESOURCES.css().oauthExpires());
-
- grid = new Grid(2, 2);
- grid.setStyleName(Gerrit.RESOURCES.css().infoBlock());
- grid.addStyleName(Gerrit.RESOURCES.css().oauthInfoBlock());
- add(grid);
-
- expiredNote = new Label(Util.C.labelOAuthExpired());
- expiredNote.setVisible(false);
- add(expiredNote);
-
- row(grid, 0, Util.C.labelOAuthToken(), tokenLabel);
- row(grid, 1, Util.C.labelOAuthExpires(), expiresLabel);
-
- CellFormatter fmt = grid.getCellFormatter();
- fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
- fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
- fmt.addStyleName(1, 0, Gerrit.RESOURCES.css().bottomheader());
-
- flow = new FlowPanel();
- flow.setStyleName(Gerrit.RESOURCES.css().oauthPanel());
- add(flow);
-
- Label netrcLabel = new Label(Util.C.labelOAuthNetRCEntry());
- netrcLabel.setStyleName(Gerrit.RESOURCES.css().oauthPanelNetRCHeading());
- flow.add(netrcLabel);
- netrcValue = new CopyableLabel("");
- netrcValue.setStyleName(Gerrit.RESOURCES.css().oauthPanelNetRCEntry());
- flow.add(netrcValue);
-
- Label cookieLabel = new Label(Util.C.labelOAuthGitCookie());
- cookieLabel.setStyleName(Gerrit.RESOURCES.css().oauthPanelCookieHeading());
- flow.add(cookieLabel);
- cookieValue = new CopyableLabel("");
- cookieValue.setStyleName(Gerrit.RESOURCES.css().oauthPanelCookieEntry());
- flow.add(cookieValue);
- }
-
- private void row(Grid grid, int row, String name, Widget field) {
- final CellFormatter fmt = grid.getCellFormatter();
- if (LocaleInfo.getCurrentLocale().isRTL()) {
- grid.setText(row, 1, name);
- grid.setWidget(row, 0, field);
- fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().header());
- } else {
- grid.setText(row, 0, name);
- grid.setWidget(row, 1, field);
- fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().header());
- }
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- AccountApi.self()
- .view("preferences")
- .get(
- new ScreenLoadCallback<GeneralPreferences>(this) {
- @Override
- protected void preDisplay(GeneralPreferences prefs) {
- display(prefs);
- }
- });
- }
-
- private void display(GeneralPreferences prefs) {
- AccountApi.self()
- .view("oauthtoken")
- .get(
- new GerritCallback<OAuthTokenInfo>() {
- @Override
- public void onSuccess(OAuthTokenInfo tokenInfo) {
- tokenLabel.setText(tokenInfo.accessToken());
- expiresLabel.setText(getExpiresAt(tokenInfo, prefs));
- netrcValue.setText(getNetRC(tokenInfo));
- cookieValue.setText(getCookie(tokenInfo));
- flow.setVisible(true);
- expiredNote.setVisible(false);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- if (isNoSuchEntity(caught) || isSigninFailure(caught)) {
- tokenLabel.setText("");
- expiresLabel.setText("");
- netrcValue.setText("");
- cookieValue.setText("");
- flow.setVisible(false);
- expiredNote.setVisible(true);
- } else {
- showFailure(caught);
- }
- }
- });
- }
-
- private static long getExpiresAt(OAuthTokenInfo tokenInfo) {
- if (tokenInfo.expiresAt() == null) {
- return Long.MAX_VALUE;
- }
- long expiresAt;
- try {
- expiresAt = Long.parseLong(tokenInfo.expiresAt());
- } catch (NumberFormatException e) {
- return Long.MAX_VALUE;
- }
- return expiresAt;
- }
-
- private static long getExpiresAtSeconds(OAuthTokenInfo tokenInfo) {
- return getExpiresAt(tokenInfo) / 1000L;
- }
-
- private static String getExpiresAt(OAuthTokenInfo tokenInfo, GeneralPreferences prefs) {
- long expiresAt = getExpiresAt(tokenInfo);
- if (expiresAt == Long.MAX_VALUE) {
- return "";
- }
- String dateFormat = prefs.dateFormat().getLongFormat();
- String timeFormat = prefs.timeFormat().getFormat();
- DateTimeFormat formatter = DateTimeFormat.getFormat(dateFormat + " " + timeFormat);
- return formatter.format(new Date(expiresAt));
- }
-
- private static String getNetRC(OAuthTokenInfo accessTokenInfo) {
- StringBuilder sb = new StringBuilder();
- sb.append("machine ");
- sb.append(accessTokenInfo.resourceHost());
- sb.append(" login ");
- sb.append(accessTokenInfo.username());
- sb.append(" password ");
- sb.append(accessTokenInfo.accessToken());
- return sb.toString();
- }
-
- private static String getCookie(OAuthTokenInfo accessTokenInfo) {
- StringBuilder sb = new StringBuilder();
- sb.append(accessTokenInfo.resourceHost());
- sb.append("\tFALSE\t/\tTRUE\t");
- sb.append(getExpiresAtSeconds(accessTokenInfo));
- sb.append("\tgit-");
- sb.append(accessTokenInfo.username());
- sb.append('\t');
- sb.append(accessTokenInfo.accessToken());
- if (accessTokenInfo.providerId() != null) {
- sb.append('@').append(accessTokenInfo.providerId());
- }
- return sb.toString();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPasswordScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPasswordScreen.java
deleted file mode 100644
index 5dd7530..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPasswordScreen.java
+++ /dev/null
@@ -1,161 +0,0 @@
-// Copyright (C) 2008 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.client.account;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.GerritUiExtensionPoint;
-import com.google.gerrit.client.api.ExtensionPanel;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.i18n.client.LocaleInfo;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Grid;
-import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.clippy.client.CopyableLabel;
-
-public class MyPasswordScreen extends SettingsScreen {
- private CopyableLabel password;
- private Button generatePassword;
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
-
- String url = Gerrit.info().auth().httpPasswordUrl();
- if (url != null) {
- Anchor link = new Anchor();
- link.setText(Util.C.linkObtainPassword());
- link.setHref(url);
- link.setTarget("_blank");
- add(link);
- return;
- }
-
- password = new CopyableLabel(Util.C.revokePassword());
- password.addStyleName(Gerrit.RESOURCES.css().accountPassword());
-
- generatePassword = new Button(Util.C.buttonGeneratePassword());
- generatePassword.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- doGeneratePassword();
- }
- });
-
- final Grid userInfo = new Grid(2, 2);
- final CellFormatter fmt = userInfo.getCellFormatter();
- userInfo.setStyleName(Gerrit.RESOURCES.css().infoBlock());
- userInfo.addStyleName(Gerrit.RESOURCES.css().accountInfoBlock());
- add(userInfo);
-
- row(userInfo, 0, Util.C.userName(), new UsernameField());
- row(userInfo, 1, Util.C.password(), password);
-
- fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
- fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
- fmt.addStyleName(1, 0, Gerrit.RESOURCES.css().bottomheader());
-
- final FlowPanel buttons = new FlowPanel();
- buttons.add(generatePassword);
- add(buttons);
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- ExtensionPanel extensionPanel =
- createExtensionPoint(GerritUiExtensionPoint.PASSWORD_SCREEN_BOTTOM);
- extensionPanel.addStyleName(Gerrit.RESOURCES.css().extensionPanel());
- add(extensionPanel);
-
- if (password == null) {
- display();
- return;
- }
-
- enableUI(false);
- AccountApi.getUsername(
- "self",
- new GerritCallback<NativeString>() {
- @Override
- public void onSuccess(NativeString user) {
- Gerrit.getUserAccount().username(user.asString());
- enableUI(true);
- display();
- }
-
- @Override
- public void onFailure(Throwable caught) {
- if (RestApi.isNotFound(caught)) {
- Gerrit.getUserAccount().username(null);
- display();
- } else {
- super.onFailure(caught);
- }
- }
- });
- }
-
- private void display(String pass) {
- password.setText(pass != null ? pass : "");
- password.setVisible(pass != null);
- enableUI(true);
- }
-
- private void row(Grid info, int row, String name, Widget field) {
- final CellFormatter fmt = info.getCellFormatter();
- if (LocaleInfo.getCurrentLocale().isRTL()) {
- info.setText(row, 1, name);
- info.setWidget(row, 0, field);
- fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().header());
- } else {
- info.setText(row, 0, name);
- info.setWidget(row, 1, field);
- fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().header());
- }
- }
-
- private void doGeneratePassword() {
- if (Gerrit.getUserAccount().username() != null) {
- enableUI(false);
- AccountApi.generateHttpPassword(
- "self",
- new GerritCallback<NativeString>() {
- @Override
- public void onSuccess(NativeString newPassword) {
- display(newPassword.asString());
- }
-
- @Override
- public void onFailure(Throwable caught) {
- enableUI(true);
- }
- });
- }
- }
-
- private void enableUI(boolean on) {
- on &= Gerrit.getUserAccount().username() != null;
-
- generatePassword.setEnabled(on);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java
deleted file mode 100644
index afb8718..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyPreferencesScreen.java
+++ /dev/null
@@ -1,515 +0,0 @@
-// Copyright (C) 2008 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.client.account;
-
-import static com.google.gerrit.extensions.client.GeneralPreferencesInfo.DEFAULT_PAGESIZE;
-import static com.google.gerrit.extensions.client.GeneralPreferencesInfo.PAGESIZE_CHOICES;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.GerritUiExtensionPoint;
-import com.google.gerrit.client.StringListPanel;
-import com.google.gerrit.client.api.ExtensionPanel;
-import com.google.gerrit.client.config.ConfigServerApi;
-import com.google.gerrit.client.info.GeneralPreferences;
-import com.google.gerrit.client.info.TopMenuItem;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.rpc.ScreenLoadCallback;
-import com.google.gerrit.client.ui.OnEditEnabler;
-import com.google.gerrit.extensions.client.GeneralPreferencesInfo;
-import com.google.gerrit.extensions.client.GeneralPreferencesInfo.ReviewCategoryStrategy;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.i18n.client.DateTimeFormat;
-import com.google.gwt.i18n.client.LocaleInfo;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Grid;
-import com.google.gwt.user.client.ui.ListBox;
-import com.google.gwtexpui.user.client.UserAgent;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-
-public class MyPreferencesScreen extends SettingsScreen {
- private CheckBox showSiteHeader;
- private CheckBox useFlashClipboard;
- private CheckBox highlightAssigneeInChangeTable;
- private CheckBox relativeDateInChangeTable;
- private CheckBox sizeBarInChangeTable;
- private CheckBox legacycidInChangeTable;
- private CheckBox muteCommonPathPrefixes;
- private CheckBox signedOffBy;
- private CheckBox publishCommentsOnPush;
- private CheckBox workInProgressByDefault;
- private ListBox maximumPageSize;
- private ListBox dateFormat;
- private ListBox timeFormat;
- private ListBox reviewCategoryStrategy;
- private ListBox diffView;
- private ListBox emailStrategy;
- private ListBox emailFormat;
- private ListBox defaultBaseForMerges;
- private StringListPanel myMenus;
- private Button save;
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
-
- showSiteHeader = new CheckBox(Util.C.showSiteHeader());
- useFlashClipboard = new CheckBox(Util.C.useFlashClipboard());
- maximumPageSize = new ListBox();
- for (int v : PAGESIZE_CHOICES) {
- maximumPageSize.addItem(Util.M.rowsPerPage(v), String.valueOf(v));
- }
-
- reviewCategoryStrategy = new ListBox();
- reviewCategoryStrategy.addItem(
- Util.C.messageShowInReviewCategoryNone(),
- GeneralPreferencesInfo.ReviewCategoryStrategy.NONE.name());
- reviewCategoryStrategy.addItem(
- Util.C.messageShowInReviewCategoryName(),
- GeneralPreferencesInfo.ReviewCategoryStrategy.NAME.name());
- reviewCategoryStrategy.addItem(
- Util.C.messageShowInReviewCategoryEmail(),
- GeneralPreferencesInfo.ReviewCategoryStrategy.EMAIL.name());
- reviewCategoryStrategy.addItem(
- Util.C.messageShowInReviewCategoryUsername(),
- GeneralPreferencesInfo.ReviewCategoryStrategy.USERNAME.name());
- reviewCategoryStrategy.addItem(
- Util.C.messageShowInReviewCategoryAbbrev(),
- GeneralPreferencesInfo.ReviewCategoryStrategy.ABBREV.name());
-
- emailStrategy = new ListBox();
- emailStrategy.addItem(
- Util.C.messageCCMeOnMyComments(),
- GeneralPreferencesInfo.EmailStrategy.CC_ON_OWN_COMMENTS.name());
- emailStrategy.addItem(
- Util.C.messageEnabled(), GeneralPreferencesInfo.EmailStrategy.ENABLED.name());
- emailStrategy.addItem(
- Util.C.messageDisabled(), GeneralPreferencesInfo.EmailStrategy.DISABLED.name());
-
- emailFormat = new ListBox();
- emailFormat.addItem(
- Util.C.messagePlaintextOnly(), GeneralPreferencesInfo.EmailFormat.PLAINTEXT.name());
- emailFormat.addItem(
- Util.C.messageHtmlPlaintext(), GeneralPreferencesInfo.EmailFormat.HTML_PLAINTEXT.name());
-
- defaultBaseForMerges = new ListBox();
- defaultBaseForMerges.addItem(
- Util.C.autoMerge(), GeneralPreferencesInfo.DefaultBase.AUTO_MERGE.name());
- defaultBaseForMerges.addItem(
- Util.C.firstParent(), GeneralPreferencesInfo.DefaultBase.FIRST_PARENT.name());
-
- diffView = new ListBox();
- diffView.addItem(
- com.google.gerrit.client.changes.Util.C.sideBySide(),
- GeneralPreferencesInfo.DiffView.SIDE_BY_SIDE.name());
- diffView.addItem(
- com.google.gerrit.client.changes.Util.C.unifiedDiff(),
- GeneralPreferencesInfo.DiffView.UNIFIED_DIFF.name());
-
- Date now = new Date();
- dateFormat = new ListBox();
- for (GeneralPreferencesInfo.DateFormat fmt : GeneralPreferencesInfo.DateFormat.values()) {
- StringBuilder r = new StringBuilder();
- r.append(DateTimeFormat.getFormat(fmt.getShortFormat()).format(now));
- r.append(" ; ");
- r.append(DateTimeFormat.getFormat(fmt.getLongFormat()).format(now));
- dateFormat.addItem(r.toString(), fmt.name());
- }
-
- timeFormat = new ListBox();
- for (GeneralPreferencesInfo.TimeFormat fmt : GeneralPreferencesInfo.TimeFormat.values()) {
- StringBuilder r = new StringBuilder();
- r.append(DateTimeFormat.getFormat(fmt.getFormat()).format(now));
- timeFormat.addItem(r.toString(), fmt.name());
- }
-
- FlowPanel dateTimePanel = new FlowPanel();
-
- final int labelIdx;
- final int fieldIdx;
- if (LocaleInfo.getCurrentLocale().isRTL()) {
- labelIdx = 1;
- fieldIdx = 0;
- dateTimePanel.add(timeFormat);
- dateTimePanel.add(dateFormat);
- } else {
- labelIdx = 0;
- fieldIdx = 1;
- dateTimePanel.add(dateFormat);
- dateTimePanel.add(timeFormat);
- }
- highlightAssigneeInChangeTable = new CheckBox(Util.C.highlightAssigneeInChangeTable());
- relativeDateInChangeTable = new CheckBox(Util.C.showRelativeDateInChangeTable());
- sizeBarInChangeTable = new CheckBox(Util.C.showSizeBarInChangeTable());
- legacycidInChangeTable = new CheckBox(Util.C.showLegacycidInChangeTable());
- muteCommonPathPrefixes = new CheckBox(Util.C.muteCommonPathPrefixes());
- signedOffBy = new CheckBox(Util.C.signedOffBy());
- publishCommentsOnPush = new CheckBox(Util.C.publishCommentsOnPush());
- workInProgressByDefault = new CheckBox(Util.C.workInProgressByDefault());
-
- boolean flashClippy = !UserAgent.hasJavaScriptClipboard() && UserAgent.Flash.isInstalled();
- final Grid formGrid = new Grid(16 + (flashClippy ? 1 : 0), 2);
-
- int row = 0;
-
- formGrid.setText(row, labelIdx, Util.C.reviewCategoryLabel());
- formGrid.setWidget(row, fieldIdx, reviewCategoryStrategy);
- row++;
-
- formGrid.setText(row, labelIdx, Util.C.maximumPageSizeFieldLabel());
- formGrid.setWidget(row, fieldIdx, maximumPageSize);
- row++;
-
- formGrid.setText(row, labelIdx, Util.C.dateFormatLabel());
- formGrid.setWidget(row, fieldIdx, dateTimePanel);
- row++;
-
- formGrid.setText(row, labelIdx, Util.C.emailFieldLabel());
- formGrid.setWidget(row, fieldIdx, emailStrategy);
- row++;
-
- formGrid.setText(row, labelIdx, Util.C.emailFormatFieldLabel());
- formGrid.setWidget(row, fieldIdx, emailFormat);
- row++;
-
- formGrid.setText(row, labelIdx, Util.C.defaultBaseForMerges());
- formGrid.setWidget(row, fieldIdx, defaultBaseForMerges);
- row++;
-
- formGrid.setText(row, labelIdx, Util.C.diffViewLabel());
- formGrid.setWidget(row, fieldIdx, diffView);
- row++;
-
- formGrid.setText(row, labelIdx, "");
- formGrid.setWidget(row, fieldIdx, showSiteHeader);
- row++;
-
- formGrid.setText(row, labelIdx, "");
- formGrid.setWidget(row, fieldIdx, highlightAssigneeInChangeTable);
- row++;
-
- formGrid.setText(row, labelIdx, "");
- formGrid.setWidget(row, fieldIdx, relativeDateInChangeTable);
- row++;
-
- formGrid.setText(row, labelIdx, "");
- formGrid.setWidget(row, fieldIdx, sizeBarInChangeTable);
- row++;
-
- formGrid.setText(row, labelIdx, "");
- formGrid.setWidget(row, fieldIdx, legacycidInChangeTable);
- row++;
-
- formGrid.setText(row, labelIdx, "");
- formGrid.setWidget(row, fieldIdx, muteCommonPathPrefixes);
- row++;
-
- formGrid.setText(row, labelIdx, "");
- formGrid.setWidget(row, fieldIdx, signedOffBy);
- row++;
-
- formGrid.setText(row, labelIdx, "");
- formGrid.setWidget(row, fieldIdx, publishCommentsOnPush);
- row++;
-
- formGrid.setText(row, labelIdx, "");
- formGrid.setWidget(row, fieldIdx, workInProgressByDefault);
- row++;
-
- if (flashClippy) {
- formGrid.setText(row, labelIdx, "");
- formGrid.setWidget(row, fieldIdx, useFlashClipboard);
- }
-
- add(formGrid);
-
- save = new Button(Util.C.buttonSaveChanges());
- save.setEnabled(false);
- save.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- doSave();
- }
- });
-
- myMenus = new MyMenuPanel(save);
- add(myMenus);
-
- add(save);
-
- final OnEditEnabler e = new OnEditEnabler(save);
- e.listenTo(showSiteHeader);
- e.listenTo(useFlashClipboard);
- e.listenTo(maximumPageSize);
- e.listenTo(dateFormat);
- e.listenTo(timeFormat);
- e.listenTo(highlightAssigneeInChangeTable);
- e.listenTo(relativeDateInChangeTable);
- e.listenTo(sizeBarInChangeTable);
- e.listenTo(legacycidInChangeTable);
- e.listenTo(muteCommonPathPrefixes);
- e.listenTo(signedOffBy);
- e.listenTo(publishCommentsOnPush);
- e.listenTo(workInProgressByDefault);
- e.listenTo(diffView);
- e.listenTo(reviewCategoryStrategy);
- e.listenTo(emailStrategy);
- e.listenTo(emailFormat);
- e.listenTo(defaultBaseForMerges);
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- ExtensionPanel extensionPanel =
- createExtensionPoint(GerritUiExtensionPoint.PREFERENCES_SCREEN_BOTTOM);
- extensionPanel.addStyleName(Gerrit.RESOURCES.css().extensionPanel());
- add(extensionPanel);
-
- AccountApi.self()
- .view("preferences")
- .get(
- new ScreenLoadCallback<GeneralPreferences>(this) {
- @Override
- public void preDisplay(GeneralPreferences prefs) {
- display(prefs);
- }
- });
- }
-
- private void enable(boolean on) {
- showSiteHeader.setEnabled(on);
- useFlashClipboard.setEnabled(on);
- maximumPageSize.setEnabled(on);
- dateFormat.setEnabled(on);
- timeFormat.setEnabled(on);
- highlightAssigneeInChangeTable.setEnabled(on);
- relativeDateInChangeTable.setEnabled(on);
- sizeBarInChangeTable.setEnabled(on);
- legacycidInChangeTable.setEnabled(on);
- muteCommonPathPrefixes.setEnabled(on);
- signedOffBy.setEnabled(on);
- publishCommentsOnPush.setEnabled(on);
- workInProgressByDefault.setEnabled(on);
- reviewCategoryStrategy.setEnabled(on);
- diffView.setEnabled(on);
- emailStrategy.setEnabled(on);
- emailFormat.setEnabled(on);
- defaultBaseForMerges.setEnabled(on);
- }
-
- private void display(GeneralPreferences p) {
- showSiteHeader.setValue(p.showSiteHeader());
- useFlashClipboard.setValue(p.useFlashClipboard());
- setListBox(maximumPageSize, DEFAULT_PAGESIZE, p.changesPerPage());
- setListBox(
- dateFormat,
- GeneralPreferencesInfo.DateFormat.STD, //
- p.dateFormat());
- setListBox(
- timeFormat,
- GeneralPreferencesInfo.TimeFormat.HHMM_12, //
- p.timeFormat());
- highlightAssigneeInChangeTable.setValue(p.highlightAssigneeInChangeTable());
- relativeDateInChangeTable.setValue(p.relativeDateInChangeTable());
- sizeBarInChangeTable.setValue(p.sizeBarInChangeTable());
- legacycidInChangeTable.setValue(p.legacycidInChangeTable());
- muteCommonPathPrefixes.setValue(p.muteCommonPathPrefixes());
- signedOffBy.setValue(p.signedOffBy());
- publishCommentsOnPush.setValue(p.publishCommentsOnPush());
- workInProgressByDefault.setValue(p.workInProgressByDefault());
- setListBox(
- reviewCategoryStrategy,
- GeneralPreferencesInfo.ReviewCategoryStrategy.NONE,
- p.reviewCategoryStrategy());
- setListBox(diffView, GeneralPreferencesInfo.DiffView.SIDE_BY_SIDE, p.diffView());
- setListBox(emailStrategy, GeneralPreferencesInfo.EmailStrategy.ENABLED, p.emailStrategy());
- setListBox(emailFormat, GeneralPreferencesInfo.EmailFormat.HTML_PLAINTEXT, p.emailFormat());
- setListBox(
- defaultBaseForMerges,
- GeneralPreferencesInfo.DefaultBase.FIRST_PARENT,
- p.defaultBaseForMerges());
- display(p.my());
- }
-
- private void display(JsArray<TopMenuItem> items) {
- List<List<String>> values = new ArrayList<>();
- for (TopMenuItem item : Natives.asList(items)) {
- values.add(Arrays.asList(item.getName(), item.getUrl()));
- }
- myMenus.display(values);
- }
-
- private void setListBox(ListBox f, int defaultValue, int currentValue) {
- setListBox(f, String.valueOf(defaultValue), String.valueOf(currentValue));
- }
-
- private <T extends Enum<?>> void setListBox(final ListBox f, T defaultValue, T currentValue) {
- setListBox(
- f,
- defaultValue != null ? defaultValue.name() : "",
- currentValue != null ? currentValue.name() : "");
- }
-
- private void setListBox(ListBox f, String defaultValue, String currentValue) {
- final int n = f.getItemCount();
- for (int i = 0; i < n; i++) {
- if (f.getValue(i).equals(currentValue)) {
- f.setSelectedIndex(i);
- return;
- }
- }
- if (!currentValue.equals(defaultValue)) {
- setListBox(f, defaultValue, defaultValue);
- }
- }
-
- private int getListBox(ListBox f, int defaultValue) {
- final int idx = f.getSelectedIndex();
- if (0 <= idx) {
- return Short.parseShort(f.getValue(idx));
- }
- return defaultValue;
- }
-
- private <T extends Enum<?>> T getListBox(ListBox f, T defaultValue, T[] all) {
- final int idx = f.getSelectedIndex();
- if (0 <= idx) {
- String v = f.getValue(idx);
- if ("".equals(v)) {
- return defaultValue;
- }
- for (T t : all) {
- if (t.name().equals(v)) {
- return t;
- }
- }
- }
- return defaultValue;
- }
-
- private void doSave() {
- GeneralPreferences p = GeneralPreferences.create();
- p.showSiteHeader(showSiteHeader.getValue());
- p.useFlashClipboard(useFlashClipboard.getValue());
- p.changesPerPage(getListBox(maximumPageSize, DEFAULT_PAGESIZE));
- p.dateFormat(
- getListBox(
- dateFormat,
- GeneralPreferencesInfo.DateFormat.STD,
- GeneralPreferencesInfo.DateFormat.values()));
- p.timeFormat(
- getListBox(
- timeFormat,
- GeneralPreferencesInfo.TimeFormat.HHMM_12,
- GeneralPreferencesInfo.TimeFormat.values()));
- p.highlightAssigneeInChangeTable(highlightAssigneeInChangeTable.getValue());
- p.relativeDateInChangeTable(relativeDateInChangeTable.getValue());
- p.sizeBarInChangeTable(sizeBarInChangeTable.getValue());
- p.legacycidInChangeTable(legacycidInChangeTable.getValue());
- p.muteCommonPathPrefixes(muteCommonPathPrefixes.getValue());
- p.signedOffBy(signedOffBy.getValue());
- p.publishCommentsOnPush(publishCommentsOnPush.getValue());
- p.workInProgressByDefault(workInProgressByDefault.getValue());
- p.reviewCategoryStrategy(
- getListBox(
- reviewCategoryStrategy, ReviewCategoryStrategy.NONE, ReviewCategoryStrategy.values()));
- p.diffView(
- getListBox(
- diffView,
- GeneralPreferencesInfo.DiffView.SIDE_BY_SIDE,
- GeneralPreferencesInfo.DiffView.values()));
-
- p.emailStrategy(
- getListBox(
- emailStrategy,
- GeneralPreferencesInfo.EmailStrategy.ENABLED,
- GeneralPreferencesInfo.EmailStrategy.values()));
-
- p.emailFormat(
- getListBox(
- emailFormat,
- GeneralPreferencesInfo.EmailFormat.HTML_PLAINTEXT,
- GeneralPreferencesInfo.EmailFormat.values()));
-
- p.defaultBaseForMerges(
- getListBox(
- defaultBaseForMerges,
- GeneralPreferencesInfo.DefaultBase.FIRST_PARENT,
- GeneralPreferencesInfo.DefaultBase.values()));
-
- List<TopMenuItem> items = new ArrayList<>();
- for (List<String> v : myMenus.getValues()) {
- items.add(TopMenuItem.create(v.get(0), v.get(1)));
- }
- p.setMyMenus(items);
-
- enable(false);
- save.setEnabled(false);
-
- AccountApi.self()
- .view("preferences")
- .put(
- p,
- new GerritCallback<GeneralPreferences>() {
- @Override
- public void onSuccess(GeneralPreferences prefs) {
- Gerrit.setUserPreferences(prefs);
- enable(true);
- display(prefs);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- enable(true);
- save.setEnabled(true);
- super.onFailure(caught);
- }
- });
- }
-
- private class MyMenuPanel extends StringListPanel {
- MyMenuPanel(Button save) {
- super(Util.C.myMenu(), Arrays.asList(Util.C.myMenuName(), Util.C.myMenuUrl()), save, false);
-
- setInfo(Util.C.myMenuInfo());
-
- Button resetButton = new Button(Util.C.myMenuReset());
- resetButton.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- ConfigServerApi.defaultPreferences(
- new GerritCallback<GeneralPreferences>() {
- @Override
- public void onSuccess(GeneralPreferences p) {
- MyPreferencesScreen.this.display(p.my());
- widget.setEnabled(true);
- }
- });
- }
- });
- buttonPanel.add(resetButton);
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyProfileScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyProfileScreen.java
deleted file mode 100644
index 0275948..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyProfileScreen.java
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (C) 2008 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.client.account;
-
-import static com.google.gerrit.client.FormatUtil.mediumFormat;
-
-import com.google.gerrit.client.AvatarImage;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.GerritUiExtensionPoint;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gwt.i18n.client.LocaleInfo;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.Grid;
-import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.VerticalPanel;
-
-public class MyProfileScreen extends SettingsScreen {
- private AvatarImage avatar;
- private Anchor changeAvatar;
- private int labelIdx;
- private int fieldIdx;
- private Grid info;
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
-
- HorizontalPanel h = new HorizontalPanel();
- add(h);
-
- if (Gerrit.info().plugin().hasAvatars()) {
- VerticalPanel v = new VerticalPanel();
- v.addStyleName(Gerrit.RESOURCES.css().avatarInfoPanel());
- h.add(v);
- avatar = new AvatarImage();
- v.add(avatar);
- changeAvatar = new Anchor(Util.C.changeAvatar(), "", "_blank");
- changeAvatar.setVisible(false);
- v.add(changeAvatar);
- }
-
- if (LocaleInfo.getCurrentLocale().isRTL()) {
- labelIdx = 1;
- fieldIdx = 0;
- } else {
- labelIdx = 0;
- fieldIdx = 1;
- }
-
- info = new Grid((Gerrit.info().auth().siteHasUsernames() ? 1 : 0) + 4, 2);
- info.setStyleName(Gerrit.RESOURCES.css().infoBlock());
- info.addStyleName(Gerrit.RESOURCES.css().accountInfoBlock());
- h.add(info);
-
- int row = 0;
- if (Gerrit.info().auth().siteHasUsernames()) {
- infoRow(row++, Util.C.userName());
- }
- infoRow(row++, Util.C.fullName());
- infoRow(row++, Util.C.preferredEmail());
- infoRow(row++, Util.C.registeredOn());
- infoRow(row++, Util.C.accountId());
-
- final CellFormatter fmt = info.getCellFormatter();
- fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
- fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
- fmt.addStyleName(row - 1, 0, Gerrit.RESOURCES.css().bottomheader());
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- add(createExtensionPoint(GerritUiExtensionPoint.PROFILE_SCREEN_BOTTOM));
- display(Gerrit.getUserAccount());
- display();
- }
-
- private void infoRow(int row, String name) {
- info.setText(row, labelIdx, name);
- info.getCellFormatter().addStyleName(row, 0, Gerrit.RESOURCES.css().header());
- }
-
- void display(AccountInfo account) {
- if (Gerrit.info().plugin().hasAvatars()) {
- avatar.setAccount(account, 93, false);
- new RestApi("/accounts/")
- .id("self")
- .view("avatar.change.url")
- .get(
- new AsyncCallback<NativeString>() {
- @Override
- public void onSuccess(NativeString changeUrl) {
- changeAvatar.setHref(changeUrl.asString());
- changeAvatar.setVisible(true);
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- });
- }
-
- int row = 0;
- if (Gerrit.info().auth().siteHasUsernames()) {
- info.setWidget(row++, fieldIdx, new UsernameField());
- }
- info.setText(row++, fieldIdx, account.name());
- info.setText(row++, fieldIdx, account.email());
- info.setText(row++, fieldIdx, mediumFormat(account.registeredOn()));
- info.setText(row, fieldIdx, Integer.toString(account._accountId()));
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MySshKeysScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MySshKeysScreen.java
deleted file mode 100644
index 6ba63aa..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MySshKeysScreen.java
+++ /dev/null
@@ -1,32 +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.google.gerrit.client.account;
-
-public class MySshKeysScreen extends SettingsScreen {
- private SshPanel panel;
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- panel =
- new SshPanel() {
- @Override
- void display() {
- MySshKeysScreen.this.display();
- }
- };
- add(panel);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyWatchedProjectsScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyWatchedProjectsScreen.java
deleted file mode 100644
index f29b573..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyWatchedProjectsScreen.java
+++ /dev/null
@@ -1,228 +0,0 @@
-// Copyright (C) 2008 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.client.account;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.ui.HintTextBox;
-import com.google.gerrit.client.ui.ProjectListPopup;
-import com.google.gerrit.client.ui.ProjectNameSuggestOracle;
-import com.google.gerrit.client.ui.RemoteSuggestBox;
-import com.google.gerrit.common.PageLinks;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-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.SelectionEvent;
-import com.google.gwt.event.logical.shared.SelectionHandler;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Grid;
-import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-
-public class MyWatchedProjectsScreen extends SettingsScreen {
- private Button addNew;
- private RemoteSuggestBox nameBox;
- private HintTextBox filterTxt;
- private MyWatchesTable watchesTab;
- private Button browse;
- private Button delSel;
- private Grid grid;
- private ProjectListPopup projectsPopup;
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- createWidgets();
-
- /* top table */
- grid = new Grid(2, 2);
- grid.setStyleName(Gerrit.RESOURCES.css().infoBlock());
- grid.setText(0, 0, Util.C.watchedProjectName());
- final HorizontalPanel hp = new HorizontalPanel();
- hp.add(nameBox);
- hp.add(browse);
- grid.setWidget(0, 1, hp);
-
- grid.setText(1, 0, Util.C.watchedProjectFilter());
- grid.setWidget(1, 1, filterTxt);
-
- final CellFormatter fmt = grid.getCellFormatter();
- fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
- fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
- fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().header());
- fmt.addStyleName(1, 0, Gerrit.RESOURCES.css().header());
- fmt.addStyleName(1, 0, Gerrit.RESOURCES.css().bottomheader());
-
- final FlowPanel fp = new FlowPanel();
- fp.setStyleName(Gerrit.RESOURCES.css().addWatchPanel());
- fp.add(grid);
- fp.add(addNew);
- add(fp);
-
- /* bottom table */
- add(watchesTab);
- add(delSel);
-
- /* popup */
- projectsPopup =
- new ProjectListPopup() {
- @Override
- protected void onMovePointerTo(String projectName) {
- // prevent user input from being overwritten by simply poping up
- if (!projectsPopup.isPoppingUp() || "".equals(nameBox.getText())) {
- nameBox.setText(projectName);
- }
- }
-
- @Override
- protected void openRow(String projectName) {
- nameBox.setText(projectName);
- doAddNew();
- }
- };
- projectsPopup.initPopup(Util.C.projects(), PageLinks.SETTINGS_PROJECTS);
- }
-
- protected void createWidgets() {
- nameBox = new RemoteSuggestBox(new ProjectNameSuggestOracle());
- nameBox.setVisibleLength(50);
- nameBox.setHintText(Util.C.defaultProjectName());
- nameBox.addSelectionHandler(
- new SelectionHandler<String>() {
- @Override
- public void onSelection(SelectionEvent<String> event) {
- doAddNew();
- }
- });
-
- filterTxt = new HintTextBox();
- filterTxt.setVisibleLength(50);
- filterTxt.setHintText(Util.C.defaultFilter());
- filterTxt.addKeyPressHandler(
- new KeyPressHandler() {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
- doAddNew();
- }
- }
- });
-
- addNew = new Button(Util.C.buttonWatchProject());
- addNew.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- doAddNew();
- }
- });
-
- browse = new Button(Util.C.buttonBrowseProjects());
- browse.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- int top = grid.getAbsoluteTop() - 50; // under page header
- // Try to place it to the right of everything else, but not
- // right justified
- int left =
- 5
- + Math.max(
- grid.getAbsoluteLeft() + grid.getOffsetWidth(),
- watchesTab.getAbsoluteLeft() + watchesTab.getOffsetWidth());
- projectsPopup.setPreferredCoordinates(top, left);
- projectsPopup.displayPopup();
- }
- });
-
- watchesTab = new MyWatchesTable();
-
- delSel = new Button(Util.C.buttonDeleteSshKey());
- delSel.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- watchesTab.deleteChecked();
- }
- });
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- populateWatches();
- }
-
- @Override
- protected void onUnload() {
- super.onUnload();
- projectsPopup.closePopup();
- }
-
- protected void doAddNew() {
- final String projectName = nameBox.getText().trim();
- if ("".equals(projectName)) {
- return;
- }
-
- addNew.setEnabled(false);
- nameBox.setEnabled(false);
- filterTxt.setEnabled(false);
-
- final ProjectWatchInfo projectWatchInfo = JavaScriptObject.createObject().cast();
- projectWatchInfo.project(projectName);
- projectWatchInfo.filter(filterTxt.getText());
-
- AccountApi.updateWatchedProject(
- "self",
- projectWatchInfo,
- new GerritCallback<JsArray<ProjectWatchInfo>>() {
- @Override
- public void onSuccess(JsArray<ProjectWatchInfo> watchedProjects) {
- addNew.setEnabled(true);
- nameBox.setEnabled(true);
- filterTxt.setEnabled(true);
-
- nameBox.setText("");
- watchesTab.insertWatch(projectWatchInfo);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- addNew.setEnabled(true);
- nameBox.setEnabled(true);
- filterTxt.setEnabled(true);
- super.onFailure(caught);
- }
- });
- }
-
- protected void populateWatches() {
- AccountApi.getWatchedProjects(
- "self",
- new GerritCallback<JsArray<ProjectWatchInfo>>() {
- @Override
- public void onSuccess(JsArray<ProjectWatchInfo> watchedProjects) {
- watchesTab.display(watchedProjects);
- display();
- }
- });
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyWatchesTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyWatchesTable.java
deleted file mode 100644
index 0a61b2d..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/MyWatchesTable.java
+++ /dev/null
@@ -1,193 +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.google.gerrit.client.account;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.FancyFlexTable;
-import com.google.gerrit.client.ui.ProjectLink;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Label;
-import java.util.HashSet;
-import java.util.Set;
-
-public class MyWatchesTable extends FancyFlexTable<ProjectWatchInfo> {
-
- public MyWatchesTable() {
- table.setWidth("");
- table.insertRow(1);
- table.setText(0, 2, Util.C.watchedProjectName());
- table.setText(0, 3, Util.C.watchedProjectColumnEmailNotifications());
-
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().iconHeader());
- fmt.addStyleName(0, 2, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 3, Gerrit.RESOURCES.css().dataHeader());
- fmt.setRowSpan(0, 0, 2);
- fmt.setRowSpan(0, 1, 2);
- fmt.setRowSpan(0, 2, 2);
- fmt.getElement(0, 3).setPropertyString("align", "center");
-
- fmt.setColSpan(0, 3, 5);
- table.setText(1, 0, Util.C.watchedProjectColumnNewChanges());
- table.setText(1, 1, Util.C.watchedProjectColumnNewPatchSets());
- table.setText(1, 2, Util.C.watchedProjectColumnAllComments());
- table.setText(1, 3, Util.C.watchedProjectColumnSubmittedChanges());
- table.setText(1, 4, Util.C.watchedProjectColumnAbandonedChanges());
- fmt.addStyleName(1, 0, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(1, 1, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(1, 2, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(1, 3, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(1, 4, Gerrit.RESOURCES.css().dataHeader());
- }
-
- public void deleteChecked() {
- final Set<ProjectWatchInfo> infos = getCheckedProjectWatchInfos();
- if (!infos.isEmpty()) {
- AccountApi.deleteWatchedProjects(
- "self",
- infos,
- new GerritCallback<JsArray<ProjectWatchInfo>>() {
- @Override
- public void onSuccess(JsArray<ProjectWatchInfo> watchedProjects) {
- remove(infos);
- }
- });
- }
- }
-
- protected void remove(Set<ProjectWatchInfo> infos) {
- for (int row = 1; row < table.getRowCount(); ) {
- final ProjectWatchInfo k = getRowItem(row);
- if (k != null && infos.contains(k)) {
- table.removeRow(row);
- } else {
- row++;
- }
- }
- }
-
- protected Set<ProjectWatchInfo> getCheckedProjectWatchInfos() {
- final Set<ProjectWatchInfo> infos = new HashSet<>();
- for (int row = 1; row < table.getRowCount(); row++) {
- final ProjectWatchInfo k = getRowItem(row);
- if (k != null && ((CheckBox) table.getWidget(row, 1)).getValue()) {
- infos.add(k);
- }
- }
- return infos;
- }
-
- public void insertWatch(ProjectWatchInfo k) {
- final String newName = k.project();
- int row = 1;
- for (; row < table.getRowCount(); row++) {
- final ProjectWatchInfo i = getRowItem(row);
- if (i != null && i.project().compareTo(newName) >= 0) {
- break;
- }
- }
-
- table.insertRow(row);
- applyDataRowStyle(row);
- populate(row, k);
- }
-
- public void display(JsArray<ProjectWatchInfo> result) {
- while (2 < table.getRowCount()) {
- table.removeRow(table.getRowCount() - 1);
- }
-
- for (ProjectWatchInfo info : Natives.asList(result)) {
- final int row = table.getRowCount();
- table.insertRow(row);
- applyDataRowStyle(row);
- populate(row, info);
- }
- }
-
- protected void populate(int row, ProjectWatchInfo info) {
- final FlowPanel fp = new FlowPanel();
- fp.add(new ProjectLink(info.project(), new Project.NameKey(info.project())));
- if (info.filter() != null) {
- Label filter = new Label(info.filter());
- filter.setStyleName(Gerrit.RESOURCES.css().watchedProjectFilter());
- fp.add(filter);
- }
-
- table.setWidget(row, 1, new CheckBox());
- table.setWidget(row, 2, fp);
-
- addNotifyButton(ProjectWatchInfo.Type.NEW_CHANGES, info, row, 3);
- addNotifyButton(ProjectWatchInfo.Type.NEW_PATCHSETS, info, row, 4);
- addNotifyButton(ProjectWatchInfo.Type.ALL_COMMENTS, info, row, 5);
- addNotifyButton(ProjectWatchInfo.Type.SUBMITTED_CHANGES, info, row, 6);
- addNotifyButton(ProjectWatchInfo.Type.ABANDONED_CHANGES, info, row, 7);
-
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().iconCell());
- fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 4, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 5, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 6, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 7, Gerrit.RESOURCES.css().dataCell());
-
- setRowItem(row, info);
- }
-
- protected void addNotifyButton(
- final ProjectWatchInfo.Type type, ProjectWatchInfo info, int row, int col) {
- final CheckBox cbox = new CheckBox();
-
- cbox.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- final Boolean oldVal = info.notify(type);
- info.notify(type, cbox.getValue());
- cbox.setEnabled(false);
-
- AccountApi.updateWatchedProject(
- "self",
- info,
- new GerritCallback<JsArray<ProjectWatchInfo>>() {
- @Override
- public void onSuccess(JsArray<ProjectWatchInfo> watchedProjects) {
- cbox.setEnabled(true);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- cbox.setEnabled(true);
- info.notify(type, oldVal);
- cbox.setValue(oldVal);
- super.onFailure(caught);
- }
- });
- }
- });
-
- cbox.setValue(info.notify(type));
- table.setWidget(row, col, cbox);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/NewAgreementScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/NewAgreementScreen.java
deleted file mode 100644
index 7c90884..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/NewAgreementScreen.java
+++ /dev/null
@@ -1,258 +0,0 @@
-// Copyright (C) 2008 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.client.account;
-
-import com.google.gerrit.client.ErrorDialog;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.info.AgreementInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.AccountScreen;
-import com.google.gerrit.client.ui.OnEditEnabler;
-import com.google.gerrit.client.ui.SmallHeading;
-import com.google.gerrit.common.PageLinks;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.http.client.Request;
-import com.google.gwt.http.client.RequestBuilder;
-import com.google.gwt.http.client.RequestCallback;
-import com.google.gwt.http.client.RequestException;
-import com.google.gwt.http.client.Response;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.FormPanel;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.InlineLabel;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.Panel;
-import com.google.gwt.user.client.ui.RadioButton;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwtexpui.globalkey.client.NpTextBox;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public class NewAgreementScreen extends AccountScreen {
- private final String nextToken;
- private Set<String> mySigned;
- private List<AgreementInfo> available;
- private AgreementInfo current;
-
- private VerticalPanel radios;
-
- private Panel agreementGroup;
- private HTML agreementHtml;
-
- private Panel finalGroup;
- private NpTextBox yesIAgreeBox;
- private Button submit;
-
- public NewAgreementScreen() {
- this(null);
- }
-
- public NewAgreementScreen(String token) {
- nextToken = token != null ? token : PageLinks.SETTINGS_AGREEMENTS;
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- AccountApi.getAgreements(
- "self",
- new GerritCallback<JsArray<AgreementInfo>>() {
- @Override
- public void onSuccess(JsArray<AgreementInfo> result) {
- if (isAttached()) {
- mySigned = new HashSet<>();
- for (AgreementInfo info : Natives.asList(result)) {
- mySigned.add(info.name());
- }
- postRPC();
- }
- }
- });
-
- available = Gerrit.info().auth().contributorAgreements();
- postRPC();
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- setPageTitle(Util.C.newAgreement());
-
- final FlowPanel formBody = new FlowPanel();
- radios = new VerticalPanel();
- formBody.add(radios);
-
- agreementGroup = new FlowPanel();
- agreementGroup.add(new SmallHeading(Util.C.newAgreementReviewLegalHeading()));
-
- agreementHtml = new HTML();
- agreementHtml.setStyleName(Gerrit.RESOURCES.css().contributorAgreementLegal());
- agreementGroup.add(agreementHtml);
- formBody.add(agreementGroup);
-
- finalGroup = new VerticalPanel();
- finalGroup.add(new SmallHeading(Util.C.newAgreementCompleteHeading()));
- final FlowPanel fp = new FlowPanel();
- yesIAgreeBox = new NpTextBox();
- yesIAgreeBox.setVisibleLength(Util.C.newAgreementIAGREE().length() + 8);
- yesIAgreeBox.setMaxLength(Util.C.newAgreementIAGREE().length());
- fp.add(yesIAgreeBox);
- fp.add(new InlineLabel(Util.M.enterIAGREE(Util.C.newAgreementIAGREE())));
- finalGroup.add(fp);
- submit = new Button(Util.C.buttonSubmitNewAgreement());
- submit.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- doSign();
- }
- });
- finalGroup.add(submit);
- formBody.add(finalGroup);
- new OnEditEnabler(submit, yesIAgreeBox);
-
- final FormPanel form = new FormPanel();
- form.add(formBody);
- add(form);
- }
-
- private void postRPC() {
- if (mySigned != null && available != null) {
- renderSelf();
- display();
- }
- }
-
- private void renderSelf() {
- current = null;
- agreementGroup.setVisible(false);
- finalGroup.setVisible(false);
- radios.clear();
-
- final SmallHeading hdr = new SmallHeading();
- if (available.isEmpty()) {
- hdr.setText(Util.C.newAgreementNoneAvailable());
- } else {
- hdr.setText(Util.C.newAgreementSelectTypeHeading());
- }
- radios.add(hdr);
-
- for (AgreementInfo cla : available) {
- final RadioButton r = new RadioButton("cla_id", cla.name());
- r.addStyleName(Gerrit.RESOURCES.css().contributorAgreementButton());
- radios.add(r);
-
- if (mySigned.contains(cla.name())) {
- r.setEnabled(false);
- final Label l = new Label(Util.C.newAgreementAlreadySubmitted());
- l.setStyleName(Gerrit.RESOURCES.css().contributorAgreementAlreadySubmitted());
- radios.add(l);
- } else {
- r.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- showCLA(cla);
- }
- });
- }
-
- if (cla.description() != null && !cla.description().equals("")) {
- final Label l = new Label(cla.description());
- l.setStyleName(Gerrit.RESOURCES.css().contributorAgreementShortDescription());
- radios.add(l);
- }
- }
- }
-
- private void doSign() {
- submit.setEnabled(false);
-
- if (current == null || !Util.C.newAgreementIAGREE().equalsIgnoreCase(yesIAgreeBox.getText())) {
- yesIAgreeBox.setText("");
- yesIAgreeBox.setFocus(true);
- return;
- }
- doEnterAgreement();
- }
-
- private void doEnterAgreement() {
- AccountApi.enterAgreement(
- "self",
- current.name(),
- new GerritCallback<NativeString>() {
- @Override
- public void onSuccess(NativeString result) {
- Gerrit.display(nextToken);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- yesIAgreeBox.setText("");
- super.onFailure(caught);
- }
- });
- }
-
- private void showCLA(AgreementInfo cla) {
- current = cla;
- String url = cla.url();
- if (url != null && url.length() > 0) {
- agreementGroup.setVisible(true);
- agreementHtml.setText(Gerrit.C.rpcStatusWorking());
- if (!url.startsWith("http:") && !url.startsWith("https:")) {
- url = GWT.getHostPageBaseURL() + url;
- }
- final RequestBuilder rb = new RequestBuilder(RequestBuilder.GET, url);
- rb.setCallback(
- new RequestCallback() {
- @Override
- public void onError(Request request, Throwable exception) {
- new ErrorDialog(exception).center();
- }
-
- @Override
- public void onResponseReceived(Request request, Response response) {
- final String ct = response.getHeader("Content-Type");
- if (response.getStatusCode() == 200
- && ct != null
- && (ct.equals("text/html") || ct.startsWith("text/html;"))) {
- agreementHtml.setHTML(response.getText());
- } else {
- new ErrorDialog(response.getStatusText()).center();
- }
- }
- });
- try {
- rb.send();
- } catch (RequestException e) {
- new ErrorDialog(e).show();
- }
- } else {
- agreementGroup.setVisible(false);
- }
-
- finalGroup.setVisible(cla.autoVerifyGroup() != null);
- yesIAgreeBox.setText("");
- submit.setEnabled(false);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/ProjectWatchInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/ProjectWatchInfo.java
deleted file mode 100644
index fab25ae..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/ProjectWatchInfo.java
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (C) 2016 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.client.account;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class ProjectWatchInfo extends JavaScriptObject {
-
- public enum Type {
- NEW_CHANGES,
- NEW_PATCHSETS,
- ALL_COMMENTS,
- SUBMITTED_CHANGES,
- ABANDONED_CHANGES
- }
-
- public final native String project() /*-{ return this.project; }-*/;
-
- public final native String filter() /*-{ return this.filter; }-*/;
-
- public final native void project(String s) /*-{ this.project = s; }-*/;
-
- public final native void filter(String s) /*-{ this.filter = s; }-*/;
-
- public final void notify(ProjectWatchInfo.Type t, Boolean b) {
- if (t == ProjectWatchInfo.Type.NEW_CHANGES) {
- notifyNewChanges(b.booleanValue());
- } else if (t == Type.NEW_PATCHSETS) {
- notifyNewPatchSets(b.booleanValue());
- } else if (t == Type.ALL_COMMENTS) {
- notifyAllComments(b.booleanValue());
- } else if (t == Type.SUBMITTED_CHANGES) {
- notifySubmittedChanges(b.booleanValue());
- } else if (t == Type.ABANDONED_CHANGES) {
- notifyAbandonedChanges(b.booleanValue());
- }
- }
-
- public final Boolean notify(ProjectWatchInfo.Type t) {
- boolean b = false;
- if (t == ProjectWatchInfo.Type.NEW_CHANGES) {
- b = notifyNewChanges();
- } else if (t == Type.NEW_PATCHSETS) {
- b = notifyNewPatchSets();
- } else if (t == Type.ALL_COMMENTS) {
- b = notifyAllComments();
- } else if (t == Type.SUBMITTED_CHANGES) {
- b = notifySubmittedChanges();
- } else if (t == Type.ABANDONED_CHANGES) {
- b = notifyAbandonedChanges();
- }
- return Boolean.valueOf(b);
- }
-
- private native boolean
- notifyNewChanges() /*-{ return this['notify_new_changes'] ? true : false; }-*/;
-
- private native boolean
- notifyNewPatchSets() /*-{ return this['notify_new_patch_sets'] ? true : false; }-*/;
-
- private native boolean
- notifyAllComments() /*-{ return this['notify_all_comments'] ? true : false; }-*/;
-
- private native boolean
- notifySubmittedChanges() /*-{ return this['notify_submitted_changes'] ? true : false; }-*/;
-
- private native boolean
- notifyAbandonedChanges() /*-{ return this['notify_abandoned_changes'] ? true : false; }-*/;
-
- private native void notifyNewChanges(
- boolean b) /*-{ this['notify_new_changes'] = b ? true : null; }-*/;
-
- private native void notifyNewPatchSets(
- boolean b) /*-{ this['notify_new_patch_sets'] = b ? true : null; }-*/;
-
- private native void notifyAllComments(
- boolean b) /*-{ this['notify_all_comments'] = b ? true : null; }-*/;
-
- private native void notifySubmittedChanges(
- boolean b) /*-{ this['notify_submitted_changes'] = b ? true : null; }-*/;
-
- private native void notifyAbandonedChanges(
- boolean b) /*-{ this['notify_abandoned_changes'] = b ? true : null; }-*/;
-
- protected ProjectWatchInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/RegisterScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/RegisterScreen.java
deleted file mode 100644
index 29de14a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/RegisterScreen.java
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright (C) 2009 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.client.account;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.ui.AccountScreen;
-import com.google.gerrit.client.ui.InlineHyperlink;
-import com.google.gerrit.client.ui.SmallHeading;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.extensions.client.AccountFieldName;
-import com.google.gwt.i18n.client.LocaleInfo;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.FormPanel;
-import com.google.gwt.user.client.ui.Grid;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
-
-public class RegisterScreen extends AccountScreen {
- private final String nextToken;
-
- public RegisterScreen(String next) {
- nextToken = next;
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- display();
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- setPageTitle(Util.C.welcomeToGerritCodeReview());
-
- final FlowPanel formBody = new FlowPanel();
-
- final FlowPanel contactGroup = new FlowPanel();
- contactGroup.setStyleName(Gerrit.RESOURCES.css().registerScreenSection());
- contactGroup.add(new SmallHeading(Util.C.welcomeReviewContact()));
- final HTML whereFrom = new HTML(Util.C.welcomeContactFrom());
- whereFrom.setStyleName(Gerrit.RESOURCES.css().registerScreenExplain());
- contactGroup.add(whereFrom);
- contactGroup.add(
- new ContactPanelShort() {
- @Override
- protected void display(AccountInfo account) {
- super.display(account);
-
- if ("".equals(nameTxt.getText())) {
- // No name? Encourage the user to provide us something.
- //
- nameTxt.setFocus(true);
- save.setEnabled(true);
- }
- }
- });
- formBody.add(contactGroup);
-
- if (Gerrit.getUserAccount().username() == null
- && Gerrit.info().auth().canEdit(AccountFieldName.USER_NAME)) {
- final FlowPanel fp = new FlowPanel();
- fp.setStyleName(Gerrit.RESOURCES.css().registerScreenSection());
- fp.add(new SmallHeading(Util.C.welcomeUsernameHeading()));
-
- final Grid userInfo = new Grid(1, 2);
- final CellFormatter fmt = userInfo.getCellFormatter();
- userInfo.setStyleName(Gerrit.RESOURCES.css().infoBlock());
- userInfo.addStyleName(Gerrit.RESOURCES.css().accountInfoBlock());
- fp.add(userInfo);
-
- fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().topmost());
- fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().topmost());
- fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().bottomheader());
-
- UsernameField field = new UsernameField();
- if (LocaleInfo.getCurrentLocale().isRTL()) {
- userInfo.setText(0, 1, Util.C.userName());
- userInfo.setWidget(0, 0, field);
- fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().header());
- } else {
- userInfo.setText(0, 0, Util.C.userName());
- userInfo.setWidget(0, 1, field);
- fmt.addStyleName(0, 0, Gerrit.RESOURCES.css().header());
- }
-
- formBody.add(fp);
- }
-
- if (Gerrit.info().hasSshd()) {
- final FlowPanel sshKeyGroup = new FlowPanel();
- sshKeyGroup.setStyleName(Gerrit.RESOURCES.css().registerScreenSection());
- sshKeyGroup.add(new SmallHeading(Util.C.welcomeSshKeyHeading()));
- final HTML whySshKey = new HTML(Util.C.welcomeSshKeyText());
- whySshKey.setStyleName(Gerrit.RESOURCES.css().registerScreenExplain());
- sshKeyGroup.add(whySshKey);
- sshKeyGroup.add(
- new SshPanel() {
- {
- setKeyTableVisible(false);
- }
- });
- formBody.add(sshKeyGroup);
- }
-
- final FlowPanel choices = new FlowPanel();
- choices.setStyleName(Gerrit.RESOURCES.css().registerScreenNextLinks());
- if (Gerrit.info().auth().useContributorAgreements()) {
- final FlowPanel agreementGroup = new FlowPanel();
- agreementGroup.setStyleName(Gerrit.RESOURCES.css().registerScreenSection());
- agreementGroup.add(new SmallHeading(Util.C.welcomeAgreementHeading()));
- final HTML whyAgreement = new HTML(Util.C.welcomeAgreementText());
- whyAgreement.setStyleName(Gerrit.RESOURCES.css().registerScreenExplain());
- agreementGroup.add(whyAgreement);
-
- choices.add(new InlineHyperlink(Util.C.newAgreement(), PageLinks.SETTINGS_NEW_AGREEMENT));
- choices.add(new InlineHyperlink(Util.C.welcomeAgreementLater(), nextToken));
- formBody.add(agreementGroup);
- } else {
- choices.add(new InlineHyperlink(Util.C.welcomeContinue(), nextToken));
- }
- formBody.add(choices);
-
- final FormPanel form = new FormPanel();
- form.add(formBody);
- add(form);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SettingsScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SettingsScreen.java
deleted file mode 100644
index a948595..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SettingsScreen.java
+++ /dev/null
@@ -1,103 +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.google.gerrit.client.account;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.GerritUiExtensionPoint;
-import com.google.gerrit.client.api.ExtensionPanel;
-import com.google.gerrit.client.api.ExtensionSettingsScreen;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.MenuScreen;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.extensions.client.GitBasicAuthPolicy;
-import java.util.HashSet;
-import java.util.Set;
-
-public abstract class SettingsScreen extends MenuScreen {
- private final Set<String> allMenuNames;
- private final Set<String> ambiguousMenuNames;
-
- public SettingsScreen() {
- setRequiresSignIn(true);
-
- allMenuNames = new HashSet<>();
- ambiguousMenuNames = new HashSet<>();
-
- linkByGerrit(Util.C.tabAccountSummary(), PageLinks.SETTINGS);
- linkByGerrit(Util.C.tabPreferences(), PageLinks.SETTINGS_PREFERENCES);
- linkByGerrit(Util.C.tabDiffPreferences(), PageLinks.SETTINGS_DIFF_PREFERENCES);
- linkByGerrit(Util.C.tabEditPreferences(), PageLinks.SETTINGS_EDIT_PREFERENCES);
- linkByGerrit(Util.C.tabWatchedProjects(), PageLinks.SETTINGS_PROJECTS);
- linkByGerrit(Util.C.tabContactInformation(), PageLinks.SETTINGS_CONTACT);
- if (Gerrit.info().hasSshd()) {
- linkByGerrit(Util.C.tabSshKeys(), PageLinks.SETTINGS_SSHKEYS);
- }
- if (Gerrit.info().auth().isHttpPasswordSettingsEnabled()) {
- linkByGerrit(Util.C.tabHttpAccess(), PageLinks.SETTINGS_HTTP_PASSWORD);
- }
- if (Gerrit.info().auth().isOAuth()
- && Gerrit.info().auth().gitBasicAuthPolicy() == GitBasicAuthPolicy.OAUTH) {
- linkByGerrit(Util.C.tabOAuthToken(), PageLinks.SETTINGS_OAUTH_TOKEN);
- }
- if (Gerrit.info().gerrit().editGpgKeys()) {
- linkByGerrit(Util.C.tabGpgKeys(), PageLinks.SETTINGS_GPGKEYS);
- }
- linkByGerrit(Util.C.tabWebIdentities(), PageLinks.SETTINGS_WEBIDENT);
- linkByGerrit(Util.C.tabMyGroups(), PageLinks.SETTINGS_MYGROUPS);
- if (Gerrit.info().auth().useContributorAgreements()) {
- linkByGerrit(Util.C.tabAgreements(), PageLinks.SETTINGS_AGREEMENTS);
- }
-
- for (String pluginName : ExtensionSettingsScreen.Definition.plugins()) {
- for (ExtensionSettingsScreen.Definition def :
- Natives.asList(ExtensionSettingsScreen.Definition.get(pluginName))) {
- if (!allMenuNames.add(def.getMenu())) {
- ambiguousMenuNames.add(def.getMenu());
- }
- }
- }
-
- for (String pluginName : ExtensionSettingsScreen.Definition.plugins()) {
- for (ExtensionSettingsScreen.Definition def :
- Natives.asList(ExtensionSettingsScreen.Definition.get(pluginName))) {
- linkByPlugin(pluginName, def.getMenu(), PageLinks.toSettings(pluginName, def.getPath()));
- }
- }
- }
-
- private void linkByGerrit(String text, String target) {
- allMenuNames.add(text);
- link(text, target);
- }
-
- private void linkByPlugin(String pluginName, String text, String target) {
- if (ambiguousMenuNames.contains(text)) {
- text += " (" + pluginName + ")";
- }
- link(text, target);
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- setPageTitle(Util.C.settingsHeading());
- }
-
- protected ExtensionPanel createExtensionPoint(GerritUiExtensionPoint extensionPoint) {
- ExtensionPanel extensionPanel = new ExtensionPanel(extensionPoint);
- extensionPanel.putObject(GerritUiExtensionPoint.Key.ACCOUNT_INFO, Gerrit.getUserAccount());
- return extensionPanel;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SshHostKeyPanel.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SshHostKeyPanel.java
deleted file mode 100644
index 2dfc2ed..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SshHostKeyPanel.java
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (C) 2008 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.client.account;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.ui.SmallHeading;
-import com.google.gerrit.common.data.SshHostKey;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwtexpui.clippy.client.CopyableLabel;
-
-class SshHostKeyPanel extends Composite {
- SshHostKeyPanel(SshHostKey info) {
- final FlowPanel body = new FlowPanel();
- body.setStyleName(Gerrit.RESOURCES.css().sshHostKeyPanel());
- body.add(new SmallHeading(Util.C.sshHostKeyTitle()));
- {
- final Label fpLbl = new Label(Util.C.sshHostKeyFingerprint());
- fpLbl.setStyleName(Gerrit.RESOURCES.css().sshHostKeyPanelHeading());
- body.add(fpLbl);
- final Label fpVal = new Label(info.getFingerprint());
- fpVal.setStyleName(Gerrit.RESOURCES.css().sshHostKeyPanelFingerprintData());
- body.add(fpVal);
- }
- {
- final HTML hdr = new HTML(Util.C.sshHostKeyKnownHostEntry());
- hdr.setStyleName(Gerrit.RESOURCES.css().sshHostKeyPanelHeading());
- body.add(hdr);
-
- final CopyableLabel lbl;
- lbl = new CopyableLabel(info.getHostIdent() + " " + info.getHostKey());
- lbl.setPreviewText(SshPanel.elide(lbl.getText(), 80));
- lbl.addStyleName(Gerrit.RESOURCES.css().sshHostKeyPanelKnownHostEntry());
- body.add(lbl);
- }
- initWidget(body);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SshKeyInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SshKeyInfo.java
deleted file mode 100644
index 23b3d2d..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SshKeyInfo.java
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (C) 2013 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.client.account;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class SshKeyInfo extends JavaScriptObject {
- public final native int seq() /*-{ return this.seq || 0; }-*/;
-
- public final native String sshPublicKey() /*-{ return this.ssh_public_key; }-*/;
-
- public final native String encodedKey() /*-{ return this.encoded_key; }-*/;
-
- public final native String algorithm() /*-{ return this.algorithm; }-*/;
-
- public final native String comment() /*-{ return this.comment; }-*/;
-
- public final native boolean isValid() /*-{ return this['valid'] ? true : false; }-*/;
-
- protected SshKeyInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SshPanel.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SshPanel.java
deleted file mode 100644
index 6a8b44d..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/SshPanel.java
+++ /dev/null
@@ -1,387 +0,0 @@
-// Copyright (C) 2008 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.client.account;
-
-import com.google.gerrit.client.ErrorDialog;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.VoidResult;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.ComplexDisclosurePanel;
-import com.google.gerrit.client.ui.FancyFlexTable;
-import com.google.gerrit.client.ui.SmallHeading;
-import com.google.gerrit.common.data.SshHostKey;
-import com.google.gerrit.common.errors.InvalidSshKeyException;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-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.Composite;
-import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.HasHorizontalAlignment;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Panel;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwtexpui.clippy.client.CopyableLabel;
-import com.google.gwtexpui.globalkey.client.NpTextArea;
-import com.google.gwtjsonrpc.client.RemoteJsonException;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-
-class SshPanel extends Composite {
- private SshKeyTable keys;
-
- private Button showAddKeyBlock;
- private Panel addKeyBlock;
- private Button closeAddKeyBlock;
- private Button clearNew;
- private Button addNew;
- private NpTextArea addTxt;
- private Button deleteKey;
-
- private Panel serverKeys;
-
- private int loadCount;
-
- SshPanel() {
- final FlowPanel body = new FlowPanel();
-
- showAddKeyBlock = new Button(Util.C.buttonShowAddSshKey());
- showAddKeyBlock.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- showAddKeyBlock(true);
- }
- });
-
- keys = new SshKeyTable();
- body.add(keys);
- {
- final FlowPanel fp = new FlowPanel();
- deleteKey = new Button(Util.C.buttonDeleteSshKey());
- deleteKey.setEnabled(false);
- deleteKey.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- keys.deleteChecked();
- }
- });
- fp.add(deleteKey);
- fp.add(showAddKeyBlock);
- body.add(fp);
- }
-
- addKeyBlock = new VerticalPanel();
- addKeyBlock.setVisible(false);
- addKeyBlock.setStyleName(Gerrit.RESOURCES.css().addSshKeyPanel());
- addKeyBlock.add(new SmallHeading(Util.C.addSshKeyPanelHeader()));
-
- final ComplexDisclosurePanel addSshKeyHelp =
- new ComplexDisclosurePanel(Util.C.addSshKeyHelpTitle(), false);
- addSshKeyHelp.setContent(new HTML(Util.C.addSshKeyHelp()));
- addKeyBlock.add(addSshKeyHelp);
-
- addTxt = new NpTextArea();
- addTxt.setVisibleLines(12);
- addTxt.setCharacterWidth(80);
- addTxt.setSpellCheck(false);
- addKeyBlock.add(addTxt);
-
- final HorizontalPanel buttons = new HorizontalPanel();
- addKeyBlock.add(buttons);
-
- clearNew = new Button(Util.C.buttonClearSshKeyInput());
- clearNew.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- addTxt.setText("");
- addTxt.setFocus(true);
- }
- });
- buttons.add(clearNew);
-
- addNew = new Button(Util.C.buttonAddSshKey());
- addNew.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- doAddNew();
- }
- });
- buttons.add(addNew);
-
- closeAddKeyBlock = new Button(Util.C.buttonCloseAddSshKey());
- closeAddKeyBlock.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- showAddKeyBlock(false);
- }
- });
- buttons.add(closeAddKeyBlock);
- buttons.setCellWidth(closeAddKeyBlock, "100%");
- buttons.setCellHorizontalAlignment(closeAddKeyBlock, HasHorizontalAlignment.ALIGN_RIGHT);
-
- body.add(addKeyBlock);
-
- serverKeys = new FlowPanel();
- body.add(serverKeys);
-
- initWidget(body);
- }
-
- void setKeyTableVisible(boolean on) {
- keys.setVisible(on);
- deleteKey.setVisible(on);
- closeAddKeyBlock.setVisible(on);
- }
-
- void doAddNew() {
- final String txt = addTxt.getText();
- if (txt != null && txt.length() > 0) {
- addNew.setEnabled(false);
- AccountApi.addSshKey(
- "self",
- txt,
- new GerritCallback<SshKeyInfo>() {
- @Override
- public void onSuccess(SshKeyInfo k) {
- addNew.setEnabled(true);
- addTxt.setText("");
- keys.addOneKey(k);
- if (!keys.isVisible()) {
- showAddKeyBlock(false);
- setKeyTableVisible(true);
- keys.updateDeleteButton();
- }
- }
-
- @Override
- public void onFailure(Throwable caught) {
- addNew.setEnabled(true);
-
- if (isInvalidSshKey(caught)) {
- new ErrorDialog(Util.C.invalidSshKeyError()).center();
-
- } else {
- super.onFailure(caught);
- }
- }
-
- private boolean isInvalidSshKey(Throwable caught) {
- if (caught instanceof InvalidSshKeyException) {
- return true;
- }
- return caught instanceof RemoteJsonException
- && InvalidSshKeyException.MESSAGE.equals(caught.getMessage());
- }
- });
- }
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- refreshSshKeys();
- Gerrit.SYSTEM_SVC.daemonHostKeys(
- new GerritCallback<List<SshHostKey>>() {
- @Override
- public void onSuccess(List<SshHostKey> result) {
- serverKeys.clear();
- for (SshHostKey keyInfo : result) {
- serverKeys.add(new SshHostKeyPanel(keyInfo));
- }
- if (++loadCount == 2) {
- display();
- }
- }
- });
- }
-
- private void refreshSshKeys() {
- AccountApi.getSshKeys(
- "self",
- new GerritCallback<JsArray<SshKeyInfo>>() {
- @Override
- public void onSuccess(JsArray<SshKeyInfo> result) {
- keys.display(Natives.asList(result));
- if (result.length() == 0 && keys.isVisible()) {
- showAddKeyBlock(true);
- }
- if (++loadCount == 2) {
- display();
- }
- }
- });
- }
-
- void display() {}
-
- private void showAddKeyBlock(boolean show) {
- showAddKeyBlock.setVisible(!show);
- addKeyBlock.setVisible(show);
- }
-
- private class SshKeyTable extends FancyFlexTable<SshKeyInfo> {
- private ValueChangeHandler<Boolean> updateDeleteHandler;
-
- SshKeyTable() {
- table.setWidth("");
- table.setText(0, 2, Util.C.sshKeyStatus());
- table.setText(0, 3, Util.C.sshKeyAlgorithm());
- table.setText(0, 4, Util.C.sshKeyKey());
- table.setText(0, 5, Util.C.sshKeyComment());
-
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().iconHeader());
- fmt.addStyleName(0, 2, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 3, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 4, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 5, Gerrit.RESOURCES.css().dataHeader());
-
- updateDeleteHandler =
- new ValueChangeHandler<Boolean>() {
- @Override
- public void onValueChange(ValueChangeEvent<Boolean> event) {
- updateDeleteButton();
- }
- };
- }
-
- void deleteChecked() {
- final HashSet<Integer> sequenceNumbers = new HashSet<>();
- for (int row = 1; row < table.getRowCount(); row++) {
- final SshKeyInfo k = getRowItem(row);
- if (k != null && ((CheckBox) table.getWidget(row, 1)).getValue()) {
- sequenceNumbers.add(k.seq());
- }
- }
- if (sequenceNumbers.isEmpty()) {
- updateDeleteButton();
- } else {
- deleteKey.setEnabled(false);
- AccountApi.deleteSshKeys(
- "self",
- sequenceNumbers,
- new GerritCallback<VoidResult>() {
- @Override
- public void onSuccess(VoidResult result) {
- for (int row = 1; row < table.getRowCount(); ) {
- final SshKeyInfo k = getRowItem(row);
- if (k != null && sequenceNumbers.contains(k.seq())) {
- table.removeRow(row);
- } else {
- row++;
- }
- }
- if (table.getRowCount() == 1) {
- display(Collections.<SshKeyInfo>emptyList());
- } else {
- updateDeleteButton();
- }
- }
-
- @Override
- public void onFailure(Throwable caught) {
- refreshSshKeys();
- updateDeleteButton();
- super.onFailure(caught);
- }
- });
- }
- }
-
- void display(List<SshKeyInfo> result) {
- if (result.isEmpty()) {
- setKeyTableVisible(false);
- showAddKeyBlock(true);
- } else {
- while (1 < table.getRowCount()) {
- table.removeRow(table.getRowCount() - 1);
- }
- for (SshKeyInfo k : result) {
- addOneKey(k);
- }
- setKeyTableVisible(true);
- deleteKey.setEnabled(false);
- }
- }
-
- void addOneKey(SshKeyInfo k) {
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- final int row = table.getRowCount();
- table.insertRow(row);
- applyDataRowStyle(row);
-
- final CheckBox sel = new CheckBox();
- sel.addValueChangeHandler(updateDeleteHandler);
-
- table.setWidget(row, 1, sel);
- if (k.isValid()) {
- table.setText(row, 2, "");
- fmt.removeStyleName(
- row,
- 2, //
- Gerrit.RESOURCES.css().sshKeyPanelInvalid());
- } else {
- table.setText(row, 2, Util.C.sshKeyInvalid());
- fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().sshKeyPanelInvalid());
- }
- table.setText(row, 3, k.algorithm());
-
- CopyableLabel keyLabel = new CopyableLabel(k.sshPublicKey());
- keyLabel.setPreviewText(elide(k.encodedKey(), 40));
- table.setWidget(row, 4, keyLabel);
-
- table.setText(row, 5, k.comment());
-
- fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().iconCell());
- fmt.addStyleName(row, 4, Gerrit.RESOURCES.css().sshKeyPanelEncodedKey());
- for (int c = 2; c <= 5; c++) {
- fmt.addStyleName(row, c, Gerrit.RESOURCES.css().dataCell());
- }
-
- setRowItem(row, k);
- }
-
- void updateDeleteButton() {
- boolean on = false;
- for (int row = 1; row < table.getRowCount(); row++) {
- CheckBox sel = (CheckBox) table.getWidget(row, 1);
- if (sel.getValue()) {
- on = true;
- break;
- }
- }
- deleteKey.setEnabled(on);
- }
- }
-
- static String elide(String s, int len) {
- if (s == null || s.length() < len || len <= 10) {
- return s;
- }
- return s.substring(0, len - 10) + "..." + s.substring(s.length() - 10);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/UsernameField.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/UsernameField.java
deleted file mode 100644
index 4fdd067..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/UsernameField.java
+++ /dev/null
@@ -1,204 +0,0 @@
-// Copyright (C) 2008 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.client.account;
-
-import com.google.gerrit.client.ConfirmationCallback;
-import com.google.gerrit.client.ConfirmationDialog;
-import com.google.gerrit.client.ErrorDialog;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.client.ui.OnEditEnabler;
-import com.google.gerrit.extensions.client.AccountFieldName;
-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.user.client.ui.Button;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.TextBox;
-import com.google.gwtexpui.clippy.client.CopyableLabel;
-import com.google.gwtexpui.globalkey.client.NpTextBox;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-
-class UsernameField extends Composite {
- // If these regular expressions are modified the same modifications should be done to the
- // corresponding regular expressions in the
- // com.google.gerrit.server.account.externalids.ExternalId class.
- private static final String USER_NAME_PATTERN_FIRST_REGEX = "[a-zA-Z0-9]";
- private static final String USER_NAME_PATTERN_REST_REGEX = "[a-zA-Z0-9.!#$%&’*+=?^_`\\{|\\}~@-]";
-
- private CopyableLabel userNameLbl;
- private NpTextBox userNameTxt;
- private Button setUserName;
-
- UsernameField() {
- String user = Gerrit.getUserAccount().username();
- userNameLbl = new CopyableLabel(user != null ? user : "");
- userNameLbl.setStyleName(Gerrit.RESOURCES.css().accountUsername());
-
- if (user != null || !canEditUserName()) {
- initWidget(userNameLbl);
-
- } else {
- final FlowPanel body = new FlowPanel();
- initWidget(body);
- setStyleName(Gerrit.RESOURCES.css().usernameField());
-
- userNameTxt = new NpTextBox();
- userNameTxt.addKeyPressHandler(new UserNameValidator());
- userNameTxt.addStyleName(Gerrit.RESOURCES.css().accountUsername());
- userNameTxt.setVisibleLength(16);
- userNameTxt.addKeyPressHandler(
- new KeyPressHandler() {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
- confirmSetUserName();
- }
- }
- });
-
- setUserName = new Button(Util.C.buttonSetUserName());
- setUserName.setVisible(canEditUserName());
- setUserName.setEnabled(false);
- setUserName.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- confirmSetUserName();
- }
- });
- new OnEditEnabler(setUserName, userNameTxt);
-
- userNameLbl.setVisible(false);
- body.add(userNameLbl);
- body.add(userNameTxt);
- body.add(setUserName);
- }
- }
-
- private boolean canEditUserName() {
- return Gerrit.info().auth().canEdit(AccountFieldName.USER_NAME);
- }
-
- private void confirmSetUserName() {
- new ConfirmationDialog(
- Util.C.confirmSetUserNameTitle(),
- new SafeHtmlBuilder().append(Util.C.confirmSetUserName()),
- new ConfirmationCallback() {
- @Override
- public void onOk() {
- doSetUserName();
- }
- })
- .center();
- }
-
- private void doSetUserName() {
- if (!canEditUserName()) {
- return;
- }
-
- enableUI(false);
-
- String newName = userNameTxt.getText();
- if ("".equals(newName)) {
- newName = null;
- }
- final String newUserName = newName;
-
- AccountApi.setUsername(
- "self",
- newUserName,
- new GerritCallback<NativeString>() {
- @Override
- public void onSuccess(NativeString result) {
- Gerrit.getUserAccount().username(newUserName);
- userNameLbl.setText(newUserName);
- userNameLbl.setVisible(true);
- userNameTxt.setVisible(false);
- setUserName.setVisible(false);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- enableUI(true);
- if (RestApi.isExpected(422 /* Unprocessable Entity */)) {
- new ErrorDialog(Util.C.invalidUserName()).center();
- } else {
- super.onFailure(caught);
- }
- }
- });
- }
-
- private void enableUI(boolean on) {
- userNameTxt.setEnabled(on);
- setUserName.setEnabled(on);
- }
-
- private static final class UserNameValidator implements KeyPressHandler {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- final char code = event.getCharCode();
- final int nativeCode = event.getNativeEvent().getKeyCode();
- switch (nativeCode) {
- case KeyCodes.KEY_ALT:
- case KeyCodes.KEY_BACKSPACE:
- case KeyCodes.KEY_CTRL:
- case KeyCodes.KEY_DELETE:
- case KeyCodes.KEY_DOWN:
- case KeyCodes.KEY_END:
- case KeyCodes.KEY_ENTER:
- case KeyCodes.KEY_ESCAPE:
- case KeyCodes.KEY_HOME:
- case KeyCodes.KEY_LEFT:
- case KeyCodes.KEY_PAGEDOWN:
- case KeyCodes.KEY_PAGEUP:
- case KeyCodes.KEY_RIGHT:
- case KeyCodes.KEY_SHIFT:
- case KeyCodes.KEY_TAB:
- case KeyCodes.KEY_UP:
- // Allow these, even if one of their assigned codes is
- // identical to an ASCII character we do not want to
- // allow in the box.
- //
- // We still want to let the user move around the input box
- // with their arrow keys, or to move between fields using tab.
- // Invalid characters introduced will be caught through the
- // server's own validation of the input data.
- //
- break;
-
- default:
- final TextBox box = (TextBox) event.getSource();
- final String re;
- if (box.getCursorPos() == 0) {
- re = USER_NAME_PATTERN_FIRST_REGEX;
- } else {
- re = USER_NAME_PATTERN_REST_REGEX;
- }
- if (!String.valueOf(code).matches("^" + re + "$")) {
- event.preventDefault();
- event.stopPropagation();
- }
- }
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/Util.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/Util.java
deleted file mode 100644
index 1c4870c..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/Util.java
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (C) 2008 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.client.account;
-
-import com.google.gerrit.common.data.ProjectAdminService;
-import com.google.gwt.core.client.GWT;
-import com.google.gwtjsonrpc.client.JsonUtil;
-
-public class Util {
- public static final AccountConstants C = GWT.create(AccountConstants.class);
- public static final AccountMessages M = GWT.create(AccountMessages.class);
- public static final ProjectAdminService PROJECT_SVC;
-
- static {
- PROJECT_SVC = GWT.create(ProjectAdminService.class);
- JsonUtil.bind(PROJECT_SVC, "rpc/ProjectAdminService");
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/ValidateEmailScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/ValidateEmailScreen.java
deleted file mode 100644
index b66f108..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/account/ValidateEmailScreen.java
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (C) 2009 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.client.account;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.VoidResult;
-import com.google.gerrit.client.config.ConfigServerApi;
-import com.google.gerrit.client.rpc.ScreenLoadCallback;
-import com.google.gerrit.client.ui.AccountScreen;
-import com.google.gerrit.common.PageLinks;
-
-public class ValidateEmailScreen extends AccountScreen {
- private final String magicToken;
-
- public ValidateEmailScreen(String magicToken) {
- this.magicToken = magicToken;
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- setPageTitle(Util.C.settingsHeading());
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- ConfigServerApi.confirmEmail(
- magicToken,
- new ScreenLoadCallback<VoidResult>(this) {
- @Override
- protected void preDisplay(VoidResult result) {}
-
- @Override
- protected void postDisplay() {
- Gerrit.display(PageLinks.SETTINGS_CONTACT);
- }
- });
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/actions/ActionButton.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/actions/ActionButton.java
deleted file mode 100644
index 85937db..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/actions/ActionButton.java
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright (C) 2013 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.client.actions;
-
-import com.google.gerrit.client.api.ActionContext;
-import com.google.gerrit.client.api.ChangeGlue;
-import com.google.gerrit.client.api.EditGlue;
-import com.google.gerrit.client.api.ProjectGlue;
-import com.google.gerrit.client.api.RevisionGlue;
-import com.google.gerrit.client.info.ActionInfo;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.EditInfo;
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.client.projects.BranchInfo;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-
-public class ActionButton extends Button implements ClickHandler {
- private final Project.NameKey project;
- private final BranchInfo branch;
- private final ChangeInfo change;
- private final EditInfo edit;
- private final RevisionInfo revision;
- private final ActionInfo action;
- private ActionContext ctx;
-
- public ActionButton(Project.NameKey project, ActionInfo action) {
- this(project, null, null, null, null, action);
- }
-
- public ActionButton(Project.NameKey project, BranchInfo branch, ActionInfo action) {
- this(project, branch, null, null, null, action);
- }
-
- public ActionButton(ChangeInfo change, ActionInfo action) {
- this(null, null, change, null, null, action);
- }
-
- public ActionButton(ChangeInfo change, RevisionInfo revision, ActionInfo action) {
- this(null, null, change, null, revision, action);
- }
-
- private ActionButton(
- Project.NameKey project,
- BranchInfo branch,
- ChangeInfo change,
- EditInfo edit,
- RevisionInfo revision,
- ActionInfo action) {
- super(new SafeHtmlBuilder().openDiv().append(action.label()).closeDiv());
- setStyleName("");
- setTitle(action.title());
- setEnabled(action.enabled());
- addClickHandler(this);
-
- this.project = project;
- this.branch = branch;
- this.change = change;
- this.edit = edit;
- this.revision = revision;
- this.action = action;
- }
-
- @Override
- public void onClick(ClickEvent event) {
- if (ctx != null && ctx.has_popup()) {
- ctx.hide();
- ctx = null;
- return;
- }
-
- if (revision != null) {
- RevisionGlue.onAction(change, revision, action, this);
- } else if (edit != null) {
- EditGlue.onAction(change, edit, action, this);
- } else if (change != null) {
- ChangeGlue.onAction(change, action, this);
- } else if (branch != null) {
- ProjectGlue.onAction(project, branch, action, this);
- } else if (project != null) {
- ProjectGlue.onAction(project, action, this);
- }
- }
-
- @Override
- public void onUnload() {
- if (ctx != null) {
- if (ctx.has_popup()) {
- ctx.hide();
- }
- ctx = null;
- }
- super.onUnload();
- }
-
- public void link(ActionContext ctx) {
- this.ctx = ctx;
- }
-
- public void unlink() {
- ctx = null;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccessSectionEditor.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccessSectionEditor.java
deleted file mode 100644
index 7bd8b82..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccessSectionEditor.java
+++ /dev/null
@@ -1,295 +0,0 @@
-// Copyright (C) 2011 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.client.admin;
-
-import static java.util.stream.Collectors.toCollection;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.common.data.AccessSection;
-import com.google.gerrit.common.data.LabelType;
-import com.google.gerrit.common.data.Permission;
-import com.google.gerrit.common.data.ProjectAccess;
-import com.google.gerrit.common.data.RefConfigSection;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.core.client.Scheduler.ScheduledCommand;
-import com.google.gwt.dom.client.DivElement;
-import com.google.gwt.dom.client.SpanElement;
-import com.google.gwt.dom.client.Style.Display;
-import com.google.gwt.editor.client.Editor;
-import com.google.gwt.editor.client.EditorDelegate;
-import com.google.gwt.editor.client.ValueAwareEditor;
-import com.google.gwt.editor.client.adapters.EditorSource;
-import com.google.gwt.editor.client.adapters.ListEditor;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.MouseOutEvent;
-import com.google.gwt.event.dom.client.MouseOverEvent;
-import com.google.gwt.event.logical.shared.ValueChangeEvent;
-import com.google.gwt.event.logical.shared.ValueChangeHandler;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.ValueListBox;
-import java.util.ArrayList;
-import java.util.List;
-
-public class AccessSectionEditor extends Composite
- implements Editor<AccessSection>, ValueAwareEditor<AccessSection> {
- interface Binder extends UiBinder<HTMLPanel, AccessSectionEditor> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- @UiField ValueEditor<String> name;
-
- @UiField FlowPanel permissionContainer;
- ListEditor<Permission, PermissionEditor> permissions;
-
- @UiField DivElement addContainer;
-
- @UiField(provided = true)
- @Editor.Ignore
- ValueListBox<String> permissionSelector;
-
- @UiField SpanElement deletedName;
-
- @UiField Anchor deleteSection;
-
- @UiField DivElement normal;
- @UiField DivElement deleted;
-
- @UiField SpanElement sectionType;
- @UiField SpanElement sectionName;
-
- private final ProjectAccess projectAccess;
- private AccessSection value;
- private boolean editing;
- private boolean readOnly;
- private boolean isDeleted;
-
- public AccessSectionEditor(ProjectAccess access) {
- projectAccess = access;
- permissionSelector = new ValueListBox<>(new PermissionNameRenderer(access.getCapabilities()));
- permissionSelector.addValueChangeHandler(
- new ValueChangeHandler<String>() {
- @Override
- public void onValueChange(ValueChangeEvent<String> event) {
- if (!AdminConstants.I.addPermission().equals(event.getValue())) {
- onAddPermission(event.getValue());
- }
- }
- });
-
- initWidget(uiBinder.createAndBindUi(this));
- permissions = ListEditor.of(new PermissionEditorSource());
- }
-
- @UiHandler("deleteSection")
- void onDeleteHover(@SuppressWarnings("unused") MouseOverEvent event) {
- normal.addClassName(AdminResources.I.css().deleteSectionHover());
- }
-
- @UiHandler("deleteSection")
- void onDeleteNonHover(@SuppressWarnings("unused") MouseOutEvent event) {
- normal.removeClassName(AdminResources.I.css().deleteSectionHover());
- }
-
- @UiHandler("deleteSection")
- void onDeleteSection(@SuppressWarnings("unused") ClickEvent event) {
- isDeleted = true;
-
- if (name.isVisible() && RefConfigSection.isValid(name.getValue())) {
- deletedName.setInnerText(AdminMessages.I.deletedReference(name.getValue()));
- } else {
- String name = AdminConstants.I.sectionNames().get(value.getName());
- if (name == null) {
- name = value.getName();
- }
- deletedName.setInnerText(AdminMessages.I.deletedSection(name));
- }
-
- normal.getStyle().setDisplay(Display.NONE);
- deleted.getStyle().setDisplay(Display.BLOCK);
- }
-
- @UiHandler("undoDelete")
- void onUndoDelete(@SuppressWarnings("unused") ClickEvent event) {
- isDeleted = false;
- deleted.getStyle().setDisplay(Display.NONE);
- normal.getStyle().setDisplay(Display.BLOCK);
- }
-
- void onAddPermission(String varName) {
- int idx = permissions.getList().size();
-
- Permission p = value.getPermission(varName, true);
- permissions.getList().add(p);
-
- PermissionEditor e = permissions.getEditors().get(idx);
- e.beginAddRule();
-
- rebuildPermissionSelector();
- }
-
- void editRefPattern() {
- name.edit();
- Scheduler.get()
- .scheduleDeferred(
- new ScheduledCommand() {
- @Override
- public void execute() {
- name.setFocus(true);
- }
- });
- }
-
- void enableEditing() {
- readOnly = false;
- addContainer.getStyle().setDisplay(Display.BLOCK);
- rebuildPermissionSelector();
- }
-
- boolean isDeleted() {
- return isDeleted;
- }
-
- @Override
- public void setValue(AccessSection value) {
- sortPermissions(value);
-
- this.value = value;
- this.readOnly = !editing || !(projectAccess.isOwnerOf(value) || projectAccess.canUpload());
-
- name.setEnabled(!readOnly);
- deleteSection.setVisible(!readOnly);
-
- if (RefConfigSection.isValid(value.getName())) {
- name.setVisible(true);
- name.setIgnoreEditorValue(false);
- sectionType.setInnerText(AdminConstants.I.sectionTypeReference());
-
- } else {
- name.setVisible(false);
- name.setIgnoreEditorValue(true);
-
- String name = AdminConstants.I.sectionNames().get(value.getName());
- if (name != null) {
- sectionType.setInnerText(name);
- sectionName.getStyle().setDisplay(Display.NONE);
- } else {
- sectionType.setInnerText(AdminConstants.I.sectionTypeSection());
- sectionName.setInnerText(value.getName());
- sectionName.getStyle().clearDisplay();
- }
- }
-
- if (readOnly) {
- addContainer.getStyle().setDisplay(Display.NONE);
- } else {
- enableEditing();
- }
- }
-
- private void sortPermissions(AccessSection accessSection) {
- accessSection.setPermissions(
- accessSection.getPermissions().stream().sorted().collect(toCollection(ArrayList::new)));
- }
-
- void setEditing(boolean editing) {
- this.editing = editing;
- }
-
- private void rebuildPermissionSelector() {
- List<String> perms = new ArrayList<>();
-
- if (AccessSection.GLOBAL_CAPABILITIES.equals(value.getName())) {
- for (String varName : projectAccess.getCapabilities().keySet()) {
- addPermission(varName, perms);
- }
- } else if (RefConfigSection.isValid(value.getName())) {
- for (LabelType t : projectAccess.getLabelTypes().getLabelTypes()) {
- addPermission(Permission.forLabel(t.getName()), perms);
- }
- for (LabelType t : projectAccess.getLabelTypes().getLabelTypes()) {
- addPermission(Permission.forLabelAs(t.getName()), perms);
- }
- for (String varName : AdminConstants.I.permissionNames().keySet()) {
- addPermission(varName, perms);
- }
- }
- if (perms.isEmpty()) {
- addContainer.getStyle().setDisplay(Display.NONE);
- } else {
- addContainer.getStyle().setDisplay(Display.BLOCK);
- perms.add(0, AdminConstants.I.addPermission());
- permissionSelector.setValue(AdminConstants.I.addPermission());
- permissionSelector.setAcceptableValues(perms);
- }
- }
-
- private void addPermission(String permissionName, List<String> permissionList) {
- if (value.getPermission(permissionName) != null) {
- return;
- }
- if (Gerrit.info().gerrit().isAllProjects(projectAccess.getProjectName())
- && !Permission.canBeOnAllProjects(value.getName(), permissionName)) {
- return;
- }
- permissionList.add(permissionName);
- }
-
- @Override
- public void flush() {
- List<Permission> src = permissions.getList();
- List<Permission> keep = new ArrayList<>(src.size());
-
- for (int i = 0; i < src.size(); i++) {
- PermissionEditor e = (PermissionEditor) permissionContainer.getWidget(i);
- if (!e.isDeleted()) {
- keep.add(src.get(i));
- }
- }
- value.setPermissions(keep);
- }
-
- @Override
- public void onPropertyChange(String... paths) {}
-
- @Override
- public void setDelegate(EditorDelegate<AccessSection> delegate) {}
-
- private class PermissionEditorSource extends EditorSource<PermissionEditor> {
- @Override
- public PermissionEditor create(int index) {
- PermissionEditor subEditor =
- new PermissionEditor(projectAccess, readOnly, value, projectAccess.getLabelTypes());
- permissionContainer.insert(subEditor, index);
- return subEditor;
- }
-
- @Override
- public void dispose(PermissionEditor subEditor) {
- subEditor.removeFromParent();
- }
-
- @Override
- public void setIndex(PermissionEditor subEditor, int index) {
- permissionContainer.insert(subEditor, index);
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccessSectionEditor.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccessSectionEditor.ui.xml
deleted file mode 100644
index 3710265..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccessSectionEditor.ui.xml
+++ /dev/null
@@ -1,157 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2011 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:e='urn:import:com.google.gwt.editor.ui.client'
- xmlns:my='urn:import:com.google.gerrit.client.admin'
- ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat'
- ui:generateKeys='com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator'
- ui:generateLocales='default,en'
- >
-<ui:with field='res' type='com.google.gerrit.client.admin.AdminResources'/>
-<ui:style gss='false'>
- @eval selectionColor com.google.gerrit.client.Gerrit.getTheme().selectionColor;
- @eval trimColor com.google.gerrit.client.Gerrit.getTheme().trimColor;
-
- .panel {
- width: 50em;
- position: relative;
- }
-
- .content {
- margin-top: 4px;
- margin-bottom: 4px;
- padding-bottom: 2px;
- }
-
- .normal {
- background-color: trimColor;
- }
-
- .deleted {
- padding-left: 7px;
- padding-bottom: 2px;
- }
-
- .header {
- padding-left: 5px;
- padding-right: 5px;
- }
- .headerText {
- vertical-align: top;
- white-space: nowrap;
- font-weight: bold;
- }
- .headerTable {
- border: 0;
- width: 100%;
- padding-right: 40px;
- }
-
- .header:hover {
- background-color: selectionColor;
- }
-
- .name {
- width: 100%;
- }
- .nameEdit {
- width: 100%;
- }
-
- .permissionList {
- margin-left: 5px;
- margin-right: 5px;
- margin-bottom: 5px;
- }
-
- .addContainer {
- padding-left: 16px;
- padding-right: 16px;
- font-size: 80%;
- }
- .addContainer:hover {
- background-color: selectionColor;
- }
-
- .deleteIcon {
- position: absolute;
- top: 5px;
- right: 17px;
- }
-
- .undoIcon {
- position: absolute;
- top: 2px;
- right: 17px;
- }
-</ui:style>
-
-<g:HTMLPanel styleName='{style.panel}'>
-<div ui:field='normal' class='{style.normal} {style.content}'>
- <div class='{style.header}'>
- <table class='{style.headerTable}'><tr>
- <td class='{style.headerText}'>
- <span ui:field='sectionType'/>
- </td>
- <td width='100%'>
- <my:ValueEditor
- ui:field='name'
- addStyleNames='{style.name}'
- editTitle='Edit reference pattern'>
- <ui:attribute name='editTitle'/>
- <my:editor>
- <my:RefPatternBox styleName='{style.nameEdit}'/>
- </my:editor>
- </my:ValueEditor>
- <span ui:field='sectionName' class='{style.name}'/>
- </td>
- </tr></table>
-
- <g:Anchor
- ui:field='deleteSection'
- href='javascript:void'
- styleName='{style.deleteIcon} {res.css.deleteIcon}'
- title='Delete this section (and nested rules)'>
- <ui:attribute name='title'/>
- </g:Anchor>
- </div>
-
- <g:FlowPanel
- ui:field='permissionContainer'
- styleName='{style.permissionList}'/>
- <div ui:field='addContainer' class='{style.addContainer}'>
- <g:ValueListBox ui:field='permissionSelector'/>
- </div>
-</div>
-
-<div
- ui:field='deleted'
- class='{style.deleted} {res.css.deleted}'
- style='display: none'>
- <span ui:field='deletedName'/>
- <g:Anchor
- ui:field='undoDelete'
- href='javascript:void'
- styleName='{style.undoIcon} {res.css.undoIcon}'
- title='Undo deletion'>
- <ui:attribute name='title'/>
- </g:Anchor>
-</div>
-</g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupAuditLogScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupAuditLogScreen.java
deleted file mode 100644
index 5e38a14..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupAuditLogScreen.java
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright (C) 2015 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.client.admin;
-
-import static com.google.gerrit.client.FormatUtil.mediumFormat;
-import static com.google.gerrit.client.FormatUtil.name;
-
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.groups.GroupApi;
-import com.google.gerrit.client.groups.GroupAuditEventInfo;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.info.GroupInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.FancyFlexTable;
-import com.google.gerrit.client.ui.Hyperlink;
-import com.google.gerrit.client.ui.SmallHeading;
-import com.google.gerrit.reviewdb.client.AccountGroup;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
-import java.util.List;
-
-public class AccountGroupAuditLogScreen extends AccountGroupScreen {
- private AuditEventTable auditEventTable;
-
- public AccountGroupAuditLogScreen(GroupInfo toShow, String token) {
- super(toShow, token);
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- add(new SmallHeading(AdminConstants.I.headingAuditLog()));
- auditEventTable = new AuditEventTable();
- add(auditEventTable);
- }
-
- @Override
- protected void display(GroupInfo group, boolean canModify) {
- GroupApi.getAuditLog(
- group.getGroupUUID(),
- new GerritCallback<JsArray<GroupAuditEventInfo>>() {
- @Override
- public void onSuccess(JsArray<GroupAuditEventInfo> result) {
- auditEventTable.display(Natives.asList(result));
- }
- });
- }
-
- private static class AuditEventTable extends FancyFlexTable<GroupAuditEventInfo> {
- AuditEventTable() {
- table.setText(0, 1, AdminConstants.I.columnDate());
- table.setText(0, 2, AdminConstants.I.columnType());
- table.setText(0, 3, AdminConstants.I.columnMember());
- table.setText(0, 4, AdminConstants.I.columnByUser());
-
- FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 2, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 3, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 4, Gerrit.RESOURCES.css().dataHeader());
- }
-
- void display(List<GroupAuditEventInfo> auditEvents) {
- while (1 < table.getRowCount()) {
- table.removeRow(table.getRowCount() - 1);
- }
-
- for (GroupAuditEventInfo auditEvent : auditEvents) {
- int row = table.getRowCount();
- table.insertRow(row);
- applyDataRowStyle(row);
- populate(row, auditEvent);
- }
- }
-
- void populate(int row, GroupAuditEventInfo auditEvent) {
- FlexCellFormatter fmt = table.getFlexCellFormatter();
- table.setText(row, 1, mediumFormat(auditEvent.date()));
-
- switch (auditEvent.type()) {
- case ADD_USER:
- case ADD_GROUP:
- table.setText(row, 2, AdminConstants.I.typeAdded());
- break;
- case REMOVE_USER:
- case REMOVE_GROUP:
- table.setText(row, 2, AdminConstants.I.typeRemoved());
- break;
- }
-
- switch (auditEvent.type()) {
- case ADD_USER:
- case REMOVE_USER:
- table.setText(row, 3, formatAccount(auditEvent.memberAsUser()));
- break;
- case ADD_GROUP:
- case REMOVE_GROUP:
- GroupInfo member = auditEvent.memberAsGroup();
- if (AccountGroup.isInternalGroup(member.getGroupUUID())) {
- table.setWidget(
- row,
- 3,
- new Hyperlink(formatGroup(member), Dispatcher.toGroup(member.getGroupUUID())));
- fmt.getElement(row, 3).setTitle(null);
- } else if (member.url() != null) {
- Anchor a = new Anchor();
- a.setText(formatGroup(member));
- a.setHref(member.url());
- a.setTitle("UUID " + member.getGroupUUID().get());
- table.setWidget(row, 3, a);
- fmt.getElement(row, 3).setTitle(null);
- } else {
- table.setText(row, 3, formatGroup(member));
- fmt.getElement(row, 3).setTitle("UUID " + member.getGroupUUID().get());
- }
- break;
- }
-
- table.setText(row, 4, formatAccount(auditEvent.user()));
-
- fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 4, Gerrit.RESOURCES.css().dataCell());
-
- setRowItem(row, auditEvent);
- }
- }
-
- private static String formatAccount(AccountInfo account) {
- StringBuilder b = new StringBuilder();
- b.append(name(account));
- b.append(" (");
- b.append(account._accountId());
- b.append(")");
- return b.toString();
- }
-
- private static String formatGroup(GroupInfo group) {
- return group.name() != null && !group.name().isEmpty()
- ? group.name()
- : group.getGroupUUID().get();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupInfoScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupInfoScreen.java
deleted file mode 100644
index 34a1ac9..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupInfoScreen.java
+++ /dev/null
@@ -1,243 +0,0 @@
-// Copyright (C) 2008 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.client.admin;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.VoidResult;
-import com.google.gerrit.client.groups.GroupApi;
-import com.google.gerrit.client.info.GroupInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.ui.AccountGroupSuggestOracle;
-import com.google.gerrit.client.ui.OnEditEnabler;
-import com.google.gerrit.client.ui.RemoteSuggestBox;
-import com.google.gerrit.client.ui.SmallHeading;
-import com.google.gerrit.reviewdb.client.AccountGroup;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwtexpui.clippy.client.CopyableLabel;
-import com.google.gwtexpui.globalkey.client.NpTextArea;
-import com.google.gwtexpui.globalkey.client.NpTextBox;
-
-public class AccountGroupInfoScreen extends AccountGroupScreen {
- private CopyableLabel groupUUIDLabel;
-
- private NpTextBox groupNameTxt;
- private Button saveName;
-
- private RemoteSuggestBox ownerTxt;
- private Button saveOwner;
-
- private NpTextArea descTxt;
- private Button saveDesc;
-
- private CheckBox visibleToAllCheckBox;
- private Button saveGroupOptions;
-
- public AccountGroupInfoScreen(GroupInfo toShow, String token) {
- super(toShow, token);
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- initUUID();
- initName();
- initOwner();
- initDescription();
- initGroupOptions();
- }
-
- private void enableForm(boolean canModify) {
- groupNameTxt.setEnabled(canModify);
- ownerTxt.setEnabled(canModify);
- descTxt.setEnabled(canModify);
- visibleToAllCheckBox.setEnabled(canModify);
- }
-
- private void initUUID() {
- final VerticalPanel groupUUIDPanel = new VerticalPanel();
- groupUUIDPanel.setStyleName(Gerrit.RESOURCES.css().groupUUIDPanel());
- groupUUIDPanel.add(new SmallHeading(AdminConstants.I.headingGroupUUID()));
- groupUUIDLabel = new CopyableLabel("");
- groupUUIDPanel.add(groupUUIDLabel);
- add(groupUUIDPanel);
- }
-
- private void initName() {
- final VerticalPanel groupNamePanel = new VerticalPanel();
- groupNamePanel.setStyleName(Gerrit.RESOURCES.css().groupNamePanel());
- groupNameTxt = new NpTextBox();
- groupNameTxt.setStyleName(Gerrit.RESOURCES.css().groupNameTextBox());
- groupNameTxt.setVisibleLength(60);
- groupNamePanel.add(groupNameTxt);
-
- saveName = new Button(AdminConstants.I.buttonRenameGroup());
- saveName.setEnabled(false);
- saveName.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- final String newName = groupNameTxt.getText().trim();
- GroupApi.renameGroup(
- getGroupUUID(),
- newName,
- new GerritCallback<com.google.gerrit.client.VoidResult>() {
- @Override
- public void onSuccess(com.google.gerrit.client.VoidResult result) {
- saveName.setEnabled(false);
- setPageTitle(AdminMessages.I.group(newName));
- groupNameTxt.setText(newName);
- if (getGroupUUID().equals(getOwnerGroupUUID())) {
- ownerTxt.setText(newName);
- }
- }
- });
- }
- });
- groupNamePanel.add(saveName);
- add(groupNamePanel);
- }
-
- private void initOwner() {
- final VerticalPanel ownerPanel = new VerticalPanel();
- ownerPanel.setStyleName(Gerrit.RESOURCES.css().groupOwnerPanel());
- ownerPanel.add(new SmallHeading(AdminConstants.I.headingOwner()));
-
- final AccountGroupSuggestOracle accountGroupOracle = new AccountGroupSuggestOracle();
- ownerTxt = new RemoteSuggestBox(accountGroupOracle);
- ownerTxt.setStyleName(Gerrit.RESOURCES.css().groupOwnerTextBox());
- ownerTxt.setVisibleLength(60);
- ownerPanel.add(ownerTxt);
-
- saveOwner = new Button(AdminConstants.I.buttonChangeGroupOwner());
- saveOwner.setEnabled(false);
- saveOwner.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- final String newOwner = ownerTxt.getText().trim();
- if (newOwner.length() > 0) {
- AccountGroup.UUID ownerUuid = accountGroupOracle.getUUID(newOwner);
- String ownerId = ownerUuid != null ? ownerUuid.get() : newOwner;
- GroupApi.setGroupOwner(
- getGroupUUID(),
- ownerId,
- new GerritCallback<GroupInfo>() {
- @Override
- public void onSuccess(GroupInfo result) {
- updateOwnerGroup(result);
- saveOwner.setEnabled(false);
- }
- });
- }
- }
- });
- ownerPanel.add(saveOwner);
- add(ownerPanel);
- }
-
- private void initDescription() {
- final VerticalPanel vp = new VerticalPanel();
- vp.setStyleName(Gerrit.RESOURCES.css().groupDescriptionPanel());
- vp.add(new SmallHeading(AdminConstants.I.headingDescription()));
-
- descTxt = new NpTextArea();
- descTxt.setVisibleLines(6);
- descTxt.setCharacterWidth(60);
- vp.add(descTxt);
-
- saveDesc = new Button(AdminConstants.I.buttonSaveDescription());
- saveDesc.setEnabled(false);
- saveDesc.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- final String txt = descTxt.getText().trim();
- GroupApi.setGroupDescription(
- getGroupUUID(),
- txt,
- new GerritCallback<VoidResult>() {
- @Override
- public void onSuccess(VoidResult result) {
- saveDesc.setEnabled(false);
- }
- });
- }
- });
- vp.add(saveDesc);
- add(vp);
- }
-
- private void initGroupOptions() {
- final VerticalPanel groupOptionsPanel = new VerticalPanel();
-
- final VerticalPanel vp = new VerticalPanel();
- vp.setStyleName(Gerrit.RESOURCES.css().groupOptionsPanel());
- vp.add(new SmallHeading(AdminConstants.I.headingGroupOptions()));
-
- visibleToAllCheckBox = new CheckBox(AdminConstants.I.isVisibleToAll());
- vp.add(visibleToAllCheckBox);
- groupOptionsPanel.add(vp);
-
- saveGroupOptions = new Button(AdminConstants.I.buttonSaveGroupOptions());
- saveGroupOptions.setEnabled(false);
- saveGroupOptions.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- GroupApi.setGroupOptions(
- getGroupUUID(),
- visibleToAllCheckBox.getValue(),
- new GerritCallback<VoidResult>() {
- @Override
- public void onSuccess(VoidResult result) {
- saveGroupOptions.setEnabled(false);
- }
- });
- }
- });
- groupOptionsPanel.add(saveGroupOptions);
-
- add(groupOptionsPanel);
-
- final OnEditEnabler enabler = new OnEditEnabler(saveGroupOptions);
- enabler.listenTo(visibleToAllCheckBox);
- }
-
- @Override
- protected void display(GroupInfo group, boolean canModify) {
- groupUUIDLabel.setText(group.getGroupUUID().get());
- groupNameTxt.setText(group.name());
- ownerTxt.setText(
- group.owner() != null
- ? group.owner()
- : AdminMessages.I.deletedReference(group.getOwnerUUID().get()));
- descTxt.setText(group.description());
- visibleToAllCheckBox.setValue(group.options().isVisibleToAll());
- setMembersTabVisible(AccountGroup.isInternalGroup(group.getGroupUUID()));
-
- enableForm(canModify);
- saveName.setVisible(canModify);
- saveOwner.setVisible(canModify);
- saveDesc.setVisible(canModify);
- saveGroupOptions.setVisible(canModify);
- new OnEditEnabler(saveDesc, descTxt);
- new OnEditEnabler(saveName, groupNameTxt);
- new OnEditEnabler(saveOwner, ownerTxt.getTextBox());
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupMembersScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupMembersScreen.java
deleted file mode 100644
index 6eaab5d..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupMembersScreen.java
+++ /dev/null
@@ -1,436 +0,0 @@
-// Copyright (C) 2008 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.client.admin;
-
-import static java.util.Comparator.comparing;
-
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.VoidResult;
-import com.google.gerrit.client.groups.GroupApi;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.info.GroupInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.AccountGroupSuggestOracle;
-import com.google.gerrit.client.ui.AccountLinkPanel;
-import com.google.gerrit.client.ui.AccountSuggestOracle;
-import com.google.gerrit.client.ui.AddMemberBox;
-import com.google.gerrit.client.ui.FancyFlexTable;
-import com.google.gerrit.client.ui.Hyperlink;
-import com.google.gerrit.client.ui.SmallHeading;
-import com.google.gerrit.reviewdb.client.AccountGroup;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Panel;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.List;
-
-public class AccountGroupMembersScreen extends AccountGroupScreen {
-
- private MemberTable members;
- private IncludeTable includes;
-
- private Panel memberPanel;
- private AddMemberBox addMemberBox;
- private Button delMember;
-
- private Panel includePanel;
- private AddMemberBox addIncludeBox;
- private Button delInclude;
-
- private FlowPanel noMembersInfo;
- private AccountGroupSuggestOracle accountGroupSuggestOracle;
-
- public AccountGroupMembersScreen(GroupInfo toShow, String token) {
- super(toShow, token);
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- initMemberList();
- initIncludeList();
- initNoMembersInfo();
- }
-
- private void enableForm(boolean canModify) {
- addMemberBox.setEnabled(canModify);
- members.setEnabled(canModify);
- addIncludeBox.setEnabled(canModify);
- includes.setEnabled(canModify);
- }
-
- private void initMemberList() {
- addMemberBox =
- new AddMemberBox(
- AdminConstants.I.buttonAddGroupMember(),
- AdminConstants.I.defaultAccountName(),
- new AccountSuggestOracle());
-
- addMemberBox.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- doAddNewMember();
- }
- });
-
- members = new MemberTable();
- members.addStyleName(Gerrit.RESOURCES.css().groupMembersTable());
-
- delMember = new Button(AdminConstants.I.buttonDeleteGroupMembers());
- delMember.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- members.deleteChecked();
- }
- });
-
- memberPanel = new FlowPanel();
- memberPanel.add(new SmallHeading(AdminConstants.I.headingMembers()));
- memberPanel.add(addMemberBox);
- memberPanel.add(members);
- memberPanel.add(delMember);
- add(memberPanel);
- }
-
- private void initIncludeList() {
- accountGroupSuggestOracle = new AccountGroupSuggestOracle();
- addIncludeBox =
- new AddMemberBox(
- AdminConstants.I.buttonAddIncludedGroup(),
- AdminConstants.I.defaultAccountGroupName(),
- accountGroupSuggestOracle);
-
- addIncludeBox.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- doAddNewInclude();
- }
- });
-
- includes = new IncludeTable();
- includes.addStyleName(Gerrit.RESOURCES.css().groupIncludesTable());
-
- delInclude = new Button(AdminConstants.I.buttonDeleteIncludedGroup());
- delInclude.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- includes.deleteChecked();
- }
- });
-
- includePanel = new FlowPanel();
- includePanel.add(new SmallHeading(AdminConstants.I.headingIncludedGroups()));
- includePanel.add(addIncludeBox);
- includePanel.add(includes);
- includePanel.add(delInclude);
- add(includePanel);
- }
-
- private void initNoMembersInfo() {
- noMembersInfo = new FlowPanel();
- noMembersInfo.setVisible(false);
- noMembersInfo.add(new SmallHeading(AdminConstants.I.noMembersInfo()));
- add(noMembersInfo);
- }
-
- @Override
- protected void display(GroupInfo group, boolean canModify) {
- if (AccountGroup.isInternalGroup(group.getGroupUUID())) {
- members.display(Natives.asList(group.members()));
- includes.display(Natives.asList(group.includes()));
- } else {
- memberPanel.setVisible(false);
- includePanel.setVisible(false);
- noMembersInfo.setVisible(true);
- }
-
- enableForm(canModify);
- delMember.setVisible(canModify);
- delInclude.setVisible(canModify);
- }
-
- void doAddNewMember() {
- final String nameEmail = addMemberBox.getText();
- if (nameEmail.length() == 0) {
- return;
- }
-
- addMemberBox.setEnabled(false);
- GroupApi.addMember(
- getGroupUUID(),
- nameEmail,
- new GerritCallback<AccountInfo>() {
- @Override
- public void onSuccess(AccountInfo memberInfo) {
- addMemberBox.setEnabled(true);
- addMemberBox.setText("");
- members.insert(memberInfo);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- addMemberBox.setEnabled(true);
- super.onFailure(caught);
- }
- });
- }
-
- void doAddNewInclude() {
- String groupName = addIncludeBox.getText();
- if (groupName.length() == 0) {
- return;
- }
-
- AccountGroup.UUID uuid = accountGroupSuggestOracle.getUUID(groupName);
- if (uuid == null) {
- return;
- }
-
- addIncludeBox.setEnabled(false);
- GroupApi.addIncludedGroup(
- getGroupUUID(),
- uuid.get(),
- new GerritCallback<GroupInfo>() {
- @Override
- public void onSuccess(GroupInfo result) {
- addIncludeBox.setEnabled(true);
- addIncludeBox.setText("");
- includes.insert(result);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- addIncludeBox.setEnabled(true);
- super.onFailure(caught);
- }
- });
- }
-
- private class MemberTable extends FancyFlexTable<AccountInfo> {
- private boolean enabled = true;
-
- MemberTable() {
- table.setText(0, 2, AdminConstants.I.columnMember());
- table.setText(0, 3, AdminConstants.I.columnEmailAddress());
-
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().iconHeader());
- fmt.addStyleName(0, 2, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 3, Gerrit.RESOURCES.css().dataHeader());
- }
-
- void setEnabled(boolean enabled) {
- this.enabled = enabled;
- for (int row = 1; row < table.getRowCount(); row++) {
- final AccountInfo i = getRowItem(row);
- if (i != null) {
- ((CheckBox) table.getWidget(row, 1)).setEnabled(enabled);
- }
- }
- }
-
- void deleteChecked() {
- final HashSet<Integer> ids = new HashSet<>();
- for (int row = 1; row < table.getRowCount(); row++) {
- final AccountInfo i = getRowItem(row);
- if (i != null && ((CheckBox) table.getWidget(row, 1)).getValue()) {
- ids.add(i._accountId());
- }
- }
- if (!ids.isEmpty()) {
- GroupApi.removeMembers(
- getGroupUUID(),
- ids,
- new GerritCallback<VoidResult>() {
- @Override
- public void onSuccess(VoidResult result) {
- for (int row = 1; row < table.getRowCount(); ) {
- final AccountInfo i = getRowItem(row);
- if (i != null && ids.contains(i._accountId())) {
- table.removeRow(row);
- } else {
- row++;
- }
- }
- }
- });
- }
- }
-
- void display(List<AccountInfo> result) {
- while (1 < table.getRowCount()) {
- table.removeRow(table.getRowCount() - 1);
- }
-
- for (AccountInfo i : result) {
- final int row = table.getRowCount();
- table.insertRow(row);
- applyDataRowStyle(row);
- populate(row, i);
- }
- }
-
- void insert(AccountInfo info) {
- Comparator<AccountInfo> c =
- comparing((AccountInfo a) -> nullToEmpty(a.name()))
- .thenComparing(a -> nullToEmpty(a.email()))
- .thenComparing(AccountInfo::_accountId);
- int insertPos = getInsertRow(c, info);
- if (insertPos >= 0) {
- table.insertRow(insertPos);
- applyDataRowStyle(insertPos);
- populate(insertPos, info);
- }
- }
-
- void populate(int row, AccountInfo i) {
- CheckBox checkBox = new CheckBox();
- table.setWidget(row, 1, checkBox);
- checkBox.setEnabled(enabled);
- table.setWidget(row, 2, AccountLinkPanel.create(i));
- table.setText(row, 3, i.email());
-
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().iconCell());
- fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell());
-
- setRowItem(row, i);
- }
- }
-
- private class IncludeTable extends FancyFlexTable<GroupInfo> {
- private boolean enabled = true;
-
- IncludeTable() {
- table.setText(0, 2, AdminConstants.I.columnGroupName());
- table.setText(0, 3, AdminConstants.I.columnGroupDescription());
-
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().iconHeader());
- fmt.addStyleName(0, 2, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 3, Gerrit.RESOURCES.css().dataHeader());
- }
-
- void setEnabled(boolean enabled) {
- this.enabled = enabled;
- for (int row = 1; row < table.getRowCount(); row++) {
- final GroupInfo i = getRowItem(row);
- if (i != null) {
- ((CheckBox) table.getWidget(row, 1)).setEnabled(enabled);
- }
- }
- }
-
- void deleteChecked() {
- final HashSet<AccountGroup.UUID> ids = new HashSet<>();
- for (int row = 1; row < table.getRowCount(); row++) {
- final GroupInfo i = getRowItem(row);
- if (i != null && ((CheckBox) table.getWidget(row, 1)).getValue()) {
- ids.add(i.getGroupUUID());
- }
- }
- if (!ids.isEmpty()) {
- GroupApi.removeIncludedGroups(
- getGroupUUID(),
- ids,
- new GerritCallback<VoidResult>() {
- @Override
- public void onSuccess(VoidResult result) {
- for (int row = 1; row < table.getRowCount(); ) {
- final GroupInfo i = getRowItem(row);
- if (i != null && ids.contains(i.getGroupUUID())) {
- table.removeRow(row);
- } else {
- row++;
- }
- }
- }
- });
- }
- }
-
- void display(List<GroupInfo> list) {
- while (1 < table.getRowCount()) {
- table.removeRow(table.getRowCount() - 1);
- }
-
- for (GroupInfo i : list) {
- final int row = table.getRowCount();
- table.insertRow(row);
- applyDataRowStyle(row);
- populate(row, i);
- }
- }
-
- void insert(GroupInfo info) {
- Comparator<GroupInfo> c =
- comparing((GroupInfo g) -> nullToEmpty(g.name())).thenComparing(GroupInfo::getGroupUUID);
- int insertPos = getInsertRow(c, info);
- if (insertPos >= 0) {
- table.insertRow(insertPos);
- applyDataRowStyle(insertPos);
- populate(insertPos, info);
- }
- }
-
- void populate(int row, GroupInfo i) {
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
-
- AccountGroup.UUID uuid = i.getGroupUUID();
- CheckBox checkBox = new CheckBox();
- table.setWidget(row, 1, checkBox);
- checkBox.setEnabled(enabled);
- if (AccountGroup.isInternalGroup(uuid)) {
- table.setWidget(row, 2, new Hyperlink(i.name(), Dispatcher.toGroup(uuid)));
- fmt.getElement(row, 2).setTitle(null);
- table.setText(row, 3, i.description());
- } else if (i.url() != null) {
- Anchor a = new Anchor();
- a.setText(i.name());
- a.setHref(i.url());
- a.setTitle("UUID " + uuid.get());
- table.setWidget(row, 2, a);
- fmt.getElement(row, 2).setTitle(null);
- } else {
- table.setText(row, 2, i.name());
- fmt.getElement(row, 2).setTitle("UUID " + uuid.get());
- }
-
- fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().iconCell());
- fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell());
-
- setRowItem(row, i);
- }
- }
-
- // Like Guava's Strings#nullToEmpty, which can't be used in GWT UI code.
- private static String nullToEmpty(String str) {
- return str == null ? "" : str;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupScreen.java
deleted file mode 100644
index b67213b..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AccountGroupScreen.java
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright (C) 2011 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.client.admin;
-
-import static com.google.gerrit.client.Dispatcher.toGroup;
-
-import com.google.gerrit.client.groups.GroupApi;
-import com.google.gerrit.client.info.GroupInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.ui.MenuScreen;
-import com.google.gerrit.reviewdb.client.AccountGroup;
-
-public abstract class AccountGroupScreen extends MenuScreen {
- public static final String INFO = "info";
- public static final String MEMBERS = "members";
- public static final String AUDIT_LOG = "audit-log";
-
- private final GroupInfo group;
- private final String token;
- private final String membersTabToken;
- private final String auditLogTabToken;
-
- public AccountGroupScreen(GroupInfo toShow, String token) {
- setRequiresSignIn(true);
-
- this.group = toShow;
- this.token = token;
- this.membersTabToken = getTabToken(token, MEMBERS);
- this.auditLogTabToken = getTabToken(token, AUDIT_LOG);
-
- link(AdminConstants.I.groupTabGeneral(), getTabToken(token, INFO));
- link(
- AdminConstants.I.groupTabMembers(),
- membersTabToken,
- AccountGroup.isInternalGroup(group.getGroupUUID()));
- }
-
- private String getTabToken(String token, String tab) {
- if (token.startsWith("/admin/groups/uuid-")) {
- return toGroup(group.getGroupUUID(), tab);
- }
- return toGroup(group.getGroupId(), tab);
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- setPageTitle(AdminMessages.I.group(group.name()));
- display();
- GroupApi.isGroupOwner(
- group.name(),
- new GerritCallback<Boolean>() {
- @Override
- public void onSuccess(Boolean result) {
- if (result) {
- link(
- AdminConstants.I.groupTabAuditLog(),
- auditLogTabToken,
- AccountGroup.isInternalGroup(group.getGroupUUID()));
- setToken(token);
- }
- display(group, result);
- }
- });
- }
-
- protected abstract void display(GroupInfo group, boolean canModify);
-
- protected AccountGroup.UUID getGroupUUID() {
- return group.getGroupUUID();
- }
-
- protected void updateOwnerGroup(GroupInfo ownerGroup) {
- group.setOwnerUUID(ownerGroup.getGroupUUID());
- group.owner(ownerGroup.name());
- }
-
- protected AccountGroup.UUID getOwnerGroupUUID() {
- return group.getOwnerUUID();
- }
-
- protected void setMembersTabVisible(boolean visible) {
- setLinkVisible(membersTabToken, visible);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminConstants.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminConstants.java
deleted file mode 100644
index 9def3b3..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminConstants.java
+++ /dev/null
@@ -1,293 +0,0 @@
-// Copyright (C) 2008 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.client.admin;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.i18n.client.Constants;
-import java.util.Map;
-
-public interface AdminConstants extends Constants {
- AdminConstants I = GWT.create(AdminConstants.class);
-
- String defaultAccountName();
-
- String defaultAccountGroupName();
-
- String defaultBranchName();
-
- String defaultTagName();
-
- String defaultRevisionSpec();
-
- String annotation();
-
- String buttonDeleteIncludedGroup();
-
- String buttonAddIncludedGroup();
-
- String buttonDeleteGroupMembers();
-
- String buttonAddGroupMember();
-
- String buttonSaveDescription();
-
- String buttonRenameGroup();
-
- String buttonCreateGroup();
-
- String buttonCreateProject();
-
- String buttonChangeGroupOwner();
-
- String buttonChangeGroupType();
-
- String buttonSelectGroup();
-
- String buttonSaveChanges();
-
- String checkBoxEmptyCommit();
-
- String checkBoxPermissionsOnly();
-
- String useContentMerge();
-
- String useContributorAgreements();
-
- String useSignedOffBy();
-
- String createNewChangeForAllNotInTarget();
-
- String enableSignedPush();
-
- String requireSignedPush();
-
- String requireChangeID();
-
- String rejectImplicitMerges();
-
- String privateByDefault();
-
- String workInProgressByDefault();
-
- String enableReviewerByEmail();
-
- String matchAuthorToCommitterDate();
-
- String headingMaxObjectSizeLimit();
-
- String headingGroupOptions();
-
- String isVisibleToAll();
-
- String buttonSaveGroupOptions();
-
- String suggestedGroupLabel();
-
- String parentSuggestions();
-
- String buttonBrowseProjects();
-
- String projects();
-
- String projectRepoBrowser();
-
- String headingGroupUUID();
-
- String headingOwner();
-
- String headingDescription();
-
- String headingProjectOptions();
-
- String headingProjectCommands();
-
- String headingCommands();
-
- String headingMembers();
-
- String headingIncludedGroups();
-
- String noMembersInfo();
-
- String headingExternalGroup();
-
- String headingCreateGroup();
-
- String headingParentProjectName();
-
- String columnProjectName();
-
- String headingAgreements();
-
- String headingAuditLog();
-
- String headingProjectSubmitType();
-
- String projectSubmitType_INHERIT();
-
- String projectSubmitType_FAST_FORWARD_ONLY();
-
- String projectSubmitType_MERGE_ALWAYS();
-
- String projectSubmitType_MERGE_IF_NECESSARY();
-
- String projectSubmitType_REBASE_IF_NECESSARY();
-
- String projectSubmitType_REBASE_ALWAYS();
-
- String projectSubmitType_CHERRY_PICK();
-
- String headingProjectState();
-
- String projectState_ACTIVE();
-
- String projectState_READ_ONLY();
-
- String projectState_HIDDEN();
-
- String columnMember();
-
- String columnEmailAddress();
-
- String columnGroupName();
-
- String columnGroupDescription();
-
- String columnGroupType();
-
- String columnGroupNotifications();
-
- String columnGroupVisibleToAll();
-
- String columnDate();
-
- String columnType();
-
- String columnByUser();
-
- String typeAdded();
-
- String typeRemoved();
-
- String columnBranchName();
-
- String columnBranchRevision();
-
- String columnTagName();
-
- String columnTagRevision();
-
- String columnTagAnnotation();
-
- String initialRevision();
-
- String revision();
-
- String buttonAddBranch();
-
- String buttonDeleteBranch();
-
- String buttonAddTag();
-
- String buttonDeleteTag();
-
- String saveHeadButton();
-
- String cancelHeadButton();
-
- String groupItemHelp();
-
- String groupListTitle();
-
- String groupFilter();
-
- String createGroupTitle();
-
- String groupTabGeneral();
-
- String groupTabMembers();
-
- String groupTabAuditLog();
-
- String projectListTitle();
-
- String projectFilter();
-
- String createProjectTitle();
-
- String projectListQueryLink();
-
- String plugins();
-
- String pluginEnabled();
-
- String pluginDisabled();
-
- String pluginSettingsToolTip();
-
- String columnPluginName();
-
- String columnPluginSettings();
-
- String columnPluginVersion();
-
- String columnPluginStatus();
-
- String noGroupSelected();
-
- String errorNoMatchingGroups();
-
- String errorNoGitRepository();
-
- String addPermission();
-
- Map<String, String> permissionNames();
-
- String refErrorEmpty();
-
- String refErrorBeginSlash();
-
- String refErrorDoubleSlash();
-
- String refErrorNoSpace();
-
- String refErrorPrintable();
-
- String errorsMustBeFixed();
-
- String sectionTypeReference();
-
- String sectionTypeSection();
-
- Map<String, String> sectionNames();
-
- String pagedListPrev();
-
- String pagedListNext();
-
- String buttonCreate();
-
- String buttonCreateDescription();
-
- String buttonCreateChange();
-
- String buttonCreateChangeDescription();
-
- String buttonEditConfig();
-
- String buttonEditConfigDescription();
-
- String editConfigMessage();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminConstants.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminConstants.properties
deleted file mode 100644
index 7901f33..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminConstants.properties
+++ /dev/null
@@ -1,204 +0,0 @@
-defaultAccountName = Name or Email
-defaultAccountGroupName = Group Name
-defaultBranchName = Branch Name
-defaultTagName = Tag Name
-defaultRevisionSpec = Revision (Branch or SHA-1)
-annotation = Annotation (optional)
-
-buttonDeleteIncludedGroup = Delete
-buttonAddIncludedGroup = Add
-buttonDeleteGroupMembers = Delete
-buttonAddGroupMember = Add
-buttonRenameGroup = Rename Group
-buttonSaveDescription = Save Description
-buttonCreateGroup = Create Group
-buttonCreateProject = Create Project
-buttonChangeGroupOwner = Change Owner
-buttonChangeGroupType = Change Type
-buttonSelectGroup = Select
-buttonSaveChanges = Save Changes
-checkBoxEmptyCommit = Create initial empty commit
-checkBoxPermissionsOnly = Only serve as parent for other projects
-buttonBrowseProjects = Browse
-projects = All projects
-projectRepoBrowser = Repository Browser
-useContentMerge = Allow content merges
-useContributorAgreements = Require a valid contributor agreement to upload
-useSignedOffBy = Require <code>Signed-off-by</code> in commit message
-createNewChangeForAllNotInTarget = Create a new change for every commit not in the target branch
-enableSignedPush = Enable signed push
-requireSignedPush = Require signed push
-requireChangeID = Require <code>Change-Id</code> in commit message
-rejectImplicitMerges = Reject implicit merges when changes are pushed for review
-privateByDefault = Set all new changes private by default
-workInProgressByDefault = Set all new changes work-in-progress by default
-headingMaxObjectSizeLimit = Maximum Git object size limit
-headingGroupOptions = Group Options
-isVisibleToAll = Make group visible to all registered users.
-buttonSaveGroupOptions = Save Group Options
-suggestedGroupLabel = group
-headingParentProjectName = Rights Inherit From
-parentSuggestions = Parent Suggestion
-columnProjectName = Project Name
-enableReviewerByEmail = Enable adding unregistered users as reviewers and CCs on changes
-matchAuthorToCommitterDate = Match authored date with committer date upon submit
-
-headingGroupUUID = Group UUID
-headingOwner = Owners
-headingDescription = Description
-headingProjectOptions = Project Options
-headingProjectCommands = Project Commands
-headingCommands = Commands
-headingMembers = Members
-headingIncludedGroups = Included Groups
-noMembersInfo = Group Members can only be viewed for Gerrit internal groups. For external groups and Gerrit system groups the members cannot be displayed.
-headingExternalGroup = Selected External Group
-headingCreateGroup = Create New Group
-headingAgreements = Contributor Agreements
-headingAuditLog = Audit Log
-
-headingProjectSubmitType = Submit Type
-projectSubmitType_INHERIT = Inherit
-projectSubmitType_FAST_FORWARD_ONLY = Fast Forward Only
-projectSubmitType_MERGE_IF_NECESSARY = Merge if Necessary
-projectSubmitType_REBASE_ALWAYS = Rebase Always
-projectSubmitType_REBASE_IF_NECESSARY = Rebase if Necessary
-projectSubmitType_MERGE_ALWAYS = Always Merge
-projectSubmitType_CHERRY_PICK = Cherry Pick
-
-headingProjectState = State
-projectState_ACTIVE = Active
-projectState_READ_ONLY = Read Only
-projectState_HIDDEN = Hidden
-
-columnMember = Member
-columnEmailAddress = Email Address
-columnGroupName = Group Name
-columnGroupDescription = Description
-columnGroupType = Group Type
-columnGroupNotifications = Email Only Authors
-columnGroupVisibleToAll = Visible To All
-
-columnDate = Date
-columnType = Type
-columnByUser = By User
-
-typeAdded = Added
-typeRemoved = Removed
-
-columnBranchName = Branch Name
-columnBranchRevision = Revision
-columnTagName = Tag Name
-columnTagRevision = Revision
-columnTagAnnotation = Annotation
-initialRevision = Initial Revision
-revision = Revision
-buttonAddBranch = Create Branch
-buttonAddTag = Create Tag
-buttonDeleteBranch = Delete
-buttonDeleteTag = Delete
-saveHeadButton = Save
-cancelHeadButton = Cancel
-
-groupItemHelp = group
-
-groupListTitle = Groups
-groupFilter = Filter
-createGroupTitle = Create Group
-groupTabGeneral = General
-groupTabMembers = Members
-groupTabAuditLog = Audit Log
-projectListTitle = Projects
-projectFilter = Filter
-createProjectTitle = Create Project
-projectListQueryLink = Search for changes on this project
-
-plugins = Plugins
-pluginEnabled = Enabled
-pluginDisabled = Disabled
-pluginSettingsToolTip = Plugin Settings
-columnPluginName = Plugin Name
-columnPluginSettings = Settings
-columnPluginVersion = Version
-columnPluginStatus = Status
-
-noGroupSelected = (No group selected)
-errorNoMatchingGroups = No Matching Groups
-errorNoGitRepository = No Git Repository
-
-pagedListPrev = ⇦Prev
-pagedListNext = Next⇨
-
-addPermission = Add Permission ...
-
-# Permission Names
-permissionNames = \
- abandon, \
- addPatchSet, \
- create, \
- createTag, \
- createSignedTag, \
- delete, \
- deleteChanges, \
- deleteOwnChanges, \
- editAssignee, \
- editHashtags, \
- editTopicName, \
- forgeAuthor, \
- forgeCommitter, \
- forgeServerAsCommitter, \
- owner, \
- push, \
- pushMerge, \
- read, \
- rebase, \
- removeReviewer, \
- submit, \
- submitAs, \
- viewPrivateChanges
-
-abandon = Abandon
-addPatchSet = Add Patch Set
-create = Create Reference
-createTag = Create Annotated Tag
-createSignedTag = Create Signed Tag
-delete = Delete Reference
-deleteChanges = Delete Changes
-deleteOwnChanges = Delete Own Changes
-editAssignee = Edit Assignee
-editHashtags = Edit Hashtags
-editTopicName = Edit Topic Name
-forgeAuthor = Forge Author Identity
-forgeCommitter = Forge Committer Identity
-forgeServerAsCommitter = Forge Server Identity
-owner = Owner
-push = Push
-pushMerge = Push Merge Commit
-read = Read
-rebase = Rebase
-removeReviewer = Remove Reviewer
-submit = Submit
-submitAs = Submit (On Behalf Of)
-viewPrivateChanges = View Private Changes
-
-refErrorEmpty = Reference must be supplied
-refErrorBeginSlash = Reference must not start with '/'
-refErrorDoubleSlash = References cannot contain '//'
-refErrorNoSpace = References cannot contain spaces
-refErrorPrintable = References may contain only printable characters
-errorsMustBeFixed = Errors must be fixed before committing changes.
-
-# Section Names
-sectionTypeReference = Reference:
-sectionTypeSection = Section:
-sectionNames = \
- GLOBAL_CAPABILITIES
-GLOBAL_CAPABILITIES = Global Capabilities
-
-buttonCreate = Create
-buttonCreateDescription = Insert the description of the change.
-buttonCreateChange = Create Change
-buttonCreateChangeDescription = Create change directly in the browser.
-buttonEditConfig = Edit Config
-buttonEditConfigDescription = Creates a change to edit the project configuration in the browser.
-editConfigMessage = Edit Project Config
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminCss.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminCss.java
deleted file mode 100644
index 53b2e72..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminCss.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) 2011 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.client.admin;
-
-import com.google.gwt.resources.client.CssResource;
-
-public interface AdminCss extends CssResource {
- String deleteIcon();
-
- String undoIcon();
-
- String deleted();
-
- String deletedBorder();
-
- String deleteSectionHover();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminMessages.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminMessages.java
deleted file mode 100644
index 7b18a39..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminMessages.java
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (C) 2008 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.client.admin;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.i18n.client.Messages;
-
-public interface AdminMessages extends Messages {
- AdminMessages I = GWT.create(AdminMessages.class);
-
- String group(String name);
-
- String label(String name);
-
- String labelAs(String name);
-
- String project(String name);
-
- String deletedGroup(int id);
-
- String deletedReference(String name);
-
- String deletedSection(String name);
-
- String effectiveMaxObjectSizeLimit(String effectiveMaxObjectSizeLimit);
-
- String noMaxObjectSizeLimit();
-
- String pluginProjectOptionsTitle(String pluginName);
-
- String pluginProjectInheritedValue(String value);
-
- String pluginProjectInheritedListValue(String value);
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminMessages.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminMessages.properties
deleted file mode 100644
index c9aa987..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminMessages.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-group = Group {0}
-label = Label {0}
-labelAs = Label {0} (On Behalf Of)
-project = Project {0}
-deletedGroup = Deleted Group {0}
-deletedReference = Reference {0} was deleted
-deletedSection = Section {0} was deleted
-effectiveMaxObjectSizeLimit = effective: {0} bytes
-noMaxObjectSizeLimit = No max object size limit is set.
-pluginProjectOptionsTitle = {0} Plugin Options
-pluginProjectOptionsTitle = {0} Plugin
-pluginProjectInheritedValue = inherited: {0}
-pluginProjectInheritedListValue = INHERIT ({0})
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminResources.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminResources.java
deleted file mode 100644
index dfbfbb6..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminResources.java
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright (C) 2011 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.client.admin;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.resources.client.ClientBundle;
-import com.google.gwt.resources.client.ImageResource;
-
-public interface AdminResources extends ClientBundle {
- AdminResources I = GWT.create(AdminResources.class);
-
- @Source("admin.css")
- AdminCss css();
-
- /** unknown origin TODO replace icons */
- @Source("deleteNormal.png")
- ImageResource deleteNormal();
-
- @Source("deleteHover.png")
- ImageResource deleteHover();
-
- /** silk icons (CC-BY3.0): http://famfamfam.com/lab/icons/silk/ */
- @Source("arrow_undo.png")
- ImageResource undoNormal();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/CreateChangeAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/CreateChangeAction.java
deleted file mode 100644
index 611db85..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/CreateChangeAction.java
+++ /dev/null
@@ -1,69 +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.client.admin;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.ui.CreateChangeDialog;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.PopupPanel;
-
-class CreateChangeAction {
- static void call(Button b, String project) {
- // TODO Replace CreateChangeDialog with a nicer looking display.
- b.setEnabled(false);
- new CreateChangeDialog(new Project.NameKey(project)) {
- {
- sendButton.setText(AdminConstants.I.buttonCreate());
- message.setText(AdminConstants.I.buttonCreateDescription());
- }
-
- @Override
- public void onSend() {
- ChangeApi.createChange(
- project,
- getDestinationBranch(),
- getDestinationTopic(),
- message.getText(),
- null,
- new GerritCallback<ChangeInfo>() {
- @Override
- public void onSuccess(ChangeInfo result) {
- sent = true;
- hide();
- Gerrit.display(PageLinks.toChange(result.projectNameKey(), result.legacyId()));
- }
-
- @Override
- public void onFailure(Throwable caught) {
- enableButtons(true);
- super.onFailure(caught);
- }
- });
- }
-
- @Override
- public void onClose(CloseEvent<PopupPanel> event) {
- super.onClose(event);
- b.setEnabled(true);
- }
- }.center();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/CreateGroupScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/CreateGroupScreen.java
deleted file mode 100644
index 6914ee9..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/CreateGroupScreen.java
+++ /dev/null
@@ -1,160 +0,0 @@
-// Copyright (C) 2012 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.client.admin;
-
-import static com.google.gerrit.common.data.GlobalCapability.CREATE_GROUP;
-
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.NotFoundScreen;
-import com.google.gerrit.client.account.AccountCapabilities;
-import com.google.gerrit.client.groups.GroupApi;
-import com.google.gerrit.client.info.GroupInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.ui.OnEditEnabler;
-import com.google.gerrit.client.ui.Screen;
-import com.google.gerrit.client.ui.SmallHeading;
-import com.google.gerrit.common.PageLinks;
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.core.client.Scheduler.ScheduledCommand;
-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.user.client.Event;
-import com.google.gwt.user.client.History;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwtexpui.globalkey.client.NpTextBox;
-
-public class CreateGroupScreen extends Screen {
-
- private NpTextBox addTxt;
- private Button addNew;
-
- public CreateGroupScreen() {
- super();
- setRequiresSignIn(true);
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- AccountCapabilities.all(
- new GerritCallback<AccountCapabilities>() {
- @Override
- public void onSuccess(AccountCapabilities ac) {
- if (ac.canPerform(CREATE_GROUP)) {
- display();
- } else {
- Gerrit.display(PageLinks.ADMIN_CREATE_GROUP, new NotFoundScreen());
- }
- }
- },
- CREATE_GROUP);
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- setPageTitle(AdminConstants.I.createGroupTitle());
- addCreateGroupPanel();
- }
-
- @Override
- public void onShowView() {
- super.onShowView();
- if (addTxt != null) {
- addTxt.setFocus(true);
- }
- }
-
- private void addCreateGroupPanel() {
- VerticalPanel addPanel = new VerticalPanel();
- addPanel.setStyleName(Gerrit.RESOURCES.css().addSshKeyPanel());
- addPanel.add(new SmallHeading(AdminConstants.I.headingCreateGroup()));
-
- addTxt =
- new NpTextBox() {
- @Override
- public void onBrowserEvent(Event event) {
- super.onBrowserEvent(event);
- if (event.getTypeInt() == Event.ONPASTE) {
- Scheduler.get()
- .scheduleDeferred(
- new ScheduledCommand() {
- @Override
- public void execute() {
- if (addTxt.getValue().trim().length() != 0) {
- addNew.setEnabled(true);
- }
- }
- });
- }
- }
- };
- addTxt.sinkEvents(Event.ONPASTE);
-
- addTxt.setVisibleLength(60);
- addTxt.addKeyPressHandler(
- new KeyPressHandler() {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
- doCreateGroup();
- }
- }
- });
- addPanel.add(addTxt);
-
- addNew = new Button(AdminConstants.I.buttonCreateGroup());
- addNew.setEnabled(false);
- addNew.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- doCreateGroup();
- }
- });
- addPanel.add(addNew);
- add(addPanel);
-
- new OnEditEnabler(addNew, addTxt);
- }
-
- private void doCreateGroup() {
- final String newName = addTxt.getText();
- if (newName == null || newName.length() == 0) {
- return;
- }
-
- addNew.setEnabled(false);
- GroupApi.createGroup(
- newName,
- new GerritCallback<GroupInfo>() {
- @Override
- public void onSuccess(GroupInfo result) {
- History.newItem(Dispatcher.toGroup(result.getGroupId(), AccountGroupScreen.MEMBERS));
- }
-
- @Override
- public void onFailure(Throwable caught) {
- super.onFailure(caught);
- addNew.setEnabled(true);
- }
- });
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/CreateProjectScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/CreateProjectScreen.java
deleted file mode 100644
index 02b9169..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/CreateProjectScreen.java
+++ /dev/null
@@ -1,306 +0,0 @@
-// Copyright (C) 2011 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.client.admin;
-
-import static com.google.gerrit.common.data.GlobalCapability.CREATE_PROJECT;
-
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.ErrorDialog;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.NotFoundScreen;
-import com.google.gerrit.client.VoidResult;
-import com.google.gerrit.client.account.AccountCapabilities;
-import com.google.gerrit.client.projects.ProjectApi;
-import com.google.gerrit.client.projects.ProjectInfo;
-import com.google.gerrit.client.projects.ProjectMap;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.ui.OnEditEnabler;
-import com.google.gerrit.client.ui.ProjectListPopup;
-import com.google.gerrit.client.ui.ProjectNameSuggestOracle;
-import com.google.gerrit.client.ui.ProjectsTable;
-import com.google.gerrit.client.ui.RemoteSuggestBox;
-import com.google.gerrit.client.ui.Screen;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.common.ProjectUtil;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.core.client.Scheduler.ScheduledCommand;
-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.user.client.Event;
-import com.google.gwt.user.client.History;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.user.client.ui.Grid;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwtexpui.globalkey.client.NpTextBox;
-
-public class CreateProjectScreen extends Screen {
- private Grid grid;
- private NpTextBox project;
- private Button create;
- private Button browse;
- private RemoteSuggestBox parent;
- private CheckBox emptyCommit;
- private CheckBox permissionsOnly;
- private ProjectsTable suggestedParentsTab;
- private ProjectListPopup projectsPopup;
-
- public CreateProjectScreen() {
- super();
- setRequiresSignIn(true);
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- AccountCapabilities.all(
- new GerritCallback<AccountCapabilities>() {
- @Override
- public void onSuccess(AccountCapabilities ac) {
- if (ac.canPerform(CREATE_PROJECT)) {
- display();
- } else {
- Gerrit.display(PageLinks.ADMIN_CREATE_PROJECT, new NotFoundScreen());
- }
- }
- },
- CREATE_PROJECT);
- }
-
- @Override
- protected void onUnload() {
- super.onUnload();
- projectsPopup.closePopup();
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- setPageTitle(AdminConstants.I.createProjectTitle());
- addCreateProjectPanel();
-
- /* popup */
- projectsPopup =
- new ProjectListPopup() {
- @Override
- protected void onMovePointerTo(String projectName) {
- // prevent user input from being overwritten by simply poping up
- if (!projectsPopup.isPoppingUp() || "".equals(parent.getText())) {
- parent.setText(projectName);
- }
- }
- };
- projectsPopup.initPopup(AdminConstants.I.projects(), PageLinks.ADMIN_PROJECTS);
- }
-
- @Override
- public void onShowView() {
- super.onShowView();
- if (project != null) {
- project.setFocus(true);
- }
- }
-
- private void addCreateProjectPanel() {
- final VerticalPanel fp = new VerticalPanel();
- fp.setStyleName(Gerrit.RESOURCES.css().createProjectPanel());
-
- initCreateButton();
- initCreateTxt();
- initParentBox();
-
- addGrid(fp);
-
- emptyCommit = new CheckBox(AdminConstants.I.checkBoxEmptyCommit());
- emptyCommit.setValue(true);
- permissionsOnly = new CheckBox(AdminConstants.I.checkBoxPermissionsOnly());
- fp.add(emptyCommit);
- fp.add(permissionsOnly);
- fp.add(create);
- VerticalPanel vp = new VerticalPanel();
- vp.add(fp);
- initSuggestedParents();
- vp.add(suggestedParentsTab);
- add(vp);
- }
-
- private void initCreateTxt() {
- project =
- new NpTextBox() {
- @Override
- public void onBrowserEvent(Event event) {
- super.onBrowserEvent(event);
- if (event.getTypeInt() == Event.ONPASTE) {
- Scheduler.get()
- .scheduleDeferred(
- new ScheduledCommand() {
- @Override
- public void execute() {
- if (project.getValue().trim().length() != 0) {
- create.setEnabled(true);
- }
- }
- });
- }
- }
- };
- project.sinkEvents(Event.ONPASTE);
- project.setVisibleLength(50);
- project.addKeyPressHandler(
- new KeyPressHandler() {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
- doCreateProject();
- }
- }
- });
- new OnEditEnabler(create, project);
- }
-
- private void initCreateButton() {
- create = new Button(AdminConstants.I.buttonCreateProject());
- create.setEnabled(false);
- create.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- doCreateProject();
- }
- });
-
- browse = new Button(AdminConstants.I.buttonBrowseProjects());
- browse.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- int top = grid.getAbsoluteTop() - 50; // under page header
- // Try to place it to the right of everything else, but not
- // right justified
- int left =
- 5
- + Math.max(
- grid.getAbsoluteLeft() + grid.getOffsetWidth(),
- suggestedParentsTab.getAbsoluteLeft()
- + suggestedParentsTab.getOffsetWidth());
- projectsPopup.setPreferredCoordinates(top, left);
- projectsPopup.displayPopup();
- }
- });
- }
-
- private void initParentBox() {
- parent = new RemoteSuggestBox(new ProjectNameSuggestOracle());
- parent.setVisibleLength(50);
- }
-
- private void initSuggestedParents() {
- suggestedParentsTab =
- new ProjectsTable() {
- {
- table.setText(0, 1, AdminConstants.I.parentSuggestions());
- }
-
- @Override
- protected void populate(int row, ProjectInfo k) {
- populateState(row, k);
- final Anchor projectLink = new Anchor(k.name());
- projectLink.addClickHandler(
- new ClickHandler() {
-
- @Override
- public void onClick(ClickEvent event) {
- parent.setText(getRowItem(row).name());
- }
- });
-
- table.setWidget(row, ProjectsTable.C_NAME, projectLink);
- table.setText(row, ProjectsTable.C_DESCRIPTION, k.description());
-
- setRowItem(row, k);
- }
- };
- suggestedParentsTab.setVisible(false);
-
- ProjectMap.parentCandidates(
- new GerritCallback<ProjectMap>() {
- @Override
- public void onSuccess(ProjectMap list) {
- if (!list.isEmpty()) {
- suggestedParentsTab.setVisible(true);
- suggestedParentsTab.display(list);
- suggestedParentsTab.finishDisplay();
- }
- }
- });
- }
-
- private void addGrid(VerticalPanel fp) {
- grid = new Grid(2, 3);
- grid.setStyleName(Gerrit.RESOURCES.css().infoBlock());
- grid.setText(0, 0, AdminConstants.I.columnProjectName() + ":");
- grid.setWidget(0, 1, project);
- grid.setText(1, 0, AdminConstants.I.headingParentProjectName() + ":");
- grid.setWidget(1, 1, parent);
- grid.setWidget(1, 2, browse);
- fp.add(grid);
- }
-
- private void doCreateProject() {
- final String projectName = project.getText().trim();
- final String parentName = parent.getText().trim();
-
- if ("".equals(projectName)) {
- project.setFocus(true);
- return;
- }
-
- enableForm(false);
- ProjectApi.createProject(
- projectName,
- parentName,
- emptyCommit.getValue(),
- permissionsOnly.getValue(),
- new AsyncCallback<VoidResult>() {
- @Override
- public void onSuccess(VoidResult result) {
- String nameWithoutSuffix = ProjectUtil.stripGitSuffix(projectName);
- History.newItem(
- Dispatcher.toProjectAdmin(
- new Project.NameKey(nameWithoutSuffix), ProjectScreen.INFO));
- }
-
- @Override
- public void onFailure(Throwable caught) {
- new ErrorDialog(caught.getMessage()).center();
- enableForm(true);
- }
- });
- }
-
- private void enableForm(boolean enabled) {
- project.setEnabled(enabled);
- create.setEnabled(enabled);
- parent.setEnabled(enabled);
- emptyCommit.setEnabled(enabled);
- permissionsOnly.setEnabled(enabled);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/EditConfigAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/EditConfigAction.java
deleted file mode 100644
index cb2ca0f..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/EditConfigAction.java
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (C) 2015 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.client.admin;
-
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gerrit.reviewdb.client.RefNames;
-import com.google.gwt.user.client.ui.Button;
-
-public class EditConfigAction {
-
- static void call(Button b, Project.NameKey project) {
- b.setEnabled(false);
-
- ChangeApi.createChange(
- project.get(),
- RefNames.REFS_CONFIG,
- null,
- AdminConstants.I.editConfigMessage(),
- null,
- new GerritCallback<ChangeInfo>() {
- @Override
- public void onSuccess(ChangeInfo result) {
- Gerrit.display(
- Dispatcher.toEditScreen(
- project, new PatchSet.Id(result.legacyId(), 1), "project.config"));
- }
-
- @Override
- public void onFailure(Throwable caught) {
- b.setEnabled(true);
- super.onFailure(caught);
- }
- });
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/GroupListScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/GroupListScreen.java
deleted file mode 100644
index b37a680..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/GroupListScreen.java
+++ /dev/null
@@ -1,232 +0,0 @@
-// Copyright (C) 2008 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.client.admin;
-
-import static com.google.gerrit.common.PageLinks.ADMIN_GROUPS;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.groups.GroupMap;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.ui.Hyperlink;
-import com.google.gerrit.client.ui.PagingHyperlink;
-import com.google.gerrit.client.ui.Screen;
-import com.google.gerrit.common.PageLinks;
-import com.google.gwt.event.dom.client.KeyCodes;
-import com.google.gwt.event.dom.client.KeyUpEvent;
-import com.google.gwt.event.dom.client.KeyUpHandler;
-import com.google.gwt.http.client.URL;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwtexpui.globalkey.client.NpTextBox;
-
-public class GroupListScreen extends Screen {
- private Hyperlink prev;
- private Hyperlink next;
- private GroupTable groups;
- private NpTextBox filterTxt;
- private int pageSize;
-
- private String match = "";
- private int start;
- private Query query;
-
- public GroupListScreen() {
- setRequiresSignIn(true);
- pageSize = Gerrit.getUserPreferences().changesPerPage();
- }
-
- public GroupListScreen(String params) {
- this();
- for (String kvPair : params.split("[,;&]")) {
- String[] kv = kvPair.split("=", 2);
- if (kv.length != 2 || kv[0].isEmpty()) {
- continue;
- }
-
- if ("filter".equals(kv[0])) {
- match = URL.decodeQueryString(kv[1]);
- }
-
- if ("skip".equals(kv[0]) && URL.decodeQueryString(kv[1]).matches("^[\\d]+")) {
- start = Integer.parseInt(URL.decodeQueryString(kv[1]));
- }
- }
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- query = new Query(match).start(start).run();
- }
-
- private void setupNavigationLink(Hyperlink link, String filter, int skip) {
- link.setTargetHistoryToken(getTokenForScreen(filter, skip));
- link.setVisible(true);
- }
-
- private String getTokenForScreen(String filter, int skip) {
- String token = ADMIN_GROUPS;
- if (filter != null && !filter.isEmpty()) {
- token += "?filter=" + URL.encodeQueryString(filter);
- }
- if (skip > 0) {
- if (token.contains("?filter=")) {
- token += ",";
- } else {
- token += "?";
- }
- token += "skip=" + skip;
- }
- return token;
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- setPageTitle(AdminConstants.I.groupListTitle());
- initPageHeader();
-
- prev = PagingHyperlink.createPrev();
- prev.setVisible(false);
-
- next = PagingHyperlink.createNext();
- next.setVisible(false);
-
- groups = new GroupTable(PageLinks.ADMIN_GROUPS);
- add(groups);
-
- final HorizontalPanel buttons = new HorizontalPanel();
- buttons.setStyleName(Gerrit.RESOURCES.css().changeTablePrevNextLinks());
- buttons.add(prev);
- buttons.add(next);
- add(buttons);
- }
-
- private void initPageHeader() {
- final HorizontalPanel hp = new HorizontalPanel();
- hp.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel());
- final Label filterLabel = new Label(AdminConstants.I.projectFilter());
- filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel());
- hp.add(filterLabel);
- filterTxt = new NpTextBox();
- filterTxt.setValue(match);
- filterTxt.addKeyUpHandler(
- new KeyUpHandler() {
- @Override
- public void onKeyUp(KeyUpEvent event) {
- Query q =
- new Query(filterTxt.getValue())
- .open(event.getNativeKeyCode() == KeyCodes.KEY_ENTER);
- if (match.equals(q.qMatch)) {
- q.start(start);
- }
- if (q.open || !match.equals(q.qMatch)) {
- if (query == null) {
- q.run();
- }
- query = q;
- }
- }
- });
- hp.add(filterTxt);
- add(hp);
- }
-
- @Override
- public void onShowView() {
- super.onShowView();
- if (match != null) {
- filterTxt.setCursorPos(match.length());
- }
- filterTxt.setFocus(true);
- }
-
- @Override
- public void registerKeys() {
- super.registerKeys();
- groups.setRegisterKeys(true);
- }
-
- private class Query {
- private final String qMatch;
- private int qStart;
- private boolean open;
-
- Query(String match) {
- this.qMatch = match;
- }
-
- Query start(int start) {
- this.qStart = start;
- return this;
- }
-
- Query open(boolean open) {
- this.open = open;
- return this;
- }
-
- Query run() {
- int limit = open ? 1 : pageSize + 1;
- GroupMap.match(
- qMatch,
- limit,
- qStart,
- new GerritCallback<GroupMap>() {
- @Override
- public void onSuccess(GroupMap result) {
- if (!isAttached()) {
- // View has been disposed.
- } else if (query == Query.this) {
- query = null;
- showMap(result);
- } else {
- query.run();
- }
- }
- });
- return this;
- }
-
- private void showMap(GroupMap result) {
- if (open && !result.isEmpty()) {
- Gerrit.display(PageLinks.toGroup(result.values().get(0).getGroupUUID()));
- return;
- }
-
- setToken(getTokenForScreen(qMatch, qStart));
- GroupListScreen.this.match = qMatch;
- GroupListScreen.this.start = qStart;
-
- if (result.size() <= pageSize) {
- groups.display(result, qMatch);
- next.setVisible(false);
- } else {
- groups.displaySubset(result, 0, result.size() - 1, qMatch);
- setupNavigationLink(next, qMatch, qStart + pageSize);
- }
-
- if (qStart > 0) {
- setupNavigationLink(prev, qMatch, qStart - pageSize);
- } else {
- prev.setVisible(false);
- }
-
- if (!isCurrentView()) {
- display();
- }
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/GroupReferenceBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/GroupReferenceBox.java
deleted file mode 100644
index db138a9..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/GroupReferenceBox.java
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright (C) 2011 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.client.admin;
-
-import com.google.gerrit.client.ui.AccountGroupSuggestOracle;
-import com.google.gerrit.client.ui.RemoteSuggestBox;
-import com.google.gerrit.common.data.GroupReference;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.editor.client.LeafValueEditor;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.event.logical.shared.HasCloseHandlers;
-import com.google.gwt.event.logical.shared.HasSelectionHandlers;
-import com.google.gwt.event.logical.shared.SelectionEvent;
-import com.google.gwt.event.logical.shared.SelectionHandler;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.Focusable;
-
-public class GroupReferenceBox extends Composite
- implements LeafValueEditor<GroupReference>,
- HasSelectionHandlers<GroupReference>,
- HasCloseHandlers<GroupReferenceBox>,
- Focusable {
- private final AccountGroupSuggestOracle oracle;
- private final RemoteSuggestBox suggestBox;
-
- public GroupReferenceBox() {
- oracle = new AccountGroupSuggestOracle();
- suggestBox = new RemoteSuggestBox(oracle);
- initWidget(suggestBox);
-
- suggestBox.addSelectionHandler(
- new SelectionHandler<String>() {
- @Override
- public void onSelection(SelectionEvent<String> event) {
- SelectionEvent.fire(GroupReferenceBox.this, toValue(event.getSelectedItem()));
- }
- });
- suggestBox.addCloseHandler(
- new CloseHandler<RemoteSuggestBox>() {
- @Override
- public void onClose(CloseEvent<RemoteSuggestBox> event) {
- suggestBox.setText("");
- CloseEvent.fire(GroupReferenceBox.this, GroupReferenceBox.this);
- }
- });
- }
-
- public void setVisibleLength(int len) {
- suggestBox.setVisibleLength(len);
- }
-
- @Override
- public HandlerRegistration addSelectionHandler(SelectionHandler<GroupReference> handler) {
- return addHandler(handler, SelectionEvent.getType());
- }
-
- @Override
- public HandlerRegistration addCloseHandler(CloseHandler<GroupReferenceBox> handler) {
- return addHandler(handler, CloseEvent.getType());
- }
-
- @Override
- public GroupReference getValue() {
- return toValue(suggestBox.getText());
- }
-
- private GroupReference toValue(String name) {
- if (name != null && !name.isEmpty()) {
- return new GroupReference(oracle.getUUID(name), name);
- }
- return null;
- }
-
- @Override
- public void setValue(GroupReference value) {
- suggestBox.setText(value != null ? value.getName() : "");
- }
-
- @Override
- public int getTabIndex() {
- return suggestBox.getTabIndex();
- }
-
- @Override
- public void setTabIndex(int index) {
- suggestBox.setTabIndex(index);
- }
-
- @Override
- public void setFocus(boolean focused) {
- suggestBox.setFocus(focused);
- }
-
- @Override
- public void setAccessKey(char key) {
- suggestBox.setAccessKey(key);
- }
-
- public void setProject(Project.NameKey projectName) {
- oracle.setProject(projectName);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/GroupTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/GroupTable.java
deleted file mode 100644
index be0db41..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/GroupTable.java
+++ /dev/null
@@ -1,151 +0,0 @@
-// Copyright (C) 2008 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.client.admin;
-
-import static java.util.Comparator.comparing;
-
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.groups.GroupList;
-import com.google.gerrit.client.groups.GroupMap;
-import com.google.gerrit.client.info.GroupInfo;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.HighlightingInlineHyperlink;
-import com.google.gerrit.client.ui.NavigationTable;
-import com.google.gerrit.client.ui.Util;
-import com.google.gerrit.common.PageLinks;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.History;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
-import com.google.gwt.user.client.ui.HTMLTable.Cell;
-import com.google.gwt.user.client.ui.Image;
-import java.util.List;
-
-public class GroupTable extends NavigationTable<GroupInfo> {
- private static final int NUM_COLS = 3;
-
- public GroupTable() {
- this(null);
- }
-
- public GroupTable(String pointerId) {
- super(AdminConstants.I.groupItemHelp());
- setSavePointerId(pointerId);
-
- table.setText(0, 1, AdminConstants.I.columnGroupName());
- table.setText(0, 2, AdminConstants.I.columnGroupDescription());
- table.setText(0, 3, AdminConstants.I.columnGroupVisibleToAll());
- table.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- final Cell cell = table.getCellForEvent(event);
- if (cell != null
- && cell.getCellIndex() != 1
- && getRowItem(cell.getRowIndex()) != null) {
- movePointerTo(cell.getRowIndex());
- }
- }
- });
-
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- for (int i = 1; i <= NUM_COLS; i++) {
- fmt.addStyleName(0, i, Gerrit.RESOURCES.css().dataHeader());
- }
- }
-
- @Override
- protected Object getRowItemKey(GroupInfo item) {
- return item.getGroupId();
- }
-
- @Override
- protected void onOpenRow(int row) {
- GroupInfo groupInfo = getRowItem(row);
- if (isInteralGroup(groupInfo)) {
- History.newItem(Dispatcher.toGroup(groupInfo.getGroupId()));
- } else if (groupInfo.url() != null) {
- Window.open(groupInfo.url(), "_self", null);
- }
- }
-
- public void display(GroupMap groups, String toHighlight) {
- display(Natives.asList(groups.values()), toHighlight);
- }
-
- public void display(GroupList groups) {
- display(Natives.asList(groups), null);
- }
-
- public void display(List<GroupInfo> list, String toHighlight) {
- displaySubset(list, toHighlight, 0, list.size());
- }
-
- public void displaySubset(GroupMap groups, int fromIndex, int toIndex, String toHighlight) {
- displaySubset(Natives.asList(groups.values()), toHighlight, fromIndex, toIndex);
- }
-
- public void displaySubset(List<GroupInfo> list, String toHighlight, int fromIndex, int toIndex) {
- while (1 < table.getRowCount()) {
- table.removeRow(table.getRowCount() - 1);
- }
-
- list.sort(comparing(GroupInfo::name));
- for (GroupInfo group : list.subList(fromIndex, toIndex)) {
- final int row = table.getRowCount();
- table.insertRow(row);
- applyDataRowStyle(row);
- populate(row, group, toHighlight);
- }
- }
-
- void populate(int row, GroupInfo k, String toHighlight) {
- if (k.url() != null) {
- if (isInteralGroup(k)) {
- table.setWidget(
- row,
- 1,
- new HighlightingInlineHyperlink(
- k.name(), Dispatcher.toGroup(k.getGroupId()), toHighlight));
- } else {
- Anchor link = new Anchor();
- link.setHTML(Util.highlight(k.name(), toHighlight));
- link.setHref(k.url());
- table.setWidget(row, 1, link);
- }
- } else {
- table.setHTML(row, 1, Util.highlight(k.name(), toHighlight));
- }
- table.setText(row, 2, k.description());
- if (k.options().isVisibleToAll()) {
- table.setWidget(row, 3, new Image(Gerrit.RESOURCES.greenCheck()));
- }
-
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().groupName());
- for (int i = 1; i <= NUM_COLS; i++) {
- fmt.addStyleName(row, i, Gerrit.RESOURCES.css().dataCell());
- }
-
- setRowItem(row, k);
- }
-
- private boolean isInteralGroup(GroupInfo groupInfo) {
- return groupInfo != null && groupInfo.url().startsWith("#" + PageLinks.ADMIN_GROUPS);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PaginatedProjectScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PaginatedProjectScreen.java
deleted file mode 100644
index 75c3cb6..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PaginatedProjectScreen.java
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (C) 2015 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.client.admin;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.ui.Hyperlink;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.http.client.URL;
-
-abstract class PaginatedProjectScreen extends ProjectScreen {
- protected int pageSize;
- protected String match = "";
- protected int start;
-
- PaginatedProjectScreen(Project.NameKey toShow) {
- super(toShow);
- pageSize = Gerrit.getUserPreferences().changesPerPage();
- }
-
- protected void parseToken(String token) {
- for (String kvPair : token.split("[,;&/?]")) {
- String[] kv = kvPair.split("=", 2);
- if (kv.length != 2 || kv[0].isEmpty()) {
- continue;
- }
-
- if ("filter".equals(kv[0])) {
- match = URL.decodeQueryString(kv[1]);
- }
-
- if ("skip".equals(kv[0]) && URL.decodeQueryString(kv[1]).matches("^[\\d]+")) {
- start = Integer.parseInt(URL.decodeQueryString(kv[1]));
- }
- }
- }
-
- protected void parseToken() {
- parseToken(getToken());
- }
-
- protected String getTokenForScreen(String filter, int skip) {
- String token = getScreenToken();
- if (filter != null && !filter.isEmpty()) {
- token += "?filter=" + URL.encodeQueryString(filter);
- }
- if (skip > 0) {
- if (token.contains("?filter=")) {
- token += ",";
- } else {
- token += "?";
- }
- token += "skip=" + skip;
- }
- return token;
- }
-
- protected abstract String getScreenToken();
-
- protected void setupNavigationLink(Hyperlink link, String filter, int skip) {
- link.setTargetHistoryToken(getTokenForScreen(filter, skip));
- link.setVisible(true);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionEditor.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionEditor.java
deleted file mode 100644
index 39dadcc..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionEditor.java
+++ /dev/null
@@ -1,329 +0,0 @@
-// Copyright (C) 2011 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.client.admin;
-
-import com.google.gerrit.client.ErrorDialog;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.groups.GroupMap;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.common.data.AccessSection;
-import com.google.gerrit.common.data.GlobalCapability;
-import com.google.gerrit.common.data.GroupInfo;
-import com.google.gerrit.common.data.GroupReference;
-import com.google.gerrit.common.data.LabelType;
-import com.google.gerrit.common.data.LabelTypes;
-import com.google.gerrit.common.data.Permission;
-import com.google.gerrit.common.data.PermissionRange;
-import com.google.gerrit.common.data.PermissionRule;
-import com.google.gerrit.common.data.ProjectAccess;
-import com.google.gerrit.common.data.RefConfigSection;
-import com.google.gerrit.reviewdb.client.AccountGroup;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.core.client.Scheduler.ScheduledCommand;
-import com.google.gwt.dom.client.DivElement;
-import com.google.gwt.dom.client.Style.Display;
-import com.google.gwt.editor.client.Editor;
-import com.google.gwt.editor.client.EditorDelegate;
-import com.google.gwt.editor.client.ValueAwareEditor;
-import com.google.gwt.editor.client.adapters.EditorSource;
-import com.google.gwt.editor.client.adapters.ListEditor;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.MouseOutEvent;
-import com.google.gwt.event.dom.client.MouseOverEvent;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.SelectionEvent;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.ValueLabel;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-public class PermissionEditor extends Composite
- implements Editor<Permission>, ValueAwareEditor<Permission> {
- interface Binder extends UiBinder<HTMLPanel, PermissionEditor> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- @UiField(provided = true)
- @Path("name")
- ValueLabel<String> normalName;
-
- @UiField(provided = true)
- @Path("name")
- ValueLabel<String> deletedName;
-
- @UiField CheckBox exclusiveGroup;
-
- @UiField FlowPanel ruleContainer;
- ListEditor<PermissionRule, PermissionRuleEditor> rules;
-
- @UiField DivElement addContainer;
- @UiField DivElement addStage1;
- @UiField DivElement addStage2;
- @UiField Anchor beginAddRule;
- @UiField @Editor.Ignore GroupReferenceBox groupToAdd;
- @UiField Button addRule;
-
- @UiField Anchor deletePermission;
-
- @UiField DivElement normal;
- @UiField DivElement deleted;
-
- private final Project.NameKey projectName;
- private final Map<AccountGroup.UUID, GroupInfo> groupInfo;
- private final boolean readOnly;
- private final AccessSection section;
- private final LabelTypes labelTypes;
- private Permission value;
- private PermissionRange.WithDefaults validRange;
- private boolean isDeleted;
-
- public PermissionEditor(
- ProjectAccess projectAccess, boolean readOnly, AccessSection section, LabelTypes labelTypes) {
- this.readOnly = readOnly;
- this.section = section;
- this.projectName = projectAccess.getProjectName();
- this.groupInfo = projectAccess.getGroupInfo();
- this.labelTypes = labelTypes;
-
- PermissionNameRenderer nameRenderer =
- new PermissionNameRenderer(projectAccess.getCapabilities());
- normalName = new ValueLabel<>(nameRenderer);
- deletedName = new ValueLabel<>(nameRenderer);
-
- initWidget(uiBinder.createAndBindUi(this));
- groupToAdd.setProject(projectName);
- rules = ListEditor.of(new RuleEditorSource());
-
- exclusiveGroup.setEnabled(!readOnly);
- exclusiveGroup.setVisible(RefConfigSection.isValid(section.getName()));
-
- if (readOnly) {
- addContainer.removeFromParent();
- addContainer = null;
-
- deletePermission.removeFromParent();
- deletePermission = null;
- }
- }
-
- @UiHandler("deletePermission")
- void onDeleteHover(@SuppressWarnings("unused") MouseOverEvent event) {
- addStyleName(AdminResources.I.css().deleteSectionHover());
- }
-
- @UiHandler("deletePermission")
- void onDeleteNonHover(@SuppressWarnings("unused") MouseOutEvent event) {
- removeStyleName(AdminResources.I.css().deleteSectionHover());
- }
-
- @UiHandler("deletePermission")
- void onDeletePermission(@SuppressWarnings("unused") ClickEvent event) {
- isDeleted = true;
- normal.getStyle().setDisplay(Display.NONE);
- deleted.getStyle().setDisplay(Display.BLOCK);
- }
-
- @UiHandler("undoDelete")
- void onUndoDelete(@SuppressWarnings("unused") ClickEvent event) {
- isDeleted = false;
- deleted.getStyle().setDisplay(Display.NONE);
- normal.getStyle().setDisplay(Display.BLOCK);
- }
-
- @UiHandler("beginAddRule")
- void onBeginAddRule(@SuppressWarnings("unused") ClickEvent event) {
- beginAddRule();
- }
-
- void beginAddRule() {
- addStage1.getStyle().setDisplay(Display.NONE);
- addStage2.getStyle().setDisplay(Display.BLOCK);
-
- Scheduler.get()
- .scheduleDeferred(
- new ScheduledCommand() {
- @Override
- public void execute() {
- groupToAdd.setFocus(true);
- }
- });
- }
-
- @UiHandler("addRule")
- void onAddGroupByClick(@SuppressWarnings("unused") ClickEvent event) {
- GroupReference ref = groupToAdd.getValue();
- if (ref != null) {
- addGroup(ref);
- } else {
- groupToAdd.setFocus(true);
- }
- }
-
- @UiHandler("groupToAdd")
- void onAddGroupByEnter(SelectionEvent<GroupReference> event) {
- GroupReference ref = event.getSelectedItem();
- if (ref != null) {
- addGroup(ref);
- }
- }
-
- @UiHandler("groupToAdd")
- void onAbortAddGroup(@SuppressWarnings("unused") CloseEvent<GroupReferenceBox> event) {
- hideAddGroup();
- }
-
- @UiHandler("hideAddGroup")
- void hideAddGroup(@SuppressWarnings("unused") ClickEvent event) {
- hideAddGroup();
- }
-
- private void hideAddGroup() {
- addStage1.getStyle().setDisplay(Display.BLOCK);
- addStage2.getStyle().setDisplay(Display.NONE);
- }
-
- private void addGroup(GroupReference ref) {
- if (ref.getUUID() != null) {
- if (value.getRule(ref) == null) {
- PermissionRule newRule = value.getRule(ref, true);
- if (validRange != null) {
- int min = validRange.getDefaultMin();
- int max = validRange.getDefaultMax();
- newRule.setRange(min, max);
-
- } else if (GlobalCapability.PRIORITY.equals(value.getName())) {
- newRule.setAction(PermissionRule.Action.BATCH);
- }
-
- rules.getList().add(newRule);
- }
- groupToAdd.setValue(null);
- groupToAdd.setFocus(true);
-
- } else {
- // If the oracle didn't get to complete a UUID, resolve it now.
- //
- addRule.setEnabled(false);
- GroupMap.suggestAccountGroupForProject(
- projectName.get(),
- ref.getName(),
- 1,
- new GerritCallback<GroupMap>() {
- @Override
- public void onSuccess(GroupMap result) {
- addRule.setEnabled(true);
- if (result.values().length() == 1) {
- addGroup(
- new GroupReference(
- result.values().get(0).getGroupUUID(), result.values().get(0).name()));
- } else {
- groupToAdd.setFocus(true);
- new ErrorDialog(Gerrit.M.noSuchGroupMessage(ref.getName())).center();
- }
- }
-
- @Override
- public void onFailure(Throwable caught) {
- addRule.setEnabled(true);
- super.onFailure(caught);
- }
- });
- }
- }
-
- boolean isDeleted() {
- return isDeleted;
- }
-
- @Override
- public void setValue(Permission value) {
- this.value = value;
-
- if (Permission.hasRange(value.getName())) {
- LabelType lt = labelTypes.byLabel(value.getLabel());
- if (lt != null) {
- validRange =
- new PermissionRange.WithDefaults(
- value.getName(),
- lt.getMin().getValue(),
- lt.getMax().getValue(),
- lt.getMin().getValue(),
- lt.getMax().getValue());
- }
- } else if (GlobalCapability.isGlobalCapability(value.getName())) {
- validRange = GlobalCapability.getRange(value.getName());
-
- } else {
- validRange = null;
- }
-
- if (Permission.OWNER.equals(value.getName())) {
- exclusiveGroup.setEnabled(false);
- } else {
- exclusiveGroup.setEnabled(!readOnly);
- }
- }
-
- @Override
- public void flush() {
- List<PermissionRule> src = rules.getList();
- List<PermissionRule> keep = new ArrayList<>(src.size());
-
- for (int i = 0; i < src.size(); i++) {
- PermissionRuleEditor e = (PermissionRuleEditor) ruleContainer.getWidget(i);
- if (!e.isDeleted()) {
- keep.add(src.get(i));
- }
- }
- value.setRules(keep);
- }
-
- @Override
- public void onPropertyChange(String... paths) {}
-
- @Override
- public void setDelegate(EditorDelegate<Permission> delegate) {}
-
- private class RuleEditorSource extends EditorSource<PermissionRuleEditor> {
- @Override
- public PermissionRuleEditor create(int index) {
- PermissionRuleEditor subEditor =
- new PermissionRuleEditor(readOnly, groupInfo, section, value, validRange);
- ruleContainer.insert(subEditor, index);
- return subEditor;
- }
-
- @Override
- public void dispose(PermissionRuleEditor subEditor) {
- subEditor.removeFromParent();
- }
-
- @Override
- public void setIndex(PermissionRuleEditor subEditor, int index) {
- ruleContainer.insert(subEditor, index);
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionEditor.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionEditor.ui.xml
deleted file mode 100644
index 00c41dc..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionEditor.ui.xml
+++ /dev/null
@@ -1,146 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2011 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:e='urn:import:com.google.gwt.editor.ui.client'
- xmlns:my='urn:import:com.google.gerrit.client.admin'
- ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat'
- ui:generateKeys='com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator'
- ui:generateLocales='default,en'
- >
-<ui:with field='res' type='com.google.gerrit.client.admin.AdminResources'/>
-<ui:style gss='false'>
- @eval selectionColor com.google.gerrit.client.Gerrit.getTheme().selectionColor;
- @eval backgroundColor com.google.gerrit.client.Gerrit.getTheme().backgroundColor;
-
- .panel {
- position: relative;
- }
-
- .normal {
- border: 1px solid backgroundColor;
- margin-top: -1px;
- margin-bottom: -1px;
- }
-
- .header {
- position: relative;
- padding-left: 5px;
- padding-right: 5px;
- padding-bottom: 1px;
- white-space: nowrap;
- }
-
- .header:hover {
- background-color: selectionColor;
- }
-
- .name {
- font-style: italic;
- }
-
- .exclusiveGroup {
- position: absolute;
- top: 0;
- right: 36px;
- width: 7em;
- font-size: 80%;
- }
-
- .addContainer {
- padding-left: 10px;
- position: relative;
- }
- .addContainer:hover {
- background-color: selectionColor;
- }
- .addLink {
- font-size: 80%;
- }
-
- .deleteIcon {
- position: absolute;
- top: 1px;
- right: 12px;
- }
-</ui:style>
-
-<g:HTMLPanel stylePrimaryName='{style.panel}'>
-<div ui:field='normal' class='{style.normal}'>
- <div class='{style.header}'>
- <g:ValueLabel styleName='{style.name}' ui:field='normalName'/>
- <g:CheckBox
- ui:field='exclusiveGroup'
- addStyleNames='{style.exclusiveGroup}'
- text='Exclusive'>
- <ui:attribute name='text'/>
- </g:CheckBox>
- <g:Anchor
- ui:field='deletePermission'
- href='javascript:void'
- styleName='{style.deleteIcon} {res.css.deleteIcon}'
- title='Delete this permission (and nested rules)'>
- <ui:attribute name='title'/>
- </g:Anchor>
- </div>
- <g:FlowPanel ui:field='ruleContainer'/>
- <div ui:field='addContainer' class='{style.addContainer}'>
- <div ui:field='addStage1'>
- <g:Anchor
- ui:field='beginAddRule'
- styleName='{style.addLink}'
- href='javascript:void'
- text='Add Group'>
- <ui:attribute name='text'/>
- </g:Anchor>
- </div>
- <div ui:field='addStage2' style='display: none'>
- <ui:msg>Group Name: <my:GroupReferenceBox
- ui:field='groupToAdd'
- visibleLength='45'/></ui:msg>
- <g:Button
- ui:field='addRule'
- text='Add'>
- <ui:attribute name='text'/>
- </g:Button>
- <g:Anchor
- ui:field='hideAddGroup'
- href='javascript:void'
- styleName='{style.deleteIcon} {res.css.deleteIcon}'
- title='Cancel additional group'>
- <ui:attribute name='title'/>
- </g:Anchor>
- </div>
- </div>
-</div>
-
-<div
- ui:field='deleted'
- class='{res.css.deleted} {res.css.deletedBorder}'
- style='display: none'>
- <ui:msg>Permission <g:ValueLabel styleName='{style.name}' ui:field='deletedName'/> was deleted</ui:msg>
- <g:Anchor
- ui:field='undoDelete'
- href='javascript:void'
- styleName='{style.deleteIcon} {res.css.undoIcon}'
- title='Undo deletion'>
- <ui:attribute name='title'/>
- </g:Anchor>
-</div>
-</g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionNameRenderer.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionNameRenderer.java
deleted file mode 100644
index ef02bd0..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionNameRenderer.java
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright (C) 2011 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.client.admin;
-
-import com.google.gerrit.common.data.Permission;
-import com.google.gwt.text.shared.Renderer;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
-class PermissionNameRenderer implements Renderer<String> {
- private static final Map<String, String> permissions;
-
- static {
- permissions = new HashMap<>();
- for (Map.Entry<String, String> e : AdminConstants.I.permissionNames().entrySet()) {
- permissions.put(e.getKey(), e.getValue());
- permissions.put(e.getKey().toLowerCase(), e.getValue());
- }
- }
-
- private final Map<String, String> fromServer;
-
- PermissionNameRenderer(Map<String, String> allFromOutside) {
- fromServer = allFromOutside;
- }
-
- @Override
- public String render(String varName) {
- if (Permission.isLabelAs(varName)) {
- return AdminMessages.I.labelAs(Permission.extractLabel(varName));
- } else if (Permission.isLabel(varName)) {
- return AdminMessages.I.label(Permission.extractLabel(varName));
- }
-
- String desc = permissions.get(varName);
- if (desc != null) {
- return desc;
- }
-
- desc = fromServer.get(varName);
- if (desc != null) {
- return desc;
- }
-
- desc = permissions.get(varName.toLowerCase());
- if (desc != null) {
- return desc;
- }
-
- desc = fromServer.get(varName.toLowerCase());
- if (desc != null) {
- return desc;
- }
- return varName;
- }
-
- @Override
- public void render(String object, Appendable appendable) throws IOException {
- appendable.append(render(object));
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionRuleEditor.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionRuleEditor.java
deleted file mode 100644
index 16dd167..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionRuleEditor.java
+++ /dev/null
@@ -1,258 +0,0 @@
-// Copyright (C) 2011 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.client.admin;
-
-import static com.google.gerrit.common.data.Permission.EDIT_TOPIC_NAME;
-import static com.google.gerrit.common.data.Permission.PUSH;
-
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.common.data.AccessSection;
-import com.google.gerrit.common.data.GlobalCapability;
-import com.google.gerrit.common.data.GroupInfo;
-import com.google.gerrit.common.data.GroupReference;
-import com.google.gerrit.common.data.Permission;
-import com.google.gerrit.common.data.PermissionRange;
-import com.google.gerrit.common.data.PermissionRule;
-import com.google.gerrit.reviewdb.client.AccountGroup;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.DivElement;
-import com.google.gwt.dom.client.SpanElement;
-import com.google.gwt.dom.client.Style.Display;
-import com.google.gwt.editor.client.Editor;
-import com.google.gwt.editor.client.EditorDelegate;
-import com.google.gwt.editor.client.ValueAwareEditor;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.text.shared.Renderer;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwt.user.client.ui.ValueListBox;
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-public class PermissionRuleEditor extends Composite
- implements Editor<PermissionRule>, ValueAwareEditor<PermissionRule> {
- interface Binder extends UiBinder<HTMLPanel, PermissionRuleEditor> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- @UiField(provided = true)
- ValueListBox<PermissionRule.Action> action;
-
- @UiField(provided = true)
- RangeBox min;
-
- @UiField(provided = true)
- RangeBox max;
-
- @UiField CheckBox force;
-
- @UiField Anchor groupNameLink;
- @UiField SpanElement groupNameSpan;
- @UiField SpanElement deletedGroupName;
-
- @UiField Anchor deleteRule;
-
- @UiField DivElement normal;
- @UiField DivElement deleted;
-
- @UiField SpanElement rangeEditor;
-
- private Map<AccountGroup.UUID, GroupInfo> groupInfo;
- private boolean isDeleted;
- private HandlerRegistration clickHandler;
-
- public PermissionRuleEditor(
- boolean readOnly,
- Map<AccountGroup.UUID, GroupInfo> groupInfo,
- AccessSection section,
- Permission permission,
- PermissionRange.WithDefaults validRange) {
- this.groupInfo = groupInfo;
- action = new ValueListBox<>(actionRenderer);
-
- if (validRange != null && 10 < validRange.getRangeSize()) {
- min = new RangeBox.Box();
- max = new RangeBox.Box();
-
- } else if (validRange != null) {
- RangeBox.List minList = new RangeBox.List();
- RangeBox.List maxList = new RangeBox.List();
- List<Integer> valueList = validRange.getValuesAsList();
-
- minList.list.setValue(validRange.getMin());
- maxList.list.setValue(validRange.getMax());
-
- minList.list.setAcceptableValues(valueList);
- maxList.list.setAcceptableValues(valueList);
-
- min = minList;
- max = maxList;
-
- action.setAcceptableValues(
- Arrays.asList(
- PermissionRule.Action.ALLOW,
- PermissionRule.Action.DENY,
- PermissionRule.Action.BLOCK));
-
- } else {
- min = new RangeBox.Box();
- max = new RangeBox.Box();
-
- if (GlobalCapability.PRIORITY.equals(permission.getName())) {
- action.setValue(PermissionRule.Action.INTERACTIVE);
- action.setAcceptableValues(
- Arrays.asList(PermissionRule.Action.INTERACTIVE, PermissionRule.Action.BATCH));
-
- } else {
- action.setValue(PermissionRule.Action.ALLOW);
- action.setAcceptableValues(
- Arrays.asList(
- PermissionRule.Action.ALLOW,
- PermissionRule.Action.DENY,
- PermissionRule.Action.BLOCK));
- }
- }
-
- initWidget(uiBinder.createAndBindUi(this));
-
- String name = permission.getName();
- boolean canForce = PUSH.equals(name);
- if (canForce) {
- String ref = section.getName();
- canForce = !ref.startsWith("refs/for/") && !ref.startsWith("^refs/for/");
- force.setText(PermissionRule.FORCE_PUSH);
- } else {
- canForce = EDIT_TOPIC_NAME.equals(name);
- force.setText(PermissionRule.FORCE_EDIT);
- }
- force.setVisible(canForce);
- force.setEnabled(!readOnly);
- action.getElement().setPropertyBoolean("disabled", readOnly);
-
- if (validRange != null) {
- min.setEnabled(!readOnly);
- max.setEnabled(!readOnly);
- } else {
- rangeEditor.getStyle().setDisplay(Display.NONE);
- }
-
- if (readOnly) {
- deleteRule.removeFromParent();
- deleteRule = null;
- }
-
- if (name.equals(GlobalCapability.BATCH_CHANGES_LIMIT)) {
- min.setEnabled(false);
- }
- }
-
- boolean isDeleted() {
- return isDeleted;
- }
-
- @UiHandler("deleteRule")
- void onDeleteRule(@SuppressWarnings("unused") ClickEvent event) {
- isDeleted = true;
- normal.getStyle().setDisplay(Display.NONE);
- deleted.getStyle().setDisplay(Display.BLOCK);
- }
-
- @UiHandler("undoDelete")
- void onUndoDelete(@SuppressWarnings("unused") ClickEvent event) {
- isDeleted = false;
- deleted.getStyle().setDisplay(Display.NONE);
- normal.getStyle().setDisplay(Display.BLOCK);
- }
-
- @Override
- public void setValue(PermissionRule value) {
- if (clickHandler != null) {
- clickHandler.removeHandler();
- clickHandler = null;
- }
-
- GroupReference ref = value.getGroup();
- GroupInfo info =
- groupInfo != null && ref.getUUID() != null ? groupInfo.get(ref.getUUID()) : null;
-
- boolean link;
- if (ref.getUUID() != null && AccountGroup.isInternalGroup(ref.getUUID())) {
- final String token = Dispatcher.toGroup(ref.getUUID());
- groupNameLink.setText(ref.getName());
- groupNameLink.setHref("#" + token);
- groupNameLink.setTitle(info != null ? info.getDescription() : null);
- groupNameLink.setTarget(null);
- clickHandler =
- groupNameLink.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- event.preventDefault();
- event.stopPropagation();
- Gerrit.display(token);
- }
- });
- link = true;
- } else if (info != null && info.getUrl() != null) {
- groupNameLink.setText(ref.getName());
- groupNameLink.setHref(info.getUrl());
- groupNameLink.setTitle(info.getDescription());
- groupNameLink.setTarget("_blank");
- link = true;
- } else {
- groupNameSpan.setInnerText(ref.getName());
- groupNameSpan.setTitle(ref.getUUID() != null ? ref.getUUID().get() : "");
- link = false;
- }
-
- deletedGroupName.setInnerText(ref.getName());
- groupNameLink.setVisible(link);
- UIObject.setVisible(groupNameSpan, !link);
- }
-
- @Override
- public void setDelegate(EditorDelegate<PermissionRule> delegate) {}
-
- @Override
- public void flush() {}
-
- @Override
- public void onPropertyChange(String... paths) {}
-
- private static class ActionRenderer implements Renderer<PermissionRule.Action> {
- @Override
- public String render(PermissionRule.Action object) {
- return object != null ? object.toString() : "";
- }
-
- @Override
- public void render(PermissionRule.Action object, Appendable appendable) throws IOException {
- appendable.append(render(object));
- }
- }
-
- private static final ActionRenderer actionRenderer = new ActionRenderer();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionRuleEditor.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionRuleEditor.ui.xml
deleted file mode 100644
index 644fef4..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PermissionRuleEditor.ui.xml
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2011 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:e='urn:import:com.google.gwt.editor.ui.client'
- xmlns:my='urn:import:com.google.gerrit.client.admin'
- xmlns:q='urn:import:com.google.gerrit.client.ui'
- ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat'
- ui:generateKeys='com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator'
- ui:generateLocales='default,en'
- >
-<ui:with field='res' type='com.google.gerrit.client.admin.AdminResources'/>
-<ui:style gss='false'>
- @eval selectionColor com.google.gerrit.client.Gerrit.getTheme().selectionColor;
-
- .panel {
- position: relative;
- height: 1.5em;
- }
-
- .panel:hover {
- background-color: selectionColor;
- }
-
- .normal {
- padding-left: 10px;
- white-space: nowrap;
- height: 100%;
- }
-
- .deleted {
- height: 100%;
- }
-
- .actionList, .minmax {
- font-size: 80%;
- }
-
- .forcePush {
- position: absolute;
- top: 0;
- right: 36px;
- width: 7em;
- font-size: 80%;
- }
-
- .deleteIcon {
- position: absolute;
- top: 2px;
- right: 11px;
- }
-
- .groupName {
- display: inline;
- }
-</ui:style>
-
-<g:HTMLPanel styleName='{style.panel}'>
-<div ui:field='normal' class='{style.normal}'>
- <g:ValueListBox ui:field='action' styleName='{style.actionList}'/>
- <span ui:field='rangeEditor'>
- <g:Widget ui:field='min' styleName='{style.minmax}'/>
- <g:Widget ui:field='max' styleName='{style.minmax}'/>
- </span>
-
- <g:Anchor ui:field='groupNameLink' styleName='{style.groupName}'/>
- <span ui:field='groupNameSpan' styleName='{style.groupName}'/>
- <g:CheckBox ui:field='force' addStyleNames='{style.forcePush}'/>
- <g:Anchor
- ui:field='deleteRule'
- href='javascript:void'
- styleName='{style.deleteIcon} {res.css.deleteIcon}'
- title='Delete this rule'>
- <ui:attribute name='title'/>
- </g:Anchor>
-</div>
-
-<div
- ui:field='deleted'
- class='{res.css.deleted} {style.deleted}'
- style='display: none'>
- <ui:msg>Group <span ui:field='deletedGroupName'/> was deleted</ui:msg>
- <g:Anchor
- ui:field='undoDelete'
- href='javascript:void'
- styleName='{style.deleteIcon} {res.css.undoIcon}'
- title='Undo deletion'>
- <ui:attribute name='title'/>
- </g:Anchor>
-</div>
-</g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PluginListScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PluginListScreen.java
deleted file mode 100644
index 381c644..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PluginListScreen.java
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright (C) 2012 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.client.admin;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.api.ExtensionScreen;
-import com.google.gerrit.client.plugins.PluginInfo;
-import com.google.gerrit.client.plugins.PluginMap;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.rpc.ScreenLoadCallback;
-import com.google.gerrit.client.ui.FancyFlexTable;
-import com.google.gerrit.client.ui.InlineHyperlink;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.ImageResourceRenderer;
-import com.google.gwt.user.client.ui.Panel;
-
-public class PluginListScreen extends PluginScreen {
-
- private Panel pluginPanel;
- private PluginTable pluginTable;
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- initPluginList();
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- PluginMap.all(
- new ScreenLoadCallback<PluginMap>(this) {
- @Override
- protected void preDisplay(PluginMap result) {
- pluginTable.display(result);
- }
- });
- }
-
- private void initPluginList() {
- pluginTable = new PluginTable();
- pluginTable.addStyleName(Gerrit.RESOURCES.css().pluginsTable());
-
- pluginPanel = new FlowPanel();
- pluginPanel.setWidth("500px");
- pluginPanel.add(pluginTable);
- add(pluginPanel);
- }
-
- private static class PluginTable extends FancyFlexTable<PluginInfo> {
- PluginTable() {
- table.setText(0, 1, AdminConstants.I.columnPluginName());
- table.setText(0, 2, AdminConstants.I.columnPluginSettings());
- table.setText(0, 3, AdminConstants.I.columnPluginVersion());
- table.setText(0, 4, AdminConstants.I.columnPluginStatus());
-
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 2, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 3, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 4, Gerrit.RESOURCES.css().dataHeader());
- }
-
- void display(PluginMap plugins) {
- while (1 < table.getRowCount()) {
- table.removeRow(table.getRowCount() - 1);
- }
-
- for (PluginInfo p : Natives.asList(plugins.values())) {
- final int row = table.getRowCount();
- table.insertRow(row);
- applyDataRowStyle(row);
- populate(row, p);
- }
- }
-
- void populate(int row, PluginInfo plugin) {
- if (plugin.disabled() || plugin.indexUrl() == null) {
- table.setText(row, 1, plugin.name());
- } else {
- table.setWidget(
- row, 1, new Anchor(plugin.name(), Gerrit.selfRedirect(plugin.indexUrl()), "_blank"));
-
- if (new ExtensionScreen(plugin.name() + "/settings").isFound()) {
- InlineHyperlink adminScreenLink = new InlineHyperlink();
- adminScreenLink.setHTML(new ImageResourceRenderer().render(Gerrit.RESOURCES.gear()));
- adminScreenLink.setTargetHistoryToken("/x/" + plugin.name() + "/settings");
- adminScreenLink.setTitle(AdminConstants.I.pluginSettingsToolTip());
- table.setWidget(row, 2, adminScreenLink);
- }
- }
-
- table.setText(row, 3, plugin.version());
- table.setText(
- row,
- 4,
- plugin.disabled() ? AdminConstants.I.pluginDisabled() : AdminConstants.I.pluginEnabled());
-
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 4, Gerrit.RESOURCES.css().dataCell());
-
- setRowItem(row, plugin);
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PluginScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PluginScreen.java
deleted file mode 100644
index 0909fe1..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/PluginScreen.java
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (C) 2012 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.client.admin;
-
-import com.google.gerrit.client.ui.Screen;
-
-public abstract class PluginScreen extends Screen {
-
- public PluginScreen() {
- setRequiresSignIn(true);
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- setPageTitle(AdminConstants.I.plugins());
- display();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessEditor.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessEditor.java
deleted file mode 100644
index a52ea60..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessEditor.java
+++ /dev/null
@@ -1,196 +0,0 @@
-// Copyright (C) 2011 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.client.admin;
-
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.ui.Hyperlink;
-import com.google.gerrit.client.ui.ParentProjectBox;
-import com.google.gerrit.common.data.AccessSection;
-import com.google.gerrit.common.data.ProjectAccess;
-import com.google.gerrit.common.data.WebLinkInfoCommon;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.DivElement;
-import com.google.gwt.dom.client.Style.Display;
-import com.google.gwt.editor.client.Editor;
-import com.google.gwt.editor.client.EditorDelegate;
-import com.google.gwt.editor.client.ValueAwareEditor;
-import com.google.gwt.editor.client.adapters.EditorSource;
-import com.google.gwt.editor.client.adapters.ListEditor;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.Image;
-import java.util.ArrayList;
-import java.util.List;
-
-public class ProjectAccessEditor extends Composite
- implements Editor<ProjectAccess>, ValueAwareEditor<ProjectAccess> {
- interface Binder extends UiBinder<HTMLPanel, ProjectAccessEditor> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- @UiField DivElement inheritsFrom;
-
- @UiField Hyperlink parentProject;
-
- @UiField @Editor.Ignore ParentProjectBox parentProjectBox;
-
- @UiField DivElement history;
-
- @UiField FlowPanel webLinkPanel;
-
- @UiField FlowPanel localContainer;
- ListEditor<AccessSection, AccessSectionEditor> local;
-
- @UiField Anchor addSection;
-
- private ProjectAccess value;
-
- private boolean editing;
-
- public ProjectAccessEditor() {
- initWidget(uiBinder.createAndBindUi(this));
- local = ListEditor.of(new Source(localContainer));
- }
-
- @UiHandler("addSection")
- void onAddSection(@SuppressWarnings("unused") ClickEvent event) {
- int index = local.getList().size();
- local.getList().add(new AccessSection("refs/heads/*"));
-
- AccessSectionEditor editor = local.getEditors().get(index);
- editor.enableEditing();
- editor.editRefPattern();
- }
-
- @Override
- public void setValue(ProjectAccess value) {
- // If the owner can edit the Global Capabilities but they don't exist in this
- // project, create an empty one at the beginning of the list making it
- // possible to add permissions to it.
- if (editing
- && value.isOwnerOf(AccessSection.GLOBAL_CAPABILITIES)
- && value.getLocal(AccessSection.GLOBAL_CAPABILITIES) == null) {
- value.getLocal().add(0, new AccessSection(AccessSection.GLOBAL_CAPABILITIES));
- }
-
- this.value = value;
-
- Project.NameKey parent = value.getInheritsFrom();
- if (parent != null) {
- inheritsFrom.getStyle().setDisplay(Display.BLOCK);
- parentProject.setText(parent.get());
- parentProject.setTargetHistoryToken( //
- Dispatcher.toProjectAdmin(parent, ProjectScreen.ACCESS));
-
- parentProjectBox.setVisible(editing);
- parentProjectBox.setProject(value.getProjectName());
- parentProjectBox.setParentProject(value.getInheritsFrom());
- parentProject.setVisible(!parentProjectBox.isVisible());
- } else {
- inheritsFrom.getStyle().setDisplay(Display.NONE);
- }
- setUpWebLinks();
-
- addSection.setVisible(editing && (!value.getOwnerOf().isEmpty() || value.canUpload()));
- }
-
- @Override
- public void flush() {
- List<AccessSection> src = local.getList();
- List<AccessSection> keep = new ArrayList<>(src.size());
-
- for (int i = 0; i < src.size(); i++) {
- AccessSectionEditor e = (AccessSectionEditor) localContainer.getWidget(i);
- if (!e.isDeleted() && !src.get(i).getPermissions().isEmpty()) {
- keep.add(src.get(i));
- }
- }
- value.setLocal(keep);
- value.setInheritsFrom(parentProjectBox.getParentProjectName());
- }
-
- @Override
- public void onPropertyChange(String... paths) {}
-
- @Override
- public void setDelegate(EditorDelegate<ProjectAccess> delegate) {}
-
- void setEditing(boolean editing) {
- this.editing = editing;
- addSection.setVisible(editing);
- }
-
- private void setUpWebLinks() {
- List<WebLinkInfoCommon> links = value.getFileHistoryLinks();
- if (!value.isConfigVisible() || links == null || links.isEmpty()) {
- history.getStyle().setDisplay(Display.NONE);
- return;
- }
- for (WebLinkInfoCommon link : links) {
- webLinkPanel.add(toAnchor(link));
- }
- }
-
- private static Anchor toAnchor(WebLinkInfoCommon info) {
- Anchor a = new Anchor();
- a.setHref(info.url);
- if (info.target != null && !info.target.isEmpty()) {
- a.setTarget(info.target);
- }
- if (info.imageUrl != null && !info.imageUrl.isEmpty()) {
- Image img = new Image();
- img.setAltText(info.name);
- img.setUrl(info.imageUrl);
- img.setTitle(info.name);
- a.getElement().appendChild(img.getElement());
- } else {
- a.setText("(" + info.name + ")");
- }
- return a;
- }
-
- private class Source extends EditorSource<AccessSectionEditor> {
- private final FlowPanel container;
-
- Source(FlowPanel container) {
- this.container = container;
- }
-
- @Override
- public AccessSectionEditor create(int index) {
- AccessSectionEditor subEditor = new AccessSectionEditor(value);
- subEditor.setEditing(editing);
- container.insert(subEditor, index);
- return subEditor;
- }
-
- @Override
- public void dispose(AccessSectionEditor subEditor) {
- subEditor.removeFromParent();
- }
-
- @Override
- public void setIndex(AccessSectionEditor subEditor, int index) {
- container.insert(subEditor, index);
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessEditor.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessEditor.ui.xml
deleted file mode 100644
index 7fbf70d..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessEditor.ui.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2011 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:q='urn:import:com.google.gerrit.client.ui'
- ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat'
- ui:generateKeys='com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator'
- ui:generateLocales='default,en'
- >
-<ui:style gss='false'>
- .inheritsFrom {
- margin-bottom: 0.5em;
- }
- .parentTitle {
- font-weight: bold;
- }
- .parentLink {
- display: inline;
- }
-
- .history {
- margin-bottom: 0.5em;
- }
- .historyTitle {
- font-weight: bold;
- }
- .webLinkPanel a {
- display: inline;
- }
- .webLinkPanel>a {
- margin-left:2px;
- }
-
- .addContainer {
- margin-top: 5px;
- }
- .addContainer:hover {
- background-color: selectionColor;
- }
-</ui:style>
-
-<g:HTMLPanel>
- <div ui:field='inheritsFrom' class='{style.inheritsFrom}'>
- <span class='{style.parentTitle}'><ui:msg>Rights Inherit From:</ui:msg></span>
- <q:Hyperlink ui:field='parentProject' styleName='{style.parentLink}'/>
- <q:ParentProjectBox
- ui:field='parentProjectBox'
- visible='false'/>
- </div>
- <div ui:field='history' class='{style.history}'>
- <span class='{style.historyTitle}'><ui:msg>History:</ui:msg></span>
- <td>
- <g:FlowPanel ui:field="webLinkPanel" styleName='{style.webLinkPanel}'/>
- </td>
- </div>
-
- <g:FlowPanel ui:field='localContainer'/>
- <div class='{style.addContainer}'>
- <g:Anchor
- ui:field='addSection'
- href='javascript:void'
- text='Add Reference'>
- <ui:attribute name='text'/>
- </g:Anchor>
- </div>
-</g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessScreen.java
deleted file mode 100644
index eb44bda..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessScreen.java
+++ /dev/null
@@ -1,312 +0,0 @@
-// Copyright (C) 2011 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.client.admin;
-
-import static com.google.gerrit.common.ProjectAccessUtil.mergeSections;
-import static com.google.gerrit.common.ProjectAccessUtil.removeEmptyPermissionsAndSections;
-
-import com.google.gerrit.client.ErrorDialog;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.config.CapabilityInfo;
-import com.google.gerrit.client.config.ConfigServerApi;
-import com.google.gerrit.client.rpc.CallbackGroup;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.rpc.ScreenLoadCallback;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.common.data.AccessSection;
-import com.google.gerrit.common.data.ProjectAccess;
-import com.google.gerrit.common.errors.UpdateParentFailedException;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.DivElement;
-import com.google.gwt.editor.client.SimpleBeanEditorDriver;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwtexpui.globalkey.client.NpTextArea;
-import com.google.gwtjsonrpc.client.RemoteJsonException;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-public class ProjectAccessScreen extends ProjectScreen {
- interface Binder extends UiBinder<HTMLPanel, ProjectAccessScreen> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- interface Driver
- extends SimpleBeanEditorDriver< //
- ProjectAccess, //
- ProjectAccessEditor> {}
-
- @UiField DivElement editTools;
-
- @UiField Button edit;
-
- @UiField Button cancel1;
-
- @UiField Button cancel2;
-
- @UiField VerticalPanel error;
-
- @UiField ProjectAccessEditor accessEditor;
-
- @UiField DivElement commitTools;
-
- @UiField NpTextArea commitMessage;
-
- @UiField Button commit;
-
- @UiField Button review;
-
- private Driver driver;
-
- private ProjectAccess access;
-
- private NativeMap<CapabilityInfo> capabilityMap;
-
- public ProjectAccessScreen(Project.NameKey toShow) {
- super(toShow);
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- add(uiBinder.createAndBindUi(this));
-
- driver = GWT.create(Driver.class);
- accessEditor.setEditing(false);
- driver.initialize(accessEditor);
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- CallbackGroup cbs = new CallbackGroup();
- ConfigServerApi.capabilities(
- cbs.add(
- new AsyncCallback<NativeMap<CapabilityInfo>>() {
- @Override
- public void onSuccess(NativeMap<CapabilityInfo> result) {
- capabilityMap = result;
- }
-
- @Override
- public void onFailure(Throwable caught) {
- // Handled by ScreenLoadCallback.onFailure().
- }
- }));
- Util.PROJECT_SVC.projectAccess(
- getProjectKey(),
- cbs.addFinal(
- new ScreenLoadCallback<ProjectAccess>(this) {
- @Override
- public void preDisplay(ProjectAccess access) {
- displayReadOnly(access);
- }
- }));
- savedPanel = ACCESS;
- }
-
- private void displayReadOnly(ProjectAccess access) {
- this.access = access;
- Map<String, String> allCapabilities = new HashMap<>();
- for (CapabilityInfo c : Natives.asList(capabilityMap.values())) {
- allCapabilities.put(c.id(), c.name());
- }
- this.access.setCapabilities(allCapabilities);
- accessEditor.setEditing(false);
- UIObject.setVisible(editTools, !access.getOwnerOf().isEmpty() || access.canUpload());
- edit.setEnabled(!access.getOwnerOf().isEmpty() || access.canUpload());
- cancel1.setVisible(false);
- UIObject.setVisible(commitTools, false);
- driver.edit(access);
- }
-
- @UiHandler("edit")
- void onEdit(@SuppressWarnings("unused") ClickEvent event) {
- resetEditors();
-
- edit.setEnabled(false);
- cancel1.setVisible(true);
- UIObject.setVisible(commitTools, true);
- commit.setVisible(!access.getOwnerOf().isEmpty());
- review.setVisible(access.canUpload());
- accessEditor.setEditing(true);
- driver.edit(access);
- }
-
- private void resetEditors() {
- // Push an empty instance through the driver before pushing the real
- // data. This will force GWT to delete and recreate the editors, which
- // is required to build initialize them as editable vs. read-only.
- ProjectAccess mock = new ProjectAccess();
- mock.setProjectName(access.getProjectName());
- mock.setRevision(access.getRevision());
- mock.setLocal(Collections.<AccessSection>emptyList());
- mock.setOwnerOf(Collections.<String>emptySet());
- driver.edit(mock);
- }
-
- @UiHandler(value = {"cancel1", "cancel2"})
- void onCancel(@SuppressWarnings("unused") ClickEvent event) {
- Gerrit.display(PageLinks.toProjectAcceess(getProjectKey()));
- }
-
- @UiHandler("commit")
- void onCommit(@SuppressWarnings("unused") ClickEvent event) {
- final ProjectAccess access = driver.flush();
-
- if (driver.hasErrors()) {
- Window.alert(AdminConstants.I.errorsMustBeFixed());
- return;
- }
-
- String message = commitMessage.getText().trim();
- if ("".equals(message)) {
- message = null;
- }
-
- enable(false);
- Util.PROJECT_SVC.changeProjectAccess( //
- getProjectKey(), //
- access.getRevision(), //
- message, //
- access.getLocal(), //
- access.getInheritsFrom(), //
- new GerritCallback<ProjectAccess>() {
- @Override
- public void onSuccess(ProjectAccess newAccess) {
- enable(true);
- commitMessage.setText("");
- error.clear();
- final Set<String> diffs = getDiffs(access, newAccess);
- if (diffs.isEmpty()) {
- displayReadOnly(newAccess);
- } else {
- error.add(new Label(Gerrit.C.projectAccessError()));
- for (String diff : diffs) {
- error.add(new Label(diff));
- }
- if (access.canUpload()) {
- error.add(new Label(Gerrit.C.projectAccessProposeForReviewHint()));
- }
- }
- }
-
- private Set<String> getDiffs(ProjectAccess wantedAccess, ProjectAccess newAccess) {
- List<AccessSection> wantedSections =
- mergeSections(removeEmptyPermissionsAndSections(wantedAccess.getLocal()));
- List<AccessSection> newSections =
- removeEmptyPermissionsAndSections(newAccess.getLocal());
- HashSet<AccessSection> same = new HashSet<>(wantedSections);
- HashSet<AccessSection> different =
- new HashSet<>(wantedSections.size() + newSections.size());
- different.addAll(wantedSections);
- different.addAll(newSections);
- same.retainAll(newSections);
- different.removeAll(same);
-
- Set<String> differentNames = new HashSet<>();
- for (AccessSection s : different) {
- differentNames.add(s.getName());
- }
- return differentNames;
- }
-
- @Override
- public void onFailure(Throwable caught) {
- error.clear();
- enable(true);
- if (caught instanceof RemoteJsonException
- && caught.getMessage().startsWith(UpdateParentFailedException.MESSAGE)) {
- new ErrorDialog(
- Gerrit.M.parentUpdateFailed(
- caught
- .getMessage()
- .substring(UpdateParentFailedException.MESSAGE.length() + 1)))
- .center();
- } else {
- super.onFailure(caught);
- }
- }
- });
- }
-
- @UiHandler("review")
- void onReview(@SuppressWarnings("unused") ClickEvent event) {
- final ProjectAccess access = driver.flush();
-
- if (driver.hasErrors()) {
- Window.alert(AdminConstants.I.errorsMustBeFixed());
- return;
- }
-
- String message = commitMessage.getText().trim();
- if ("".equals(message)) {
- message = null;
- }
-
- enable(false);
- Util.PROJECT_SVC.reviewProjectAccess( //
- getProjectKey(), //
- access.getRevision(), //
- message, //
- access.getLocal(), //
- access.getInheritsFrom(), //
- new GerritCallback<Change.Id>() {
- @Override
- public void onSuccess(Change.Id changeId) {
- enable(true);
- commitMessage.setText("");
- error.clear();
- if (changeId != null) {
- Gerrit.display(PageLinks.toChange(getProjectKey(), changeId));
- } else {
- displayReadOnly(access);
- }
- }
-
- @Override
- public void onFailure(Throwable caught) {
- error.clear();
- enable(true);
- super.onFailure(caught);
- }
- });
- }
-
- private void enable(boolean enabled) {
- commitMessage.setEnabled(enabled);
- commit.setEnabled(enabled && !access.getOwnerOf().isEmpty());
- review.setEnabled(enabled && access.canUpload());
- cancel1.setEnabled(enabled);
- cancel2.setEnabled(enabled);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessScreen.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessScreen.ui.xml
deleted file mode 100644
index 724c7a1..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectAccessScreen.ui.xml
+++ /dev/null
@@ -1,87 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2011 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:my='urn:import:com.google.gerrit.client.admin'
- xmlns:expui='urn:import:com.google.gwtexpui.globalkey.client'
- ui:generateFormat='com.google.gwt.i18n.rebind.format.PropertiesFormat'
- ui:generateKeys='com.google.gwt.i18n.rebind.keygen.MD5KeyGenerator'
- ui:generateLocales='default,en'
- >
-<ui:style gss='false'>
- @external .gwt-TextArea;
-
- .commitMessage {
- margin-top: 2em;
- }
- .commitMessage .gwt-TextArea {
- margin: 5px 5px 5px 5px;
- }
- .errorMessage {
- margin-top: 5px;
- margin-bottom: 5px;
- color: red;
- }
-</ui:style>
-
-<g:HTMLPanel>
- <div ui:field='editTools'>
- <g:Button
- ui:field='edit'
- text='Edit'>
- <ui:attribute name='text'/>
- </g:Button>
- <g:Button
- ui:field='cancel1'
- text='Cancel'>
- <ui:attribute name='text'/>
- </g:Button>
- </div>
- <my:ProjectAccessEditor ui:field='accessEditor'/>
- <div ui:field='commitTools'>
- <div class='{style.commitMessage}'>
- <ui:msg>Commit Message (optional):</ui:msg><br/>
- <expui:NpTextArea
- ui:field='commitMessage'
- visibleLines='4'
- characterWidth='60'
- spellCheck='true'
- />
- </div>
- <g:VerticalPanel
- styleName='{style.errorMessage}'
- ui:field='error'>
- </g:VerticalPanel>
- <g:Button
- ui:field='commit'
- text='Save Changes'>
- <ui:attribute name='text'/>
- </g:Button>
- <g:Button
- ui:field='review'
- text='Save for Review'>
- <ui:attribute name='text'/>
- </g:Button>
- <g:Button
- ui:field='cancel2'
- text='Cancel'>
- <ui:attribute name='text'/>
- </g:Button>
- </div>
-</g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectBranchesScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectBranchesScreen.java
deleted file mode 100644
index c6a391b..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectBranchesScreen.java
+++ /dev/null
@@ -1,673 +0,0 @@
-// Copyright (C) 2009 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.client.admin;
-
-import static com.google.gerrit.client.ui.Util.highlight;
-
-import com.google.gerrit.client.ConfirmationCallback;
-import com.google.gerrit.client.ConfirmationDialog;
-import com.google.gerrit.client.ErrorDialog;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.VoidResult;
-import com.google.gerrit.client.access.AccessMap;
-import com.google.gerrit.client.access.ProjectAccessInfo;
-import com.google.gerrit.client.actions.ActionButton;
-import com.google.gerrit.client.info.ActionInfo;
-import com.google.gerrit.client.info.WebLinkInfo;
-import com.google.gerrit.client.projects.BranchInfo;
-import com.google.gerrit.client.projects.ProjectApi;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.rpc.ScreenLoadCallback;
-import com.google.gerrit.client.ui.HintTextBox;
-import com.google.gerrit.client.ui.Hyperlink;
-import com.google.gerrit.client.ui.NavigationTable;
-import com.google.gerrit.client.ui.OnEditEnabler;
-import com.google.gerrit.client.ui.PagingHyperlink;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gerrit.reviewdb.client.RefNames;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.core.client.Scheduler.ScheduledCommand;
-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.dom.client.KeyUpEvent;
-import com.google.gwt.event.dom.client.KeyUpHandler;
-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.FlexCellFormatter;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Grid;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.InlineHTML;
-import com.google.gwt.user.client.ui.InlineLabel;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.TextBox;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.globalkey.client.NpTextBox;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public class ProjectBranchesScreen extends PaginatedProjectScreen {
- private Hyperlink prev;
- private Hyperlink next;
- private BranchesTable branchTable;
- private Button delBranch;
- private Button addBranch;
- private HintTextBox nameTxtBox;
- private HintTextBox irevTxtBox;
- private FlowPanel addPanel;
- private NpTextBox filterTxt;
- private Query query;
-
- public ProjectBranchesScreen(Project.NameKey toShow) {
- super(toShow);
- }
-
- @Override
- public String getScreenToken() {
- return PageLinks.toProjectBranches(getProjectKey());
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- addPanel.setVisible(false);
- AccessMap.get(
- getProjectKey(),
- new GerritCallback<ProjectAccessInfo>() {
- @Override
- public void onSuccess(ProjectAccessInfo result) {
- addPanel.setVisible(result.canAddRefs());
- }
- });
- query = new Query(match).start(start).run();
- savedPanel = BRANCHES;
- }
-
- private void updateForm() {
- branchTable.updateDeleteButton();
- addBranch.setEnabled(true);
- nameTxtBox.setEnabled(true);
- irevTxtBox.setEnabled(true);
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- initPageHeader();
-
- prev = PagingHyperlink.createPrev();
- prev.setVisible(false);
-
- next = PagingHyperlink.createNext();
- next.setVisible(false);
-
- addPanel = new FlowPanel();
-
- final Grid addGrid = new Grid(2, 2);
- addGrid.setStyleName(Gerrit.RESOURCES.css().addBranch());
- final int texBoxLength = 50;
-
- nameTxtBox = new HintTextBox();
- nameTxtBox.setVisibleLength(texBoxLength);
- nameTxtBox.setHintText(AdminConstants.I.defaultBranchName());
- nameTxtBox.addKeyPressHandler(
- new KeyPressHandler() {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
- doAddNewBranch();
- }
- }
- });
- addGrid.setText(0, 0, AdminConstants.I.columnBranchName() + ":");
- addGrid.setWidget(0, 1, nameTxtBox);
-
- irevTxtBox = new HintTextBox();
- irevTxtBox.setVisibleLength(texBoxLength);
- irevTxtBox.setHintText(AdminConstants.I.defaultRevisionSpec());
- irevTxtBox.addKeyPressHandler(
- new KeyPressHandler() {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
- doAddNewBranch();
- }
- }
- });
- addGrid.setText(1, 0, AdminConstants.I.initialRevision() + ":");
- addGrid.setWidget(1, 1, irevTxtBox);
-
- addBranch = new Button(AdminConstants.I.buttonAddBranch());
- addBranch.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- doAddNewBranch();
- }
- });
- addPanel.add(addGrid);
- addPanel.add(addBranch);
-
- branchTable = new BranchesTable();
-
- delBranch = new Button(AdminConstants.I.buttonDeleteBranch());
- delBranch.setStyleName(Gerrit.RESOURCES.css().branchTableDeleteButton());
- delBranch.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- branchTable.deleteChecked();
- }
- });
- HorizontalPanel buttons = new HorizontalPanel();
- buttons.setStyleName(Gerrit.RESOURCES.css().branchTablePrevNextLinks());
- buttons.add(delBranch);
- buttons.add(prev);
- buttons.add(next);
- add(branchTable);
- add(buttons);
- add(addPanel);
- }
-
- private void initPageHeader() {
- parseToken();
- HorizontalPanel hp = new HorizontalPanel();
- hp.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel());
- Label filterLabel = new Label(AdminConstants.I.projectFilter());
- filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel());
- hp.add(filterLabel);
- filterTxt = new NpTextBox();
- filterTxt.setValue(match);
- filterTxt.addKeyUpHandler(
- new KeyUpHandler() {
- @Override
- public void onKeyUp(KeyUpEvent event) {
- Query q = new Query(filterTxt.getValue());
- if (match.equals(q.qMatch)) {
- q.start(start);
- } else {
- if (query == null) {
- q.run();
- }
- query = q;
- }
- }
- });
- hp.add(filterTxt);
- add(hp);
- }
-
- private void doAddNewBranch() {
- final String branchName = nameTxtBox.getText().trim();
- if ("".equals(branchName)) {
- nameTxtBox.setFocus(true);
- return;
- }
-
- final String rev = irevTxtBox.getText().trim();
- if ("".equals(rev)) {
- irevTxtBox.setText("HEAD");
- Scheduler.get()
- .scheduleDeferred(
- new ScheduledCommand() {
- @Override
- public void execute() {
- irevTxtBox.selectAll();
- irevTxtBox.setFocus(true);
- }
- });
- return;
- }
-
- addBranch.setEnabled(false);
- ProjectApi.createBranch(
- getProjectKey(),
- branchName,
- rev,
- new GerritCallback<BranchInfo>() {
- @Override
- public void onSuccess(BranchInfo branch) {
- showAddedBranch(branch);
- nameTxtBox.setText("");
- irevTxtBox.setText("");
- query = new Query(match).start(start).run();
- }
-
- @Override
- public void onFailure(Throwable caught) {
- addBranch.setEnabled(true);
- selectAllAndFocus(nameTxtBox);
- new ErrorDialog(caught.getMessage()).center();
- }
- });
- }
-
- void showAddedBranch(BranchInfo branch) {
- SafeHtmlBuilder b = new SafeHtmlBuilder();
- b.openElement("b");
- b.append(Gerrit.C.branchCreationConfirmationMessage());
- b.closeElement("b");
-
- b.openElement("p");
- b.append(branch.ref());
- b.closeElement("p");
-
- ConfirmationDialog confirmationDialog =
- new ConfirmationDialog(
- Gerrit.C.branchCreationDialogTitle(),
- b.toSafeHtml(),
- new ConfirmationCallback() {
- @Override
- public void onOk() {
- // do nothing
- }
- });
- confirmationDialog.center();
- confirmationDialog.setCancelVisible(false);
- }
-
- private static void selectAllAndFocus(TextBox textBox) {
- textBox.selectAll();
- textBox.setFocus(true);
- }
-
- private class BranchesTable extends NavigationTable<BranchInfo> {
- private ValueChangeHandler<Boolean> updateDeleteHandler;
- boolean canDelete;
-
- BranchesTable() {
- table.setWidth("");
- table.setText(0, 2, AdminConstants.I.columnBranchName());
- table.setText(0, 3, AdminConstants.I.columnBranchRevision());
-
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().iconHeader());
- fmt.addStyleName(0, 2, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 3, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 4, Gerrit.RESOURCES.css().dataHeader());
-
- updateDeleteHandler =
- new ValueChangeHandler<Boolean>() {
- @Override
- public void onValueChange(ValueChangeEvent<Boolean> event) {
- updateDeleteButton();
- }
- };
- }
-
- Set<String> getCheckedRefs() {
- Set<String> refs = new HashSet<>();
- for (int row = 1; row < table.getRowCount(); row++) {
- final BranchInfo k = getRowItem(row);
- if (k != null
- && table.getWidget(row, 1) instanceof CheckBox
- && ((CheckBox) table.getWidget(row, 1)).getValue()) {
- refs.add(k.ref());
- }
- }
- return refs;
- }
-
- void setChecked(Set<String> refs) {
- for (int row = 1; row < table.getRowCount(); row++) {
- final BranchInfo k = getRowItem(row);
- if (k != null && refs.contains(k.ref()) && table.getWidget(row, 1) instanceof CheckBox) {
- ((CheckBox) table.getWidget(row, 1)).setValue(true);
- }
- }
- }
-
- void deleteChecked() {
- final Set<String> refs = getCheckedRefs();
-
- SafeHtmlBuilder b = new SafeHtmlBuilder();
- b.openElement("b");
- b.append(Gerrit.C.branchDeletionConfirmationMessage());
- b.closeElement("b");
-
- b.openElement("p");
- boolean first = true;
- for (String ref : refs) {
- if (!first) {
- b.append(",").br();
- }
- b.append(ref);
- first = false;
- }
- b.closeElement("p");
-
- if (refs.isEmpty()) {
- updateDeleteButton();
- return;
- }
-
- delBranch.setEnabled(false);
- ConfirmationDialog confirmationDialog =
- new ConfirmationDialog(
- Gerrit.C.branchDeletionDialogTitle(),
- b.toSafeHtml(),
- new ConfirmationCallback() {
- @Override
- public void onOk() {
- deleteBranches(refs);
- }
-
- @Override
- public void onCancel() {
- branchTable.updateDeleteButton();
- }
- });
- confirmationDialog.center();
- }
-
- private void deleteBranches(Set<String> branches) {
- ProjectApi.deleteBranches(
- getProjectKey(),
- branches,
- new GerritCallback<VoidResult>() {
- @Override
- public void onSuccess(VoidResult result) {
- query = new Query(match).start(start).run();
- }
-
- @Override
- public void onFailure(Throwable caught) {
- query = new Query(match).start(start).run();
- super.onFailure(caught);
- }
- });
- }
-
- void display(List<BranchInfo> branches) {
- displaySubset(branches, 0, branches.size());
- }
-
- void displaySubset(List<BranchInfo> branches, int fromIndex, int toIndex) {
- canDelete = false;
-
- while (1 < table.getRowCount()) {
- table.removeRow(table.getRowCount() - 1);
- }
-
- for (BranchInfo k : branches.subList(fromIndex, toIndex)) {
- final int row = table.getRowCount();
- table.insertRow(row);
- applyDataRowStyle(row);
- populate(row, k);
- }
- }
-
- void populate(int row, BranchInfo k) {
- if (k.canDelete()) {
- CheckBox sel = new CheckBox();
- sel.addValueChangeHandler(updateDeleteHandler);
- table.setWidget(row, 1, sel);
- canDelete = true;
- } else {
- table.setText(row, 1, "");
- }
-
- table.setWidget(row, 2, new InlineHTML(highlight(k.getShortName(), match)));
-
- if (k.revision() != null) {
- if ("HEAD".equals(k.getShortName())) {
- setHeadRevision(row, 3, k.revision());
- } else {
- table.setText(row, 3, k.revision());
- }
- } else {
- table.setText(row, 3, "");
- }
-
- FlowPanel actionsPanel = new FlowPanel();
- if (k.webLinks() != null) {
- for (WebLinkInfo webLink : Natives.asList(k.webLinks())) {
- actionsPanel.add(webLink.toAnchor());
- }
- }
- if (k.actions() != null) {
- k.actions().copyKeysIntoChildren("id");
- for (ActionInfo a : Natives.asList(k.actions().values())) {
- actionsPanel.add(new ActionButton(getProjectKey(), k, a));
- }
- }
- table.setWidget(row, 4, actionsPanel);
-
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- String iconCellStyle = Gerrit.RESOURCES.css().iconCell();
- String dataCellStyle = Gerrit.RESOURCES.css().dataCell();
- if (RefNames.REFS_CONFIG.equals(k.getShortName()) || "HEAD".equals(k.getShortName())) {
- iconCellStyle = Gerrit.RESOURCES.css().specialBranchIconCell();
- dataCellStyle = Gerrit.RESOURCES.css().specialBranchDataCell();
- fmt.setStyleName(row, 0, iconCellStyle);
- }
- fmt.addStyleName(row, 1, iconCellStyle);
- fmt.addStyleName(row, 2, dataCellStyle);
- fmt.addStyleName(row, 3, dataCellStyle);
- fmt.addStyleName(row, 4, dataCellStyle);
-
- setRowItem(row, k);
- }
-
- private void setHeadRevision(int row, int column, String rev) {
- AccessMap.get(
- getProjectKey(),
- new GerritCallback<ProjectAccessInfo>() {
- @Override
- public void onSuccess(ProjectAccessInfo result) {
- if (result.isOwner()) {
- table.setWidget(row, column, getHeadRevisionWidget(rev));
- } else {
- table.setText(row, 3, rev);
- }
- }
- });
- }
-
- private Widget getHeadRevisionWidget(String headRevision) {
- FlowPanel p = new FlowPanel();
- final InlineLabel l = new InlineLabel(headRevision);
- final Image edit = new Image(Gerrit.RESOURCES.edit());
- edit.addStyleName(Gerrit.RESOURCES.css().editHeadButton());
-
- final NpTextBox input = new NpTextBox();
- input.setVisibleLength(35);
- input.setValue(headRevision);
- input.setVisible(false);
- final Button save = new Button();
- save.setText(AdminConstants.I.saveHeadButton());
- save.setVisible(false);
- save.setEnabled(false);
- final Button cancel = new Button();
- cancel.setText(AdminConstants.I.cancelHeadButton());
- cancel.setVisible(false);
-
- OnEditEnabler e = new OnEditEnabler(save);
- e.listenTo(input);
-
- edit.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- l.setVisible(false);
- edit.setVisible(false);
- input.setVisible(true);
- save.setVisible(true);
- cancel.setVisible(true);
- }
- });
- save.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- save.setEnabled(false);
- ProjectApi.setHead(
- getProjectKey(),
- input.getValue().trim(),
- new GerritCallback<NativeString>() {
- @Override
- public void onSuccess(NativeString result) {
- Gerrit.display(PageLinks.toProjectBranches(getProjectKey()));
- }
-
- @Override
- public void onFailure(Throwable caught) {
- super.onFailure(caught);
- save.setEnabled(true);
- }
- });
- }
- });
- cancel.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- l.setVisible(true);
- edit.setVisible(true);
- input.setVisible(false);
- input.setValue(headRevision);
- save.setVisible(false);
- save.setEnabled(false);
- cancel.setVisible(false);
- }
- });
-
- p.add(l);
- p.add(edit);
- p.add(input);
- p.add(save);
- p.add(cancel);
- return p;
- }
-
- boolean hasBranchCanDelete() {
- return canDelete;
- }
-
- void updateDeleteButton() {
- boolean on = false;
- for (int row = 1; row < table.getRowCount(); row++) {
- Widget w = table.getWidget(row, 1);
- if (w != null && w instanceof CheckBox) {
- CheckBox sel = (CheckBox) w;
- if (sel.getValue()) {
- on = true;
- break;
- }
- }
- }
- delBranch.setEnabled(on);
- }
-
- @Override
- protected void onOpenRow(int row) {
- if (row > 0) {
- movePointerTo(row);
- }
- }
-
- @Override
- protected Object getRowItemKey(BranchInfo item) {
- return item.ref();
- }
- }
-
- @Override
- public void onShowView() {
- super.onShowView();
- if (match != null) {
- filterTxt.setCursorPos(match.length());
- }
- filterTxt.setFocus(true);
- }
-
- private class Query {
- private String qMatch;
- private int qStart;
-
- Query(String match) {
- this.qMatch = match;
- }
-
- Query start(int start) {
- this.qStart = start;
- return this;
- }
-
- Query run() {
- // Retrieve one more branch than page size to determine if there are more
- // branches to display
- ProjectApi.getBranches(
- getProjectKey(),
- pageSize + 1,
- qStart,
- qMatch,
- new ScreenLoadCallback<JsArray<BranchInfo>>(ProjectBranchesScreen.this) {
- @Override
- public void preDisplay(JsArray<BranchInfo> result) {
- if (!isAttached()) {
- // View has been disposed.
- } else if (query == Query.this) {
- query = null;
- showList(result);
- } else {
- query.run();
- }
- }
- });
- return this;
- }
-
- void showList(JsArray<BranchInfo> result) {
- setToken(getTokenForScreen(qMatch, qStart));
- ProjectBranchesScreen.this.match = qMatch;
- ProjectBranchesScreen.this.start = qStart;
-
- if (result.length() <= pageSize) {
- branchTable.display(Natives.asList(result));
- next.setVisible(false);
- } else {
- branchTable.displaySubset(Natives.asList(result), 0, result.length() - 1);
- setupNavigationLink(next, qMatch, qStart + pageSize);
- }
- if (qStart > 0) {
- setupNavigationLink(prev, qMatch, qStart - pageSize);
- } else {
- prev.setVisible(false);
- }
-
- delBranch.setVisible(branchTable.hasBranchCanDelete());
- Set<String> checkedRefs = branchTable.getCheckedRefs();
- branchTable.setChecked(checkedRefs);
- updateForm();
-
- if (!isCurrentView()) {
- display();
- }
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectDashboardsScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectDashboardsScreen.java
deleted file mode 100644
index 7b5d04d..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectDashboardsScreen.java
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (C) 2012 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.client.admin;
-
-import com.google.gerrit.client.dashboards.DashboardList;
-import com.google.gerrit.client.dashboards.DashboardsTable;
-import com.google.gerrit.client.rpc.ScreenLoadCallback;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.ui.FlowPanel;
-
-public class ProjectDashboardsScreen extends ProjectScreen {
- private DashboardsTable dashes;
- Project.NameKey project;
-
- public ProjectDashboardsScreen(Project.NameKey project) {
- super(project);
- this.project = project;
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- DashboardList.all(
- getProjectKey(),
- new ScreenLoadCallback<JsArray<DashboardList>>(this) {
- @Override
- protected void preDisplay(JsArray<DashboardList> result) {
- dashes.display(result);
- }
- });
- savedPanel = DASHBOARDS;
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- dashes = new DashboardsTable(project);
- FlowPanel fp = new FlowPanel();
- fp.add(dashes);
- add(fp);
- dashes.setSavePointerId("dashboards/project/" + getProjectKey().get());
- display();
- }
-
- @Override
- public void registerKeys() {
- super.registerKeys();
- dashes.setRegisterKeys(true);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectInfoScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectInfoScreen.java
deleted file mode 100644
index d10a031..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectInfoScreen.java
+++ /dev/null
@@ -1,826 +0,0 @@
-// Copyright (C) 2008 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.client.admin;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.GerritUiExtensionPoint;
-import com.google.gerrit.client.StringListPanel;
-import com.google.gerrit.client.access.AccessMap;
-import com.google.gerrit.client.access.ProjectAccessInfo;
-import com.google.gerrit.client.actions.ActionButton;
-import com.google.gerrit.client.api.ExtensionPanel;
-import com.google.gerrit.client.change.Resources;
-import com.google.gerrit.client.download.DownloadPanel;
-import com.google.gerrit.client.info.ActionInfo;
-import com.google.gerrit.client.info.DownloadInfo.DownloadCommandInfo;
-import com.google.gerrit.client.info.DownloadInfo.DownloadSchemeInfo;
-import com.google.gerrit.client.projects.ConfigInfo;
-import com.google.gerrit.client.projects.ConfigInfo.ConfigParameterInfo;
-import com.google.gerrit.client.projects.ConfigInfo.ConfigParameterValue;
-import com.google.gerrit.client.projects.ConfigInfo.InheritedBooleanInfo;
-import com.google.gerrit.client.projects.ConfigInfo.SubmitTypeInfo;
-import com.google.gerrit.client.projects.ProjectApi;
-import com.google.gerrit.client.rpc.CallbackGroup;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.rpc.ScreenLoadCallback;
-import com.google.gerrit.client.ui.NpIntTextBox;
-import com.google.gerrit.client.ui.OnEditEnabler;
-import com.google.gerrit.client.ui.SmallHeading;
-import com.google.gerrit.extensions.client.InheritableBoolean;
-import com.google.gerrit.extensions.client.ProjectState;
-import com.google.gerrit.extensions.client.SubmitType;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.event.dom.client.ChangeEvent;
-import com.google.gwt.event.dom.client.ChangeHandler;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-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.HasEnabled;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.ListBox;
-import com.google.gwt.user.client.ui.Panel;
-import com.google.gwt.user.client.ui.TextBox;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.globalkey.client.NpTextArea;
-import com.google.gwtexpui.globalkey.client.NpTextBox;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-public class ProjectInfoScreen extends ProjectScreen {
- private boolean isOwner;
- private boolean configVisible;
-
- private LabeledWidgetsGrid grid;
- private Panel pluginOptionsPanel;
- private LabeledWidgetsGrid actionsGrid;
-
- // Section: Project Options
- private ListBox requireChangeID;
- private ListBox submitType;
- private ListBox state;
- private ListBox contentMerge;
- private ListBox newChangeForAllNotInTarget;
- private ListBox enableSignedPush;
- private ListBox requireSignedPush;
- private ListBox rejectImplicitMerges;
- private ListBox privateByDefault;
- private ListBox workInProgressByDefault;
- private ListBox enableReviewerByEmail;
- private ListBox matchAuthorToCommitterDate;
- private NpTextBox maxObjectSizeLimit;
- private Label effectiveMaxObjectSizeLimit;
- private Map<String, Map<String, HasEnabled>> pluginConfigWidgets;
-
- // Section: Contributor Agreements
- private ListBox contributorAgreements;
- private ListBox signedOffBy;
-
- private NpTextArea descTxt;
- private Button saveProject;
-
- private OnEditEnabler saveEnabler;
-
- public ProjectInfoScreen(Project.NameKey toShow) {
- super(toShow);
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
-
- Resources.I.style().ensureInjected();
- saveProject = new Button(AdminConstants.I.buttonSaveChanges());
- saveProject.setStyleName("");
- saveProject.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- doSave();
- }
- });
-
- ExtensionPanel extensionPanelTop =
- new ExtensionPanel(GerritUiExtensionPoint.PROJECT_INFO_SCREEN_TOP);
- extensionPanelTop.put(GerritUiExtensionPoint.Key.PROJECT_NAME, getProjectKey().get());
- add(extensionPanelTop);
-
- add(new ProjectDownloadPanel(getProjectKey().get(), true));
-
- initDescription();
- grid = new LabeledWidgetsGrid();
- pluginOptionsPanel = new FlowPanel();
- actionsGrid = new LabeledWidgetsGrid();
- initProjectOptions();
- initAgreements();
- add(grid);
- add(pluginOptionsPanel);
- add(saveProject);
- add(actionsGrid);
-
- ExtensionPanel extensionPanelBottom =
- new ExtensionPanel(GerritUiExtensionPoint.PROJECT_INFO_SCREEN_BOTTOM);
- extensionPanelBottom.put(GerritUiExtensionPoint.Key.PROJECT_NAME, getProjectKey().get());
- add(extensionPanelBottom);
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
-
- Project.NameKey project = getProjectKey();
- CallbackGroup cbg = new CallbackGroup();
- AccessMap.get(
- project,
- cbg.add(
- new GerritCallback<ProjectAccessInfo>() {
- @Override
- public void onSuccess(ProjectAccessInfo result) {
- isOwner = result.isOwner();
- configVisible = result.configVisible();
- enableForm();
- saveProject.setVisible(isOwner);
- }
- }));
- ProjectApi.getConfig(
- project,
- cbg.addFinal(
- new ScreenLoadCallback<ConfigInfo>(this) {
- @Override
- public void preDisplay(ConfigInfo result) {
- display(result);
- }
- }));
-
- savedPanel = INFO;
- }
-
- private void enableForm() {
- enableForm(isOwner);
- }
-
- private void enableForm(boolean isOwner) {
- state.setEnabled(isOwner);
- submitType.setEnabled(isOwner);
- setEnabledForUseContentMerge();
- newChangeForAllNotInTarget.setEnabled(isOwner);
- if (enableSignedPush != null) {
- enableSignedPush.setEnabled(isOwner);
- }
- if (requireSignedPush != null) {
- requireSignedPush.setEnabled(isOwner);
- }
- descTxt.setEnabled(isOwner);
- contributorAgreements.setEnabled(isOwner);
- signedOffBy.setEnabled(isOwner);
- requireChangeID.setEnabled(isOwner);
- rejectImplicitMerges.setEnabled(isOwner);
- privateByDefault.setEnabled(isOwner);
- workInProgressByDefault.setEnabled(isOwner);
- maxObjectSizeLimit.setEnabled(isOwner);
- enableReviewerByEmail.setEnabled(isOwner);
- matchAuthorToCommitterDate.setEnabled(isOwner);
-
- if (pluginConfigWidgets != null) {
- for (Map<String, HasEnabled> widgetMap : pluginConfigWidgets.values()) {
- for (HasEnabled widget : widgetMap.values()) {
- widget.setEnabled(isOwner);
- }
- }
- }
- }
-
- private void initDescription() {
- final VerticalPanel vp = new VerticalPanel();
- vp.add(new SmallHeading(AdminConstants.I.headingDescription()));
-
- descTxt = new NpTextArea();
- descTxt.setVisibleLines(6);
- descTxt.setCharacterWidth(60);
- vp.add(descTxt);
-
- add(vp);
- saveEnabler = new OnEditEnabler(saveProject);
- saveEnabler.listenTo(descTxt);
- }
-
- private void initProjectOptions() {
- grid.addHeader(new SmallHeading(AdminConstants.I.headingProjectOptions()));
-
- state = new ListBox();
- for (ProjectState stateValue : ProjectState.values()) {
- state.addItem(Util.toLongString(stateValue), stateValue.name());
- }
- saveEnabler.listenTo(state);
- grid.add(AdminConstants.I.headingProjectState(), state);
-
- submitType = new ListBox();
- for (SubmitType type : SubmitType.values()) {
- submitType.addItem(Util.toLongString(type), type.name());
- }
- submitType.addChangeHandler(
- new ChangeHandler() {
- @Override
- public void onChange(ChangeEvent event) {
- setEnabledForUseContentMerge();
- }
- });
- saveEnabler.listenTo(submitType);
- grid.add(AdminConstants.I.headingProjectSubmitType(), submitType);
-
- contentMerge = newInheritedBooleanBox();
- saveEnabler.listenTo(contentMerge);
- grid.add(AdminConstants.I.useContentMerge(), contentMerge);
-
- newChangeForAllNotInTarget = newInheritedBooleanBox();
- saveEnabler.listenTo(newChangeForAllNotInTarget);
- grid.add(AdminConstants.I.createNewChangeForAllNotInTarget(), newChangeForAllNotInTarget);
-
- requireChangeID = newInheritedBooleanBox();
- saveEnabler.listenTo(requireChangeID);
- grid.addHtml(AdminConstants.I.requireChangeID(), requireChangeID);
-
- if (Gerrit.info().receive().enableSignedPush()) {
- enableSignedPush = newInheritedBooleanBox();
- saveEnabler.listenTo(enableSignedPush);
- grid.add(AdminConstants.I.enableSignedPush(), enableSignedPush);
- requireSignedPush = newInheritedBooleanBox();
- saveEnabler.listenTo(requireSignedPush);
- grid.add(AdminConstants.I.requireSignedPush(), requireSignedPush);
- }
-
- rejectImplicitMerges = newInheritedBooleanBox();
- saveEnabler.listenTo(rejectImplicitMerges);
- grid.addHtml(AdminConstants.I.rejectImplicitMerges(), rejectImplicitMerges);
-
- privateByDefault = newInheritedBooleanBox();
- saveEnabler.listenTo(privateByDefault);
- grid.addHtml(AdminConstants.I.privateByDefault(), privateByDefault);
-
- workInProgressByDefault = newInheritedBooleanBox();
- saveEnabler.listenTo(workInProgressByDefault);
- grid.addHtml(AdminConstants.I.workInProgressByDefault(), workInProgressByDefault);
-
- enableReviewerByEmail = newInheritedBooleanBox();
- saveEnabler.listenTo(enableReviewerByEmail);
- grid.addHtml(AdminConstants.I.enableReviewerByEmail(), enableReviewerByEmail);
-
- matchAuthorToCommitterDate = newInheritedBooleanBox();
- saveEnabler.listenTo(matchAuthorToCommitterDate);
- grid.addHtml(AdminConstants.I.matchAuthorToCommitterDate(), matchAuthorToCommitterDate);
-
- maxObjectSizeLimit = new NpTextBox();
- saveEnabler.listenTo(maxObjectSizeLimit);
- effectiveMaxObjectSizeLimit = new Label();
- effectiveMaxObjectSizeLimit.setStyleName(
- Gerrit.RESOURCES.css().maxObjectSizeLimitEffectiveLabel());
- HorizontalPanel p = new HorizontalPanel();
- p.add(maxObjectSizeLimit);
- p.add(effectiveMaxObjectSizeLimit);
- grid.addHtml(AdminConstants.I.headingMaxObjectSizeLimit(), p);
- }
-
- private static ListBox newInheritedBooleanBox() {
- ListBox box = new ListBox();
- for (InheritableBoolean b : InheritableBoolean.values()) {
- box.addItem(b.name(), b.name());
- }
- return box;
- }
-
- /**
- * Enables the {@link #contentMerge} checkbox if the selected submit type allows the usage of
- * content merge. If the submit type (currently only 'Fast Forward Only') does not allow content
- * merge the useContentMerge checkbox gets disabled.
- */
- private void setEnabledForUseContentMerge() {
- if (SubmitType.FAST_FORWARD_ONLY.equals(
- SubmitType.valueOf(submitType.getValue(submitType.getSelectedIndex())))) {
- contentMerge.setEnabled(false);
- InheritedBooleanInfo b = InheritedBooleanInfo.create();
- b.setConfiguredValue(InheritableBoolean.FALSE);
- setBool(contentMerge, b);
- } else {
- contentMerge.setEnabled(submitType.isEnabled());
- }
- }
-
- private void initAgreements() {
- grid.addHeader(new SmallHeading(AdminConstants.I.headingAgreements()));
-
- contributorAgreements = newInheritedBooleanBox();
- if (Gerrit.info().auth().useContributorAgreements()) {
- saveEnabler.listenTo(contributorAgreements);
- grid.add(AdminConstants.I.useContributorAgreements(), contributorAgreements);
- }
-
- signedOffBy = newInheritedBooleanBox();
- saveEnabler.listenTo(signedOffBy);
- grid.addHtml(AdminConstants.I.useSignedOffBy(), signedOffBy);
- }
-
- private void setSubmitType(SubmitTypeInfo newSubmitType) {
- int index = -1;
- if (newSubmitType != null) {
- for (int i = 0; i < submitType.getItemCount(); i++) {
- if (submitType.getValue(i).equals(SubmitType.INHERIT.name())) {
- submitType.setItemText(i, getInheritString(newSubmitType));
- }
- if (newSubmitType.configuredValue().name().equals(submitType.getValue(i))) {
- index = i;
- }
- }
- submitType.setSelectedIndex(index);
- setEnabledForUseContentMerge();
- }
- }
-
- private static String getInheritString(SubmitTypeInfo submitType) {
- return Util.toLongString(SubmitType.INHERIT)
- + " ("
- + Util.toLongString(submitType.inheritedValue())
- + ")";
- }
-
- private void setState(ProjectState newState) {
- if (state != null) {
- for (int i = 0; i < state.getItemCount(); i++) {
- if (newState.name().equals(state.getValue(i))) {
- state.setSelectedIndex(i);
- break;
- }
- }
- }
- }
-
- private void setBool(ListBox box, InheritedBooleanInfo inheritedBoolean) {
- if (box == null) {
- return;
- }
- int inheritedIndex = -1;
- for (int i = 0; i < box.getItemCount(); i++) {
- if (box.getValue(i).startsWith(InheritableBoolean.INHERIT.name())) {
- inheritedIndex = i;
- }
- if (box.getValue(i).startsWith(inheritedBoolean.configuredValue().name())) {
- box.setSelectedIndex(i);
- }
- }
- if (inheritedIndex >= 0) {
- if (Gerrit.info().gerrit().isAllProjects(getProjectKey())) {
- if (box.getSelectedIndex() == inheritedIndex) {
- for (int i = 0; i < box.getItemCount(); i++) {
- if (box.getValue(i).equals(InheritableBoolean.FALSE.name())) {
- box.setSelectedIndex(i);
- break;
- }
- }
- }
- box.removeItem(inheritedIndex);
- } else {
- box.setItemText(
- inheritedIndex,
- InheritableBoolean.INHERIT.name() + " (" + inheritedBoolean.inheritedValue() + ")");
- }
- }
- }
-
- private static InheritableBoolean getBool(ListBox box) {
- int i = box.getSelectedIndex();
- if (i >= 0) {
- final String selectedValue = box.getValue(i);
- if (selectedValue.startsWith(InheritableBoolean.INHERIT.name())) {
- return InheritableBoolean.INHERIT;
- }
- return InheritableBoolean.valueOf(selectedValue);
- }
- return InheritableBoolean.INHERIT;
- }
-
- void display(ConfigInfo result) {
- descTxt.setText(result.description());
- setBool(contributorAgreements, result.useContributorAgreements());
- setBool(signedOffBy, result.useSignedOffBy());
- setBool(contentMerge, result.useContentMerge());
- setBool(newChangeForAllNotInTarget, result.createNewChangeForAllNotInTarget());
- setBool(requireChangeID, result.requireChangeId());
- if (Gerrit.info().receive().enableSignedPush()) {
- setBool(enableSignedPush, result.enableSignedPush());
- setBool(requireSignedPush, result.requireSignedPush());
- }
- setBool(rejectImplicitMerges, result.rejectImplicitMerges());
- setBool(privateByDefault, result.privateByDefault());
- setBool(workInProgressByDefault, result.workInProgressByDefault());
- setBool(enableReviewerByEmail, result.enableReviewerByEmail());
- setBool(matchAuthorToCommitterDate, result.matchAuthorToCommitterDate());
- setSubmitType(result.defaultSubmitType());
- setState(result.state());
- maxObjectSizeLimit.setText(result.maxObjectSizeLimit().configuredValue());
- if (result.maxObjectSizeLimit().value() != null) {
- effectiveMaxObjectSizeLimit.setText(
- AdminMessages.I.effectiveMaxObjectSizeLimit(result.maxObjectSizeLimit().value()));
- if (result.maxObjectSizeLimit().summary() != null) {
- effectiveMaxObjectSizeLimit.setTitle(result.maxObjectSizeLimit().summary());
- }
- } else {
- effectiveMaxObjectSizeLimit.setText(AdminMessages.I.noMaxObjectSizeLimit());
- }
-
- saveProject.setEnabled(false);
- initPluginOptions(result);
- initProjectActions(result);
- }
-
- private void initPluginOptions(ConfigInfo info) {
- pluginOptionsPanel.clear();
- pluginConfigWidgets = new HashMap<>();
-
- for (String pluginName : info.pluginConfig().keySet()) {
- Map<String, HasEnabled> widgetMap = new HashMap<>();
- pluginConfigWidgets.put(pluginName, widgetMap);
- LabeledWidgetsGrid g = new LabeledWidgetsGrid();
- g.addHeader(new SmallHeading(AdminMessages.I.pluginProjectOptionsTitle(pluginName)));
- pluginOptionsPanel.add(g);
- NativeMap<ConfigParameterInfo> pluginConfig = info.pluginConfig(pluginName);
- pluginConfig.copyKeysIntoChildren("name");
- for (ConfigParameterInfo param : Natives.asList(pluginConfig.values())) {
- HasEnabled w;
- switch (param.type()) {
- case "STRING":
- case "INT":
- case "LONG":
- w = renderTextBox(g, param);
- break;
- case "BOOLEAN":
- w = renderCheckBox(g, param);
- break;
- case "LIST":
- w = renderListBox(g, param);
- break;
- case "ARRAY":
- w = renderStringListPanel(g, param);
- break;
- default:
- throw new UnsupportedOperationException("unsupported widget type");
- }
- if (param.editable()) {
- widgetMap.put(param.name(), w);
- } else {
- w.setEnabled(false);
- }
- }
- }
-
- enableForm();
- }
-
- private TextBox renderTextBox(LabeledWidgetsGrid g, ConfigParameterInfo param) {
- NpTextBox textBox = param.type().equals("STRING") ? new NpTextBox() : new NpIntTextBox();
- if (param.inheritable()) {
- textBox.setValue(param.configuredValue());
- Label inheritedLabel =
- new Label(AdminMessages.I.pluginProjectInheritedValue(param.inheritedValue()));
- inheritedLabel.setStyleName(Gerrit.RESOURCES.css().pluginProjectConfigInheritedValue());
- HorizontalPanel p = new HorizontalPanel();
- p.add(textBox);
- p.add(inheritedLabel);
- addWidget(g, p, param);
- } else {
- textBox.setValue(param.value());
- addWidget(g, textBox, param);
- }
- if (textBox.getValue().length() > textBox.getVisibleLength()) {
- textBox.setVisibleLength(textBox.getValue().length());
- }
- saveEnabler.listenTo(textBox);
- return textBox;
- }
-
- private CheckBox renderCheckBox(LabeledWidgetsGrid g, ConfigParameterInfo param) {
- CheckBox checkBox = new CheckBox(getDisplayName(param));
- checkBox.setValue(Boolean.parseBoolean(param.value()));
- HorizontalPanel p = new HorizontalPanel();
- p.add(checkBox);
- if (param.description() != null) {
- Image infoImg = new Image(Gerrit.RESOURCES.info());
- infoImg.setTitle(param.description());
- p.add(infoImg);
- }
- if (param.warning() != null) {
- Image warningImg = new Image(Gerrit.RESOURCES.warning());
- warningImg.setTitle(param.warning());
- p.add(warningImg);
- }
- g.add((String) null, p);
- saveEnabler.listenTo(checkBox);
- return checkBox;
- }
-
- private ListBox renderListBox(LabeledWidgetsGrid g, ConfigParameterInfo param) {
- if (param.permittedValues() == null) {
- return null;
- }
- ListBox listBox = new ListBox();
- if (param.inheritable()) {
- listBox.addItem(AdminMessages.I.pluginProjectInheritedListValue(param.inheritedValue()));
- if (param.configuredValue() == null) {
- listBox.setSelectedIndex(0);
- }
- for (int i = 0; i < param.permittedValues().length(); i++) {
- String pv = param.permittedValues().get(i);
- listBox.addItem(pv);
- if (pv.equals(param.configuredValue())) {
- listBox.setSelectedIndex(i + 1);
- }
- }
- } else {
- for (int i = 0; i < param.permittedValues().length(); i++) {
- String pv = param.permittedValues().get(i);
- listBox.addItem(pv);
- if (pv.equals(param.value())) {
- listBox.setSelectedIndex(i);
- }
- }
- }
-
- if (param.editable()) {
- saveEnabler.listenTo(listBox);
- addWidget(g, listBox, param);
- } else {
- listBox.setEnabled(false);
-
- if (param.inheritable() && listBox.getSelectedIndex() != 0) {
- // the inherited value is not selected,
- // since the listBox is disabled the inherited value cannot be
- // seen and we have to display it explicitly
- Label inheritedLabel =
- new Label(AdminMessages.I.pluginProjectInheritedValue(param.inheritedValue()));
- inheritedLabel.setStyleName(Gerrit.RESOURCES.css().pluginProjectConfigInheritedValue());
- HorizontalPanel p = new HorizontalPanel();
- p.add(listBox);
- p.add(inheritedLabel);
- addWidget(g, p, param);
- } else {
- addWidget(g, listBox, param);
- }
- }
-
- return listBox;
- }
-
- private StringListPanel renderStringListPanel(LabeledWidgetsGrid g, ConfigParameterInfo param) {
- StringListPanel p =
- new StringListPanel(null, Arrays.asList(getDisplayName(param)), saveProject, false);
- List<List<String>> values = new ArrayList<>();
- for (String v : Natives.asList(param.values())) {
- values.add(Arrays.asList(v));
- }
- p.display(values);
- if (!param.editable()) {
- p.setEnabled(false);
- }
- addWidget(g, p, param);
- return p;
- }
-
- private void addWidget(LabeledWidgetsGrid g, Widget w, ConfigParameterInfo param) {
- if (param.description() != null || param.warning() != null) {
- HorizontalPanel p = new HorizontalPanel();
- p.add(new Label(getDisplayName(param)));
- if (param.description() != null) {
- Image infoImg = new Image(Gerrit.RESOURCES.info());
- infoImg.setTitle(param.description());
- p.add(infoImg);
- }
- if (param.warning() != null) {
- Image warningImg = new Image(Gerrit.RESOURCES.warning());
- warningImg.setTitle(param.warning());
- p.add(warningImg);
- }
- p.add(new Label(":"));
- g.add(p, w);
- } else {
- g.add(getDisplayName(param), w);
- }
- }
-
- private String getDisplayName(ConfigParameterInfo param) {
- return param.displayName() != null ? param.displayName() : param.name();
- }
-
- private void initProjectActions(ConfigInfo info) {
- actionsGrid.clear(true);
- actionsGrid.removeAllRows();
- boolean showCreateChange = Gerrit.isSignedIn();
-
- NativeMap<ActionInfo> actions = info.actions();
- if (actions == null) {
- actions = NativeMap.create().cast();
- }
- if (actions.isEmpty() && !showCreateChange) {
- return;
- }
- actions.copyKeysIntoChildren("id");
- actionsGrid.addHeader(new SmallHeading(AdminConstants.I.headingProjectCommands()));
- FlowPanel actionsPanel = new FlowPanel();
- actionsPanel.setStyleName(Gerrit.RESOURCES.css().projectActions());
- actionsPanel.setVisible(true);
- actionsGrid.add(AdminConstants.I.headingCommands(), actionsPanel);
-
- for (String id : actions.keySet()) {
- actionsPanel.add(new ActionButton(getProjectKey(), actions.get(id)));
- }
-
- // TODO: The user should have create permission on the branch referred to by
- // HEAD. This would have to happen on the server side.
- if (showCreateChange) {
- actionsPanel.add(createChangeAction());
- }
-
- if (isOwner && configVisible) {
- actionsPanel.add(createEditConfigAction());
- }
- }
-
- private Button createChangeAction() {
- final Button createChange = new Button(AdminConstants.I.buttonCreateChange());
- createChange.setStyleName("");
- createChange.setTitle(AdminConstants.I.buttonCreateChangeDescription());
- createChange.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- CreateChangeAction.call(createChange, getProjectKey().get());
- }
- });
- return createChange;
- }
-
- private Button createEditConfigAction() {
- final Button editConfig = new Button(AdminConstants.I.buttonEditConfig());
- editConfig.setStyleName("");
- editConfig.setTitle(AdminConstants.I.buttonEditConfigDescription());
- editConfig.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- EditConfigAction.call(editConfig, getProjectKey());
- }
- });
- return editConfig;
- }
-
- private void doSave() {
- enableForm(false);
- saveProject.setEnabled(false);
- InheritableBoolean esp = enableSignedPush != null ? getBool(enableSignedPush) : null;
- InheritableBoolean rsp = requireSignedPush != null ? getBool(requireSignedPush) : null;
- ProjectApi.setConfig(
- getProjectKey(),
- descTxt.getText().trim(),
- getBool(contributorAgreements),
- getBool(contentMerge),
- getBool(signedOffBy),
- getBool(newChangeForAllNotInTarget),
- getBool(requireChangeID),
- esp,
- rsp,
- getBool(rejectImplicitMerges),
- getBool(privateByDefault),
- getBool(workInProgressByDefault),
- getBool(enableReviewerByEmail),
- getBool(matchAuthorToCommitterDate),
- maxObjectSizeLimit.getText().trim(),
- SubmitType.valueOf(submitType.getValue(submitType.getSelectedIndex())),
- ProjectState.valueOf(state.getValue(state.getSelectedIndex())),
- getPluginConfigValues(),
- new GerritCallback<ConfigInfo>() {
- @Override
- public void onSuccess(ConfigInfo result) {
- enableForm();
- display(result);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- enableForm();
- super.onFailure(caught);
- }
- });
- }
-
- private Map<String, Map<String, ConfigParameterValue>> getPluginConfigValues() {
- Map<String, Map<String, ConfigParameterValue>> pluginConfigValues =
- new HashMap<>(pluginConfigWidgets.size());
- for (Entry<String, Map<String, HasEnabled>> e : pluginConfigWidgets.entrySet()) {
- Map<String, ConfigParameterValue> values = new HashMap<>(e.getValue().size());
- pluginConfigValues.put(e.getKey(), values);
- for (Entry<String, HasEnabled> e2 : e.getValue().entrySet()) {
- HasEnabled widget = e2.getValue();
- if (widget instanceof TextBox) {
- values.put(
- e2.getKey(),
- ConfigParameterValue.create().value(((TextBox) widget).getValue().trim()));
- } else if (widget instanceof CheckBox) {
- values.put(
- e2.getKey(),
- ConfigParameterValue.create()
- .value(Boolean.toString(((CheckBox) widget).getValue())));
- } else if (widget instanceof ListBox) {
- ListBox listBox = (ListBox) widget;
- // the inherited value is at index 0,
- // if it is selected no value should be set on this project
- String value =
- listBox.getSelectedIndex() > 0 ? listBox.getValue(listBox.getSelectedIndex()) : null;
- values.put(e2.getKey(), ConfigParameterValue.create().value(value));
- } else if (widget instanceof StringListPanel) {
- values.put(
- e2.getKey(),
- ConfigParameterValue.create()
- .values(((StringListPanel) widget).getValues(0).toArray(new String[] {})));
- } else {
- throw new UnsupportedOperationException("unsupported widget type");
- }
- }
- }
- return pluginConfigValues;
- }
-
- public static class ProjectDownloadPanel extends DownloadPanel {
- public ProjectDownloadPanel(String project, boolean isAllowsAnonymous) {
- super(project, isAllowsAnonymous);
- }
-
- @Override
- protected List<DownloadCommandInfo> getCommands(DownloadSchemeInfo schemeInfo) {
- return schemeInfo.cloneCommands(project);
- }
- }
-
- private static class LabeledWidgetsGrid extends FlexTable {
- private String labelSuffix;
-
- LabeledWidgetsGrid() {
- super();
- labelSuffix = ":";
- }
-
- private void addHeader(Widget widget) {
- int row = getRowCount();
- insertRow(row);
- setWidget(row, 0, widget);
- getCellFormatter().getElement(row, 0).setAttribute("colSpan", "2");
- }
-
- private void add(String label, boolean labelIsHtml, Widget widget) {
- int row = getRowCount();
- insertRow(row);
- if (label != null) {
- if (labelIsHtml) {
- setHTML(row, 0, label + labelSuffix);
- } else {
- setText(row, 0, label + labelSuffix);
- }
- }
- setWidget(row, 1, widget);
- }
-
- public void add(String label, Widget widget) {
- add(label, false, widget);
- }
-
- public void addHtml(String label, Widget widget) {
- add(label, true, widget);
- }
-
- public void add(Widget label, Widget widget) {
- int row = getRowCount();
- insertRow(row);
- setWidget(row, 0, label);
- setWidget(row, 1, widget);
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectListScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectListScreen.java
deleted file mode 100644
index 2a03136..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectListScreen.java
+++ /dev/null
@@ -1,259 +0,0 @@
-// Copyright (C) 2008 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.client.admin;
-
-import static com.google.gerrit.common.PageLinks.ADMIN_PROJECTS;
-
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.info.WebLinkInfo;
-import com.google.gerrit.client.projects.ProjectInfo;
-import com.google.gerrit.client.projects.ProjectMap;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.HighlightingInlineHyperlink;
-import com.google.gerrit.client.ui.Hyperlink;
-import com.google.gerrit.client.ui.PagingHyperlink;
-import com.google.gerrit.client.ui.ProjectSearchLink;
-import com.google.gerrit.client.ui.ProjectsTable;
-import com.google.gerrit.common.PageLinks;
-import com.google.gwt.event.dom.client.KeyCodes;
-import com.google.gwt.event.dom.client.KeyUpEvent;
-import com.google.gwt.event.dom.client.KeyUpHandler;
-import com.google.gwt.user.client.History;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwtexpui.globalkey.client.NpTextBox;
-import java.util.List;
-
-public class ProjectListScreen extends PaginatedProjectScreen {
- private Hyperlink prev;
- private Hyperlink next;
- private ProjectsTable projects;
- private NpTextBox filterTxt;
-
- private Query query;
-
- public ProjectListScreen() {
- super(null);
- }
-
- public ProjectListScreen(String params) {
- this();
- parseToken(params);
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- query = new Query(match).start(start).run();
- }
-
- @Override
- public String getScreenToken() {
- return ADMIN_PROJECTS;
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- setPageTitle(AdminConstants.I.projectListTitle());
- initPageHeader();
-
- prev = PagingHyperlink.createPrev();
- prev.setVisible(false);
-
- next = PagingHyperlink.createNext();
- next.setVisible(false);
-
- projects =
- new ProjectsTable() {
- @Override
- protected void initColumnHeaders() {
- super.initColumnHeaders();
- table.setText(0, ProjectsTable.C_REPO_BROWSER, AdminConstants.I.projectRepoBrowser());
- table
- .getFlexCellFormatter()
- .addStyleName(0, ProjectsTable.C_REPO_BROWSER, Gerrit.RESOURCES.css().dataHeader());
- }
-
- @Override
- protected void onOpenRow(int row) {
- History.newItem(link(getRowItem(row)));
- }
-
- private String link(ProjectInfo item) {
- return Dispatcher.toProject(item.name_key());
- }
-
- @Override
- protected void insert(int row, ProjectInfo k) {
- super.insert(row, k);
- table
- .getFlexCellFormatter()
- .addStyleName(row, ProjectsTable.C_REPO_BROWSER, Gerrit.RESOURCES.css().dataCell());
- }
-
- @Override
- protected void populate(int row, ProjectInfo k) {
- populateState(row, k);
- FlowPanel fp = new FlowPanel();
- fp.add(new ProjectSearchLink(k.name_key()));
- fp.add(new HighlightingInlineHyperlink(k.name(), link(k), match));
- table.setWidget(row, ProjectsTable.C_NAME, fp);
- table.setText(row, ProjectsTable.C_DESCRIPTION, k.description());
- addWebLinks(row, k);
-
- setRowItem(row, k);
- }
-
- private void addWebLinks(int row, ProjectInfo k) {
- List<WebLinkInfo> webLinks = Natives.asList(k.webLinks());
- if (webLinks != null && !webLinks.isEmpty()) {
- FlowPanel p = new FlowPanel();
- table.setWidget(row, ProjectsTable.C_REPO_BROWSER, p);
- for (WebLinkInfo weblink : webLinks) {
- p.add(weblink.toAnchor());
- }
- }
- }
- };
- projects.setSavePointerId(PageLinks.ADMIN_PROJECTS);
-
- add(projects);
- final HorizontalPanel buttons = new HorizontalPanel();
- buttons.setStyleName(Gerrit.RESOURCES.css().changeTablePrevNextLinks());
- buttons.add(prev);
- buttons.add(next);
- add(buttons);
- }
-
- private void initPageHeader() {
- final HorizontalPanel hp = new HorizontalPanel();
- hp.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel());
- final Label filterLabel = new Label(AdminConstants.I.projectFilter());
- filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel());
- hp.add(filterLabel);
- filterTxt = new NpTextBox();
- filterTxt.setValue(match);
- filterTxt.addKeyUpHandler(
- new KeyUpHandler() {
- @Override
- public void onKeyUp(KeyUpEvent event) {
- Query q =
- new Query(filterTxt.getValue())
- .open(event.getNativeKeyCode() == KeyCodes.KEY_ENTER);
- if (match.equals(q.qMatch)) {
- q.start(start);
- }
- if (q.open || !match.equals(q.qMatch)) {
- if (query == null) {
- q.run();
- }
- query = q;
- }
- }
- });
- hp.add(filterTxt);
- add(hp);
- }
-
- @Override
- public void onShowView() {
- super.onShowView();
- if (match != null) {
- filterTxt.setCursorPos(match.length());
- }
- filterTxt.setFocus(true);
- }
-
- @Override
- public void registerKeys() {
- super.registerKeys();
- projects.setRegisterKeys(true);
- }
-
- private class Query {
- private final String qMatch;
- private int qStart;
- private boolean open;
-
- Query(String match) {
- this.qMatch = match;
- }
-
- Query start(int start) {
- this.qStart = start;
- return this;
- }
-
- Query open(boolean open) {
- this.open = open;
- return this;
- }
-
- Query run() {
- int limit = open ? 1 : pageSize + 1;
- ProjectMap.match(
- qMatch,
- limit,
- qStart,
- new GerritCallback<ProjectMap>() {
- @Override
- public void onSuccess(ProjectMap result) {
- if (!isAttached()) {
- // View has been disposed.
- } else if (query == Query.this) {
- query = null;
- showMap(result);
- } else {
- query.run();
- }
- }
- });
- return this;
- }
-
- private void showMap(ProjectMap result) {
- if (open && !result.isEmpty()) {
- Gerrit.display(PageLinks.toProject(result.values().get(0).name_key()));
- return;
- }
-
- setToken(getTokenForScreen(qMatch, qStart));
- ProjectListScreen.this.match = qMatch;
- ProjectListScreen.this.start = qStart;
-
- if (result.size() <= pageSize) {
- projects.display(result);
- next.setVisible(false);
- } else {
- projects.displaySubset(result, 0, result.size() - 1);
- setupNavigationLink(next, qMatch, qStart + pageSize);
- }
-
- if (qStart > 0) {
- setupNavigationLink(prev, qMatch, qStart - pageSize);
- } else {
- prev.setVisible(false);
- }
-
- if (!isCurrentView()) {
- display();
- }
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectScreen.java
deleted file mode 100644
index dc964b8..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectScreen.java
+++ /dev/null
@@ -1,61 +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.google.gerrit.client.admin;
-
-import com.google.gerrit.client.ui.Screen;
-import com.google.gerrit.reviewdb.client.Project;
-
-public abstract class ProjectScreen extends Screen {
- public static final String INFO = "info";
- public static final String BRANCHES = "branches";
- public static final String ACCESS = "access";
- public static final String DASHBOARDS = "dashboards";
- public static final String TAGS = "tags";
-
- protected static String savedPanel;
- protected static Project.NameKey savedKey;
-
- public static String getSavedPanel() {
- return savedPanel;
- }
-
- public static Project.NameKey getSavedKey() {
- return savedKey;
- }
-
- private final Project.NameKey name;
-
- public ProjectScreen(Project.NameKey toShow) {
- name = toShow;
- }
-
- public Project.NameKey getProjectKey() {
- return name;
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- if (name != null) {
- setPageTitle(AdminMessages.I.project(name.get()));
- }
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- savedKey = name;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectTagsScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectTagsScreen.java
deleted file mode 100644
index 22c331d..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectTagsScreen.java
+++ /dev/null
@@ -1,571 +0,0 @@
-// Copyright (C) 2015 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.client.admin;
-
-import static com.google.gerrit.client.ui.Util.highlight;
-
-import com.google.gerrit.client.ConfirmationCallback;
-import com.google.gerrit.client.ConfirmationDialog;
-import com.google.gerrit.client.ErrorDialog;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.VoidResult;
-import com.google.gerrit.client.access.AccessMap;
-import com.google.gerrit.client.access.ProjectAccessInfo;
-import com.google.gerrit.client.info.WebLinkInfo;
-import com.google.gerrit.client.projects.ProjectApi;
-import com.google.gerrit.client.projects.TagInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.rpc.ScreenLoadCallback;
-import com.google.gerrit.client.ui.HintTextBox;
-import com.google.gerrit.client.ui.Hyperlink;
-import com.google.gerrit.client.ui.NavigationTable;
-import com.google.gerrit.client.ui.PagingHyperlink;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.core.client.Scheduler.ScheduledCommand;
-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.dom.client.KeyUpEvent;
-import com.google.gwt.event.dom.client.KeyUpHandler;
-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.FlexCellFormatter;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Grid;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.InlineHTML;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.TextBox;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.globalkey.client.NpTextBox;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-public class ProjectTagsScreen extends PaginatedProjectScreen {
- private Hyperlink prev;
- private Hyperlink next;
- private TagsTable tagTable;
- private Button delTag;
- private Button addTag;
- private HintTextBox nameTxtBox;
- private HintTextBox irevTxtBox;
- private HintTextBox annotationTxtBox;
- private FlowPanel addPanel;
- private NpTextBox filterTxt;
- private Query query;
-
- public ProjectTagsScreen(Project.NameKey toShow) {
- super(toShow);
- }
-
- @Override
- public String getScreenToken() {
- return PageLinks.toProjectTags(getProjectKey());
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- addPanel.setVisible(false);
- AccessMap.get(
- getProjectKey(),
- new GerritCallback<ProjectAccessInfo>() {
- @Override
- public void onSuccess(ProjectAccessInfo result) {
- addPanel.setVisible(result.canAddTagRefs());
- }
- });
- query = new Query(match).start(start).run();
- savedPanel = TAGS;
- }
-
- private void updateForm() {
- tagTable.updateDeleteButton();
- addTag.setEnabled(true);
- nameTxtBox.setEnabled(true);
- irevTxtBox.setEnabled(true);
- annotationTxtBox.setEnabled(true);
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- initPageHeader();
-
- prev = PagingHyperlink.createPrev();
- prev.setVisible(false);
-
- next = PagingHyperlink.createNext();
- next.setVisible(false);
-
- addPanel = new FlowPanel();
-
- Grid addGrid = new Grid(3, 2);
- addGrid.setStyleName(Gerrit.RESOURCES.css().addBranch());
- int texBoxLength = 50;
-
- KeyPressHandler onKeyPress =
- new KeyPressHandler() {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
- doAddNewTag();
- }
- }
- };
-
- nameTxtBox = new HintTextBox();
- nameTxtBox.setVisibleLength(texBoxLength);
- nameTxtBox.setHintText(AdminConstants.I.defaultTagName());
- nameTxtBox.addKeyPressHandler(onKeyPress);
- addGrid.setText(0, 0, AdminConstants.I.columnTagName() + ":");
- addGrid.setWidget(0, 1, nameTxtBox);
-
- irevTxtBox = new HintTextBox();
- irevTxtBox.setVisibleLength(texBoxLength);
- irevTxtBox.setHintText(AdminConstants.I.defaultRevisionSpec());
- irevTxtBox.addKeyPressHandler(onKeyPress);
- addGrid.setText(1, 0, AdminConstants.I.revision() + ":");
- addGrid.setWidget(1, 1, irevTxtBox);
-
- annotationTxtBox = new HintTextBox();
- annotationTxtBox.setVisibleLength(texBoxLength);
- annotationTxtBox.setHintText(AdminConstants.I.annotation());
- annotationTxtBox.addKeyPressHandler(onKeyPress);
- addGrid.setText(2, 0, AdminConstants.I.columnTagAnnotation() + ":");
- addGrid.setWidget(2, 1, annotationTxtBox);
-
- addTag = new Button(AdminConstants.I.buttonAddTag());
- addTag.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- doAddNewTag();
- }
- });
- addPanel.add(addGrid);
- addPanel.add(addTag);
-
- tagTable = new TagsTable();
-
- delTag = new Button(AdminConstants.I.buttonDeleteTag());
- delTag.setStyleName(Gerrit.RESOURCES.css().branchTableDeleteButton());
- delTag.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- tagTable.deleteChecked();
- }
- });
-
- HorizontalPanel buttons = new HorizontalPanel();
- buttons.setStyleName(Gerrit.RESOURCES.css().branchTablePrevNextLinks());
- buttons.add(delTag);
- buttons.add(prev);
- buttons.add(next);
- add(tagTable);
- add(buttons);
- add(addPanel);
- }
-
- private void initPageHeader() {
- parseToken();
- HorizontalPanel hp = new HorizontalPanel();
- hp.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel());
- Label filterLabel = new Label(AdminConstants.I.projectFilter());
- filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel());
- hp.add(filterLabel);
- filterTxt = new NpTextBox();
- filterTxt.setValue(match);
- filterTxt.addKeyUpHandler(
- new KeyUpHandler() {
- @Override
- public void onKeyUp(KeyUpEvent event) {
- Query q = new Query(filterTxt.getValue());
- if (match.equals(q.qMatch)) {
- q.start(start);
- } else {
- if (query == null) {
- q.run();
- }
- query = q;
- }
- }
- });
- hp.add(filterTxt);
- add(hp);
- }
-
- private void doAddNewTag() {
- String tagName = nameTxtBox.getText().trim();
- if (tagName.isEmpty()) {
- nameTxtBox.setFocus(true);
- return;
- }
-
- String rev = irevTxtBox.getText().trim();
- if (rev.isEmpty()) {
- irevTxtBox.setText("HEAD");
- Scheduler.get()
- .scheduleDeferred(
- new ScheduledCommand() {
- @Override
- public void execute() {
- irevTxtBox.selectAll();
- irevTxtBox.setFocus(true);
- }
- });
- return;
- }
-
- String annotation = annotationTxtBox.getText().trim();
- if (annotation.isEmpty()) {
- annotation = null;
- }
-
- addTag.setEnabled(false);
- ProjectApi.createTag(
- getProjectKey(),
- tagName,
- rev,
- annotation,
- new GerritCallback<TagInfo>() {
- @Override
- public void onSuccess(TagInfo tag) {
- showAddedTag(tag);
- nameTxtBox.setText("");
- irevTxtBox.setText("");
- annotationTxtBox.setText("");
- query = new Query(match).start(start).run();
- }
-
- @Override
- public void onFailure(Throwable caught) {
- addTag.setEnabled(true);
- selectAllAndFocus(nameTxtBox);
- new ErrorDialog(caught.getMessage()).center();
- }
- });
- }
-
- void showAddedTag(TagInfo tag) {
- SafeHtmlBuilder b = new SafeHtmlBuilder();
- b.openElement("b");
- b.append(Gerrit.C.tagCreationConfirmationMessage());
- b.closeElement("b");
-
- b.openElement("p");
- b.append(tag.ref());
- b.closeElement("p");
-
- ConfirmationDialog confirmationDialog =
- new ConfirmationDialog(
- Gerrit.C.tagCreationDialogTitle(),
- b.toSafeHtml(),
- new ConfirmationCallback() {
- @Override
- public void onOk() {
- // do nothing
- }
- });
- confirmationDialog.center();
- confirmationDialog.setCancelVisible(false);
- }
-
- private static void selectAllAndFocus(TextBox textBox) {
- textBox.selectAll();
- textBox.setFocus(true);
- }
-
- private class TagsTable extends NavigationTable<TagInfo> {
- private ValueChangeHandler<Boolean> updateDeleteHandler;
- boolean canDelete;
-
- TagsTable() {
- table.setWidth("");
- table.setText(0, 2, AdminConstants.I.columnTagName());
- table.setText(0, 3, AdminConstants.I.columnTagRevision());
-
- FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().iconHeader());
- fmt.addStyleName(0, 2, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 3, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 4, Gerrit.RESOURCES.css().dataHeader());
-
- updateDeleteHandler =
- new ValueChangeHandler<Boolean>() {
- @Override
- public void onValueChange(ValueChangeEvent<Boolean> event) {
- updateDeleteButton();
- }
- };
- }
-
- Set<String> getCheckedRefs() {
- Set<String> refs = new HashSet<>();
- for (int row = 1; row < table.getRowCount(); row++) {
- TagInfo k = getRowItem(row);
- if (k != null
- && table.getWidget(row, 1) instanceof CheckBox
- && ((CheckBox) table.getWidget(row, 1)).getValue()) {
- refs.add(k.ref());
- }
- }
- return refs;
- }
-
- void setChecked(Set<String> refs) {
- for (int row = 1; row < table.getRowCount(); row++) {
- TagInfo k = getRowItem(row);
- if (k != null && refs.contains(k.ref()) && table.getWidget(row, 1) instanceof CheckBox) {
- ((CheckBox) table.getWidget(row, 1)).setValue(true);
- }
- }
- }
-
- void deleteChecked() {
- final Set<String> refs = getCheckedRefs();
-
- SafeHtmlBuilder b = new SafeHtmlBuilder();
- b.openElement("b");
- b.append(Gerrit.C.tagDeletionConfirmationMessage());
- b.closeElement("b");
-
- b.openElement("p");
- boolean first = true;
- for (String ref : refs) {
- if (!first) {
- b.append(",").br();
- }
- b.append(ref);
- first = false;
- }
- b.closeElement("p");
-
- if (refs.isEmpty()) {
- updateDeleteButton();
- return;
- }
-
- delTag.setEnabled(false);
- ConfirmationDialog confirmationDialog =
- new ConfirmationDialog(
- Gerrit.C.tagDeletionDialogTitle(),
- b.toSafeHtml(),
- new ConfirmationCallback() {
- @Override
- public void onOk() {
- deleteTags(refs);
- }
-
- @Override
- public void onCancel() {
- tagTable.updateDeleteButton();
- }
- });
- confirmationDialog.center();
- }
-
- private void deleteTags(Set<String> tags) {
- ProjectApi.deleteTags(
- getProjectKey(),
- tags,
- new GerritCallback<VoidResult>() {
- @Override
- public void onSuccess(VoidResult result) {
- query = new Query(match).start(start).run();
- }
-
- @Override
- public void onFailure(Throwable caught) {
- query = new Query(match).start(start).run();
- super.onFailure(caught);
- }
- });
- }
-
- void display(List<TagInfo> tags) {
- displaySubset(tags, 0, tags.size());
- }
-
- void displaySubset(List<TagInfo> tags, int fromIndex, int toIndex) {
- canDelete = false;
-
- while (1 < table.getRowCount()) {
- table.removeRow(table.getRowCount() - 1);
- }
-
- for (TagInfo k : tags.subList(fromIndex, toIndex)) {
- int row = table.getRowCount();
- table.insertRow(row);
- applyDataRowStyle(row);
- populate(row, k);
- }
- }
-
- void populate(int row, TagInfo k) {
- if (k.canDelete()) {
- CheckBox sel = new CheckBox();
- sel.addValueChangeHandler(updateDeleteHandler);
- table.setWidget(row, 1, sel);
- canDelete = true;
- } else {
- table.setText(row, 1, "");
- }
-
- table.setWidget(row, 2, new InlineHTML(highlight(k.getShortName(), match)));
-
- if (k.revision() != null) {
- table.setText(row, 3, k.revision());
- } else {
- table.setText(row, 3, "");
- }
-
- FlowPanel actionsPanel = new FlowPanel();
- if (k.webLinks() != null) {
- for (WebLinkInfo webLink : Natives.asList(k.webLinks())) {
- actionsPanel.add(webLink.toAnchor());
- }
- }
- table.setWidget(row, 4, actionsPanel);
-
- FlexCellFormatter fmt = table.getFlexCellFormatter();
- String iconCellStyle = Gerrit.RESOURCES.css().iconCell();
- String dataCellStyle = Gerrit.RESOURCES.css().dataCell();
- fmt.addStyleName(row, 1, iconCellStyle);
- fmt.addStyleName(row, 2, dataCellStyle);
- fmt.addStyleName(row, 3, dataCellStyle);
- fmt.addStyleName(row, 4, dataCellStyle);
-
- setRowItem(row, k);
- }
-
- boolean hasTagCanDelete() {
- return canDelete;
- }
-
- void updateDeleteButton() {
- boolean on = false;
- for (int row = 1; row < table.getRowCount(); row++) {
- Widget w = table.getWidget(row, 1);
- if (w != null && w instanceof CheckBox) {
- CheckBox sel = (CheckBox) w;
- if (sel.getValue()) {
- on = true;
- break;
- }
- }
- }
- delTag.setEnabled(on);
- }
-
- @Override
- protected void onOpenRow(int row) {
- if (row > 0) {
- movePointerTo(row);
- }
- }
-
- @Override
- protected Object getRowItemKey(TagInfo item) {
- return item.ref();
- }
- }
-
- @Override
- public void onShowView() {
- super.onShowView();
- if (match != null) {
- filterTxt.setCursorPos(match.length());
- }
- filterTxt.setFocus(true);
- }
-
- private class Query {
- private String qMatch;
- private int qStart;
-
- Query(String match) {
- this.qMatch = match;
- }
-
- Query start(int start) {
- this.qStart = start;
- return this;
- }
-
- Query run() {
- // Retrieve one more tag than page size to determine if there are more
- // tags to display
- ProjectApi.getTags(
- getProjectKey(),
- pageSize + 1,
- qStart,
- qMatch,
- new ScreenLoadCallback<JsArray<TagInfo>>(ProjectTagsScreen.this) {
- @Override
- public void preDisplay(JsArray<TagInfo> result) {
- if (!isAttached()) {
- // View has been disposed.
- } else if (query == Query.this) {
- query = null;
- showList(result);
- } else {
- query.run();
- }
- }
- });
- return this;
- }
-
- void showList(JsArray<TagInfo> result) {
- setToken(getTokenForScreen(qMatch, qStart));
- ProjectTagsScreen.this.match = qMatch;
- ProjectTagsScreen.this.start = qStart;
-
- if (result.length() <= pageSize) {
- tagTable.display(Natives.asList(result));
- next.setVisible(false);
- } else {
- tagTable.displaySubset(Natives.asList(result), 0, result.length() - 1);
- setupNavigationLink(next, qMatch, qStart + pageSize);
- }
- if (qStart > 0) {
- setupNavigationLink(prev, qMatch, qStart - pageSize);
- } else {
- prev.setVisible(false);
- }
-
- delTag.setVisible(tagTable.hasTagCanDelete());
- Set<String> checkedRefs = tagTable.getCheckedRefs();
- tagTable.setChecked(checkedRefs);
- updateForm();
-
- if (!isCurrentView()) {
- display();
- }
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/RangeBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/RangeBox.java
deleted file mode 100644
index 063a60c..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/RangeBox.java
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (C) 2011 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.client.admin;
-
-import com.google.gwt.editor.client.IsEditor;
-import com.google.gwt.editor.client.adapters.TakesValueEditor;
-import com.google.gwt.text.shared.Renderer;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.IntegerBox;
-import com.google.gwt.user.client.ui.ValueBoxBase.TextAlignment;
-import com.google.gwt.user.client.ui.ValueListBox;
-import java.io.IOException;
-
-abstract class RangeBox extends Composite implements IsEditor<TakesValueEditor<Integer>> {
- static final RangeRenderer rangeRenderer = new RangeRenderer();
-
- private static class RangeRenderer implements Renderer<Integer> {
- @Override
- public String render(Integer object) {
- if (0 <= object) {
- return "+" + object;
- }
- return String.valueOf(object);
- }
-
- @Override
- public void render(Integer object, Appendable appendable) throws IOException {
- appendable.append(render(object));
- }
- }
-
- static class List extends RangeBox {
- final ValueListBox<Integer> list;
-
- List() {
- list = new ValueListBox<>(rangeRenderer);
- initWidget(list);
- }
-
- @Override
- void setEnabled(boolean on) {
- list.getElement().setPropertyBoolean("disabled", !on);
- }
-
- @Override
- public TakesValueEditor<Integer> asEditor() {
- return list.asEditor();
- }
- }
-
- static class Box extends RangeBox {
- private final IntegerBox box;
-
- Box() {
- box = new IntegerBox();
- box.setVisibleLength(10);
- box.setAlignment(TextAlignment.RIGHT);
- initWidget(box);
- }
-
- @Override
- void setEnabled(boolean on) {
- box.getElement().setPropertyBoolean("disabled", !on);
- }
-
- @Override
- public TakesValueEditor<Integer> asEditor() {
- return box.asEditor();
- }
- }
-
- abstract void setEnabled(boolean on);
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/RefPatternBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/RefPatternBox.java
deleted file mode 100644
index f1180cc..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/RefPatternBox.java
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (C) 2011 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.client.admin;
-
-import com.google.gwt.dom.client.Document;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.event.dom.client.KeyPressHandler;
-import com.google.gwt.text.shared.Parser;
-import com.google.gwt.text.shared.Renderer;
-import com.google.gwt.user.client.ui.ValueBox;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-import java.io.IOException;
-import java.text.ParseException;
-
-public class RefPatternBox extends ValueBox<String> {
- private static final Renderer<String> RENDERER =
- new Renderer<String>() {
- @Override
- public String render(String ref) {
- return ref;
- }
-
- @Override
- public void render(String ref, Appendable dst) throws IOException {
- dst.append(render(ref));
- }
- };
-
- private static final Parser<String> PARSER =
- new Parser<String>() {
- @Override
- public String parse(CharSequence text) throws ParseException {
- String ref = text.toString();
-
- if (ref.isEmpty()) {
- throw new ParseException(AdminConstants.I.refErrorEmpty(), 0);
- }
-
- if (ref.charAt(0) == '/') {
- throw new ParseException(AdminConstants.I.refErrorBeginSlash(), 0);
- }
-
- if (ref.charAt(0) == '^') {
- if (!ref.startsWith("^refs/")) {
- ref = "^refs/heads/" + ref.substring(1);
- }
- } else if (!ref.startsWith("refs/")) {
- ref = "refs/heads/" + ref;
- }
-
- for (int i = 0; i < ref.length(); i++) {
- final char c = ref.charAt(i);
-
- if (c == '/' && 0 < i && ref.charAt(i - 1) == '/') {
- throw new ParseException(AdminConstants.I.refErrorDoubleSlash(), i);
- }
-
- if (c == ' ') {
- throw new ParseException(AdminConstants.I.refErrorNoSpace(), i);
- }
-
- if (c < ' ') {
- throw new ParseException(AdminConstants.I.refErrorPrintable(), i);
- }
- }
- return ref;
- }
- };
-
- public RefPatternBox() {
- super(Document.get().createTextInputElement(), RENDERER, PARSER);
- addKeyPressHandler(GlobalKey.STOP_PROPAGATION);
- addKeyPressHandler(
- new KeyPressHandler() {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- if (event.getCharCode() == ' ') {
- event.preventDefault();
- }
- }
- });
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/Util.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/Util.java
deleted file mode 100644
index bbc8a1d..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/Util.java
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (C) 2008 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.client.admin;
-
-import com.google.gerrit.common.data.ProjectAdminService;
-import com.google.gerrit.extensions.client.ProjectState;
-import com.google.gerrit.extensions.client.SubmitType;
-import com.google.gwt.core.client.GWT;
-import com.google.gwtjsonrpc.client.JsonUtil;
-
-public class Util {
- public static final ProjectAdminService PROJECT_SVC;
-
- static {
- PROJECT_SVC = GWT.create(ProjectAdminService.class);
- JsonUtil.bind(PROJECT_SVC, "rpc/ProjectAdminService");
-
- AdminResources.I.css().ensureInjected();
- }
-
- public static String toLongString(SubmitType type) {
- if (type == null) {
- return "";
- }
- switch (type) {
- case INHERIT:
- return AdminConstants.I.projectSubmitType_INHERIT();
- case FAST_FORWARD_ONLY:
- return AdminConstants.I.projectSubmitType_FAST_FORWARD_ONLY();
- case MERGE_IF_NECESSARY:
- return AdminConstants.I.projectSubmitType_MERGE_IF_NECESSARY();
- case REBASE_IF_NECESSARY:
- return AdminConstants.I.projectSubmitType_REBASE_IF_NECESSARY();
- case REBASE_ALWAYS:
- return AdminConstants.I.projectSubmitType_REBASE_ALWAYS();
- case MERGE_ALWAYS:
- return AdminConstants.I.projectSubmitType_MERGE_ALWAYS();
- case CHERRY_PICK:
- return AdminConstants.I.projectSubmitType_CHERRY_PICK();
- default:
- return type.name();
- }
- }
-
- public static String toLongString(ProjectState type) {
- if (type == null) {
- return "";
- }
- switch (type) {
- case ACTIVE:
- return AdminConstants.I.projectState_ACTIVE();
- case READ_ONLY:
- return AdminConstants.I.projectState_READ_ONLY();
- case HIDDEN:
- return AdminConstants.I.projectState_HIDDEN();
- default:
- return type.name();
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ValueEditor.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ValueEditor.java
deleted file mode 100644
index ad614e5..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ValueEditor.java
+++ /dev/null
@@ -1,209 +0,0 @@
-// Copyright (C) 2011 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.client.admin;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.DivElement;
-import com.google.gwt.dom.client.NativeEvent;
-import com.google.gwt.dom.client.Style.Display;
-import com.google.gwt.editor.client.EditorError;
-import com.google.gwt.editor.client.HasEditorErrors;
-import com.google.gwt.editor.client.IsEditor;
-import com.google.gwt.editor.client.LeafValueEditor;
-import com.google.gwt.editor.ui.client.adapters.ValueBoxEditor;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.DoubleClickEvent;
-import com.google.gwt.event.dom.client.DoubleClickHandler;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiChild;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.Focusable;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.SimplePanel;
-import com.google.gwt.user.client.ui.ValueBoxBase;
-import com.google.gwt.user.client.ui.Widget;
-import java.text.ParseException;
-import java.util.List;
-
-public class ValueEditor<T> extends Composite
- implements HasEditorErrors<T>, IsEditor<ValueBoxEditor<T>>, LeafValueEditor<T>, Focusable {
- interface Binder extends UiBinder<Widget, ValueEditor<?>> {}
-
- static final Binder uiBinder = GWT.create(Binder.class);
-
- @UiField SimplePanel textPanel;
- private Label textLabel;
- private StartEditHandlers startHandlers;
-
- @UiField Image editIcon;
-
- @UiField SimplePanel editPanel;
-
- @UiField DivElement errorLabel;
-
- private ValueBoxBase<T> editChild;
- private ValueBoxEditor<T> editProxy;
- private boolean ignoreEditorValue;
- private T value;
-
- public ValueEditor() {
- startHandlers = new StartEditHandlers();
- initWidget(uiBinder.createAndBindUi(this));
- editPanel.setVisible(false);
- editIcon.addClickHandler(startHandlers);
- }
-
- public void edit() {
- textPanel.removeFromParent();
- textPanel = null;
- textLabel = null;
-
- editIcon.removeFromParent();
- editIcon = null;
- startHandlers = null;
-
- editPanel.setVisible(true);
- }
-
- @Override
- public ValueBoxEditor<T> asEditor() {
- if (editProxy == null) {
- editProxy = new EditorProxy();
- }
- return editProxy;
- }
-
- @Override
- public T getValue() {
- return ignoreEditorValue ? value : asEditor().getValue();
- }
-
- @Override
- public void setValue(T value) {
- this.value = value;
- asEditor().setValue(value);
- }
-
- void setIgnoreEditorValue(boolean off) {
- ignoreEditorValue = off;
- }
-
- public void setEditTitle(String title) {
- editIcon.setTitle(title);
- }
-
- @UiChild(limit = 1, tagname = "display")
- public void setDisplay(Label widget) {
- textLabel = widget;
- textPanel.add(textLabel);
-
- textLabel.addClickHandler(startHandlers);
- textLabel.addDoubleClickHandler(startHandlers);
- }
-
- @UiChild(limit = 1, tagname = "editor")
- public void setEditor(ValueBoxBase<T> widget) {
- editChild = widget;
- editPanel.add(editChild);
- editProxy = null;
- }
-
- public void setEnabled(boolean enabled) {
- editIcon.setVisible(enabled);
- startHandlers.enabled = enabled;
- }
-
- @Override
- public void showErrors(List<EditorError> errors) {
- StringBuilder buf = new StringBuilder();
- for (EditorError error : errors) {
- if (error.getEditor().equals(editProxy)) {
- buf.append("\n");
- if (error.getUserData() instanceof ParseException) {
- buf.append(((ParseException) error.getUserData()).getMessage());
- } else {
- buf.append(error.getMessage());
- }
- }
- }
-
- if (0 < buf.length()) {
- errorLabel.setInnerText(buf.substring(1));
- errorLabel.getStyle().setDisplay(Display.BLOCK);
- } else {
- errorLabel.setInnerText("");
- errorLabel.getStyle().setDisplay(Display.NONE);
- }
- }
-
- @Override
- public void setAccessKey(char key) {
- editChild.setAccessKey(key);
- }
-
- @Override
- public void setFocus(boolean focused) {
- editChild.setFocus(focused);
- if (focused) {
- editChild.setCursorPos(editChild.getText().length());
- }
- }
-
- @Override
- public int getTabIndex() {
- return editChild.getTabIndex();
- }
-
- @Override
- public void setTabIndex(int index) {
- editChild.setTabIndex(index);
- }
-
- private class StartEditHandlers implements ClickHandler, DoubleClickHandler {
- boolean enabled;
-
- @Override
- public void onClick(ClickEvent event) {
- if (enabled && event.getNativeButton() == NativeEvent.BUTTON_LEFT) {
- edit();
- }
- }
-
- @Override
- public void onDoubleClick(DoubleClickEvent event) {
- if (enabled && event.getNativeButton() == NativeEvent.BUTTON_LEFT) {
- edit();
- }
- }
- }
-
- private class EditorProxy extends ValueBoxEditor<T> {
- EditorProxy() {
- super(editChild);
- }
-
- @Override
- public void setValue(T value) {
- super.setValue(value);
- if (textLabel == null) {
- setDisplay(new Label());
- }
- textLabel.setText(editChild.getText());
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ValueEditor.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ValueEditor.ui.xml
deleted file mode 100644
index 137ad2b..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ValueEditor.ui.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2011 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- >
-<ui:with field='ico' type='com.google.gerrit.client.GerritResources'/>
-<ui:style gss='false'>
- .panel {
- position: relative;
- white-space: nowrap;
- }
-
- .textPanel {
- width: 100%;
- padding-right: 21px;
- }
-
- .editIcon {
- position: absolute;
- top: 0;
- right: 5px;
- }
-
- .editPanel {
- width: 100%;
- }
-
- .errorLabel {
- display: none;
- color: red;
- white-space: pre;
- }
-</ui:style>
-<g:HTMLPanel stylePrimaryName='{style.panel}'>
- <g:Image
- ui:field='editIcon'
- resource='{ico.edit}'
- stylePrimaryName='{style.editIcon}'
- title='Edit'>
- <ui:attribute name='title'/>
- </g:Image>
- <g:SimplePanel ui:field='textPanel' stylePrimaryName='{style.textPanel}'/>
-
- <g:SimplePanel ui:field='editPanel' stylePrimaryName='{style.editPanel}'/>
- <div
- ui:field='errorLabel'
- class='{style.errorLabel}'/>
-</g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/admin.css b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/admin.css
deleted file mode 100644
index eca4823..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/admin.css
+++ /dev/null
@@ -1,53 +0,0 @@
-/* Copyright (C) 2009 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.
- */
-
-@eval selectionColor com.google.gerrit.client.Gerrit.getTheme().selectionColor;
-@eval textColor com.google.gerrit.client.Gerrit.getTheme().textColor;
-@def deletedBackground #a9a9a9;
-
-@sprite .deleteIcon {
- gwt-image: 'deleteNormal';
- border: none;
-}
-
-@sprite .deleteIcon:hover {
- gwt-image: 'deleteHover';
- border: none;
-}
-
-@sprite .undoIcon {
- gwt-image: 'undoNormal';
- border: none;
-}
-
-.deleted {
- background-color: deletedBackground;
- color: #ffffff;
- white-space: nowrap;
- padding-left: 50px;
-}
-
-.deleted:hover {
- background-color: selectionColor;
- color: textColor;
- }
-
-.deletedBorder {
- background: 1px solid deletedBackground;
-}
-
-.deleteSectionHover {
- background-color: selectionColor !important;
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/arrow_undo.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/arrow_undo.png
deleted file mode 100644
index 6972c5e..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/arrow_undo.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/deleteHover.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/deleteHover.png
deleted file mode 100644
index 9fde3fa..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/deleteHover.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/deleteNormal.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/deleteNormal.png
deleted file mode 100644
index 47a1195..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/deleteNormal.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ActionContext.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ActionContext.java
deleted file mode 100644
index cf8de54..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ActionContext.java
+++ /dev/null
@@ -1,293 +0,0 @@
-// Copyright (C) 2013 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.client.api;
-
-import com.google.gerrit.client.actions.ActionButton;
-import com.google.gerrit.client.info.ActionInfo;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.EditInfo;
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.client.projects.BranchInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class ActionContext extends JavaScriptObject {
- static final native void init() /*-{
- var Gerrit = $wnd.Gerrit;
- var doc = $wnd.document;
- var stopPropagation = function (e) {
- if (e && e.stopPropagation) e.stopPropagation();
- else $wnd.event.cancelBubble = true;
- };
-
- Gerrit.ActionContext = function(u){this._u=u};
- Gerrit.ActionContext.prototype = {
- go: Gerrit.go,
- refresh: Gerrit.refresh,
- refreshMenuBar: Gerrit.refreshMenuBar,
- isSignedIn: Gerrit.isSignedIn,
- showError: Gerrit.showError,
-
- br: function(){return doc.createElement('br')},
- hr: function(){return doc.createElement('hr')},
- button: function(label, o) {
- var e = doc.createElement('button');
- e.appendChild(this.div(doc.createTextNode(label)));
- if (o && o.onclick) e.onclick = o.onclick;
- return e;
- },
- checkbox: function() {
- var e = doc.createElement('input');
- e.type = 'checkbox';
- return e;
- },
- div: function() {
- var e = doc.createElement('div');
- for (var i = 0; i < arguments.length; i++)
- e.appendChild(arguments[i]);
- return e;
- },
- label: function(c,label) {
- var e = doc.createElement('label');
- e.appendChild(c);
- e.appendChild(doc.createTextNode(label));
- return e;
- },
- prependLabel: function(label,c) {
- var e = doc.createElement('label');
- e.appendChild(doc.createTextNode(label));
- e.appendChild(c);
- return e;
- },
- span: function() {
- var e = doc.createElement('span');
- for (var i = 0; i < arguments.length; i++)
- e.appendChild(arguments[i]);
- return e;
- },
- msg: function(label) {
- var e = doc.createElement('span');
- e.appendChild(doc.createTextNode(label));
- return e;
- },
- textarea: function(o) {
- var e = doc.createElement('textarea');
- e.onkeypress = stopPropagation;
- if (o && o.rows) e.rows = o.rows;
- if (o && o.cols) e.cols = o.cols;
- return e;
- },
- textfield: function() {
- var e = doc.createElement('input');
- e.type = 'text';
- e.onkeypress = stopPropagation;
- return e;
- },
- select: function(a,s) {
- var e = doc.createElement('select');
- for (var i = 0; i < a.length; i++) {
- var o = doc.createElement('option');
- if (i==s) {
- o.setAttributeNode(doc.createAttribute("selected"));
- }
- o.appendChild(doc.createTextNode(a[i]));
- e.appendChild(o);
- }
- return e;
- },
- selected: function(e) {
- return e.options[e.selectedIndex].text;
- },
-
- popup: function(e){
- this._p=@com.google.gerrit.client.api.PopupHelper::popup(
- Lcom/google/gerrit/client/api/ActionContext;Lcom/google/gwt/dom/client/Element;)(this,e)},
- hide: function() {
- this._p.@com.google.gerrit.client.api.PopupHelper::hide()();
- delete this['_p'];
- },
-
- call: function(i,b) {
- var m = this.action.method.toLowerCase();
- if (m == 'get' || m == 'delete' || i==null) this[m](b);
- else this[m](i,b);
- },
- get: function(b){@com.google.gerrit.client.api.ActionContext::get(
- Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;)(this._u,b)},
- post: function(i,b){@com.google.gerrit.client.api.ActionContext::post(
- Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;)(
- this._u,i,b)},
- put: function(i,b){@com.google.gerrit.client.api.ActionContext::put(
- Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;)(
- this._u,i,b)},
- 'delete': function(b){@com.google.gerrit.client.api.ActionContext::delete(
- Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;)(this._u,b)},
- del: function(b){@com.google.gerrit.client.api.ActionContext::delete(
- Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;)(this._u,b)},
- };
- }-*/;
-
- static final native ActionContext create(RestApi f) /*-{
- return new $wnd.Gerrit.ActionContext(f);
- }-*/;
-
- final native void set(ActionInfo a) /*-{ this.action=a; }-*/;
-
- final native void set(ChangeInfo c) /*-{ this.change=c; }-*/;
-
- final native void set(EditInfo e) /*-{ this.edit=e; }-*/;
-
- final native void set(Project.NameKey p) /*-{ this.project=p; }-*/;
-
- final native void set(BranchInfo b) /*-{ this.branch=b }-*/;
-
- final native void set(RevisionInfo r) /*-{ this.revision=r; }-*/;
-
- final native void button(ActionButton b) /*-{ this._b=b; }-*/;
-
- final native ActionButton button() /*-{ return this._b; }-*/;
-
- public final native boolean has_popup() /*-{ return this.hasOwnProperty('_p') }-*/;
-
- public final native void hide() /*-{ this.hide(); }-*/;
-
- protected ActionContext() {}
-
- static final void get(RestApi api, JavaScriptObject cb) {
- api.get(wrap(cb));
- }
-
- /**
- * The same as {@link #get(RestApi, JavaScriptObject)} but without converting a {@link
- * NativeString} result to String.
- */
- static final void getRaw(RestApi api, JavaScriptObject cb) {
- api.get(wrapRaw(cb));
- }
-
- static final void post(RestApi api, JavaScriptObject in, JavaScriptObject cb) {
- if (NativeString.is(in)) {
- post(api, ((NativeString) in).asString(), cb);
- } else {
- api.post(in, wrap(cb));
- }
- }
-
- /**
- * The same as {@link #post(RestApi, JavaScriptObject, JavaScriptObject)} but without converting a
- * {@link NativeString} result to String.
- */
- static final void postRaw(RestApi api, JavaScriptObject in, JavaScriptObject cb) {
- if (NativeString.is(in)) {
- postRaw(api, ((NativeString) in).asString(), cb);
- } else {
- api.post(in, wrapRaw(cb));
- }
- }
-
- static final void post(RestApi api, String in, JavaScriptObject cb) {
- api.post(in, wrap(cb));
- }
-
- /**
- * The same as {@link #post(RestApi, String, JavaScriptObject)} but without converting a {@link
- * NativeString} result to String.
- */
- static final void postRaw(RestApi api, String in, JavaScriptObject cb) {
- api.post(in, wrapRaw(cb));
- }
-
- static final void put(RestApi api, JavaScriptObject cb) {
- api.put(wrap(cb));
- }
-
- /**
- * The same as {@link #put(RestApi, JavaScriptObject)} but without converting a {@link
- * NativeString} result to String.
- */
- static final void putRaw(RestApi api, JavaScriptObject cb) {
- api.put(wrapRaw(cb));
- }
-
- static final void put(RestApi api, JavaScriptObject in, JavaScriptObject cb) {
- if (NativeString.is(in)) {
- put(api, ((NativeString) in).asString(), cb);
- } else {
- api.put(in, wrap(cb));
- }
- }
-
- /**
- * The same as {@link #put(RestApi, JavaScriptObject, JavaScriptObject)} but without converting a
- * {@link NativeString} result to String.
- */
- static final void putRaw(RestApi api, JavaScriptObject in, JavaScriptObject cb) {
- if (NativeString.is(in)) {
- putRaw(api, ((NativeString) in).asString(), cb);
- } else {
- api.put(in, wrapRaw(cb));
- }
- }
-
- static final void put(RestApi api, String in, JavaScriptObject cb) {
- api.put(in, wrap(cb));
- }
-
- /**
- * The same as {@link #put(RestApi, String, JavaScriptObject)} but without converting a {@link
- * NativeString} result to String.
- */
- static final void putRaw(RestApi api, String in, JavaScriptObject cb) {
- api.put(in, wrapRaw(cb));
- }
-
- static final void delete(RestApi api, JavaScriptObject cb) {
- api.delete(wrap(cb));
- }
-
- /**
- * The same as {@link #delete(RestApi, JavaScriptObject)} but without converting a {@link
- * NativeString} result to String.
- */
- static final void deleteRaw(RestApi api, JavaScriptObject cb) {
- api.delete(wrapRaw(cb));
- }
-
- private static GerritCallback<JavaScriptObject> wrap(JavaScriptObject cb) {
- return new GerritCallback<JavaScriptObject>() {
- @Override
- public void onSuccess(JavaScriptObject result) {
- if (NativeString.is(result)) {
- NativeString s = result.cast();
- ApiGlue.invoke(cb, s.asString());
- } else {
- ApiGlue.invoke(cb, result);
- }
- }
- };
- }
-
- private static GerritCallback<JavaScriptObject> wrapRaw(JavaScriptObject cb) {
- return new GerritCallback<JavaScriptObject>() {
- @Override
- public void onSuccess(JavaScriptObject result) {
- ApiGlue.invoke(cb, result);
- }
- };
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ApiGlue.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ApiGlue.java
deleted file mode 100644
index 294fa9b..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ApiGlue.java
+++ /dev/null
@@ -1,322 +0,0 @@
-// Copyright (C) 2013 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.client.api;
-
-import com.google.gerrit.client.ErrorDialog;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.info.GeneralPreferences;
-import com.google.gerrit.client.info.ServerInfo;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.user.client.History;
-import com.google.gwt.user.client.Window;
-
-public class ApiGlue {
- private static String pluginName;
-
- public static void init() {
- init0();
- ActionContext.init();
- HtmlTemplate.init();
- Plugin.init();
- }
-
- private static native void init0() /*-{
- var serverUrl = @com.google.gwt.core.client.GWT::getHostPageBaseURL()();
- var ScreenDefinition = @com.google.gerrit.client.api.ExtensionScreen.Definition::TYPE;
- var SettingsScreenDefinition = @com.google.gerrit.client.api.ExtensionSettingsScreen.Definition::TYPE;
- var PanelDefinition = @com.google.gerrit.client.api.ExtensionPanel.Definition::TYPE;
- $wnd.Gerrit = {
- JsonString: @com.google.gerrit.client.rpc.NativeString::TYPE,
- events: {},
- plugins: {},
- screens: {},
- settingsScreens: {},
- panels: {},
- change_actions: {},
- edit_actions: {},
- revision_actions: {},
- project_actions: {},
- branch_actions: {},
-
- getPluginName: @com.google.gerrit.client.api.ApiGlue::getPluginName(),
- injectCss: @com.google.gwt.dom.client.StyleInjector::inject(Ljava/lang/String;),
- install: function (f) {
- var p = this._getPluginByUrl(@com.google.gerrit.client.api.PluginName::getCallerUrl()());
- @com.google.gerrit.client.api.ApiGlue::install(
- Lcom/google/gwt/core/client/JavaScriptObject;
- Lcom/google/gerrit/client/api/Plugin;)
- (f,p);
- },
- installGwt: function(u){return this._getPluginByUrl(u)},
- _getPluginByUrl: function(u) {
- return u.indexOf(serverUrl) == 0
- ? this.plugins[u.substring(serverUrl.length)]
- : this.plugins[u]
- },
-
- go: @com.google.gerrit.client.api.ApiGlue::go(Ljava/lang/String;),
- refresh: @com.google.gerrit.client.api.ApiGlue::refresh(),
- refreshMenuBar: @com.google.gerrit.client.api.ApiGlue::refreshMenuBar(),
- isSignedIn: @com.google.gerrit.client.api.ApiGlue::isSignedIn(),
- showError: @com.google.gerrit.client.api.ApiGlue::showError(Ljava/lang/String;),
- getServerInfo: @com.google.gerrit.client.api.ApiGlue::getServerInfo(),
- getCurrentUser: @com.google.gerrit.client.api.ApiGlue::getCurrentUser(),
- getUserPreferences: @com.google.gerrit.client.api.ApiGlue::getUserPreferences(),
- refreshUserPreferences: @com.google.gerrit.client.api.ApiGlue::refreshUserPreferences(),
-
- on: function (e,f){(this.events[e] || (this.events[e]=[])).push(f)},
- onAction: function (t,n,c){this._onAction(this.getPluginName(),t,n,c)},
- _onAction: function (p,t,n,c) {
- var i = p+'~'+n;
- if ('change' == t) this.change_actions[i]=c;
- else if ('edit' == t) this.edit_actions[i]=c;
- else if ('revision' == t) this.revision_actions[i]=c;
- else if ('project' == t) this.project_actions[i]=c;
- else if ('branch' == t) this.branch_actions[i]=c;
- else if ('screen' == t) _screen(p,t,c);
- },
- screen: function(r,c){this._screen(this.getPluginName(),r,c)},
- _screen: function(p,r,c){
- var s = new ScreenDefinition(r,c);
- (this.screens[p] || (this.screens[p]=[])).push(s);
- },
- settingsScreen: function(p,m,c){this._settingsScreen(this.getPluginName(),p,m,c)},
- _settingsScreen: function(n,p,m,c){
- var s = new SettingsScreenDefinition(p,m,c);
- (this.settingsScreens[n] || (this.settingsScreens[n]=[])).push(s);
- },
- panel: function(i,c,n){this._panel(this.getPluginName(),i,c,n)},
- _panel: function(n,i,c,x){
- var p = new PanelDefinition(n,c,x);
- (this.panels[i] || (this.panels[i]=[])).push(p);
- },
-
- url: function (d) {
- if (d && d.length > 0)
- return serverUrl + (d.charAt(0)=='/' ? d.substring(1) : d);
- return serverUrl;
- },
-
- _api: function(u) {
- return @com.google.gerrit.client.rpc.RestApi::new(Ljava/lang/String;)(u);
- },
- get: function(u,b) {
- @com.google.gerrit.client.api.ActionContext::get(
- Lcom/google/gerrit/client/rpc/RestApi;
- Lcom/google/gwt/core/client/JavaScriptObject;)
- (this._api(u), b);
- },
- get_raw: function(u,b) {
- @com.google.gerrit.client.api.ActionContext::getRaw(
- Lcom/google/gerrit/client/rpc/RestApi;
- Lcom/google/gwt/core/client/JavaScriptObject;)
- (this._api(u), b);
- },
- post: function(u,i,b) {
- if (typeof i == 'string') {
- @com.google.gerrit.client.api.ActionContext::post(
- Lcom/google/gerrit/client/rpc/RestApi;
- Ljava/lang/String;
- Lcom/google/gwt/core/client/JavaScriptObject;)
- (this._api(u), i, b);
- } else {
- @com.google.gerrit.client.api.ActionContext::post(
- Lcom/google/gerrit/client/rpc/RestApi;
- Lcom/google/gwt/core/client/JavaScriptObject;
- Lcom/google/gwt/core/client/JavaScriptObject;)
- (this._api(u), i, b);
- }
- },
- post_raw: function(u,i,b) {
- if (typeof i == 'string') {
- @com.google.gerrit.client.api.ActionContext::postRaw(
- Lcom/google/gerrit/client/rpc/RestApi;
- Ljava/lang/String;
- Lcom/google/gwt/core/client/JavaScriptObject;)
- (this._api(u), i, b);
- } else {
- @com.google.gerrit.client.api.ActionContext::postRaw(
- Lcom/google/gerrit/client/rpc/RestApi;
- Lcom/google/gwt/core/client/JavaScriptObject;
- Lcom/google/gwt/core/client/JavaScriptObject;)
- (this._api(u), i, b);
- }
- },
- put: function(u,i,b) {
- if (b) {
- if (typeof i == 'string') {
- @com.google.gerrit.client.api.ActionContext::put(
- Lcom/google/gerrit/client/rpc/RestApi;
- Ljava/lang/String;
- Lcom/google/gwt/core/client/JavaScriptObject;)
- (this._api(u), i, b);
- } else {
- @com.google.gerrit.client.api.ActionContext::put(
- Lcom/google/gerrit/client/rpc/RestApi;
- Lcom/google/gwt/core/client/JavaScriptObject;
- Lcom/google/gwt/core/client/JavaScriptObject;)
- (this._api(u), i, b);
- }
- } else {
- @com.google.gerrit.client.api.ActionContext::put(
- Lcom/google/gerrit/client/rpc/RestApi;
- Lcom/google/gwt/core/client/JavaScriptObject;)
- (this._api(u), i);
- }
- },
- put_raw: function(u,i,b) {
- if (b) {
- if (typeof i == 'string') {
- @com.google.gerrit.client.api.ActionContext::putRaw(
- Lcom/google/gerrit/client/rpc/RestApi;
- Ljava/lang/String;
- Lcom/google/gwt/core/client/JavaScriptObject;)
- (this._api(u), i, b);
- } else {
- @com.google.gerrit.client.api.ActionContext::putRaw(
- Lcom/google/gerrit/client/rpc/RestApi;
- Lcom/google/gwt/core/client/JavaScriptObject;
- Lcom/google/gwt/core/client/JavaScriptObject;)
- (this._api(u), i, b);
- }
- } else {
- @com.google.gerrit.client.api.ActionContext::putRaw(
- Lcom/google/gerrit/client/rpc/RestApi;
- Lcom/google/gwt/core/client/JavaScriptObject;)
- (this._api(u), i);
- }
- },
- 'delete': function(u,b) {
- @com.google.gerrit.client.api.ActionContext::delete(
- Lcom/google/gerrit/client/rpc/RestApi;
- Lcom/google/gwt/core/client/JavaScriptObject;)
- (this._api(u), b);
- },
- del: function(u,b) {
- @com.google.gerrit.client.api.ActionContext::delete(
- Lcom/google/gerrit/client/rpc/RestApi;
- Lcom/google/gwt/core/client/JavaScriptObject;)
- (this._api(u), b);
- },
- del_raw: function(u,b) {
- @com.google.gerrit.client.api.ActionContext::deleteRaw(
- Lcom/google/gerrit/client/rpc/RestApi;
- Lcom/google/gwt/core/client/JavaScriptObject;)
- (this._api(u), b);
- },
- };
- }-*/;
-
- private static void install(JavaScriptObject cb, Plugin p) throws Exception {
- try {
- pluginName = p.name();
- invoke(cb, p);
- p._initialized();
- } catch (Exception e) {
- p.failure(e);
- throw e;
- } finally {
- pluginName = null;
- PluginLoader.loaded();
- }
- }
-
- private static String getPluginName() {
- if (pluginName != null) {
- return pluginName;
- }
- return PluginName.fromUrl(PluginName.getCallerUrl());
- }
-
- private static void go(String urlOrToken) {
- if (urlOrToken.startsWith("http:")
- || urlOrToken.startsWith("https:")
- || urlOrToken.startsWith("//")) {
- Window.Location.assign(urlOrToken);
- } else {
- Gerrit.display(urlOrToken);
- }
- }
-
- private static void refresh() {
- Gerrit.display(History.getToken());
- }
-
- private static ServerInfo getServerInfo() {
- return Gerrit.info();
- }
-
- private static AccountInfo getCurrentUser() {
- return Gerrit.getUserAccount();
- }
-
- private static GeneralPreferences getUserPreferences() {
- return Gerrit.getUserPreferences();
- }
-
- private static void refreshUserPreferences() {
- Gerrit.refreshUserPreferences();
- }
-
- private static void refreshMenuBar() {
- Gerrit.refreshMenuBar();
- }
-
- private static boolean isSignedIn() {
- return Gerrit.isSignedIn();
- }
-
- private static void showError(String message) {
- new ErrorDialog(message).center();
- }
-
- static final native void invoke(JavaScriptObject f) /*-{ f(); }-*/;
-
- static final native void invoke(JavaScriptObject f, JavaScriptObject a) /*-{ f(a); }-*/;
-
- static final native void invoke(
- JavaScriptObject f, JavaScriptObject a, JavaScriptObject b) /*-{ f(a,b) }-*/;
-
- static final native void invoke(JavaScriptObject f, String a) /*-{ f(a); }-*/;
-
- public static final void fireEvent(String event, String a) {
- JsArray<JavaScriptObject> h = getEventHandlers(event);
- for (int i = 0; i < h.length(); i++) {
- invoke(h.get(i), a);
- }
- }
-
- public static final void fireEvent(String event, Element e) {
- JsArray<JavaScriptObject> h = getEventHandlers(event);
- for (int i = 0; i < h.length(); i++) {
- invoke(h.get(i), e);
- }
- }
-
- static final void fireEvent(String event, JavaScriptObject a, JavaScriptObject b) {
- JsArray<JavaScriptObject> h = getEventHandlers(event);
- for (int i = 0; i < h.length(); i++) {
- invoke(h.get(i), a, b);
- }
- }
-
- static final native JsArray<JavaScriptObject> getEventHandlers(String e)
- /*-{ return $wnd.Gerrit.events[e] || [] }-*/ ;
-
- private ApiGlue() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ChangeGlue.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ChangeGlue.java
deleted file mode 100644
index c7f0051..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ChangeGlue.java
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright (C) 2013 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.client.api;
-
-import com.google.gerrit.client.actions.ActionButton;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.info.ActionInfo;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-
-public class ChangeGlue {
- public static void fireShowChange(ChangeInfo change, RevisionInfo rev) {
- ApiGlue.fireEvent("showchange", change, rev);
- }
-
- public static boolean onSubmitChange(ChangeInfo change, RevisionInfo rev) {
- JsArray<JavaScriptObject> h = ApiGlue.getEventHandlers("submitchange");
- for (int i = 0; i < h.length(); i++) {
- if (!invoke(h.get(i), change, rev)) {
- return false;
- }
- }
- return true;
- }
-
- public static void onAction(ChangeInfo change, ActionInfo action, ActionButton button) {
- RestApi api = ChangeApi.change(change.project(), change.legacyId().get()).view(action.id());
- JavaScriptObject f = get(action.id());
- if (f != null) {
- ActionContext c = ActionContext.create(api);
- c.set(action);
- c.set(change);
- c.button(button);
- ApiGlue.invoke(f, c);
- } else {
- DefaultActions.invoke(change, action, api);
- }
- }
-
- private static native JavaScriptObject get(String id) /*-{
- return $wnd.Gerrit.change_actions[id];
- }-*/;
-
- private static native boolean invoke(JavaScriptObject h, ChangeInfo a, RevisionInfo r)
- /*-{ return h(a,r) }-*/ ;
-
- private ChangeGlue() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/DefaultActions.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/DefaultActions.java
deleted file mode 100644
index 0c4aacd..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/DefaultActions.java
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (C) 2013 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.client.api;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.info.ActionInfo;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.Window.Location;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-class DefaultActions {
- static void invoke(ChangeInfo change, ActionInfo action, RestApi api) {
- invoke(action, api, callback(PageLinks.toChange(change.projectNameKey(), change.legacyId())));
- }
-
- static void invoke(Project.NameKey project, ActionInfo action, RestApi api) {
- invoke(action, api, callback(PageLinks.toProject(project)));
- }
-
- private static AsyncCallback<JavaScriptObject> callback(String target) {
- return new GerritCallback<JavaScriptObject>() {
- @Override
- public void onSuccess(JavaScriptObject in) {
- UiResult result = asUiResult(in);
- if (result == null) {
- Gerrit.display(target);
- return;
- }
-
- if (result.alert() != null) {
- Window.alert(result.alert());
- }
-
- if (result.redirectUrl() != null && result.openWindow()) {
- Window.open(result.redirectUrl(), "_blank", null);
- } else if (result.redirectUrl() != null) {
- Location.assign(result.redirectUrl());
- } else {
- Gerrit.display(target);
- }
- }
-
- private UiResult asUiResult(JavaScriptObject in) {
- if (NativeString.is(in)) {
- String str = ((NativeString) in).asString();
- return str.isEmpty() ? UiResult.none() : UiResult.alert(str);
- }
- return in.cast();
- }
- };
- }
-
- private static void invoke(ActionInfo action, RestApi api, AsyncCallback<JavaScriptObject> cb) {
- if ("GET".equalsIgnoreCase(action.method())) {
- api.get(cb);
- } else if ("PUT".equalsIgnoreCase(action.method())) {
- api.put(JavaScriptObject.createObject(), cb);
- } else if ("DELETE".equalsIgnoreCase(action.method())) {
- api.delete(cb);
- } else {
- api.post(JavaScriptObject.createObject(), cb);
- }
- }
-
- private DefaultActions() {}
-
- private static class UiResult extends JavaScriptObject {
- static native UiResult alert(String m) /*-{ return {'alert':m} }-*/;
-
- static native UiResult none() /*-{ return {} }-*/;
-
- final native String alert() /*-{ return this.alert }-*/;
-
- final native String redirectUrl() /*-{ return this.url }-*/;
-
- final native boolean openWindow() /*-{ return this.open_window || false }-*/;
-
- protected UiResult() {}
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/EditGlue.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/EditGlue.java
deleted file mode 100644
index 85cfde6..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/EditGlue.java
+++ /dev/null
@@ -1,48 +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.client.api;
-
-import com.google.gerrit.client.actions.ActionButton;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.info.ActionInfo;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.EditInfo;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class EditGlue {
- public static void onAction(
- ChangeInfo change, EditInfo edit, ActionInfo action, ActionButton button) {
- RestApi api = ChangeApi.edit(change.project(), change.legacyId().get()).view(action.id());
-
- JavaScriptObject f = get(action.id());
- if (f != null) {
- ActionContext c = ActionContext.create(api);
- c.set(action);
- c.set(change);
- c.set(edit);
- c.button(button);
- ApiGlue.invoke(f, c);
- } else {
- DefaultActions.invoke(change, action, api);
- }
- }
-
- private static native JavaScriptObject get(String id) /*-{
- return $wnd.Gerrit.edit_actions[id];
- }-*/;
-
- private EditGlue() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ExtensionPanel.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ExtensionPanel.java
deleted file mode 100644
index 6d3dd60..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ExtensionPanel.java
+++ /dev/null
@@ -1,205 +0,0 @@
-// Copyright (C) 2015 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.client.api;
-
-import com.google.gerrit.client.GerritUiExtensionPoint;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.SimplePanel;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-public class ExtensionPanel extends FlowPanel {
- private static final Logger logger = Logger.getLogger(ExtensionPanel.class.getName());
- private final GerritUiExtensionPoint extensionPoint;
- private final List<Context> contexts;
-
- public ExtensionPanel(GerritUiExtensionPoint extensionPoint) {
- this(extensionPoint, new ArrayList<String>());
- }
-
- public ExtensionPanel(GerritUiExtensionPoint extensionPoint, List<String> panelNames) {
- this.extensionPoint = extensionPoint;
- this.contexts = create(panelNames);
- }
-
- private List<Context> create(List<String> panelNames) {
- List<Context> contexts = new ArrayList<>();
- for (Definition def : getOrderedDefs(panelNames)) {
- SimplePanel p = new SimplePanel();
- add(p);
- contexts.add(Context.create(def, p));
- }
- return contexts;
- }
-
- private List<Definition> getOrderedDefs(List<String> panelNames) {
- if (panelNames == null) {
- panelNames = Collections.emptyList();
- }
- Map<String, List<Definition>> defsOrderedByName = new LinkedHashMap<>();
- for (String name : panelNames) {
- defsOrderedByName.put(name, new ArrayList<Definition>());
- }
- for (Definition def : Natives.asList(Definition.get(extensionPoint.name()))) {
- addDef(def, defsOrderedByName);
- }
- List<Definition> orderedDefs = new ArrayList<>();
- for (List<Definition> defList : defsOrderedByName.values()) {
- orderedDefs.addAll(defList);
- }
- return orderedDefs;
- }
-
- private static void addDef(Definition def, Map<String, List<Definition>> defsOrderedByName) {
- String panelName = def.getPanelName();
- if (panelName.equals(def.getPluginName() + ".undefined")) {
- /* Handle a partially undefined panel name from the
- javascript layer by generating a random panel name.
- This maintains support for panels that do not provide a name. */
- panelName =
- def.getPluginName() + "." + Long.toHexString(Double.doubleToLongBits(Math.random()));
- }
- if (defsOrderedByName.containsKey(panelName)) {
- defsOrderedByName.get(panelName).add(def);
- } else if (defsOrderedByName.containsKey(def.getPluginName())) {
- defsOrderedByName.get(def.getPluginName()).add(def);
- } else {
- defsOrderedByName.put(panelName, Collections.singletonList(def));
- }
- }
-
- public void put(GerritUiExtensionPoint.Key key, String value) {
- for (Context ctx : contexts) {
- ctx.put(key.name(), value);
- }
- }
-
- public void putInt(GerritUiExtensionPoint.Key key, int value) {
- for (Context ctx : contexts) {
- ctx.putInt(key.name(), value);
- }
- }
-
- public void putBoolean(GerritUiExtensionPoint.Key key, boolean value) {
- for (Context ctx : contexts) {
- ctx.putBoolean(key.name(), value);
- }
- }
-
- public void putObject(GerritUiExtensionPoint.Key key, JavaScriptObject value) {
- for (Context ctx : contexts) {
- ctx.putObject(key.name(), value);
- }
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- for (Context ctx : contexts) {
- try {
- ctx.onLoad();
- } catch (RuntimeException e) {
- logger.log(
- Level.SEVERE,
- "Failed to load extension panel for extension point "
- + extensionPoint.name()
- + " from plugin "
- + ctx.getPluginName()
- + ": "
- + e.getMessage());
- }
- }
- }
-
- @Override
- protected void onUnload() {
- super.onUnload();
- for (Context ctx : contexts) {
- for (JavaScriptObject u : Natives.asList(ctx.unload())) {
- ApiGlue.invoke(u);
- }
- }
- }
-
- static class Definition extends JavaScriptObject {
- static final JavaScriptObject TYPE = init();
-
- private static native JavaScriptObject init() /*-{
- function PanelDefinition(n, c, x) {
- this.pluginName = n;
- this.onLoad = c;
- this.name = x;
- };
- return PanelDefinition;
- }-*/;
-
- static native JsArray<Definition> get(String i) /*-{ return $wnd.Gerrit.panels[i] || [] }-*/;
-
- protected Definition() {}
-
- public final native String getPanelName() /*-{ return this.pluginName + "." + this.name; }-*/;
-
- public final native String getPluginName() /*-{ return this.pluginName; }-*/;
- }
-
- static class Context extends JavaScriptObject {
- static final Context create(Definition def, SimplePanel panel) {
- return create(TYPE, def, panel.getElement());
- }
-
- final native void onLoad() /*-{ this._d.onLoad(this) }-*/;
-
- final native JsArray<JavaScriptObject> unload() /*-{ return this._u }-*/;
-
- final native String getPluginName() /*-{ return this._d.pluginName; }-*/;
-
- final native void put(String k, String v) /*-{ this.p[k] = v; }-*/;
-
- final native void putInt(String k, int v) /*-{ this.p[k] = v; }-*/;
-
- final native void putBoolean(String k, boolean v) /*-{ this.p[k] = v; }-*/;
-
- final native void putObject(String k, JavaScriptObject v) /*-{ this.p[k] = v; }-*/;
-
- private static native Context create(JavaScriptObject T, Definition d, Element e)
- /*-{ return new T(d,e) }-*/ ;
-
- private static final JavaScriptObject TYPE = init();
-
- private static native JavaScriptObject init() /*-{
- var T = function(d,e) {
- this._d = d;
- this._u = [];
- this.body = e;
- this.p = {};
- };
- T.prototype = {
- onUnload: function(f){this._u.push(f)},
- };
- return T;
- }-*/;
-
- protected Context() {}
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ExtensionScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ExtensionScreen.java
deleted file mode 100644
index ff495b9..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ExtensionScreen.java
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright (C) 2013 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.client.api;
-
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.Screen;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwt.dom.client.Element;
-
-/** Screen contributed by a plugin. */
-public class ExtensionScreen extends Screen {
- private Context ctx;
-
- public ExtensionScreen(String token) {
- if (token.contains("?")) {
- token = token.substring(0, token.indexOf('?'));
- }
- String name;
- String rest;
- int s = token.indexOf('/');
- if (0 < s) {
- name = token.substring(0, s);
- rest = token.substring(s + 1);
- } else {
- name = token;
- rest = "";
- }
- ctx = create(name, rest);
- }
-
- private Context create(String name, String rest) {
- for (Definition def : Natives.asList(Definition.get(name))) {
- JsArrayString m = def.match(rest);
- if (m != null) {
- return Context.create(def, this, m);
- }
- }
- return null;
- }
-
- public boolean isFound() {
- return ctx != null;
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- setHeaderVisible(false);
- ctx.onLoad();
- }
-
- @Override
- protected void onUnload() {
- super.onUnload();
- for (JavaScriptObject u : Natives.asList(ctx.unload())) {
- ApiGlue.invoke(u);
- }
- }
-
- static class Definition extends JavaScriptObject {
- static final JavaScriptObject TYPE = init();
-
- private static native JavaScriptObject init() /*-{
- function ScreenDefinition(r, c) {
- this.pattern = r;
- this.onLoad = c;
- };
- return ScreenDefinition;
- }-*/;
-
- static native JsArray<Definition> get(String n) /*-{ return $wnd.Gerrit.screens[n] || [] }-*/;
-
- final native JsArrayString match(String t) /*-{
- var p = this.pattern;
- if (p instanceof $wnd.RegExp) {
- var m = p.exec(t);
- return m && m[0] == t ? m : null;
- }
- return p == t ? [t] : null;
- }-*/;
-
- protected Definition() {}
- }
-
- static class Context extends JavaScriptObject {
- static final Context create(Definition def, ExtensionScreen view, JsArrayString match) {
- return create(TYPE, def, view, view.getBody().getElement(), match);
- }
-
- final native void onLoad() /*-{ this._d.onLoad(this) }-*/;
-
- final native JsArray<JavaScriptObject> unload() /*-{ return this._u }-*/;
-
- private static native Context create(
- JavaScriptObject T, Definition d, ExtensionScreen s, Element e, JsArrayString m)
- /*-{ return new T(d,s,e,m) }-*/ ;
-
- private static final JavaScriptObject TYPE = init();
-
- private static native JavaScriptObject init() /*-{
- var T = function(d,s,e,m) {
- this._d = d;
- this._s = s;
- this._u = [];
- this.body = e;
- this.token = m[0];
- this.token_match = m;
- };
- T.prototype = {
- setTitle: function(t){this._s.@com.google.gerrit.client.ui.Screen::setPageTitle(Ljava/lang/String;)(t)},
- setWindowTitle: function(t){this._s.@com.google.gerrit.client.ui.Screen::setWindowTitle(Ljava/lang/String;)(t)},
- show: function(){$entry(this._s.@com.google.gwtexpui.user.client.View::display()())},
- onUnload: function(f){this._u.push(f)},
- };
- return T;
- }-*/;
-
- protected Context() {}
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ExtensionSettingsScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ExtensionSettingsScreen.java
deleted file mode 100644
index e7d1ed1..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ExtensionSettingsScreen.java
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright (C) 2015 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.client.api;
-
-import com.google.gerrit.client.account.SettingsScreen;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.dom.client.Element;
-import java.util.Set;
-
-/** SettingsScreen contributed by a plugin. */
-public class ExtensionSettingsScreen extends SettingsScreen {
- private Context ctx;
-
- public ExtensionSettingsScreen(String token) {
- if (token.contains("?")) {
- token = token.substring(0, token.indexOf('?'));
- }
- String name;
- String rest;
- int s = token.indexOf('/');
- if (0 < s) {
- name = token.substring(0, s);
- rest = token.substring(s + 1);
- } else {
- name = token;
- rest = "";
- }
- ctx = create(name, rest);
- }
-
- private Context create(String name, String rest) {
- for (Definition def : Natives.asList(Definition.get(name))) {
- if (def.matches(rest)) {
- return Context.create(def, this);
- }
- }
- return null;
- }
-
- public boolean isFound() {
- return ctx != null;
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- setHeaderVisible(false);
- ctx.onLoad();
- }
-
- @Override
- protected void onUnload() {
- super.onUnload();
- for (JavaScriptObject u : Natives.asList(ctx.unload())) {
- ApiGlue.invoke(u);
- }
- }
-
- public static class Definition extends JavaScriptObject {
- static final JavaScriptObject TYPE = init();
-
- private static native JavaScriptObject init() /*-{
- function SettingsScreenDefinition(p, m, c) {
- this.path = p;
- this.menu = m;
- this.onLoad = c;
- };
- return SettingsScreenDefinition;
- }-*/;
-
- public static native JsArray<Definition> get(String n)
- /*-{ return $wnd.Gerrit.settingsScreens[n] || [] }-*/ ;
-
- public static final Set<String> plugins() {
- return Natives.keys(settingsScreens());
- }
-
- private static native NativeMap<NativeString> settingsScreens()
- /*-{ return $wnd.Gerrit.settingsScreens; }-*/ ;
-
- public final native String getPath() /*-{ return this.path; }-*/;
-
- public final native String getMenu() /*-{ return this.menu; }-*/;
-
- final native boolean matches(String t) /*-{ return this.path == t; }-*/;
-
- protected Definition() {}
- }
-
- static class Context extends JavaScriptObject {
- static final Context create(Definition def, ExtensionSettingsScreen view) {
- return create(TYPE, def, view, view.getBody().getElement());
- }
-
- final native void onLoad() /*-{ this._d.onLoad(this) }-*/;
-
- final native JsArray<JavaScriptObject> unload() /*-{ return this._u }-*/;
-
- private static native Context create(
- JavaScriptObject T, Definition d, ExtensionSettingsScreen s, Element e)
- /*-{ return new T(d,s,e) }-*/ ;
-
- private static final JavaScriptObject TYPE = init();
-
- private static native JavaScriptObject init() /*-{
- var T = function(d,s,e) {
- this._d = d;
- this._s = s;
- this._u = [];
- this.body = e;
- };
- T.prototype = {
- setTitle: function(t){this._s.@com.google.gerrit.client.ui.Screen::setPageTitle(Ljava/lang/String;)(t)},
- setWindowTitle: function(t){this._s.@com.google.gerrit.client.ui.Screen::setWindowTitle(Ljava/lang/String;)(t)},
- show: function(){$entry(this._s.@com.google.gwtexpui.user.client.View::display()())},
- onUnload: function(f){this._u.push(f)},
- };
- return T;
- }-*/;
-
- protected Context() {}
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/HtmlTemplate.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/HtmlTemplate.java
deleted file mode 100644
index ba9c659..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/HtmlTemplate.java
+++ /dev/null
@@ -1,153 +0,0 @@
-// Copyright (C) 2013 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.client.api;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.dom.client.Document;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.Node;
-import com.google.gwt.dom.client.StyleInjector;
-import com.google.gwt.user.client.DOM;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-
-final class HtmlTemplate {
- static native void init() /*-{
- var ElementSet = function(r,e) {
- this.root = r;
- this.elements = e;
- };
- ElementSet.prototype = {
- clear: function() {
- this.root = null;
- this.elements = null;
- },
- };
-
- $wnd.Gerrit.css = @com.google.gerrit.client.api.HtmlTemplate::css(Ljava/lang/String;);
- $wnd.Gerrit.html = function(h,r,w) {
- var i = {};
- if (r) {
- h = h.replace(
- /\sid=['"]\{([a-z_][a-z0-9_]*)\}['"]|\{([a-z0-9._-]+)\}/gi,
- function(m,a,b) {
- if (a)
- return @com.google.gerrit.client.api.HtmlTemplate::id(
- Lcom/google/gerrit/client/api/HtmlTemplate$IdMap;
- Ljava/lang/String;)
- (i,a);
- return @com.google.gerrit.client.api.HtmlTemplate::html(
- Lcom/google/gerrit/client/api/HtmlTemplate$ReplacementMap;
- Ljava/lang/String;)
- (r,b);
- });
- }
- var e = @com.google.gerrit.client.api.HtmlTemplate::parseHtml(
- Ljava/lang/String;Lcom/google/gerrit/client/api/HtmlTemplate$IdMap;
- Lcom/google/gerrit/client/api/HtmlTemplate$ReplacementMap;
- Z)
- (h,i,r,!!w);
- return w ? new ElementSet(e,i) : e;
- };
- }-*/;
-
- private static String css(String css) {
- String name = DOM.createUniqueId();
- StyleInjector.inject("." + name + "{" + css + "}");
- return name;
- }
-
- private static String id(IdMap idMap, String key) {
- String id = DOM.createUniqueId();
- idMap.put(id, key);
- return " id='" + id + "'";
- }
-
- private static String html(ReplacementMap opts, String id) {
- int d = id.indexOf('.');
- if (0 < d) {
- String name = id.substring(0, d);
- String rest = id.substring(d + 1);
- return html(opts.map(name), rest);
- }
- return new SafeHtmlBuilder().append(opts.str(id)).asString();
- }
-
- private static Node parseHtml(String html, IdMap ids, ReplacementMap opts, boolean wantElements) {
- Element div = Document.get().createDivElement();
- div.setInnerHTML(html);
- if (!ids.isEmpty()) {
- attachHandlers(div, ids, opts, wantElements);
- }
- if (div.getChildCount() == 1) {
- return div.getFirstChild();
- }
- return div;
- }
-
- private static void attachHandlers(
- Element e, IdMap ids, ReplacementMap opts, boolean wantElements) {
- if (e.getId() != null) {
- String key = ids.get(e.getId());
- if (key != null) {
- ids.remove(e.getId());
- if (wantElements) {
- ids.put(key, e);
- }
- e.setId(null);
- opts.map(key).attachHandlers(e);
- }
- }
- for (Element c = e.getFirstChildElement(); c != null; ) {
- attachHandlers(c, ids, opts, wantElements);
- c = c.getNextSiblingElement();
- }
- }
-
- private static class ReplacementMap extends JavaScriptObject {
- final native ReplacementMap map(String n) /*-{ return this[n] }-*/;
-
- final native String str(String n) /*-{ return ''+this[n] }-*/;
-
- final native void attachHandlers(Element e) /*-{
- for (var k in this) {
- var f = this[k];
- if (k.substring(0, 2) == 'on' && typeof f == 'function')
- e[k] = f;
- }
- }-*/;
-
- protected ReplacementMap() {}
- }
-
- private static class IdMap extends JavaScriptObject {
- final native String get(String i) /*-{ return this[i] }-*/;
-
- final native void remove(String i) /*-{ delete this[i] }-*/;
-
- final native void put(String i, String k) /*-{ this[i] = k }-*/;
-
- final native void put(String k, Element e) /*-{ this[k] = e }-*/;
-
- final native boolean isEmpty() /*-{
- for (var i in this)
- return false;
- return true;
- }-*/;
-
- protected IdMap() {}
- }
-
- private HtmlTemplate() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/Plugin.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/Plugin.java
deleted file mode 100644
index 48a812c1..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/Plugin.java
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (C) 2013 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.client.api;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-final class Plugin extends JavaScriptObject {
- private static final JavaScriptObject TYPE = createType();
-
- static Plugin create(String url) {
- int s = "plugins/".length();
- int e = url.indexOf('/', s);
- String name = url.substring(s, e);
- return create(TYPE, url, name);
- }
-
- native String url() /*-{ return this._scriptUrl }-*/;
-
- native String name() /*-{ return this.name }-*/;
-
- native boolean loaded() /*-{ return this._success || this._failure != null }-*/;
-
- native Exception failure() /*-{ return this._failure }-*/;
-
- native void failure(Exception e) /*-{ this._failure = e }-*/;
-
- native boolean success() /*-{ return this._success || false }-*/;
-
- native void _initialized() /*-{ this._success = true }-*/;
-
- private static native Plugin create(JavaScriptObject T, String u, String n)
- /*-{ return new T(u,n) }-*/ ;
-
- private static native JavaScriptObject createType() /*-{
- function Plugin(u, n) {
- this._scriptUrl = u;
- this.name = n;
- }
- return Plugin;
- }-*/;
-
- static native void init() /*-{
- var G = $wnd.Gerrit;
- @com.google.gerrit.client.api.Plugin::TYPE.prototype = {
- getPluginName: function(){return this.name},
- getServerInfo: @com.google.gerrit.client.api.ApiGlue::getServerInfo(),
- getCurrentUser: @com.google.gerrit.client.api.ApiGlue::getCurrentUser(),
- getUserPreferences: @com.google.gerrit.client.api.ApiGlue::getUserPreferences(),
- refreshUserPreferences: @com.google.gerrit.client.api.ApiGlue::refreshUserPreferences(),
- go: @com.google.gerrit.client.api.ApiGlue::go(Ljava/lang/String;),
- refresh: @com.google.gerrit.client.api.ApiGlue::refresh(),
- refreshMenuBar: @com.google.gerrit.client.api.ApiGlue::refreshMenuBar(),
- isSignedIn: @com.google.gerrit.client.api.ApiGlue::isSignedIn(),
- showError: @com.google.gerrit.client.api.ApiGlue::showError(Ljava/lang/String;),
- on: function(e,f){G.on(e,f)},
- onAction: function(t,n,c){G._onAction(this.name,t,n,c)},
- screen: function(p,c){G._screen(this.name,p,c)},
- settingsScreen: function(p,m,c){G._settingsScreen(this.name,p,m,c)},
- panel: function(i,c,n){G._panel(this.name,i,c,n)},
-
- url: function (u){return G.url(this._url(u))},
- get: function(u,b){@com.google.gerrit.client.api.ActionContext::get(
- Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;)(this._api(u),b)},
- post: function(u,i,b){@com.google.gerrit.client.api.ActionContext::post(
- Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;)(
- this._api(u),i,b)},
- put: function(u,i,b){@com.google.gerrit.client.api.ActionContext::put(
- Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;Lcom/google/gwt/core/client/JavaScriptObject;)(
- this._api(u),i,b)},
- 'delete': function(u,b){@com.google.gerrit.client.api.ActionContext::delete(
- Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;)(this._api(u),b)},
- del: function(u,b){@com.google.gerrit.client.api.ActionContext::delete(
- Lcom/google/gerrit/client/rpc/RestApi;Lcom/google/gwt/core/client/JavaScriptObject;)(this._api(u),b)},
-
- _loadedGwt: function(){@com.google.gerrit.client.api.PluginLoader::loaded()()},
- _api: function(u){return @com.google.gerrit.client.rpc.RestApi::new(Ljava/lang/String;)(this._url(u))},
- _url: function (d) {
- var u = 'plugins/' + this.name + '/';
- if (d && d.length > 0)
- return u + (d.charAt(0)=='/' ? d.substring(1) : d);
- return u;
- },
- };
- }-*/;
-
- protected Plugin() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/PluginLoader.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/PluginLoader.java
deleted file mode 100644
index de25ef0..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/PluginLoader.java
+++ /dev/null
@@ -1,196 +0,0 @@
-// Copyright (C) 2013 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.client.api;
-
-import static java.util.stream.Collectors.toList;
-
-import com.google.gerrit.client.ErrorDialog;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.VoidResult;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gwt.core.client.Callback;
-import com.google.gwt.core.client.CodeDownloadException;
-import com.google.gwt.core.client.ScriptInjector;
-import com.google.gwt.user.client.Timer;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.DialogBox;
-import com.google.gwtexpui.progress.client.ProgressBar;
-import java.util.List;
-
-/** Loads JavaScript plugins with a progress meter visible. */
-public class PluginLoader extends DialogBox {
- private static PluginLoader self;
-
- public static void load(
- List<String> plugins, int loadTimeout, AsyncCallback<VoidResult> callback) {
- if (plugins == null || plugins.isEmpty()) {
- callback.onSuccess(VoidResult.create());
- } else {
- plugins = plugins.stream().filter(p -> p.endsWith(".js")).collect(toList());
- if (plugins.isEmpty()) {
- callback.onSuccess(VoidResult.create());
- } else {
- self = new PluginLoader(loadTimeout, callback);
- self.load(plugins);
- self.startTimers();
- self.center();
- }
- }
- }
-
- static void loaded() {
- self.loadedOne();
- }
-
- private final int loadTimeout;
- private final AsyncCallback<VoidResult> callback;
- private ProgressBar progress;
- private Timer show;
- private Timer update;
- private Timer timeout;
- private boolean visible;
-
- private PluginLoader(int loadTimeout, AsyncCallback<VoidResult> cb) {
- super(/* auto hide */ false, /* modal */ true);
- callback = cb;
- this.loadTimeout = loadTimeout;
- progress = new ProgressBar(Gerrit.C.loadingPlugins());
-
- setStyleName(Gerrit.RESOURCES.css().errorDialog());
- addStyleName(Gerrit.RESOURCES.css().loadingPluginsDialog());
- }
-
- private void load(List<String> pluginUrls) {
- for (String url : pluginUrls) {
- Plugin plugin = Plugin.create(url);
- plugins().put(url, plugin);
- ScriptInjector.fromUrl(url)
- .setWindow(ScriptInjector.TOP_WINDOW)
- .setCallback(new LoadCallback(plugin))
- .inject();
- }
- }
-
- private void startTimers() {
- show =
- new Timer() {
- @Override
- public void run() {
- setText(Window.getTitle());
- setWidget(progress);
- setGlassEnabled(true);
- getGlassElement().addClassName(Gerrit.RESOURCES.css().errorDialogGlass());
- hide(true);
- center();
- visible = true;
- }
- };
- show.schedule(500);
-
- update =
- new Timer() {
- private int cycle;
-
- @Override
- public void run() {
- progress.setValue(100 * ++cycle * 250 / loadTimeout);
- }
- };
- update.scheduleRepeating(250);
-
- timeout =
- new Timer() {
- @Override
- public void run() {
- finish();
- }
- };
- timeout.schedule(loadTimeout);
- }
-
- private void loadedOne() {
- boolean done = true;
- for (Plugin plugin : Natives.asList(plugins().values())) {
- done &= plugin.loaded();
- }
- if (done) {
- finish();
- }
- }
-
- private void finish() {
- show.cancel();
- update.cancel();
- timeout.cancel();
- self = null;
-
- if (!hadFailures()) {
- if (visible) {
- progress.setValue(100);
- new Timer() {
- @Override
- public void run() {
- hide(true);
- }
- }.schedule(250);
- } else {
- hide(true);
- }
- }
-
- callback.onSuccess(VoidResult.create());
- }
-
- private boolean hadFailures() {
- boolean failed = false;
- for (Plugin plugin : Natives.asList(plugins().values())) {
- if (!plugin.success()) {
- failed = true;
-
- Exception e = plugin.failure();
- String msg;
- if (e != null && e instanceof CodeDownloadException) {
- msg = Gerrit.M.cannotDownloadPlugin(plugin.url());
- } else {
- msg = Gerrit.M.pluginFailed(plugin.name());
- }
- hide(true);
- new ErrorDialog(msg).center();
- }
- }
- return failed;
- }
-
- private static native NativeMap<Plugin> plugins() /*-{ return $wnd.Gerrit.plugins }-*/;
-
- private class LoadCallback implements Callback<Void, Exception> {
- private final Plugin plugin;
-
- LoadCallback(Plugin plugin) {
- this.plugin = plugin;
- }
-
- @Override
- public void onSuccess(Void result) {}
-
- @Override
- public void onFailure(Exception reason) {
- plugin.failure(reason);
- loadedOne();
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/PluginName.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/PluginName.java
deleted file mode 100644
index 7cf4fbb..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/PluginName.java
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (C) 2013 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.client.api;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JavaScriptException;
-import com.google.gwt.core.client.JsArrayString;
-
-/**
- * Determines the name a plugin has been installed under.
- *
- * <p>This implementation guesses the name a plugin runs under by looking at the JavaScript call
- * stack and identifying the URL of the script file calling {@code Gerrit.install()}. The simple
- * approach applied here is looking at the source URLs and extracting the name out of the string,
- * e.g.: {@code "http://localhost:8080/plugins/[name]/static/foo.js"}.
- */
-class PluginName {
- private static final String UNKNOWN = "<unknown>";
-
- private static String baseUrl() {
- return GWT.getHostPageBaseURL() + "plugins/";
- }
-
- static String getCallerUrl() {
- return GWT.<PluginName>create(PluginName.class).findCallerUrl();
- }
-
- static String fromUrl(String url) {
- String baseUrl = baseUrl();
- if (url != null && url.startsWith(baseUrl)) {
- int s = url.indexOf('/', baseUrl.length());
- if (s > 0) {
- return url.substring(baseUrl.length(), s);
- }
- }
- return UNKNOWN;
- }
-
- String findCallerUrl() {
- JavaScriptException err = makeException();
- if (hasStack(err)) {
- return PluginNameMoz.getUrl(err);
- }
-
- String baseUrl = baseUrl();
- StackTraceElement[] trace = getTrace(err);
- for (int i = trace.length - 1; i >= 0; i--) {
- String u = trace[i].getFileName();
- if (u != null && u.startsWith(baseUrl)) {
- return u;
- }
- }
- return UNKNOWN;
- }
-
- private static StackTraceElement[] getTrace(JavaScriptException err) {
- if (err.getStackTrace().length == 0) {
- err.fillInStackTrace();
- }
- return err.getStackTrace();
- }
-
- protected static final native JavaScriptException makeException()
- /*-{ try { null.a() } catch (e) { return e } }-*/ ;
-
- private static native boolean hasStack(JavaScriptException e) /*-{ return !!e.stack }-*/;
-
- /** Extracts URL from the stack frame. */
- static class PluginNameMoz extends PluginName {
- @Override
- String findCallerUrl() {
- return getUrl(makeException());
- }
-
- private static String getUrl(JavaScriptException e) {
- String baseUrl = baseUrl();
- JsArrayString stack = getStack(e);
- for (int i = stack.length() - 1; i >= 0; i--) {
- String frame = stack.get(i);
- int at = frame.indexOf(baseUrl);
- if (at >= 0) {
- int end = frame.indexOf(':', at + baseUrl.length());
- if (end < 0) {
- end = frame.length();
- }
- return frame.substring(at, end);
- }
- }
- return UNKNOWN;
- }
-
- private static native JsArrayString getStack(JavaScriptException e)
- /*-{ return e.stack ? e.stack.split('\n') : [] }-*/ ;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/PopupHelper.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/PopupHelper.java
deleted file mode 100644
index 173b369..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/PopupHelper.java
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (C) 2013 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.client.api;
-
-import com.google.gerrit.client.actions.ActionButton;
-import com.google.gerrit.client.change.Resources;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-
-class PopupHelper {
- static PopupHelper popup(ActionContext ctx, Element panel) {
- PopupHelper helper = new PopupHelper(ctx.button(), panel);
- helper.show();
- ctx.button().link(ctx);
- return helper;
- }
-
- private final ActionButton activatingButton;
- private final FlowPanel panel;
- private PopupPanel popup;
-
- PopupHelper(ActionButton button, Element child) {
- activatingButton = button;
- panel = new FlowPanel();
- panel.setStyleName(Resources.I.style().popupContent());
- panel.getElement().appendChild(child);
- }
-
- void show() {
- final PopupPanel p = new PopupPanel(true);
- p.setStyleName(Resources.I.style().popup());
- p.addAutoHidePartner(activatingButton.getElement());
- p.addCloseHandler(
- new CloseHandler<PopupPanel>() {
- @Override
- public void onClose(CloseEvent<PopupPanel> event) {
- activatingButton.unlink();
- if (popup == p) {
- popup = null;
- }
- }
- });
- p.add(panel);
- p.showRelativeTo(activatingButton);
- GlobalKey.dialog(p);
- popup = p;
- }
-
- void hide() {
- if (popup != null) {
- activatingButton.unlink();
- popup.hide();
- popup = null;
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ProjectGlue.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ProjectGlue.java
deleted file mode 100644
index 92070f8..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/ProjectGlue.java
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright (C) 2013 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.client.api;
-
-import com.google.gerrit.client.actions.ActionButton;
-import com.google.gerrit.client.info.ActionInfo;
-import com.google.gerrit.client.projects.BranchInfo;
-import com.google.gerrit.client.projects.ProjectApi;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class ProjectGlue {
- public static void onAction(
- Project.NameKey project, BranchInfo branch, ActionInfo action, ActionButton button) {
- RestApi api = ProjectApi.project(project).view("branches").id(branch.ref()).view(action.id());
- JavaScriptObject f = branchAction(action.id());
- if (f != null) {
- ActionContext c = ActionContext.create(api);
- c.set(action);
- c.set(project);
- c.set(branch);
- c.button(button);
- ApiGlue.invoke(f, c);
- } else {
- DefaultActions.invoke(project, action, api);
- }
- }
-
- public static void onAction(Project.NameKey project, ActionInfo action, ActionButton button) {
- RestApi api = ProjectApi.project(project).view(action.id());
- JavaScriptObject f = projectAction(action.id());
- if (f != null) {
- ActionContext c = ActionContext.create(api);
- c.set(action);
- c.set(project);
- c.button(button);
- ApiGlue.invoke(f, c);
- } else {
- DefaultActions.invoke(project, action, api);
- }
- }
-
- private static native JavaScriptObject projectAction(String id) /*-{
- return $wnd.Gerrit.project_actions[id];
- }-*/;
-
- private static native JavaScriptObject branchAction(String id) /*-{
- return $wnd.Gerrit.branch_actions[id];
- }-*/;
-
- private ProjectGlue() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/RevisionGlue.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/RevisionGlue.java
deleted file mode 100644
index d1029b2..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/api/RevisionGlue.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (C) 2013 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.client.api;
-
-import com.google.gerrit.client.actions.ActionButton;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.info.ActionInfo;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class RevisionGlue {
- public static void onAction(
- ChangeInfo change, RevisionInfo revision, ActionInfo action, ActionButton button) {
- RestApi api =
- ChangeApi.revision(change.project(), change.legacyId().get(), revision.name())
- .view(action.id());
-
- JavaScriptObject f = get(action.id());
- if (f != null) {
- ActionContext c = ActionContext.create(api);
- c.set(action);
- c.set(change);
- c.set(revision);
- c.button(button);
- ApiGlue.invoke(f, c);
- } else {
- DefaultActions.invoke(change, action, api);
- }
- }
-
- private static native JavaScriptObject get(String id) /*-{
- return $wnd.Gerrit.revision_actions[id];
- }-*/;
-
- private RevisionGlue() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/auth/openid/OpenIdConstants.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/auth/openid/OpenIdConstants.java
deleted file mode 100644
index a0eaef7..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/auth/openid/OpenIdConstants.java
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (C) 2009 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.client.auth.openid;
-
-import com.google.gwt.i18n.client.Constants;
-
-public interface OpenIdConstants extends Constants {
- String nameLaunchpad();
-
- String nameYahoo();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/auth/openid/OpenIdConstants.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/auth/openid/OpenIdConstants.properties
deleted file mode 100644
index d6e8de6..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/auth/openid/OpenIdConstants.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-nameLaunchpad = Launchpad ID
-nameYahoo = Yahoo! ID
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/auth/openid/OpenIdUtil.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/auth/openid/OpenIdUtil.java
deleted file mode 100644
index d5b7684..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/auth/openid/OpenIdUtil.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (C) 2009 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.client.auth.openid;
-
-import com.google.gwt.core.client.GWT;
-
-public class OpenIdUtil {
- public static final OpenIdConstants C;
-
- static {
- C = GWT.create(OpenIdConstants.class);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/blame/BlameInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/blame/BlameInfo.java
deleted file mode 100644
index 77fddeb..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/blame/BlameInfo.java
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (C) 2015 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.client.blame;
-
-import com.google.gerrit.client.RangeInfo;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-
-public class BlameInfo extends JavaScriptObject {
- public final native String author() /*-{ return this.author; }-*/;
-
- public final native String id() /*-{ return this.id; }-*/;
-
- public final native String commitMsg() /*-{ return this.commit_msg; }-*/;
-
- public final native int time() /*-{ return this.time; }-*/;
-
- public final native JsArray<RangeInfo> ranges() /*-{ return this.ranges; }-*/;
-
- protected BlameInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/AbandonAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/AbandonAction.java
deleted file mode 100644
index fd58959..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/AbandonAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.user.client.ui.Button;
-
-class AbandonAction extends ActionMessageBox {
- private final Project.NameKey project;
- private final Change.Id id;
-
- AbandonAction(Button b, Project.NameKey project, Change.Id id) {
- super(b);
- this.project = project;
- this.id = id;
- }
-
- @Override
- void send(String message) {
- ChangeApi.abandon(
- project.get(),
- id.get(),
- message,
- new GerritCallback<ChangeInfo>() {
- @Override
- public void onSuccess(ChangeInfo result) {
- Gerrit.display(PageLinks.toChange(project, id));
- hide();
- }
- });
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ActionMessageBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ActionMessageBox.java
deleted file mode 100644
index 5b3ee29..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ActionMessageBox.java
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.KeyCodes;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.globalkey.client.NpTextArea;
-
-abstract class ActionMessageBox extends Composite {
- interface Binder extends UiBinder<HTMLPanel, ActionMessageBox> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- interface Style extends CssResource {
- String popup();
- }
-
- private final Button activatingButton;
- private PopupPanel popup;
-
- @UiField Style style;
- @UiField NpTextArea message;
- @UiField Button send;
-
- ActionMessageBox(Button button) {
- this.activatingButton = button;
- initWidget(uiBinder.createAndBindUi(this));
- send.setText(button.getText());
- }
-
- abstract void send(String message);
-
- void show() {
- if (popup != null) {
- popup.hide();
- popup = null;
- return;
- }
-
- final PopupPanel p = new PopupPanel(true);
- p.setStyleName(style.popup());
- p.addAutoHidePartner(activatingButton.getElement());
- p.addCloseHandler(
- new CloseHandler<PopupPanel>() {
- @Override
- public void onClose(CloseEvent<PopupPanel> event) {
- if (popup == p) {
- popup = null;
- }
- }
- });
- p.add(this);
- p.showRelativeTo(activatingButton);
- GlobalKey.dialog(p);
- message.setFocus(true);
- popup = p;
- }
-
- void hide() {
- if (popup != null) {
- popup.hide();
- popup = null;
- }
- }
-
- @UiHandler("message")
- void onMessageKey(KeyPressEvent event) {
- if ((event.getCharCode() == '\n' || event.getCharCode() == KeyCodes.KEY_ENTER)
- && event.isControlKeyDown()) {
- event.preventDefault();
- event.stopPropagation();
- onSend(null);
- }
- }
-
- @UiHandler("send")
- void onSend(@SuppressWarnings("unused") ClickEvent e) {
- send(message.getValue().trim());
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ActionMessageBox.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ActionMessageBox.ui.xml
deleted file mode 100644
index a9e1bb3..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ActionMessageBox.ui.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:c='urn:import:com.google.gwtexpui.globalkey.client'>
- <ui:with field='res' type='com.google.gerrit.client.change.Resources'/>
- <ui:style gss='false' type='com.google.gerrit.client.change.ActionMessageBox.Style'>
- @eval trimColor com.google.gerrit.client.Gerrit.getTheme().trimColor;
-
- .popup { background-color: trimColor; }
- .section {
- padding: 5px 5px;
- border-bottom: 1px solid #b8b8b8;
- }
- </ui:style>
- <g:HTMLPanel>
- <div class='{style.section}'>
- <c:NpTextArea
- visibleLines='3'
- characterWidth='40'
- ui:field='message'/>
- </div>
- <div class='{style.section}'>
- <g:Button ui:field='send'
- title='(Shortcut: Ctrl-Enter)'
- styleName='{res.style.button}'>
- <ui:attribute name='title'/>
- <div><ui:msg>Send</ui:msg></div>
- </g:Button>
- </div>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Actions.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Actions.java
deleted file mode 100644
index e4f5e576..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Actions.java
+++ /dev/null
@@ -1,260 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.actions.ActionButton;
-import com.google.gerrit.client.info.ActionInfo;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.CommitInfo;
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-import java.util.TreeSet;
-
-class Actions extends Composite {
- private static final String[] CORE = {
- "abandon",
- "assignee",
- "cherrypick",
- "description",
- "followup",
- "hashtags",
- "move",
- "publish",
- "rebase",
- "restore",
- "revert",
- "submit",
- "topic",
- "private",
- "/",
- };
-
- interface Binder extends UiBinder<FlowPanel, Actions> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- @UiField Button cherrypick;
- @UiField Button move;
- @UiField Button rebase;
- @UiField Button revert;
- @UiField Button submit;
-
- @UiField Button abandon;
- private AbandonAction abandonAction;
-
- @UiField Button deleteChange;
-
- @UiField Button markPrivate;
- @UiField Button unmarkPrivate;
-
- @UiField Button restore;
- private RestoreAction restoreAction;
-
- @UiField Button followUp;
- private FollowUpAction followUpAction;
-
- private Change.Id changeId;
- private ChangeInfo changeInfo;
- private String revision;
- private Project.NameKey project;
- private String topic;
- private String subject;
- private String message;
- private String branch;
- private String key;
-
- private boolean rebaseParentNotCurrent = true;
-
- Actions() {
- initWidget(uiBinder.createAndBindUi(this));
- getElement().setId("change_actions");
- }
-
- void display(ChangeInfo info, String revision) {
- this.revision = revision;
-
- boolean hasUser = Gerrit.isSignedIn();
- RevisionInfo revInfo = info.revision(revision);
- CommitInfo commit = revInfo.commit();
- changeId = info.legacyId();
- project = info.projectNameKey();
- topic = info.topic();
- subject = commit.subject();
- message = commit.message();
- branch = info.branch();
- key = info.changeId();
- changeInfo = info;
-
- initChangeActions(info, hasUser);
-
- NativeMap<ActionInfo> actionMap =
- revInfo.hasActions() ? revInfo.actions() : NativeMap.<ActionInfo>create();
- actionMap.copyKeysIntoChildren("id");
- reloadRevisionActions(actionMap);
- }
-
- private void initChangeActions(ChangeInfo info, boolean hasUser) {
- NativeMap<ActionInfo> actions =
- info.hasActions() ? info.actions() : NativeMap.<ActionInfo>create();
- actions.copyKeysIntoChildren("id");
-
- if (hasUser) {
- a2b(actions, "abandon", abandon);
- a2b(actions, "/", deleteChange);
- a2b(actions, "move", move);
- a2b(actions, "restore", restore);
- a2b(actions, "revert", revert);
- a2b(actions, "followup", followUp);
- if (info.isPrivate()) {
- a2b(actions, "private", unmarkPrivate);
- } else {
- a2b(actions, "private", markPrivate);
- }
- for (String id : filterNonCore(actions)) {
- add(new ActionButton(info, actions.get(id)));
- }
- }
- }
-
- void reloadRevisionActions(NativeMap<ActionInfo> actions) {
- if (!Gerrit.isSignedIn()) {
- return;
- }
- boolean canSubmit = actions.containsKey("submit");
- if (canSubmit) {
- ActionInfo action = actions.get("submit");
- submit.setTitle(action.title());
- submit.setEnabled(action.enabled());
- submit.setHTML(new SafeHtmlBuilder().openDiv().append(action.label()).closeDiv());
- submit.setEnabled(action.enabled());
- }
- submit.setVisible(canSubmit);
-
- a2b(actions, "cherrypick", cherrypick);
- a2b(actions, "rebase", rebase);
-
- // The rebase button on change screen is always enabled.
- // It is the "Rebase" button in the RebaseDialog that might be disabled.
- rebaseParentNotCurrent = rebase.isEnabled();
- if (rebase.isVisible()) {
- rebase.setEnabled(true);
- }
- RevisionInfo revInfo = changeInfo.revision(revision);
- for (String id : filterNonCore(actions)) {
- add(new ActionButton(changeInfo, revInfo, actions.get(id)));
- }
- }
-
- private void add(ActionButton b) {
- ((FlowPanel) getWidget()).add(b);
- }
-
- private static TreeSet<String> filterNonCore(NativeMap<ActionInfo> m) {
- TreeSet<String> ids = new TreeSet<>(m.keySet());
- for (String id : CORE) {
- ids.remove(id);
- }
- return ids;
- }
-
- @UiHandler("followUp")
- void onFollowUp(@SuppressWarnings("unused") ClickEvent e) {
- if (followUpAction == null) {
- followUpAction = new FollowUpAction(followUp, project.get(), branch, topic, key);
- }
- followUpAction.show();
- }
-
- @UiHandler("abandon")
- void onAbandon(@SuppressWarnings("unused") ClickEvent e) {
- if (abandonAction == null) {
- abandonAction = new AbandonAction(abandon, project, changeId);
- }
- abandonAction.show();
- }
-
- @UiHandler("deleteChange")
- void onDeleteChange(@SuppressWarnings("unused") ClickEvent e) {
- if (Window.confirm(Resources.C.deleteChange())) {
- ChangeActions.delete(project, changeId, deleteChange);
- }
- }
-
- @UiHandler("markPrivate")
- void onMarkPrivate(@SuppressWarnings("unused") ClickEvent e) {
- ChangeActions.markPrivate(project, changeId, markPrivate);
- }
-
- @UiHandler("unmarkPrivate")
- void onUnmarkPrivate(@SuppressWarnings("unused") ClickEvent e) {
- ChangeActions.unmarkPrivate(project, changeId, unmarkPrivate);
- }
-
- @UiHandler("restore")
- void onRestore(@SuppressWarnings("unused") ClickEvent e) {
- if (restoreAction == null) {
- restoreAction = new RestoreAction(restore, project, changeId);
- }
- restoreAction.show();
- }
-
- @UiHandler("rebase")
- void onRebase(@SuppressWarnings("unused") ClickEvent e) {
- RebaseAction.call(
- rebase, project, changeInfo.branch(), changeId, revision, rebaseParentNotCurrent);
- }
-
- @UiHandler("submit")
- void onSubmit(@SuppressWarnings("unused") ClickEvent e) {
- SubmitAction.call(changeInfo, changeInfo.revision(revision));
- }
-
- @UiHandler("cherrypick")
- void onCherryPick(@SuppressWarnings("unused") ClickEvent e) {
- CherryPickAction.call(cherrypick, changeInfo, revision, project, message);
- }
-
- @UiHandler("move")
- void onMove(@SuppressWarnings("unused") ClickEvent e) {
- MoveAction.call(move, changeInfo, project);
- }
-
- @UiHandler("revert")
- void onRevert(@SuppressWarnings("unused") ClickEvent e) {
- RevertAction.call(revert, changeId, project, revision, subject);
- }
-
- private static void a2b(NativeMap<ActionInfo> actions, String a, Button b) {
- if (actions.containsKey(a)) {
- b.setVisible(true);
- ActionInfo actionInfo = actions.get(a);
- b.setTitle(actionInfo.title());
- b.setEnabled(actionInfo.enabled());
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Actions.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Actions.ui.xml
deleted file mode 100644
index 8aeba90..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Actions.ui.xml
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:style gss='false'>
- @def BUTTON_HEIGHT 14px;
-
- #change_actions {
- padding-top: 2px;
- padding-bottom: 20px;
- }
-
- #change_actions button {
- margin: 6px 3px 0 0;
- text-align: center;
- font-size: 8pt;
- font-weight: bold;
- border: 2px solid;
- cursor: pointer;
- color: rgba(0, 0, 0, 0.15);
- background-color: #f5f5f5;
- -webkit-border-radius: 2px;
- -webkit-box-sizing: content-box;
- }
- #change_actions button div {
- color: #444;
- min-width: 54px;
- white-space: nowrap;
- height: BUTTON_HEIGHT;
- line-height: BUTTON_HEIGHT;
- }
-
- #change_actions button.submit {
- float: right;
- background-color: #4d90fe;
- background-image: -webkit-linear-gradient(top, #4d90fe, #4d90fe);
- }
- #change_actions button.submit div {color: #fff;}
-
- #change_actions button:disabled {
- font-weight: normal;
- background-color: #999;
- background-image: -webkit-linear-gradient(top, #999, #999);
- }
- </ui:style>
-
- <g:FlowPanel>
- <g:Button ui:field='cherrypick' styleName='' visible='false'>
- <div><ui:msg>Cherry Pick</ui:msg></div>
- </g:Button>
- <g:Button ui:field='move' styleName='' visible='false'>
- <div><ui:msg>Move Change</ui:msg></div>
- </g:Button>
- <g:Button ui:field='rebase' styleName='' visible='false'>
- <div><ui:msg>Rebase</ui:msg></div>
- </g:Button>
- <g:Button ui:field='revert' styleName='' visible='false'>
- <div><ui:msg>Revert</ui:msg></div>
- </g:Button>
- <g:Button ui:field='abandon' styleName='' visible='false'>
- <div><ui:msg>Abandon</ui:msg></div>
- </g:Button>
- <g:Button ui:field='deleteChange' styleName='' visible='false'>
- <div><ui:msg>Delete Change</ui:msg></div>
- </g:Button>
- <g:Button ui:field='restore' styleName='' visible='false'>
- <div><ui:msg>Restore</ui:msg></div>
- </g:Button>
- <g:Button ui:field='followUp' styleName='' visible='false'>
- <div><ui:msg>Follow-Up</ui:msg></div>
- </g:Button>
- <g:Button ui:field='markPrivate' styleName='' visible='false'>
- <div><ui:msg>Mark Private</ui:msg></div>
- </g:Button>
- <g:Button ui:field='unmarkPrivate' styleName='' visible='false'>
- <div><ui:msg>Unmark Private</ui:msg></div>
- </g:Button>
-
- <g:Button ui:field='submit' styleName='{style.submit}' visible='false'/>
- </g:FlowPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/AddFileAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/AddFileAction.java
deleted file mode 100644
index 2080a0e..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/AddFileAction.java
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-
-class AddFileAction {
- private final Project.NameKey project;
- private final Change.Id changeId;
- private final RevisionInfo revision;
- private final ChangeScreen.Style style;
- private final Widget addButton;
- private final FileTable files;
-
- private AddFileBox addBox;
- private PopupPanel popup;
-
- AddFileAction(
- Project.NameKey project,
- Change.Id changeId,
- RevisionInfo revision,
- ChangeScreen.Style style,
- Widget addButton,
- FileTable files) {
- this.project = project;
- this.changeId = changeId;
- this.revision = revision;
- this.style = style;
- this.addButton = addButton;
- this.files = files;
- }
-
- public void onEdit() {
- if (popup != null) {
- popup.hide();
- return;
- }
-
- files.unregisterKeys();
- if (addBox == null) {
- addBox = new AddFileBox(project, changeId, revision, files);
- }
- addBox.clearPath();
-
- final PopupPanel p = new PopupPanel(true);
- p.setStyleName(style.replyBox());
- p.addAutoHidePartner(addButton.getElement());
- p.addCloseHandler(
- new CloseHandler<PopupPanel>() {
- @Override
- public void onClose(CloseEvent<PopupPanel> event) {
- if (popup == p) {
- popup = null;
- }
- }
- });
- p.add(addBox);
- p.showRelativeTo(addButton);
- GlobalKey.dialog(p);
- addBox.setFocus(true);
- popup = p;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/AddFileBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/AddFileBox.java
deleted file mode 100644
index cd862d2..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/AddFileBox.java
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.client.ui.RemoteSuggestBox;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.event.logical.shared.SelectionEvent;
-import com.google.gwt.event.logical.shared.SelectionHandler;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.Widget;
-
-class AddFileBox extends Composite {
- interface Binder extends UiBinder<HTMLPanel, AddFileBox> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- private final Project.NameKey project;
- private final Change.Id changeId;
- private final RevisionInfo revision;
- private final FileTable fileTable;
-
- @UiField Button open;
- @UiField Button cancel;
-
- @UiField(provided = true)
- RemoteSuggestBox path;
-
- AddFileBox(Project.NameKey project, Change.Id changeId, RevisionInfo revision, FileTable files) {
- this.project = project;
- this.changeId = changeId;
- this.revision = revision;
- this.fileTable = files;
-
- path = new RemoteSuggestBox(new PathSuggestOracle(project, changeId, revision));
- path.addSelectionHandler(
- new SelectionHandler<String>() {
- @Override
- public void onSelection(SelectionEvent<String> event) {
- open(event.getSelectedItem());
- }
- });
- path.addCloseHandler(
- new CloseHandler<RemoteSuggestBox>() {
- @Override
- public void onClose(CloseEvent<RemoteSuggestBox> event) {
- hide();
- fileTable.registerKeys();
- }
- });
-
- initWidget(uiBinder.createAndBindUi(this));
- }
-
- void setFocus(boolean focus) {
- path.setFocus(focus);
- }
-
- void clearPath() {
- path.setText("");
- }
-
- @UiHandler("open")
- void onOpen(@SuppressWarnings("unused") ClickEvent e) {
- open(path.getText());
- }
-
- private void open(String path) {
- hide();
- Gerrit.display(
- Dispatcher.toEditScreen(project, new PatchSet.Id(changeId, revision._number()), path));
- }
-
- @UiHandler("cancel")
- void onCancel(@SuppressWarnings("unused") ClickEvent e) {
- hide();
- fileTable.registerKeys();
- }
-
- private void hide() {
- for (Widget w = getParent(); w != null; w = w.getParent()) {
- if (w instanceof PopupPanel) {
- ((PopupPanel) w).hide();
- break;
- }
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/AddFileBox.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/AddFileBox.ui.xml
deleted file mode 100644
index c3539bc..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/AddFileBox.ui.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:u='urn:import:com.google.gerrit.client.ui'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:with field='res' type='com.google.gerrit.client.change.Resources'/>
- <ui:style gss='false'>
- .cancel { float: right; }
- </ui:style>
- <g:HTMLPanel>
- <div class='{res.style.section}'>
- <ui:msg>Path: <u:RemoteSuggestBox ui:field='path' visibleLength='86'/></ui:msg>
- </div>
- <div class='{res.style.section}'>
- <g:Button ui:field='open'
- title='Open file in editor'
- styleName='{res.style.button}'>
- <ui:attribute name='title'/>
- <div><ui:msg>Open</ui:msg></div>
- </g:Button>
- <g:Button ui:field='cancel'
- styleName='{res.style.button}'
- addStyleNames='{style.cancel}'>
- <div>Cancel</div>
- </g:Button>
- </div>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Assignee.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Assignee.java
deleted file mode 100644
index a376782..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Assignee.java
+++ /dev/null
@@ -1,239 +0,0 @@
-// Copyright (C) 2016 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.client.change;
-
-import com.google.gerrit.client.FormatUtil;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.NotSignedInDialog;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.Util;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.ui.InlineHyperlink;
-import com.google.gerrit.client.ui.RemoteSuggestBox;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.event.logical.shared.SelectionEvent;
-import com.google.gwt.event.logical.shared.SelectionHandler;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.EventListener;
-import com.google.gwt.user.client.rpc.StatusCodeException;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.UIObject;
-
-/** Edit assignee using auto-completion. */
-public class Assignee extends Composite {
- interface Binder extends UiBinder<HTMLPanel, Assignee> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- @UiField Element show;
- @UiField InlineHyperlink assigneeLink;
- @UiField Image editAssigneeIcon;
- @UiField Element form;
- @UiField Element error;
-
- @UiField(provided = true)
- RemoteSuggestBox suggestBox;
-
- private AssigneeSuggestOracle assigneeSuggestOracle;
- private Change.Id changeId;
- private Project.NameKey project;
- private boolean canEdit;
- private AccountInfo currentAssignee;
-
- Assignee() {
- assigneeSuggestOracle = new AssigneeSuggestOracle();
- suggestBox = new RemoteSuggestBox(assigneeSuggestOracle);
- suggestBox.setVisibleLength(55);
- suggestBox.setHintText(Util.C.approvalTableEditAssigneeHint());
- suggestBox.addCloseHandler(
- new CloseHandler<RemoteSuggestBox>() {
- @Override
- public void onClose(CloseEvent<RemoteSuggestBox> event) {
- Assignee.this.onCancel(null);
- }
- });
- suggestBox.addSelectionHandler(
- new SelectionHandler<String>() {
- @Override
- public void onSelection(SelectionEvent<String> event) {
- editAssignee(event.getSelectedItem());
- }
- });
-
- initWidget(uiBinder.createAndBindUi(this));
- editAssigneeIcon.addDomHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- onOpenForm();
- }
- },
- ClickEvent.getType());
- }
-
- void set(ChangeInfo info) {
- this.changeId = info.legacyId();
- this.project = info.projectNameKey();
- this.canEdit = info.hasActions() && info.actions().containsKey("assignee");
- assigneeSuggestOracle.setChange(info);
- setAssignee(info.assignee());
- editAssigneeIcon.setVisible(canEdit);
- if (!canEdit) {
- show.setTitle(null);
- }
- }
-
- void onOpenForm() {
- UIObject.setVisible(form, true);
- UIObject.setVisible(show, false);
- UIObject.setVisible(error, false);
- editAssigneeIcon.setVisible(false);
- suggestBox.setFocus(true);
- if (currentAssignee != null) {
- suggestBox.setText(FormatUtil.nameEmail(currentAssignee));
- suggestBox.selectAll();
- } else {
- suggestBox.setText("");
- }
- }
-
- void onCloseForm() {
- UIObject.setVisible(form, false);
- UIObject.setVisible(show, true);
- UIObject.setVisible(error, false);
- editAssigneeIcon.setVisible(true);
- suggestBox.setFocus(false);
- }
-
- @UiHandler("assign")
- void onEditAssignee(@SuppressWarnings("unused") ClickEvent e) {
- if (canEdit) {
- editAssignee(suggestBox.getText());
- }
- }
-
- @UiHandler("cancel")
- void onCancel(@SuppressWarnings("unused") ClickEvent e) {
- onCloseForm();
- }
-
- private void editAssignee(String assignee) {
- if (assignee.trim().isEmpty()) {
- ChangeApi.deleteAssignee(
- project.get(),
- changeId.get(),
- new GerritCallback<AccountInfo>() {
- @Override
- public void onSuccess(AccountInfo result) {
- onCloseForm();
- setAssignee(null);
- }
-
- @Override
- public void onFailure(Throwable err) {
- if (isSigninFailure(err)) {
- new NotSignedInDialog().center();
- } else {
- UIObject.setVisible(error, true);
- error.setInnerText(
- err instanceof StatusCodeException
- ? ((StatusCodeException) err).getEncodedResponse()
- : err.getMessage());
- }
- }
- });
- } else {
- ChangeApi.setAssignee(
- project.get(),
- changeId.get(),
- assignee,
- new GerritCallback<AccountInfo>() {
- @Override
- public void onSuccess(AccountInfo result) {
- onCloseForm();
- setAssignee(result);
- Reviewers reviewers = getReviewers();
- if (reviewers != null) {
- reviewers.updateReviewerList();
- }
- }
-
- @Override
- public void onFailure(Throwable err) {
- if (isSigninFailure(err)) {
- new NotSignedInDialog().center();
- } else {
- UIObject.setVisible(error, true);
- error.setInnerText(
- err instanceof StatusCodeException
- ? ((StatusCodeException) err).getEncodedResponse()
- : err.getMessage());
- }
- }
- });
- }
- }
-
- private void setAssignee(AccountInfo assignee) {
- currentAssignee = assignee;
- assigneeLink.setText(assignee != null ? getName(assignee) : null);
- assigneeLink.setTargetHistoryToken(
- assignee != null
- ? PageLinks.toAssigneeQuery(
- assignee.name() != null
- ? assignee.name()
- : assignee.email() != null
- ? assignee.email()
- : String.valueOf(assignee._accountId()))
- : "");
- }
-
- private Reviewers getReviewers() {
- Element e = DOM.getParent(getElement());
- for (e = DOM.getParent(e); e != null; e = DOM.getParent(e)) {
- EventListener l = DOM.getEventListener(e);
- if (l instanceof ChangeScreen) {
- ChangeScreen screen = (ChangeScreen) l;
- return screen.reviewers;
- }
- }
- return null;
- }
-
- private String getName(AccountInfo info) {
- if (info.name() != null) {
- return info.name();
- }
- if (info.email() != null) {
- return info.email();
- }
- return Gerrit.info().user().anonymousCowardName();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Assignee.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Assignee.ui.xml
deleted file mode 100644
index d5a7239..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Assignee.ui.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2016 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:c='urn:import:com.google.gwtexpui.globalkey.client'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:u='urn:import:com.google.gerrit.client.ui'>
- <ui:with field='ico' type='com.google.gerrit.client.GerritResources'/>
- <ui:with field='res' type='com.google.gerrit.client.change.Resources'/>
- <ui:style gss='false'>
- .suggestBox {
- margin-bottom: 2px;
- }
-
- .error {
- color: #D33D3D;
- font-weight: bold;
- }
-
- .editAssignee,
- .cancel {
- cursor: pointer;
- float: right;
- }
- </ui:style>
- <g:HTMLPanel>
- <div ui:field='show'>
- <u:InlineHyperlink ui:field='assigneeLink'
- title='Search for changes assigned to this user'/>
- <g:Image ui:field='editAssigneeIcon'
- resource='{ico.editUser}'
- styleName='{style.editAssignee}'
- title='Assign User to Change'/>
- </div>
- <div ui:field='form' style='display: none' aria-hidden='true'>
- <u:RemoteSuggestBox ui:field='suggestBox' styleName='{style.suggestBox}'/>
- <div ui:field='error'
- class='{style.error}'
- style='display: none' aria-hidden='true'/>
- <div>
- <g:Button ui:field='assign' styleName='{res.style.button}'>
- <div>Assign</div>
- </g:Button>
- <g:Button ui:field='cancel'
- styleName='{res.style.button}'
- addStyleNames='{style.cancel}'>
- <div>Cancel</div>
- </g:Button>
- </div>
- </div>
- </g:HTMLPanel>
- </ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/AssigneeSuggestOracle.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/AssigneeSuggestOracle.java
deleted file mode 100644
index c8bbfc3..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/AssigneeSuggestOracle.java
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright (C) 2016 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.client.change;
-
-import com.google.gerrit.client.account.AccountApi;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.AccountSuggestOracle.AccountSuggestion;
-import com.google.gerrit.client.ui.SuggestAfterTypingNCharsOracle;
-import com.google.gwt.core.client.JsArray;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/** REST API based suggestion Oracle for assignee */
-public class AssigneeSuggestOracle extends SuggestAfterTypingNCharsOracle {
-
- private ChangeInfo change;
-
- public void setChange(ChangeInfo change) {
- this.change = change;
- }
-
- @Override
- protected void _onRequestSuggestions(Request req, Callback cb) {
- AccountApi.suggest(
- getQuery(req),
- req.getLimit(),
- new GerritCallback<JsArray<AccountInfo>>() {
- @Override
- public void onSuccess(JsArray<AccountInfo> result) {
- List<AccountSuggestion> r = new ArrayList<>(result.length());
- for (AccountInfo reviewer : Natives.asList(result)) {
- r.add(new AccountSuggestion(reviewer, req.getQuery()));
- }
- cb.onSuggestionsReady(req, new Response(r));
- }
-
- @Override
- public void onFailure(Throwable err) {
- List<Suggestion> r = Collections.emptyList();
- cb.onSuggestionsReady(req, new Response(r));
- }
- });
- }
-
- private String getQuery(Request req) {
- StringBuilder query = new StringBuilder();
- query.append(req.getQuery());
- if (change != null) {
- query.append(" cansee:").append(change._number());
- }
- return query.toString();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeActions.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeActions.java
deleted file mode 100644
index 0bc74e4..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeActions.java
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Button;
-
-public class ChangeActions {
-
- static void delete(Project.NameKey project, Change.Id id, Button... draftButtons) {
- ChangeApi.deleteChange(project.get(), id.get(), mine(draftButtons));
- }
-
- static void markPrivate(Project.NameKey project, Change.Id id, Button... draftButtons) {
- ChangeApi.markPrivate(project.get(), id.get(), cs(project, id, draftButtons));
- }
-
- static void unmarkPrivate(Project.NameKey project, Change.Id id, Button... draftButtons) {
- ChangeApi.unmarkPrivate(project.get(), id.get(), cs(project, id, draftButtons));
- }
-
- public static GerritCallback<JavaScriptObject> cs(
- Project.NameKey project, final Change.Id id, Button... draftButtons) {
- setEnabled(false, draftButtons);
- return new GerritCallback<JavaScriptObject>() {
- @Override
- public void onSuccess(JavaScriptObject result) {
- Gerrit.display(PageLinks.toChange(project, id));
- }
-
- @Override
- public void onFailure(Throwable err) {
- setEnabled(true, draftButtons);
- if (SubmitFailureDialog.isConflict(err)) {
- new SubmitFailureDialog(err.getMessage()).center();
- Gerrit.display(PageLinks.toChange(project, id));
- } else {
- super.onFailure(err);
- }
- }
- };
- }
-
- private static AsyncCallback<JavaScriptObject> mine(Button... draftButtons) {
- setEnabled(false, draftButtons);
- return new GerritCallback<JavaScriptObject>() {
- @Override
- public void onSuccess(JavaScriptObject result) {
- Gerrit.display(PageLinks.MINE);
- }
-
- @Override
- public void onFailure(Throwable err) {
- setEnabled(true, draftButtons);
- if (SubmitFailureDialog.isConflict(err)) {
- new SubmitFailureDialog(err.getMessage()).center();
- Gerrit.display(PageLinks.MINE);
- } else {
- super.onFailure(err);
- }
- }
- };
- }
-
- private static void setEnabled(boolean enabled, Button... draftButtons) {
- if (draftButtons != null) {
- for (Button b : draftButtons) {
- b.setEnabled(enabled);
- }
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeConstants.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeConstants.java
deleted file mode 100644
index ed67846..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeConstants.java
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gwt.i18n.client.Constants;
-
-public interface ChangeConstants extends Constants {
- String previousChange();
-
- String nextChange();
-
- String openChange();
-
- String reviewedFileTitle();
-
- String editFileInline();
-
- String removeFileInline();
-
- String restoreFileInline();
-
- String openLastFile();
-
- String openCommitMessage();
-
- String patchSet();
-
- String commit();
-
- String date();
-
- String author();
-
- String notAvailable();
-
- String relatedChanges();
-
- String relatedChangesTooltip();
-
- String conflictingChanges();
-
- String conflictingChangesTooltip();
-
- String cherryPicks();
-
- String cherryPicksTooltip();
-
- String sameTopic();
-
- String sameTopicTooltip();
-
- String submittedTogether();
-
- String submittedTogetherTooltip();
-
- String noChanges();
-
- String indirectAncestor();
-
- String merged();
-
- String abandoned();
-
- String deleteChangeEdit();
-
- String deleteChange();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeConstants.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeConstants.properties
deleted file mode 100644
index 9000149..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeConstants.properties
+++ /dev/null
@@ -1,36 +0,0 @@
-previousChange = Previous related change
-nextChange = Next related change
-openChange = Open related change
-reviewedFileTitle = Mark file as reviewed (Shortcut: r)
-editFileInline = Edit file inline
-removeFileInline = Remove file inline
-restoreFileInline = Restore file inline
-
-openLastFile = Open last file
-openCommitMessage = Open commit message
-
-patchSet = Patch Set
-commit = Commit
-date = Date
-author = Author / Committer
-
-notAvailable = N/A
-relatedChanges = Related Changes
-relatedChangesTooltip = Same branch changes connected by Git history
-conflictingChanges = Conflicts With
-conflictingChangesTooltip = Open changes that conflict with this change
-cherryPicks = Cherry-Picks
-cherryPicksTooltip = Changes with the same Change-Id
-sameTopic = Same Topic
-sameTopicTooltip = Changes with the same topic
-submittedTogether = Submitted Together
-submittedTogetherTooltip = Changes submitted together with this change
-noChanges = No Changes
-indirectAncestor = Indirect ancestor
-merged = Merged
-abandoned = Abandoned
-
-deleteChangeEdit = Delete Change Edit?\n\
- \n\
- All changes made in the edit revision will be lost.
-deleteChange = Delete Change?
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeMessages.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeMessages.java
deleted file mode 100644
index 4eead56..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeMessages.java
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gwt.i18n.client.Messages;
-
-public interface ChangeMessages extends Messages {
- String patchSets(String currentlyViewedPatchSet, int currentPatchSet);
-
- String changeWithNoRevisions(int changeId);
-
- String relatedChanges(int count);
-
- String relatedChanges(String count);
-
- String conflictingChanges(int count);
-
- String conflictingChanges(String count);
-
- String cherryPicks(int count);
-
- String cherryPicks(String count);
-
- String sameTopic(int count);
-
- String sameTopic(String count);
-
- String submittedTogether(int count);
-
- String submittedTogether(String count);
-
- String editPatchSet(int patchSet);
-
- String failedToLoadFileList(String error);
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeMessages.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeMessages.properties
deleted file mode 100644
index 743945d..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeMessages.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-patchSets = Patch Sets ({0}/{1})
-changeWithNoRevisions = Cannot display change {0} because it has no revisions.
-relatedChanges = Related Changes ({0})
-conflictingChanges = Conflicts With ({0})
-cherryPicks = Cherry-Picks ({0})
-sameTopic = Same Topic ({0})
-submittedTogether = Submitted Together ({0})
-editPatchSet = edit:{0}
-failedToLoadFileList = Failed to load file list: {0}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen.java
deleted file mode 100644
index ec7bc4a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen.java
+++ /dev/null
@@ -1,1653 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.AvatarImage;
-import com.google.gerrit.client.DiffObject;
-import com.google.gerrit.client.ErrorDialog;
-import com.google.gerrit.client.FormatUtil;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.GerritUiExtensionPoint;
-import com.google.gerrit.client.NotFoundScreen;
-import com.google.gerrit.client.api.ChangeGlue;
-import com.google.gerrit.client.api.ExtensionPanel;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.ChangeList;
-import com.google.gerrit.client.changes.CommentInfo;
-import com.google.gerrit.client.changes.QueryScreen;
-import com.google.gerrit.client.changes.RevisionInfoCache;
-import com.google.gerrit.client.changes.StarredChanges;
-import com.google.gerrit.client.changes.Util;
-import com.google.gerrit.client.diff.DiffApi;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.info.AccountInfo.AvatarInfo;
-import com.google.gerrit.client.info.ActionInfo;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.CommitInfo;
-import com.google.gerrit.client.info.ChangeInfo.EditInfo;
-import com.google.gerrit.client.info.ChangeInfo.LabelInfo;
-import com.google.gerrit.client.info.ChangeInfo.MessageInfo;
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.client.info.FileInfo;
-import com.google.gerrit.client.info.GpgKeyInfo;
-import com.google.gerrit.client.info.PushCertificateInfo;
-import com.google.gerrit.client.projects.ConfigInfoCache;
-import com.google.gerrit.client.projects.ConfigInfoCache.Entry;
-import com.google.gerrit.client.rpc.CallbackGroup;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.client.rpc.ScreenLoadCallback;
-import com.google.gerrit.client.ui.BranchLink;
-import com.google.gerrit.client.ui.ChangeLink;
-import com.google.gerrit.client.ui.CommentLinkProcessor;
-import com.google.gerrit.client.ui.Hyperlink;
-import com.google.gerrit.client.ui.InlineHyperlink;
-import com.google.gerrit.client.ui.Screen;
-import com.google.gerrit.client.ui.UserActivityMonitor;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.extensions.client.ListChangesOption;
-import com.google.gerrit.extensions.client.SubmitType;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Change.Status;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwt.dom.client.AnchorElement;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.NativeEvent;
-import com.google.gwt.dom.client.SelectElement;
-import com.google.gwt.dom.client.Style.Display;
-import com.google.gwt.event.dom.client.ChangeEvent;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.event.logical.shared.ValueChangeEvent;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Event;
-import com.google.gwt.user.client.EventListener;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.InlineLabel;
-import com.google.gwt.user.client.ui.ListBox;
-import com.google.gwt.user.client.ui.Panel;
-import com.google.gwt.user.client.ui.SimplePanel;
-import com.google.gwt.user.client.ui.ToggleButton;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.globalkey.client.KeyCommand;
-import com.google.gwtexpui.globalkey.client.KeyCommandSet;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-import com.google.gwtorm.client.KeyUtil;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import net.codemirror.lib.CodeMirror;
-
-public class ChangeScreen extends Screen {
- private static final Logger logger = Logger.getLogger(ChangeScreen.class.getName());
-
- interface Binder extends UiBinder<HTMLPanel, ChangeScreen> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- interface Style extends CssResource {
- String avatar();
-
- String hashtagName();
-
- String hashtagIcon();
-
- String highlight();
-
- String labelName();
-
- String label_may();
-
- String label_need();
-
- String label_ok();
-
- String label_reject();
-
- String label_user();
-
- String pushCertStatus();
-
- String replyBox();
-
- String selected();
-
- String notCurrentPatchSet();
- }
-
- static ChangeScreen get(NativeEvent in) {
- Element e = in.getEventTarget().cast();
- for (e = DOM.getParent(e); e != null; e = DOM.getParent(e)) {
- EventListener l = DOM.getEventListener(e);
- if (l instanceof ChangeScreen) {
- return (ChangeScreen) l;
- }
- }
- return null;
- }
-
- private final Change.Id changeId;
- @Nullable private Project.NameKey project;
- private DiffObject base;
- private String revision;
- private ChangeInfo changeInfo;
- private boolean hasDraftComments;
- private CommentLinkProcessor commentLinkProcessor;
- private EditInfo edit;
- private LocalComments lc;
-
- private List<HandlerRegistration> handlers = new ArrayList<>(4);
- private UpdateCheckTimer updateCheck;
- private Timestamp lastDisplayedUpdate;
- private UpdateAvailableBar updateAvailable;
- private boolean openReplyBox;
- private boolean loaded;
- private FileTable.Mode fileTableMode;
-
- @UiField HTMLPanel headerLine;
- @UiField SimplePanel headerExtension;
- @UiField SimplePanel headerExtensionMiddle;
- @UiField SimplePanel headerExtensionRight;
- @UiField Style style;
- @UiField ToggleButton star;
- @UiField Anchor permalink;
-
- @UiField Assignee assignee;
- @UiField Element assigneeRow;
- @UiField Element ccText;
- @UiField Reviewers reviewers;
- @UiField Hashtags hashtags;
- @UiField Element hashtagTableRow;
-
- @UiField FlowPanel ownerPanel;
- @UiField InlineHyperlink ownerLink;
-
- @UiField Element uploaderRow;
- @UiField FlowPanel uploaderPanel;
- @UiField InlineLabel uploaderName;
-
- @UiField Element statusText;
- @UiField Element privateText;
- @UiField Element wipText;
- @UiField Image projectSettings;
- @UiField AnchorElement projectSettingsLink;
- @UiField InlineHyperlink projectDashboard;
- @UiField InlineHyperlink branchLink;
- @UiField Element strategy;
- @UiField Element submitActionText;
- @UiField Element notMergeable;
- @UiField Topic topic;
- @UiField Element actionText;
- @UiField Element actionDate;
- @UiField SimplePanel changeExtension;
- @UiField SimplePanel relatedExtension;
- @UiField SimplePanel commitExtension;
-
- @UiField Actions actions;
- @UiField Labels labels;
- @UiField CommitBox commit;
- @UiField RelatedChanges related;
- @UiField FileTable files;
- @UiField ListBox diffBase;
- @UiField History history;
- @UiField SimplePanel historyExtensionRight;
-
- @UiField Button includedIn;
- @UiField Button patchSets;
- @UiField Element patchSetsText;
- @UiField Button download;
- @UiField Button reply;
- @UiField Button publishEdit;
- @UiField Button rebaseEdit;
- @UiField Button deleteEdit;
- @UiField Button openAll;
- @UiField Button editMode;
- @UiField Button reviewMode;
- @UiField Button addFile;
- @UiField Button deleteFile;
- @UiField Button renameFile;
- @UiField Button expandAll;
- @UiField Button collapseAll;
- @UiField Button hideTaggedComments;
- @UiField Button showTaggedComments;
- @UiField QuickApprove quickApprove;
-
- private ReplyAction replyAction;
- private IncludedInAction includedInAction;
- private PatchSetsAction patchSetsAction;
- private DownloadAction downloadAction;
- private AddFileAction addFileAction;
- private DeleteFileAction deleteFileAction;
- private RenameFileAction renameFileAction;
-
- public ChangeScreen(
- @Nullable Project.NameKey project,
- Change.Id changeId,
- DiffObject base,
- String revision,
- boolean openReplyBox,
- FileTable.Mode mode) {
- this.project = project;
- this.changeId = changeId;
- this.base = base;
- this.revision = normalize(revision);
- this.openReplyBox = openReplyBox;
- this.fileTableMode = mode;
- this.lc = new LocalComments(project, changeId);
- add(uiBinder.createAndBindUi(this));
- }
-
- public Project.NameKey getProject() {
- return project;
- }
-
- PatchSet.Id getPatchSetId() {
- return new PatchSet.Id(changeInfo.legacyId(), changeInfo.revisions().get(revision)._number());
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- loadChangeScreen();
- }
-
- private void loadChangeScreen() {
- if (project == null) {
- // Load the project if it is not already present. This is the case when the user used a URL
- // that doesn't include the project. Setting it here will rewrite the URL token to include the
- // project (visible to the user) and all future API calls made from the change screen will use
- // project/+/changeId to identify the change.
- String query = "change:" + changeId.get();
- ChangeList.query(
- query,
- Collections.emptySet(),
- new AsyncCallback<ChangeList>() {
- @Override
- public void onSuccess(ChangeList result) {
- if (result.length() == 0) {
- Gerrit.display(getToken(), new NotFoundScreen());
- } else if (result.length() > 1) {
- Gerrit.display(PageLinks.toChangeQuery(query), QueryScreen.forQuery(query));
- } else {
- // Initialize current screen with newly obtained project
- project = result.get(0).projectNameKey();
- loadChangeScreen();
- }
- }
-
- @Override
- public void onFailure(Throwable caught) {
- GerritCallback.showFailure(caught);
- }
- });
-
- return;
- }
- CallbackGroup group = new CallbackGroup();
- if (Gerrit.isSignedIn()) {
- ChangeList.query(
- "change:" + changeId.get() + " has:draft",
- Collections.emptySet(),
- group.add(
- new AsyncCallback<ChangeList>() {
- @Override
- public void onSuccess(ChangeList result) {
- hasDraftComments = result.length() > 0;
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- }));
- ChangeApi.editWithFiles(
- Project.NameKey.asStringOrNull(project),
- changeId.get(),
- group.add(
- new AsyncCallback<EditInfo>() {
- @Override
- public void onSuccess(EditInfo result) {
- edit = result;
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- }));
- }
- loadChangeInfo(
- true,
- group.addFinal(
- new GerritCallback<ChangeInfo>() {
- @Override
- public void onSuccess(ChangeInfo info) {
- info.init();
- initCurrentRevision(info);
- final RevisionInfo rev = info.revision(revision);
- CallbackGroup group = new CallbackGroup();
- loadCommit(rev, group);
-
- group.addListener(
- new GerritCallback<Void>() {
- @Override
- public void onSuccess(Void result) {
- if (base.isBase() && rev.isMerge()) {
- base =
- DiffObject.parse(
- info.legacyId(),
- Gerrit.getUserPreferences().defaultBaseForMerges().getBase());
- }
- loadConfigInfo(info, base);
- JsArray<MessageInfo> mAr = info.messages();
- for (int i = 0; i < mAr.length(); i++) {
- if (mAr.get(i).tag() != null) {
- hideTaggedComments.setVisible(true);
- break;
- }
- }
- }
- });
- group.done();
- }
- }));
- }
-
- private RevisionInfo initCurrentRevision(ChangeInfo info) {
- info.revisions().copyKeysIntoChildren("name");
- if (edit != null) {
- edit.setName(edit.commit().commit());
- info.setEdit(edit);
- if (edit.hasFiles()) {
- edit.files().copyKeysIntoChildren("path");
- }
- info.revisions().put(edit.name(), RevisionInfo.fromEdit(edit));
- JsArray<RevisionInfo> list = info.revisions().values();
-
- // Edit is converted to a regular revision (with number = 0) and
- // added to the list of revisions. Additionally under certain
- // circumstances change edit is assigned to be the current revision
- // and is selected to be shown on the change screen.
- // We have two different strategies to assign edit to the current ps:
- // 1. revision == null: no revision is selected, so use the edit only
- // if it is based on the latest patch set
- // 2. edit was selected explicitly from ps drop down:
- // use the edit regardless of which patch set it is based on
- if (revision == null) {
- RevisionInfo.sortRevisionInfoByNumber(list);
- RevisionInfo rev = list.get(list.length() - 1);
- if (rev.isEdit()) {
- info.setCurrentRevision(rev.name());
- }
- } else if (revision.equals("edit") || revision.equals("0")) {
- for (int i = 0; i < list.length(); i++) {
- RevisionInfo r = list.get(i);
- if (r.isEdit()) {
- info.setCurrentRevision(r.name());
- break;
- }
- }
- }
- }
- return resolveRevisionToDisplay(info);
- }
-
- private void addExtensionPoints(ChangeInfo change, RevisionInfo rev, Entry result) {
- addExtensionPoint(GerritUiExtensionPoint.CHANGE_SCREEN_HEADER, headerExtension, change, rev);
- addExtensionPoint(
- GerritUiExtensionPoint.CHANGE_SCREEN_HEADER_RIGHT_OF_BUTTONS,
- headerExtensionMiddle,
- change,
- rev);
- addExtensionPoint(
- GerritUiExtensionPoint.CHANGE_SCREEN_HEADER_RIGHT_OF_POP_DOWNS,
- headerExtensionRight,
- change,
- rev);
- addExtensionPoint(
- GerritUiExtensionPoint.CHANGE_SCREEN_BELOW_CHANGE_INFO_BLOCK,
- changeExtension,
- change,
- rev,
- result.getExtensionPanelNames(
- GerritUiExtensionPoint.CHANGE_SCREEN_BELOW_CHANGE_INFO_BLOCK.toString()));
- addExtensionPoint(
- GerritUiExtensionPoint.CHANGE_SCREEN_BELOW_RELATED_INFO_BLOCK,
- relatedExtension,
- change,
- rev);
- addExtensionPoint(
- GerritUiExtensionPoint.CHANGE_SCREEN_BELOW_COMMIT_INFO_BLOCK, commitExtension, change, rev);
- addExtensionPoint(
- GerritUiExtensionPoint.CHANGE_SCREEN_HISTORY_RIGHT_OF_BUTTONS,
- historyExtensionRight,
- change,
- rev);
- }
-
- private void addExtensionPoint(
- GerritUiExtensionPoint extensionPoint,
- Panel p,
- ChangeInfo change,
- RevisionInfo rev,
- List<String> panelNames) {
- ExtensionPanel extensionPanel = new ExtensionPanel(extensionPoint, panelNames);
- extensionPanel.putObject(GerritUiExtensionPoint.Key.CHANGE_INFO, change);
- extensionPanel.putObject(GerritUiExtensionPoint.Key.REVISION_INFO, rev);
- p.add(extensionPanel);
- }
-
- private void addExtensionPoint(
- GerritUiExtensionPoint extensionPoint, Panel p, ChangeInfo change, RevisionInfo rev) {
- addExtensionPoint(extensionPoint, p, change, rev, Collections.emptyList());
- }
-
- private boolean enableSignedPush() {
- return Gerrit.info().receive().enableSignedPush();
- }
-
- void loadChangeInfo(boolean fg, AsyncCallback<ChangeInfo> cb) {
- RestApi call = ChangeApi.detail(Project.NameKey.asStringOrNull(project), changeId.get());
- EnumSet<ListChangesOption> opts =
- EnumSet.of(ListChangesOption.ALL_REVISIONS, ListChangesOption.CHANGE_ACTIONS);
- if (enableSignedPush()) {
- opts.add(ListChangesOption.PUSH_CERTIFICATES);
- }
- ChangeList.addOptions(call, opts);
- if (!fg) {
- call.background();
- }
- call.get(cb);
- }
-
- void loadRevisionInfo() {
- RestApi call = ChangeApi.actions(getProject().get(), changeId.get(), revision);
- call.background();
- call.get(
- new GerritCallback<NativeMap<ActionInfo>>() {
- @Override
- public void onSuccess(NativeMap<ActionInfo> actionMap) {
- actionMap.copyKeysIntoChildren("id");
- renderRevisionInfo(changeInfo, actionMap);
- }
- });
- }
-
- @Override
- protected void onUnload() {
- if (replyAction != null) {
- replyAction.hide();
- }
- if (updateCheck != null) {
- updateCheck.cancel();
- updateCheck = null;
- }
- for (HandlerRegistration h : handlers) {
- h.removeHandler();
- }
- handlers.clear();
- super.onUnload();
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- setHeaderVisible(false);
- Resources.I.style().ensureInjected();
- star.setVisible(Gerrit.isSignedIn());
- labels.init(style);
- reviewers.init(style, ccText);
- hashtags.init(style);
- }
-
- private void initReplyButton(ChangeInfo info, String revision) {
- if (!info.revision(revision).isEdit()) {
- reply.setTitle(Gerrit.info().change().replyLabel());
- reply.setHTML(
- new SafeHtmlBuilder().openDiv().append(Gerrit.info().change().replyLabel()).closeDiv());
- if (hasDraftComments || lc.hasReplyComment()) {
- reply.setStyleName(style.highlight());
- }
- reply.setVisible(true);
- }
- }
-
- private void gotoSibling(int offset) {
- if (offset > 0
- && changeInfo.currentRevision() != null
- && changeInfo.currentRevision().equals(revision)) {
- return;
- }
-
- if (offset < 0 && changeInfo.revision(revision)._number() == 1) {
- return;
- }
-
- JsArray<RevisionInfo> revisions = changeInfo.revisions().values();
- RevisionInfo.sortRevisionInfoByNumber(revisions);
- for (int i = 0; i < revisions.length(); i++) {
- if (revision.equals(revisions.get(i).name())) {
- if (0 <= i + offset && i + offset < revisions.length()) {
- Gerrit.display(
- PageLinks.toChange(
- project,
- new PatchSet.Id(changeInfo.legacyId(), revisions.get(i + offset)._number())));
- return;
- }
- return;
- }
- }
- }
-
- private void initIncludedInAction(ChangeInfo info) {
- if (info.status() == Status.MERGED) {
- includedInAction =
- new IncludedInAction(
- info.projectNameKey(), info.legacyId(), style, headerLine, includedIn);
- includedIn.setVisible(true);
- }
- }
-
- private void updatePatchSetsTextStyle(boolean isPatchSetCurrent) {
- if (isPatchSetCurrent) {
- patchSetsText.removeClassName(style.notCurrentPatchSet());
- } else {
- patchSetsText.addClassName(style.notCurrentPatchSet());
- }
- }
-
- private void initRevisionsAction(ChangeInfo info, String revision) {
- int currentPatchSet;
- if (info.currentRevision() != null && info.revisions().containsKey(info.currentRevision())) {
- currentPatchSet = info.revision(info.currentRevision())._number();
- } else {
- JsArray<RevisionInfo> revList = info.revisions().values();
- RevisionInfo.sortRevisionInfoByNumber(revList);
- currentPatchSet = revList.get(revList.length() - 1)._number();
- }
-
- String currentlyViewedPatchSet;
- boolean isPatchSetCurrent = true;
- String revisionId = info.revision(revision).id();
- if (revisionId.equals("edit")) {
- currentlyViewedPatchSet =
- Resources.M.editPatchSet(RevisionInfo.findEditParent(info.revisions().values()));
- currentPatchSet = info.revisions().values().length() - 1;
- } else {
- currentlyViewedPatchSet = revisionId;
- if (!currentlyViewedPatchSet.equals(Integer.toString(currentPatchSet))) {
- isPatchSetCurrent = false;
- }
- }
- patchSetsText.setInnerText(Resources.M.patchSets(currentlyViewedPatchSet, currentPatchSet));
- updatePatchSetsTextStyle(isPatchSetCurrent);
- patchSetsAction =
- new PatchSetsAction(
- info.projectNameKey(), info.legacyId(), revision, edit, style, headerLine, patchSets);
- }
-
- private void initDownloadAction(ChangeInfo info, String revision) {
- downloadAction = new DownloadAction(info, revision, style, headerLine, download);
- }
-
- private void initProjectLinks(ChangeInfo info) {
- projectSettingsLink.setHref("#" + PageLinks.toProject(info.projectNameKey()));
- projectSettings.addDomHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- if (Hyperlink.impl.handleAsClick((Event) event.getNativeEvent())) {
- event.stopPropagation();
- event.preventDefault();
- Gerrit.display(PageLinks.toProject(info.projectNameKey()));
- }
- }
- },
- ClickEvent.getType());
- projectDashboard.setText(info.project());
- projectDashboard.setTargetHistoryToken(
- PageLinks.toProjectDefaultDashboard(info.projectNameKey()));
- }
-
- private void initBranchLink(ChangeInfo info) {
- branchLink.setText(info.branch());
- branchLink.setTargetHistoryToken(
- PageLinks.toChangeQuery(
- BranchLink.query(info.projectNameKey(), info.status(), info.branch(), null)));
- }
-
- private void initEditMode(ChangeInfo info, String revision) {
- if (Gerrit.isSignedIn()) {
- RevisionInfo rev = info.revision(revision);
- if (info.status().isOpen()) {
- if (isEditModeEnabled(info, rev)) {
- editMode.setVisible(fileTableMode == FileTable.Mode.REVIEW);
- addFile.setVisible(!editMode.isVisible());
- deleteFile.setVisible(!editMode.isVisible());
- renameFile.setVisible(!editMode.isVisible());
- reviewMode.setVisible(!editMode.isVisible());
- addFileAction =
- new AddFileAction(
- info.projectNameKey(), changeId, info.revision(revision), style, addFile, files);
- deleteFileAction =
- new DeleteFileAction(
- info.projectNameKey(), changeId, info.revision(revision), style, addFile);
- renameFileAction =
- new RenameFileAction(
- info.projectNameKey(), changeId, info.revision(revision), style, addFile);
- } else {
- editMode.setVisible(false);
- addFile.setVisible(false);
- reviewMode.setVisible(false);
- }
-
- if (rev.isEdit()) {
- if (info.hasEditBasedOnCurrentPatchSet()) {
- publishEdit.setVisible(true);
- } else {
- rebaseEdit.setVisible(true);
- }
- deleteEdit.setVisible(true);
- }
- } else if (rev.isEdit()) {
- deleteEdit.setStyleName(style.highlight());
- deleteEdit.setVisible(true);
- }
- }
- }
-
- private boolean isEditModeEnabled(ChangeInfo info, RevisionInfo rev) {
- if (rev.isEdit()) {
- return true;
- }
- if (edit == null) {
- return revision.equals(info.currentRevision());
- }
- return rev._number() == RevisionInfo.findEditParent(info.revisions().values());
- }
-
- @UiHandler("publishEdit")
- void onPublishEdit(@SuppressWarnings("unused") ClickEvent e) {
- EditActions.publishEdit(getProject(), changeId, publishEdit, rebaseEdit, deleteEdit);
- }
-
- @UiHandler("rebaseEdit")
- void onRebaseEdit(@SuppressWarnings("unused") ClickEvent e) {
- EditActions.rebaseEdit(getProject(), changeId, publishEdit, rebaseEdit, deleteEdit);
- }
-
- @UiHandler("deleteEdit")
- void onDeleteEdit(@SuppressWarnings("unused") ClickEvent e) {
- if (Window.confirm(Resources.C.deleteChangeEdit())) {
- EditActions.deleteEdit(getProject(), changeId, publishEdit, rebaseEdit, deleteEdit);
- }
- }
-
- @Override
- public void registerKeys() {
- super.registerKeys();
-
- KeyCommandSet keysNavigation = new KeyCommandSet(Gerrit.C.sectionNavigation());
- keysNavigation.add(
- new KeyCommand(0, 'u', Util.C.upToChangeList()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- Gerrit.displayLastChangeList();
- }
- });
- keysNavigation.add(
- new KeyCommand(0, 'R', Util.C.keyReloadChange()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- Gerrit.display(PageLinks.toChange(project, changeId));
- }
- });
- keysNavigation.add(
- new KeyCommand(0, 'n', Util.C.keyNextPatchSet()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- gotoSibling(1);
- }
- },
- new KeyCommand(0, 'p', Util.C.keyPreviousPatchSet()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- gotoSibling(-1);
- }
- });
- handlers.add(GlobalKey.add(this, keysNavigation));
-
- KeyCommandSet keysAction = new KeyCommandSet(Gerrit.C.sectionActions());
- keysAction.add(
- new KeyCommand(0, 'a', Util.C.keyPublishComments()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- if (Gerrit.isSignedIn()) {
- onReply(null);
- } else {
- Gerrit.doSignIn(getToken());
- }
- }
- });
- keysAction.add(
- new KeyCommand(0, 'x', Util.C.keyExpandAllMessages()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- onExpandAll(null);
- }
- });
- keysAction.add(
- new KeyCommand(0, 'z', Util.C.keyCollapseAllMessages()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- onCollapseAll(null);
- }
- });
- keysAction.add(
- new KeyCommand(0, 's', Util.C.changeTableStar()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- if (Gerrit.isSignedIn()) {
- star.setValue(!star.getValue(), true);
- } else {
- Gerrit.doSignIn(getToken());
- }
- }
- });
- keysAction.add(
- new KeyCommand(0, 'c', Util.C.keyAddReviewers()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- if (Gerrit.isSignedIn()) {
- reviewers.onOpenForm();
- } else {
- Gerrit.doSignIn(getToken());
- }
- }
- });
- keysAction.add(
- new KeyCommand(0, 't', Util.C.keyEditTopic()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- if (Gerrit.isSignedIn()) {
- // In Firefox this event is mistakenly called when F5 is pressed so
- // differentiate F5 from 't' by checking the charCode(F5=0, t=116).
- if (event.getNativeEvent().getCharCode() == 0) {
- Window.Location.reload();
- return;
- }
- if (topic.canEdit()) {
- topic.onEdit();
- }
- } else {
- Gerrit.doSignIn(getToken());
- }
- }
- });
- handlers.add(GlobalKey.add(this, keysAction));
- files.registerKeys();
- }
-
- @Override
- public void onShowView() {
- super.onShowView();
- commit.onShowView();
- related.setMaxHeight(commit.getElement().getParentElement().getOffsetHeight());
-
- if (openReplyBox) {
- onReply();
- } else {
- String prior = Gerrit.getPriorView();
- if (prior != null && prior.startsWith("/c/")) {
- scrollToPath(prior.substring(3));
- }
- }
-
- ChangeGlue.fireShowChange(changeInfo, changeInfo.revision(revision));
- CodeMirror.preload();
- startPoller();
- }
-
- private void scrollToPath(String token) {
- ProjectChangeId cId;
- try {
- cId = ProjectChangeId.create(token);
- } catch (IllegalArgumentException e) {
- // Scrolling is best-effort.
- return;
- }
- if (!changeId.equals(cId.getChangeId())) {
- return; // Unrelated URL, do not scroll.
- }
-
- // Extract the start of a file path. The patch set is always contained in the URL and separated
- // by from the changeId by a forward slash. Example: /c/project/+/123/1/folder/file.txt
- int s = token.indexOf('/', cId.identifierLength() + 1);
- if (s < 0) {
- return; // URL does not name a file.
- }
-
- int c = token.lastIndexOf(',');
- if (0 <= c) {
- token = token.substring(s + 1, c);
- } else {
- token = token.substring(s + 1);
- }
-
- if (!token.isEmpty()) {
- files.scrollToPath(KeyUtil.decode(token));
- }
- }
-
- @UiHandler("star")
- void onToggleStar(ValueChangeEvent<Boolean> e) {
- StarredChanges.toggleStar(changeId, e.getValue());
- }
-
- @UiHandler("includedIn")
- void onIncludedIn(@SuppressWarnings("unused") ClickEvent e) {
- includedInAction.show();
- }
-
- @UiHandler("download")
- void onDownload(@SuppressWarnings("unused") ClickEvent e) {
- downloadAction.show();
- }
-
- @UiHandler("patchSets")
- void onPatchSets(@SuppressWarnings("unused") ClickEvent e) {
- patchSetsAction.show();
- }
-
- @UiHandler("reply")
- void onReply(@SuppressWarnings("unused") ClickEvent e) {
- onReply();
- }
-
- @UiHandler("permalink")
- void onReload(ClickEvent e) {
- e.preventDefault();
- Gerrit.display(PageLinks.toChange(project, changeId));
- }
-
- private void onReply() {
- if (Gerrit.isSignedIn()) {
- replyAction.onReply(null);
- } else {
- Gerrit.doSignIn(getToken());
- }
- }
-
- @UiHandler("openAll")
- void onOpenAll(@SuppressWarnings("unused") ClickEvent e) {
- files.openAll();
- }
-
- @UiHandler("editMode")
- void onEditMode(@SuppressWarnings("unused") ClickEvent e) {
- fileTableMode = FileTable.Mode.EDIT;
- refreshFileTable();
- editMode.setVisible(false);
- addFile.setVisible(true);
- deleteFile.setVisible(true);
- renameFile.setVisible(true);
- reviewMode.setVisible(true);
- }
-
- @UiHandler("reviewMode")
- void onReviewMode(@SuppressWarnings("unused") ClickEvent e) {
- fileTableMode = FileTable.Mode.REVIEW;
- refreshFileTable();
- editMode.setVisible(true);
- addFile.setVisible(false);
- deleteFile.setVisible(false);
- renameFile.setVisible(false);
- reviewMode.setVisible(false);
- }
-
- @UiHandler("addFile")
- void onAddFile(@SuppressWarnings("unused") ClickEvent e) {
- addFileAction.onEdit();
- }
-
- @UiHandler("deleteFile")
- void onDeleteFile(@SuppressWarnings("unused") ClickEvent e) {
- deleteFileAction.onDelete();
- }
-
- @UiHandler("renameFile")
- void onRenameFile(@SuppressWarnings("unused") ClickEvent e) {
- renameFileAction.onRename();
- }
-
- private void refreshFileTable() {
- int idx = diffBase.getSelectedIndex();
- if (0 <= idx) {
- String n = diffBase.getValue(idx);
- loadConfigInfo(changeInfo, DiffObject.parse(changeInfo.legacyId(), n));
- }
- }
-
- @UiHandler("showTaggedComments")
- void onShowTaggedComments(@SuppressWarnings("unused") ClickEvent e) {
- showTaggedComments.setVisible(false);
- hideTaggedComments.setVisible(true);
- int n = history.getWidgetCount();
- for (int i = 0; i < n; i++) {
- Message m = ((Message) history.getWidget(i));
- m.setVisible(true);
- }
- }
-
- @UiHandler("hideTaggedComments")
- void onHideTaggedComments(@SuppressWarnings("unused") ClickEvent e) {
- hideTaggedComments.setVisible(false);
- showTaggedComments.setVisible(true);
- int n = history.getWidgetCount();
- for (int i = 0; i < n; i++) {
- Message m = ((Message) history.getWidget(i));
- if (m.getMessageInfo().tag() != null) {
- m.setVisible(false);
- }
- }
- }
-
- @UiHandler("expandAll")
- void onExpandAll(@SuppressWarnings("unused") ClickEvent e) {
- int n = history.getWidgetCount();
- for (int i = 0; i < n; i++) {
- ((Message) history.getWidget(i)).setOpen(true);
- }
- expandAll.setVisible(false);
- collapseAll.setVisible(true);
- }
-
- @UiHandler("collapseAll")
- void onCollapseAll(@SuppressWarnings("unused") ClickEvent e) {
- int n = history.getWidgetCount();
- for (int i = 0; i < n; i++) {
- ((Message) history.getWidget(i)).setOpen(false);
- }
- expandAll.setVisible(true);
- collapseAll.setVisible(false);
- }
-
- @UiHandler("diffBase")
- void onChangeRevision(@SuppressWarnings("unused") ChangeEvent e) {
- int idx = diffBase.getSelectedIndex();
- if (0 <= idx) {
- String n = diffBase.getValue(idx);
- loadConfigInfo(changeInfo, DiffObject.parse(changeInfo.legacyId(), n));
- }
- }
-
- private void loadConfigInfo(ChangeInfo info, DiffObject base) {
- final RevisionInfo rev = info.revision(revision);
- if (base.isAutoMerge() && !initCurrentRevision(info).isMerge()) {
- Gerrit.display(getToken(), new NotFoundScreen());
- }
-
- updateToken(info, base, rev);
-
- RevisionInfo baseRev = resolveRevisionOrPatchSetId(info, base.asString(), null);
-
- CallbackGroup group = new CallbackGroup();
- Timestamp lastReply = myLastReply(info);
- if (rev.isEdit()) {
- // Comments are filtered for the current revision. Use parent
- // patch set for edits, as edits themself can never have comments.
- RevisionInfo p = RevisionInfo.findEditParentRevision(info.revisions().values());
- List<NativeMap<JsArray<CommentInfo>>> comments = loadComments(p, group);
- loadFileList(base, baseRev, rev, lastReply, group, comments, null);
- } else {
- loadDiff(base, baseRev, rev, lastReply, group);
- }
- group.addListener(
- new AsyncCallback<Void>() {
- @Override
- public void onSuccess(Void result) {
- loadConfigInfo(info, rev);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- logger.log(
- Level.SEVERE,
- "Loading file list and inline comments failed: " + caught.getMessage());
- loadConfigInfo(info, rev);
- }
- });
- group.done();
- }
-
- private void loadConfigInfo(ChangeInfo info, RevisionInfo rev) {
- if (loaded) {
- return;
- }
-
- RevisionInfoCache.add(changeId, rev);
- ConfigInfoCache.add(info);
- ConfigInfoCache.get(
- info.projectNameKey(),
- new ScreenLoadCallback<ConfigInfoCache.Entry>(this) {
- @Override
- protected void preDisplay(Entry result) {
- loaded = true;
- commentLinkProcessor = result.getCommentLinkProcessor();
- setTheme(result.getTheme());
- renderChangeInfo(info);
- loadRevisionInfo();
- }
- });
- ConfigInfoCache.get(
- info.projectNameKey(),
- new GerritCallback<Entry>() {
- @Override
- public void onSuccess(Entry entry) {
- addExtensionPoints(info, rev, entry);
- }
- });
- }
-
- private void updateToken(ChangeInfo info, DiffObject base, RevisionInfo rev) {
- StringBuilder token =
- new StringBuilder("/c/")
- .append(PageLinks.toChangeId(info.projectNameKey(), info.legacyId()))
- .append("/");
- if (base.asString() != null) {
- token.append(base.asString()).append("..");
- }
- if (base.asString() != null || !rev.name().equals(info.currentRevision())) {
- token.append(rev._number());
- }
- setToken(token.toString());
- }
-
- static Timestamp myLastReply(ChangeInfo info) {
- if (Gerrit.isSignedIn() && info.messages() != null) {
- int self = Gerrit.getUserAccount()._accountId();
- for (int i = info.messages().length() - 1; i >= 0; i--) {
- MessageInfo m = info.messages().get(i);
- if (m.author() != null && m.author()._accountId() == self) {
- return m.date();
- }
- }
- }
- return null;
- }
-
- private void loadDiff(
- DiffObject base,
- RevisionInfo baseRev,
- RevisionInfo rev,
- Timestamp myLastReply,
- CallbackGroup group) {
- List<NativeMap<JsArray<CommentInfo>>> comments = loadComments(rev, group);
- List<NativeMap<JsArray<CommentInfo>>> drafts = loadDrafts(rev, group);
- loadFileList(base, baseRev, rev, myLastReply, group, comments, drafts);
-
- if (Gerrit.isSignedIn() && fileTableMode == FileTable.Mode.REVIEW) {
- ChangeApi.revision(getProject().get(), changeId.get(), rev.name())
- .view("files")
- .addParameterTrue("reviewed")
- .get(
- group.add(
- new AsyncCallback<JsArrayString>() {
- @Override
- public void onSuccess(JsArrayString result) {
- files.markReviewed(result);
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- }));
- }
- }
-
- private void loadFileList(
- final DiffObject base,
- final RevisionInfo baseRev,
- final RevisionInfo rev,
- final Timestamp myLastReply,
- CallbackGroup group,
- final List<NativeMap<JsArray<CommentInfo>>> comments,
- final List<NativeMap<JsArray<CommentInfo>>> drafts) {
- DiffApi.list(
- getProject().get(),
- changeId.get(),
- rev.name(),
- baseRev,
- group.add(
- new AsyncCallback<NativeMap<FileInfo>>() {
- @Override
- public void onSuccess(NativeMap<FileInfo> m) {
- files.set(
- base,
- new PatchSet.Id(changeId, rev._number()),
- getProject(),
- style,
- reply,
- fileTableMode,
- edit != null);
- files.setValue(
- m,
- myLastReply,
- comments != null ? comments.get(0) : null,
- drafts != null ? drafts.get(0) : null);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- files.showError(caught);
- }
- }));
- }
-
- private List<NativeMap<JsArray<CommentInfo>>> loadComments(
- final RevisionInfo rev, CallbackGroup group) {
- final List<NativeMap<JsArray<CommentInfo>>> r = new ArrayList<>(1);
- // TODO(dborowitz): Could eliminate this call by adding an option to include
- // inline comments in the change detail.
- ChangeApi.comments(getProject().get(), changeId.get())
- .get(
- group.add(
- new AsyncCallback<NativeMap<JsArray<CommentInfo>>>() {
- @Override
- public void onSuccess(NativeMap<JsArray<CommentInfo>> result) {
- // Return value is used for populating the file table, so only count
- // comments for the current revision. Still include all comments in
- // the history table.
- r.add(filterForRevision(result, rev._number()));
- history.addComments(result);
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- }));
- return r;
- }
-
- private static NativeMap<JsArray<CommentInfo>> filterForRevision(
- NativeMap<JsArray<CommentInfo>> comments, int id) {
- NativeMap<JsArray<CommentInfo>> filtered = NativeMap.create();
- for (String k : comments.keySet()) {
- JsArray<CommentInfo> allRevisions = comments.get(k);
- JsArray<CommentInfo> thisRevision = JsArray.createArray().cast();
- for (int i = 0; i < allRevisions.length(); i++) {
- CommentInfo c = allRevisions.get(i);
- if (c.patchSet() == id) {
- thisRevision.push(c);
- }
- }
- filtered.put(k, thisRevision);
- }
- return filtered;
- }
-
- private List<NativeMap<JsArray<CommentInfo>>> loadDrafts(RevisionInfo rev, CallbackGroup group) {
- final List<NativeMap<JsArray<CommentInfo>>> r = new ArrayList<>(1);
- if (Gerrit.isSignedIn()) {
- ChangeApi.revision(getProject().get(), changeId.get(), rev.name())
- .view("drafts")
- .get(
- group.add(
- new AsyncCallback<NativeMap<JsArray<CommentInfo>>>() {
- @Override
- public void onSuccess(NativeMap<JsArray<CommentInfo>> result) {
- r.add(result);
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- }));
- } else {
- r.add(NativeMap.<JsArray<CommentInfo>>create());
- }
- return r;
- }
-
- private void loadCommit(RevisionInfo rev, CallbackGroup group) {
- if (rev.isEdit() || rev.commit() != null) {
- return;
- }
-
- ChangeApi.commitWithLinks(
- getProject().get(),
- changeId.get(),
- rev.name(),
- group.add(
- new AsyncCallback<CommitInfo>() {
- @Override
- public void onSuccess(CommitInfo info) {
- rev.setCommit(info);
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- }));
- }
-
- private void renderSubmitType(Change.Status status, boolean canSubmit, SubmitType submitType) {
- if (status == Change.Status.NEW && !changeInfo.isWorkInProgress()) {
- if (canSubmit) {
- statusText.setInnerText(
- changeInfo.mergeable() ? Util.C.readyToSubmit() : Util.C.mergeConflict());
- }
- setVisible(notMergeable, !changeInfo.mergeable());
- }
- submitActionText.setInnerText(com.google.gerrit.client.admin.Util.toLongString(submitType));
- }
-
- private RevisionInfo resolveRevisionToDisplay(ChangeInfo info) {
- RevisionInfo rev = resolveRevisionOrPatchSetId(info, revision, info.currentRevision());
- if (rev != null) {
- revision = rev.name();
- return rev;
- }
-
- // the revision is not visible to the calling user (maybe it is a draft?)
- // or the change is corrupt, take the last revision that was returned,
- // if no revision was returned display an error
- JsArray<RevisionInfo> revisions = info.revisions().values();
- if (revisions.length() > 0) {
- RevisionInfo.sortRevisionInfoByNumber(revisions);
- rev = revisions.get(revisions.length() - 1);
- revision = rev.name();
- return rev;
- }
- new ErrorDialog(Resources.M.changeWithNoRevisions(info.legacyId().get())).center();
- throw new IllegalStateException("no revision, cannot proceed");
- }
-
- /**
- * Resolve a revision or patch set id string to RevisionInfo. When this view is created from the
- * changes table, revision is passed as a real revision. When this view is created from side by
- * side (by closing it with 'u') patch set id is passed.
- *
- * @param info change info
- * @param revOrId revision or patch set id
- * @param defaultValue value returned when revOrId is null
- * @return resolved revision or default value
- */
- private RevisionInfo resolveRevisionOrPatchSetId(
- ChangeInfo info, String revOrId, String defaultValue) {
- int parentNum;
- if (revOrId == null) {
- revOrId = defaultValue;
- } else if ((parentNum = toParentNum(revOrId)) > 0) {
- CommitInfo commitInfo = info.revision(revision).commit();
- JsArray<CommitInfo> parents = commitInfo.parents();
- if (parents.length() >= parentNum) {
- return RevisionInfo.forParent(-parentNum, parents.get(parentNum - 1));
- }
- } else if (!info.revisions().containsKey(revOrId)) {
- JsArray<RevisionInfo> list = info.revisions().values();
- for (int i = 0; i < list.length(); i++) {
- RevisionInfo r = list.get(i);
- if (revOrId.equals(String.valueOf(r._number()))) {
- revOrId = r.name();
- break;
- }
- }
- }
- return revOrId != null ? info.revision(revOrId) : null;
- }
-
- private boolean isSubmittable(ChangeInfo info) {
- boolean canSubmit = info.status().isOpen() && revision.equals(info.currentRevision());
- if (canSubmit && info.status() == Change.Status.NEW) {
- for (String name : info.labels()) {
- LabelInfo label = info.label(name);
- switch (label.status()) {
- case NEED:
- statusText.setInnerText(Util.M.needs(name));
- canSubmit = false;
- break;
- case REJECT:
- case IMPOSSIBLE:
- if (label.blocking()) {
- statusText.setInnerText(Util.M.blockedOn(name));
- canSubmit = false;
- }
- break;
- case MAY:
- case OK:
- default:
- break;
- }
- }
- }
- return canSubmit;
- }
-
- private void renderChangeInfo(ChangeInfo info) {
- RevisionInfo revisionInfo = info.revision(revision);
- changeInfo = info;
- lastDisplayedUpdate = info.updated();
-
- labels.set(info);
-
- renderOwner(info);
- renderUploader(info, revisionInfo);
- renderActionTextDate(info);
- renderDiffBaseListBox(info);
- initReplyButton(info, revision);
- initIncludedInAction(info);
- initDownloadAction(info, revision);
- initProjectLinks(info);
- initBranchLink(info);
- initEditMode(info, revision);
- actions.display(info, revision);
-
- star.setValue(info.starred());
- permalink.setHref(ChangeLink.permalink(changeId));
- permalink.setText(String.valueOf(info.legacyId()));
- topic.set(info, revision);
- commit.set(commentLinkProcessor, info, revision);
- related.set(info, revision);
- reviewers.set(info);
- assignee.set(info);
- if (Gerrit.isNoteDbEnabled()) {
- hashtags.set(info, revision);
- } else {
- setVisible(hashtagTableRow, false);
- }
-
- StringBuilder sb = new StringBuilder();
- sb.append(Util.M.changeScreenTitleId(info.idAbbreviated()));
- if (info.subject() != null) {
- sb.append(": ");
- sb.append(info.subject());
- }
- setWindowTitle(sb.toString());
-
- // Although this is related to the revision, we can process it early to
- // render it faster.
- if (!info.status().isOpen()
- || !revision.equals(info.currentRevision())
- || revisionInfo.isEdit()) {
- setVisible(strategy, false);
- }
-
- // Properly render revision actions initially while waiting for
- // the callback to populate them correctly.
- NativeMap<ActionInfo> emptyMap = NativeMap.<ActionInfo>create();
- initRevisionsAction(info, revision);
- quickApprove.setVisible(false);
- actions.reloadRevisionActions(emptyMap);
-
- boolean current = revision.equals(info.currentRevision()) && !revisionInfo.isEdit();
-
- if (revisionInfo.isEdit()) {
- statusText.setInnerText(Util.C.changeEdit());
- } else if (!current) {
- statusText.setInnerText(Util.C.notCurrent());
- labels.setVisible(false);
- } else {
- statusText.setInnerText(Util.toLongString(info.status()));
- }
-
- if (info.isPrivate()) {
- privateText.setInnerText(Util.C.isPrivate());
- }
-
- if (info.isWorkInProgress()) {
- wipText.setInnerText(Util.C.isWorkInProgress());
- }
-
- if (Gerrit.isSignedIn()) {
- replyAction =
- new ReplyAction(
- info, revision, hasDraftComments, style, commentLinkProcessor, reply, quickApprove);
- }
- history.set(commentLinkProcessor, replyAction, changeId, info);
-
- if (current && info.status().isOpen()) {
- quickApprove.set(info, revision, replyAction);
- renderSubmitType(info.status(), isSubmittable(info), info.submitType());
- } else {
- quickApprove.setVisible(false);
- }
- }
-
- private void renderRevisionInfo(ChangeInfo info, NativeMap<ActionInfo> actionMap) {
- initRevisionsAction(info, revision);
- commit.setParentNotCurrent(
- actionMap.containsKey("rebase") && actionMap.get("rebase").enabled());
- actions.reloadRevisionActions(actionMap);
- }
-
- private void renderOwner(ChangeInfo info) {
- // TODO info card hover
- String name = name(info.owner());
- if (info.owner().avatar(AvatarInfo.DEFAULT_SIZE) != null) {
- ownerPanel.insert(new AvatarImage(info.owner()), 0);
- }
- ownerLink.setText(name);
- ownerLink.setTitle(email(info.owner(), name));
- ownerLink.setTargetHistoryToken(
- PageLinks.toAccountQuery(
- info.owner().name() != null
- ? info.owner().name()
- : info.owner().email() != null
- ? info.owner().email()
- : String.valueOf(info.owner()._accountId()),
- Change.Status.NEW));
- }
-
- private void renderUploader(ChangeInfo changeInfo, RevisionInfo revInfo) {
- AccountInfo uploader = revInfo.uploader();
- boolean isOwner = uploader == null || uploader._accountId() == changeInfo.owner()._accountId();
- renderPushCertificate(revInfo, isOwner ? ownerPanel : uploaderPanel);
- if (isOwner) {
- uploaderRow.getStyle().setDisplay(Display.NONE);
- return;
- }
- uploaderRow.getStyle().setDisplay(Display.TABLE_ROW);
-
- if (uploader.avatar(AvatarInfo.DEFAULT_SIZE) != null) {
- uploaderPanel.insert(new AvatarImage(uploader), 0);
- }
- String name = name(uploader);
- uploaderName.setText(name);
- uploaderName.setTitle(email(uploader, name));
- }
-
- private void renderPushCertificate(RevisionInfo revInfo, FlowPanel panel) {
- if (!enableSignedPush()) {
- return;
- }
- Image status = new Image();
- panel.add(status);
- status.setStyleName(style.pushCertStatus());
- if (!revInfo.hasPushCertificate() || revInfo.pushCertificate().key() == null) {
- status.setResource(Gerrit.RESOURCES.question());
- status.setTitle(Util.C.pushCertMissing());
- return;
- }
- PushCertificateInfo certInfo = revInfo.pushCertificate();
- GpgKeyInfo.Status s = certInfo.key().status();
- switch (s) {
- case BAD:
- status.setResource(Gerrit.RESOURCES.redNot());
- status.setTitle(problems(Util.C.pushCertBad(), certInfo));
- break;
- case OK:
- status.setResource(Gerrit.RESOURCES.warning());
- status.setTitle(problems(Util.C.pushCertOk(), certInfo));
- break;
- case TRUSTED:
- status.setResource(Gerrit.RESOURCES.greenCheck());
- status.setTitle(Util.C.pushCertTrusted());
- break;
- }
- }
-
- private static String name(AccountInfo info) {
- return info.name() != null ? info.name() : Gerrit.info().user().anonymousCowardName();
- }
-
- private static String email(AccountInfo info, String name) {
- return info.email() != null ? info.email() : name;
- }
-
- private static String problems(String msg, PushCertificateInfo info) {
- if (info.key() == null || !info.key().hasProblems() || info.key().problems().length() == 0) {
- return msg;
- }
-
- StringBuilder sb = new StringBuilder();
- sb.append(msg).append(':');
- for (String problem : Natives.asList(info.key().problems())) {
- sb.append('\n').append(problem);
- }
- return sb.toString();
- }
-
- private void renderActionTextDate(ChangeInfo info) {
- String action;
- if (info.created().equals(info.updated())) {
- action = Util.C.changeInfoBlockUploaded();
- } else {
- action = Util.C.changeInfoBlockUpdated();
- }
- actionText.setInnerText(action);
- actionDate.setInnerText(FormatUtil.relativeFormat(info.updated()));
- }
-
- private void renderDiffBaseListBox(ChangeInfo info) {
- JsArray<RevisionInfo> list = info.revisions().values();
- RevisionInfo.sortRevisionInfoByNumber(list);
- int selectedIdx = list.length();
- for (int i = list.length() - 1; i >= 0; i--) {
- RevisionInfo r = list.get(i);
- diffBase.addItem(r.id() + ": " + r.name().substring(0, 6), r.id());
- if (r.name().equals(revision)) {
- SelectElement.as(diffBase.getElement())
- .getOptions()
- .getItem(diffBase.getItemCount() - 1)
- .setDisabled(true);
- }
- if (base.isPatchSet() && base.asPatchSetId().get() == r._number()) {
- selectedIdx = diffBase.getItemCount() - 1;
- }
- }
-
- RevisionInfo rev = info.revisions().get(revision);
- JsArray<CommitInfo> parents = rev.commit().parents();
- if (parents.length() > 1) {
- diffBase.addItem(Util.C.autoMerge(), DiffObject.AUTO_MERGE);
- for (int i = 0; i < parents.length(); i++) {
- int parentNum = i + 1;
- diffBase.addItem(Util.M.diffBaseParent(parentNum), String.valueOf(-parentNum));
- }
-
- if (base.isParent()) {
- selectedIdx = list.length() + base.getParentNum();
- }
- } else {
- diffBase.addItem(Util.C.baseDiffItem(), "");
- }
-
- diffBase.setSelectedIndex(selectedIdx);
- }
-
- void showUpdates(ChangeInfo newInfo) {
- if (!isAttached() || newInfo.updated().equals(lastDisplayedUpdate)) {
- return;
- }
-
- JsArray<MessageInfo> om = changeInfo.messages();
- JsArray<MessageInfo> nm = newInfo.messages();
-
- if (om == null) {
- om = JsArray.createArray().cast();
- }
- if (nm == null) {
- nm = JsArray.createArray().cast();
- }
-
- if (om.length() == nm.length()) {
- return;
- }
-
- if (updateAvailable == null) {
- updateAvailable =
- new UpdateAvailableBar() {
- @Override
- void onShow() {
- Gerrit.display(PageLinks.toChange(project, changeId));
- }
-
- @Override
- void onIgnore(Timestamp newTime) {
- lastDisplayedUpdate = newTime;
- }
- };
- }
- updateAvailable.set(Natives.asList(nm).subList(om.length(), nm.length()), newInfo.updated());
- if (!updateAvailable.isAttached()) {
- add(updateAvailable);
- }
- }
-
- private void startPoller() {
- if (Gerrit.isSignedIn() && 0 < Gerrit.info().change().updateDelay()) {
- updateCheck = new UpdateCheckTimer(this);
- updateCheck.schedule();
- handlers.add(UserActivityMonitor.addValueChangeHandler(updateCheck));
- }
- }
-
- private static String normalize(String r) {
- return r != null && !r.isEmpty() ? r : null;
- }
-
- /**
- * @param parentToken
- * @return 1-based parentNum if parentToken is a String which can be parsed as a negative integer
- * i.e. "-1", "-2", etc. If parentToken cannot be parsed as a negative integer, return zero.
- */
- private static int toParentNum(String parentToken) {
- try {
- int n = Integer.parseInt(parentToken);
- if (n < 0) {
- return -n;
- }
- return 0;
- } catch (NumberFormatException e) {
- return 0;
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen.ui.xml
deleted file mode 100644
index d629fc2..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ChangeScreen.ui.xml
+++ /dev/null
@@ -1,634 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:c='urn:import:com.google.gerrit.client.change'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:x='urn:import:com.google.gerrit.client.ui'>
- <ui:with field='ico' type='com.google.gerrit.client.GerritResources'/>
- <ui:with field='res' type='com.google.gerrit.client.change.Resources'/>
- <ui:style gss='false' type='com.google.gerrit.client.change.ChangeScreen.Style'>
- @eval textColor com.google.gerrit.client.Gerrit.getTheme().textColor;
- @eval trimColor com.google.gerrit.client.Gerrit.getTheme().trimColor;
-
- @def COMMIT_WIDTH 560px;
- @def HEADER_HEIGHT 30px;
-
- @def BUTTON_HEIGHT 14px;
-
- .cs2 {
- margin-bottom: 1em;
- }
-
- .headerLine {
- position: relative;
- background-color: trimColor;
- height: HEADER_HEIGHT;
- margin: 0 -5px;
- padding: 0 5px;
- }
-
- .subjectLine {
- position: relative;
- width: COMMIT_WIDTH;
- height: HEADER_HEIGHT;
- background-color: trimColor;
- color: textColor;
- font-family: sans-serif;
- }
- .subjectText {
- width: 460px;
- height: HEADER_HEIGHT;
- line-height: HEADER_HEIGHT;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-
- .infoLine {
- position: absolute;
- top: 0;
- left: COMMIT_WIDTH;
- height: HEADER_HEIGHT;
- padding-left: 25px;
- }
-
- .infoLineHeaderButtons {
- display: inline-block;
- height: HEADER_HEIGHT;
- }
- .statusRight {
- position: absolute;
- top: 0;
- right: 0;
- height: HEADER_HEIGHT;
- }
- .idAndStatus {
- display: inline-block;
- position: relative;
- height: HEADER_HEIGHT;
- }
- .star {
- position: absolute;
- top: 5px;
- right: 2px;
- cursor: pointer;
- outline: none;
- }
- .changeId {
- width: 300px;
- white-space: nowrap;
- line-height: HEADER_HEIGHT;
- overflow: hidden;
- text-overflow: ellipsis;
- }
- .statusText {
- font-weight: bold;
- }
- .privateText {
- font-weight: bold;
- }
-
- .wipText {
- font-weight: bold;
- }
-
- div.popdown {
- display: inline-block;
- margin-top: 2px;
- margin-left: 5px;
- margin-right: 25px;
- }
-
- .popdown button {
- cursor: pointer;
- height: 25px;
- border: none;
- background-color: trimColor;
- margin: 0 0 0 -2px;
- padding-left: 2px;
- padding-right: 2px;
- min-width: 100px;
- }
- .popdown button div {
- padding-left: 6px;
- padding-right: 6px;
- }
- .popdown button div:after {
- content: " \25bc";
- }
- .popdown button.selected {
- font-weight: bold;
- }
- .popdown button:focus {
- outline: none;
- }
-
- .headerButtons button:disabled,
- #change_infoTable button:disabled,
- .popdown button:disabled {
- background-color: #999;
- background-image: -webkit-linear-gradient(top, #999, #999);
- }
-
- .infoTable {
- border-spacing: 0;
- }
-
- .infoTable th {
- width: 60px;
- color: #444;
- font-weight: normal;
- vertical-align: top;
- text-align: left;
- padding: 0 5px 0 0;
- }
-
- .projectSettings {
- float: right;
- cursor: pointer;
- }
-
- .infoColumn {
- width: 440px;
- padding-left: 17px;
- padding-right: 17px;
- vertical-align: top;
- }
-
- #change_infoTable {
- border-spacing: 0;
- width: 100%;
- margin-left: 2px;
- margin-right: 5px;
- }
-
- .notMergeable {
- float: right;
- font-weight: bold;
- color: #d00;
- }
-
- .commitColumn, .relatedColumn {
- padding: 0;
- vertical-align: top;
- }
- .commitColumn { width: COMMIT_WIDTH; }
- .relatedColumn { width: 375px; }
-
- .labels {
- border-spacing: 0;
- padding: 0;
- }
- .labelName {
- color: #444;
- vertical-align: top;
- text-align: left;
- padding-top: 3px;
- padding-right: 5px;
- white-space: nowrap;
- }
-
- .label_user {
- display: inline-block;
- margin-bottom: 2px;
- padding: 1px 3px 0px 3px;
- border-radius: 5px;
- -webkit-border-radius: 5px;
- background: trimColor;
- border: 1px solid trimColor;
- white-space: nowrap;
- }
- .label_user img.avatar {
- margin: 0 2px 0 0;
- width: 16px;
- height: 16px;
- vertical-align: bottom;
- }
- .label_user button {
- cursor: pointer;
- padding: 0;
- margin: 0 0 0 5px;
- border: 0;
- background-color: transparent;
- white-space: nowrap;
- }
-
- .label_ok {color: #060;}
- .label_reject {color: #d14836;}
- .label_need {color: #000;}
- .label_may {color: #777;}
-
- .hashtagName {
- display: inline-block;
- height: 15px;
- margin-bottom: 2px;
- padding: 1px 3px 1px 3px;
- border-radius: 5px;
- -webkit-border-radius: 5px;
- background: #E2F5FF;
- border: 1px solid #579FDA;
- white-space: nowrap;
- }
-
- .hashtagName a,
- .hashtagName button {
- position: relative;
- top: -4px;
- }
-
- .hashtagName button {
- cursor: pointer;
- padding: 0;
- margin: 0 0 0 5px;
- border: 0;
- background-color: transparent;
- white-space: nowrap;
- }
-
- .hashtagIcon img {
- position: relative;
- top: 4px;
- }
-
- .headerButtons button {
- margin: 5.286px 3px 0 0;
- text-align: center;
- font-size: 8pt;
- font-weight: bold;
- cursor: pointer;
- border: 2px solid;
- color: rgba(0, 0, 0, 0.15);
- background-color: #f5f5f5;
- -webkit-border-radius: 2px;
- -webkit-box-sizing: content-box;
- }
- .headerButtons button div {
- color: #444;
- min-width: 54px;
- white-space: nowrap;
- height: BUTTON_HEIGHT;
- line-height: BUTTON_HEIGHT;
- }
- button.highlight {
- background-color: #4d90fe;
- }
- button.highlight div { color: #fff; }
-
- .sectionHeader {
- position: relative;
- background-color: trimColor;
- font-weight: bold;
- color: textColor;
- height: 20px;
- line-height: 20px;
- margin: 0 -5px;
- padding: 5px 5px;
- }
- .sectionHeader .headerButtons {
- position: absolute;
- left: 300px;
- top: 2px;
- height: 18px;
- line-height: 18px;
- border-left: 1px inset #fff;
- padding-left: 5px;
- padding-top: 3px;
- padding-bottom: 3px;
- }
- .sectionHeader button { margin-top: 0; }
-
- .diffBase {
- display: inline-block;
- height: 18px;
- line-height: 18px;
- font-size: smaller;
- font-weight: normal;
- vertical-align: top;
- }
- .diffBase select {
- margin: 0;
- border: 2px solid rgba(0, 0, 0, 0.15);
- height: 20px;
- font-size: 8pt;
- font-weight: bold;
- border-radius: 2px;
- background-color: #f5f5f5
- }
-
- .replyBox {
- background-color: trimColor;
- }
-
- .ownerPanel img, .uploaderPanel img {
- margin: 0 2px 0 0;
- width: 16px;
- height: 16px !important;
- vertical-align: bottom;
- }
-
- .headerExtension {
- display: inline-block;
- float: right;
- }
-
- .headerExtension>div>div {
- float: left;
- }
-
- .changeExtension {
- padding-top: 5px;
- }
-
- .relatedExtension {
- padding-top: 5px;
- }
-
- .commitExtension {
- padding-top: 5px;
- }
-
- .historyExtension {
- display: inline-block;
- float: right;
- }
-
- .pushCertStatus {
- padding-left: 5px;
- }
-
- .notCurrentPatchSet {
- background-color: #FFA62F;
- }
- </ui:style>
-
- <g:HTMLPanel styleName='{style.cs2}'>
- <g:HTMLPanel styleName='{style.headerLine}' ui:field='headerLine'>
- <div class='{style.subjectLine}'>
- <div class='{style.idAndStatus}'>
- <span class='{style.changeId}'>
- <ui:msg>Change <g:Anchor ui:field='permalink' title='Reload the change (Shortcut: R)'>
- <ui:attribute name='title'/>
- </g:Anchor> - <span ui:field='statusText' class='{style.statusText}'/>
- <span ui:field='privateText' class='{style.privateText}'/>
- <span ui:field='wipText' class='{style.wipText}'/></ui:msg>
- </span>
- <g:SimplePanel ui:field='headerExtension' styleName='{style.headerExtension}'/>
- </div>
- </div>
-
- <div class='{style.infoLine}'>
- <div class='{style.headerButtons} {style.infoLineHeaderButtons}'>
- <g:Button ui:field='reply'
- styleName=''
- title=''
- visible='false'>
- <ui:attribute name='title'/>
- </g:Button>
- <c:QuickApprove ui:field='quickApprove'
- styleName='{style.highlight}'
- title='Apply score with one click'>
- <ui:attribute name='title'/>
- </c:QuickApprove>
- <g:Button ui:field='publishEdit'
- styleName='{style.highlight}' visible='false'>
- <div><ui:msg>Publish Edit</ui:msg></div>
- </g:Button>
- <g:Button ui:field='rebaseEdit'
- styleName='{style.highlight}' visible='false'>
- <div><ui:msg>Rebase Edit</ui:msg></div>
- </g:Button>
- <g:Button ui:field='deleteEdit' styleName='' visible='false'>
- <div><ui:msg>Delete Edit</ui:msg></div>
- </g:Button>
- <g:SimplePanel ui:field='headerExtensionMiddle' styleName='{style.headerExtension}'/>
- </div>
- </div>
-
- <div class='{style.statusRight}'>
- <g:FlowPanel styleName='{style.popdown}'>
- <g:Button ui:field='includedIn' styleName='' visible="false">
- <div><ui:msg>Included in</ui:msg></div>
- </g:Button>
- <g:Button ui:field='patchSets' styleName=''>
- <div ui:field='patchSetsText'/>
- </g:Button>
- <g:Button ui:field='download' styleName=''>
- <div><ui:msg>Download</ui:msg></div>
- </g:Button>
- <g:SimplePanel ui:field='headerExtensionRight' styleName='{style.headerExtension}'/>
- </g:FlowPanel>
- <c:StarIcon ui:field='star' styleName='{style.star}' title='Star the change (Shortcut: s)'>
- <ui:attribute name='title'/>
- </c:StarIcon>
- </div>
- </g:HTMLPanel>
-
- <table class='{style.infoTable}'>
- <tr>
- <td class='{style.commitColumn}'>
- <c:CommitBox ui:field='commit'/>
- <g:SimplePanel ui:field='commitExtension' styleName='{style.commitExtension}'/>
- </td>
- <td class='{style.infoColumn}'>
- <table id='change_infoTable'>
- <tr>
- <th><ui:msg>Owner</ui:msg></th>
- <td>
- <g:FlowPanel ui:field='ownerPanel' styleName='{style.ownerPanel}'>
- <x:InlineHyperlink ui:field='ownerLink'/>
- </g:FlowPanel>
- </td>
- </tr>
- <tr ui:field='uploaderRow'>
- <th><ui:msg>Uploader</ui:msg></th>
- <td>
- <g:FlowPanel ui:field='uploaderPanel' styleName='{style.uploaderPanel}'>
- <g:InlineLabel ui:field='uploaderName'/>
- </g:FlowPanel>
- </td>
- </tr>
- <tr ui:field='assigneeRow'>
- <th><ui:msg>Assignee</ui:msg></th>
- <td>
- <c:Assignee ui:field='assignee'/>
- </td>
- </tr>
- <tr>
- <th><ui:msg>Reviewers</ui:msg></th>
- <td>
- <c:Reviewers ui:field='reviewers'/>
- </td>
- </tr>
- <tr>
- <th/>
- <td ui:field='ccText'/>
- </tr>
- <tr>
- <th><ui:msg>Project</ui:msg></th>
- <td><x:InlineHyperlink ui:field='projectDashboard'
- title='Go to project dashboard'>
- <ui:attribute name='title'/>
- </x:InlineHyperlink>
- <a ui:field='projectSettingsLink'
- class='{style.projectSettings}'>
- <g:Image
- ui:field='projectSettings'
- resource='{ico.gear}'
- title='Go to project settings'>
- <ui:attribute name='title'/>
- </g:Image>
- </a>
- </td>
- </tr>
- <tr>
- <th><ui:msg>Branch</ui:msg></th>
- <td><x:InlineHyperlink ui:field='branchLink'
- title='Search for changes on this branch'>
- <ui:attribute name='title'/>
- </x:InlineHyperlink>
- </td>
- </tr>
- <tr>
- <th><ui:msg>Topic</ui:msg></th>
- <td><c:Topic ui:field='topic'/></td>
- </tr>
- <tr ui:field='strategy'>
- <th><ui:msg>Strategy</ui:msg></th>
- <td>
- <span ui:field='submitActionText'/>
- <div ui:field='notMergeable'
- class='{style.notMergeable}'
- style='display: none'
- aria-hidden='true'
- title='The change cannot be merged due to a path conflict. Rebase the change and upload the rebased commit for review.'>
- <ui:attribute name='title'/>
- <ui:msg>Cannot Merge</ui:msg>
- </div>
- </td>
- </tr>
- <tr>
- <th ui:field='actionText'/>
- <td ui:field='actionDate'/>
- </tr>
- <tr ui:field='hashtagTableRow'>
- <th><ui:msg>Hashtags</ui:msg></th>
- <td colspan='2'>
- <c:Hashtags ui:field='hashtags'/>
- </td>
- </tr>
- <tr><td colspan='2'><c:Actions ui:field='actions'/></td></tr>
- </table>
- <hr/>
- <c:Labels ui:field='labels' styleName='{style.labels}'/>
- <g:SimplePanel ui:field='changeExtension' styleName='{style.changeExtension}'/>
- <div id='change_plugins'/>
- </td>
- <td class='{style.relatedColumn}'>
- <c:RelatedChanges ui:field='related'/>
- <g:SimplePanel ui:field='relatedExtension' styleName='{style.relatedExtension}'/>
- </td>
- </tr>
- </table>
-
- <div class='{style.sectionHeader} {style.headerButtons}'>
- <ui:msg>Files</ui:msg>
- <g:Button ui:field='addFile'
- title='Add file to this change'
- styleName=''
- visible='false'>
- <ui:attribute name='title'/>
- <div><ui:msg>Add…</ui:msg></div>
- </g:Button>
- <g:Button ui:field='deleteFile'
- title='Delete file from the repository'
- styleName=''
- visible='false'>
- <ui:attribute name='title'/>
- <div><ui:msg>Delete…</ui:msg></div>
- </g:Button>
- <g:Button ui:field='renameFile'
- title='Rename file in the repository'
- styleName=''
- visible='false'>
- <ui:attribute name='title'/>
- <div><ui:msg>Rename…</ui:msg></div>
- </g:Button>
- <div class='{style.headerButtons}'>
- <g:Button ui:field='openAll'
- styleName=''
- title='Open each file in a new tab'>
- <ui:attribute name='title'/>
- <div><ui:msg>Open All</ui:msg></div>
- </g:Button>
- <div class='{style.diffBase}'>
- <ui:msg>Diff against: <g:ListBox ui:field='diffBase' styleName=''/></ui:msg>
- </div>
- <g:Button ui:field='editMode'
- styleName=''
- visible='false'
- title='Switch file table to edit mode'>
- <ui:attribute name='title'/>
- <div><ui:msg>Edit</ui:msg></div>
- </g:Button>
- <g:Button ui:field='reviewMode'
- styleName=''
- visible='false'
- title='Done with edit mode'>
- <ui:attribute name='title'/>
- <div><ui:msg>Done Editing</ui:msg></div>
- </g:Button>
- </div>
- </div>
- <c:FileTable ui:field='files'/>
-
- <div class='{style.sectionHeader}'>
- <ui:msg>History</ui:msg>
- <div class='{style.headerButtons}'>
- <g:Button ui:field='expandAll'
- styleName=''
- title='Expand all messages in the change history'>
- <ui:attribute name='title'/>
- <div><ui:msg>Expand All</ui:msg></div>
- </g:Button>
- <g:Button ui:field='collapseAll'
- styleName=''
- visible='false'
- title='Collapse all messages in the change history'>
- <ui:attribute name='title'/>
- <div><ui:msg>Collapse All</ui:msg></div>
- </g:Button>
- <g:Button ui:field='hideTaggedComments'
- styleName=''
- visible='false'
- title='Hide tagged comments'>
- <ui:attribute name='title'/>
- <div><ui:msg>Hide tagged comments</ui:msg></div>
- </g:Button>
- <g:Button ui:field='showTaggedComments'
- styleName=''
- visible='false'
- title='Show tagged comments'>
- <ui:attribute name='title'/>
- <div><ui:msg>Show tagged comments</ui:msg></div>
- </g:Button>
- <g:SimplePanel ui:field='historyExtensionRight' styleName='{style.historyExtension}'/>
- </div>
- </div>
- <c:History ui:field='history'/>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/CherryPickAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/CherryPickAction.java
deleted file mode 100644
index be011d2..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/CherryPickAction.java
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.Util;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.ui.CherryPickDialog;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.PopupPanel;
-
-class CherryPickAction {
- static void call(
- final Button b,
- final ChangeInfo info,
- final String revision,
- final Project.NameKey project,
- final String commitMessage) {
- // TODO Replace CherryPickDialog with a nicer looking display.
- b.setEnabled(false);
- new CherryPickDialog(project) {
- {
- sendButton.setText(Util.C.buttonCherryPickChangeSend());
- if (info.status() == Change.Status.MERGED) {
- message.setText(Util.M.cherryPickedChangeDefaultMessage(commitMessage.trim(), revision));
- } else {
- message.setText(commitMessage.trim());
- }
- }
-
- @Override
- public void onSend() {
- ChangeApi.cherrypick(
- info.project(),
- info.legacyId().get(),
- revision,
- getDestinationBranch(),
- getMessageText(),
- new GerritCallback<ChangeInfo>() {
- @Override
- public void onSuccess(ChangeInfo result) {
- sent = true;
- hide();
- Gerrit.display(PageLinks.toChange(project, result.legacyId()));
- }
-
- @Override
- public void onFailure(Throwable caught) {
- enableButtons(true);
- super.onFailure(caught);
- }
- });
- }
-
- @Override
- public void onClose(CloseEvent<PopupPanel> event) {
- super.onClose(event);
- b.setEnabled(true);
- }
- }.center();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/CommitBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/CommitBox.java
deleted file mode 100644
index 0112579..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/CommitBox.java
+++ /dev/null
@@ -1,219 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.AvatarImage;
-import com.google.gerrit.client.FormatUtil;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.CommitInfo;
-import com.google.gerrit.client.info.ChangeInfo.GitPerson;
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.client.info.WebLinkInfo;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.CommentLinkProcessor;
-import com.google.gerrit.client.ui.InlineHyperlink;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.common.PageLinks;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.TableRowElement;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.ScrollPanel;
-import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwtexpui.clippy.client.CopyableLabel;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-
-class CommitBox extends Composite {
- interface Binder extends UiBinder<HTMLPanel, CommitBox> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- interface Style extends CssResource {
- String collapsed();
-
- String expanded();
-
- String clippy();
-
- String parentWebLink();
- }
-
- @UiField Style style;
- @UiField FlowPanel authorPanel;
- @UiField FlowPanel committerPanel;
- @UiField Image mergeCommit;
- @UiField CopyableLabel commitName;
- @UiField FlowPanel webLinkPanel;
- @UiField TableRowElement firstParent;
- @UiField FlowPanel parentCommits;
- @UiField FlowPanel parentWebLinks;
- @UiField InlineHyperlink authorNameEmail;
- @UiField Element authorDate;
- @UiField InlineHyperlink committerNameEmail;
- @UiField Element committerDate;
- @UiField CopyableLabel idText;
- @UiField HTML text;
- @UiField ScrollPanel scroll;
- @UiField Button more;
- @UiField Element parentNotCurrentText;
- private boolean expanded;
-
- CommitBox() {
- initWidget(uiBinder.createAndBindUi(this));
- addStyleName(style.collapsed());
- }
-
- void onShowView() {
- more.setVisible(scroll.getMaximumVerticalScrollPosition() > 0);
- }
-
- @UiHandler("more")
- void onMore(@SuppressWarnings("unused") ClickEvent e) {
- if (expanded) {
- removeStyleName(style.expanded());
- addStyleName(style.collapsed());
- } else {
- removeStyleName(style.collapsed());
- addStyleName(style.expanded());
- }
- expanded = !expanded;
- }
-
- void set(CommentLinkProcessor commentLinkProcessor, ChangeInfo change, String revision) {
- RevisionInfo revInfo = change.revision(revision);
- CommitInfo commit = revInfo.commit();
-
- commitName.setText(revision);
- idText.setText("Change-Id: " + change.changeId());
- idText.setPreviewText(change.changeId());
-
- formatLink(commit.author(), authorPanel, authorNameEmail, authorDate, change);
- formatLink(commit.committer(), committerPanel, committerNameEmail, committerDate, change);
- text.setHTML(
- commentLinkProcessor.apply(new SafeHtmlBuilder().append(commit.message()).linkify()));
- setWebLinks(webLinkPanel, revInfo.commit());
-
- if (revInfo.commit().parents().length() > 1) {
- mergeCommit.setVisible(true);
- }
-
- setParents(revInfo.commit().parents());
- }
-
- void setParentNotCurrent(boolean parentNotCurrent) {
- // display the orange ball if parent has moved on (not current)
- UIObject.setVisible(parentNotCurrentText, parentNotCurrent);
- parentNotCurrentText.setInnerText(parentNotCurrent ? "\u25CF" : "");
- }
-
- private void setWebLinks(FlowPanel panel, CommitInfo commit) {
- JsArray<WebLinkInfo> links = commit.webLinks();
- if (links != null) {
- for (WebLinkInfo link : Natives.asList(links)) {
- panel.add(link.toAnchor());
- }
- }
- }
-
- private void setParents(JsArray<CommitInfo> commits) {
- setVisible(firstParent, true);
- TableRowElement next = firstParent;
- TableRowElement previous = null;
- for (CommitInfo c : Natives.asList(commits)) {
- if (next == firstParent) {
- CopyableLabel copyLabel = getCommitLabel(c);
- parentCommits.add(copyLabel);
- setWebLinks(parentWebLinks, c);
- } else {
- next.appendChild(DOM.createTD());
- Element td1 = DOM.createTD();
- td1.appendChild(getCommitLabel(c).getElement());
- next.appendChild(td1);
- FlowPanel linksPanel = new FlowPanel();
- linksPanel.addStyleName(style.parentWebLink());
- setWebLinks(linksPanel, c);
- Element td2 = DOM.createTD();
- td2.appendChild(linksPanel.getElement());
- next.appendChild(td2);
- previous.getParentElement().insertAfter(next, previous);
- }
- previous = next;
- next = DOM.createTR().cast();
- }
- }
-
- private CopyableLabel getCommitLabel(CommitInfo c) {
- CopyableLabel copyLabel;
- copyLabel = new CopyableLabel(c.commit());
- copyLabel.setTitle(c.subject());
- copyLabel.setStyleName(style.clippy());
- return copyLabel;
- }
-
- private static void formatLink(
- GitPerson person, FlowPanel p, InlineHyperlink name, Element date, ChangeInfo change) {
- // only try to fetch the avatar image for author and committer if an avatar
- // plugin is installed, if the change owner has no avatar info assume that
- // no avatar plugin is installed
- if (change.owner().hasAvatarInfo()) {
- AvatarImage avatar;
- if (sameEmail(change.owner(), person)) {
- avatar = new AvatarImage(change.owner());
- } else {
- avatar = new AvatarImage(AccountInfo.create(0, person.name(), person.email(), null));
- }
- p.insert(avatar, 0);
- }
-
- name.setText(renderName(person));
- name.setTargetHistoryToken(PageLinks.toAccountQuery(owner(person), change.status()));
- date.setInnerText(FormatUtil.mediumFormat(person.date()));
- }
-
- private static String renderName(GitPerson person) {
- return person.name() + " <" + person.email() + ">";
- }
-
- private static String owner(GitPerson person) {
- if (person.email() != null) {
- return person.email();
- } else if (person.name() != null) {
- return person.name();
- } else {
- return "";
- }
- }
-
- private static boolean sameEmail(@Nullable AccountInfo p1, @Nullable GitPerson p2) {
- return p1 != null
- && p2 != null
- && p1.email() != null
- && p2.email() != null
- && p1.email().equals(p2.email());
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/CommitBox.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/CommitBox.ui.xml
deleted file mode 100644
index 5f476be..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/CommitBox.ui.xml
+++ /dev/null
@@ -1,198 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:x='urn:import:com.google.gerrit.client.ui'
- xmlns:clippy='urn:import:com.google.gwtexpui.clippy.client'>
- <ui:with field='ico' type='com.google.gerrit.client.GerritResources'/>
- <ui:image field="toggle" src="moreLess.png"/>
- <ui:style gss='false' type='com.google.gerrit.client.change.CommitBox.Style'>
- @eval trimColor com.google.gerrit.client.Gerrit.getTheme().trimColor;
-
- .collapsed .scroll { height: 250px }
- .scroll, .more { width: 560px }
- .scroll {
- border-right: 1px solid trimColor;
- border-bottom: 1px solid trimColor;
- }
-
- .text {
- font-family: monospace;
- white-space: pre;
- }
-
- .more {
- height: 8px;
- line-height: 8px;
- text-align: center;
- }
- .moreButton {
- padding: 0 5px 0 5px;
- margin: 0;
- border: none;
- height: 8px;
- background-color: #F7F7F7;
- }
- .moreButton:focus {
- outline: none;
- }
-
- @sprite .toggle {
- gwt-image: "toggle";
- width: 13px;
- height: 8px;
- padding: 0;
- }
- .collapsed .toggle { background-position: -13px -8px }
- .expanded .toggle { background-position: 0px -8px }
- .collapsed button:hover .toggle { background-position: -13px 0px }
- .expanded button:hover .toggle { background-position: 0px 0px }
-
- .header {
- border-spacing: 0;
- padding: 0;
- width: 560px;
- }
- .header th { width: 72px; }
- .header td { white-space: nowrap; }
- .date { width: 132px; }
-
- .clippy {
- position: relative;
- }
- .clippy div {
- position: absolute;
- top: 0px;
- right: -16px;
- }
- <!-- To make room for the copyableLabel from the adjacent column -->
- .webLinkPanel a:first-child {
- margin-left:16px;
- }
- .webLinkPanel>a {
- margin-left:2px;
- }
-
- .parentWebLink a:first-child {
- margin-left:16px;
- }
- .parentWebLink>a {
- margin-left:2px;
- }
-
- .commit {
- margin-right: 3px;
- float: left;
- }
-
- .userPanel img {
- margin: 0 2px 0 0;
- width: 16px;
- height: 16px !important;
- vertical-align: bottom;
- }
-
- .parent {
- margin-right: 3px;
- float: left;
- }
- .parentNotCurrent {
- color: #FFA62F; <!-- orange -->
- font-weight: bold;
- }
-
- </ui:style>
- <g:HTMLPanel>
- <g:ScrollPanel styleName='{style.scroll}' ui:field='scroll'>
- <g:HTML styleName='{style.text}' ui:field='text'/>
- </g:ScrollPanel>
- <div class='{style.more}'>
- <g:Button ui:field='more'
- styleName='{style.moreButton}'
- title='Expand/Collapse'>
- <ui:attribute name='title'/>
- <div class='{style.toggle}'/>
- </g:Button>
- </div>
- <table class='{style.header}'>
- <tr>
- <th><ui:msg>Author</ui:msg></th>
- <td>
- <g:FlowPanel ui:field='authorPanel' styleName='{style.userPanel}'>
- <x:InlineHyperlink ui:field='authorNameEmail'
- title='Search for changes by this user'>
- <ui:attribute name='title'/>
- </x:InlineHyperlink>
- </g:FlowPanel>
- </td>
- <td ui:field='authorDate' class='{style.date}' colspan="2"/>
- </tr>
- <tr>
- <th><ui:msg>Committer</ui:msg></th>
- <td>
- <g:FlowPanel ui:field='committerPanel' styleName='{style.userPanel}'>
- <x:InlineHyperlink ui:field='committerNameEmail'
- title='Search for changes by this user'>
- <ui:attribute name='title'/>
- </x:InlineHyperlink>
- </g:FlowPanel>
- </td>
- <td ui:field='committerDate' class='{style.date}' colspan="2"/>
- </tr>
- <tr>
- <th>
- <div class='{style.commit}'>
- <ui:msg>Commit</ui:msg>
- </div>
- <g:Image
- ui:field='mergeCommit'
- resource='{ico.merge}'
- visible='false'
- title='Merge Commit'>
- <ui:attribute name='title'/>
- </g:Image>
- </th>
- <td><clippy:CopyableLabel styleName='{style.clippy}' ui:field='commitName'/></td>
- <td>
- <g:FlowPanel ui:field='webLinkPanel' styleName='{style.webLinkPanel}'/>
- </td>
- </tr>
- <tr ui:field='firstParent' style='display: none'>
- <th>
- <div class='{style.parent}'>
- <ui:msg>Parent(s)</ui:msg>
- </div>
- <div ui:field='parentNotCurrentText'
- title='Not current - rebase possible'
- class='{style.parentNotCurrent}'
- style='display: none' aria-hidden='true'/>
- </th>
- <td>
- <g:FlowPanel ui:field='parentCommits'/>
- </td>
- <td>
- <g:FlowPanel ui:field='parentWebLinks' styleName='{style.parentWebLink}'/>
- </td>
- </tr>
- <tr>
- <th><ui:msg>Change-Id</ui:msg></th>
- <td><clippy:CopyableLabel styleName='{style.clippy}' ui:field='idText'/></td>
- </tr>
- </table>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DeleteFileAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DeleteFileAction.java
deleted file mode 100644
index 9369c18..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DeleteFileAction.java
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (C) 2015 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.client.change;
-
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-
-class DeleteFileAction {
- private final Project.NameKey project;
- private final Change.Id changeId;
- private final RevisionInfo revision;
- private final ChangeScreen.Style style;
- private final Widget deleteButton;
-
- private DeleteFileBox deleteBox;
- private PopupPanel popup;
-
- DeleteFileAction(
- Project.NameKey project,
- Change.Id changeId,
- RevisionInfo revision,
- ChangeScreen.Style style,
- Widget deleteButton) {
- this.project = project;
- this.changeId = changeId;
- this.revision = revision;
- this.style = style;
- this.deleteButton = deleteButton;
- }
-
- void onDelete() {
- if (popup != null) {
- popup.hide();
- return;
- }
-
- if (deleteBox == null) {
- deleteBox = new DeleteFileBox(project, changeId, revision);
- }
- deleteBox.clearPath();
-
- final PopupPanel p = new PopupPanel(true);
- p.setStyleName(style.replyBox());
- p.addAutoHidePartner(deleteButton.getElement());
- p.addCloseHandler(
- new CloseHandler<PopupPanel>() {
- @Override
- public void onClose(CloseEvent<PopupPanel> event) {
- if (popup == p) {
- popup = null;
- }
- }
- });
- p.add(deleteBox);
- p.showRelativeTo(deleteButton);
- GlobalKey.dialog(p);
- deleteBox.setFocus(true);
- popup = p;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DeleteFileBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DeleteFileBox.java
deleted file mode 100644
index 1885293..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DeleteFileBox.java
+++ /dev/null
@@ -1,121 +0,0 @@
-// Copyright (C) 2015 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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.VoidResult;
-import com.google.gerrit.client.changes.ChangeEditApi;
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.client.ui.RemoteSuggestBox;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.event.logical.shared.SelectionEvent;
-import com.google.gwt.event.logical.shared.SelectionHandler;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.Widget;
-
-class DeleteFileBox extends Composite {
- interface Binder extends UiBinder<HTMLPanel, DeleteFileBox> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- private final Project.NameKey project;
- private final Change.Id changeId;
-
- @UiField Button delete;
- @UiField Button cancel;
-
- @UiField(provided = true)
- RemoteSuggestBox path;
-
- DeleteFileBox(Project.NameKey project, Change.Id changeId, RevisionInfo revision) {
- this.project = project;
- this.changeId = changeId;
-
- path = new RemoteSuggestBox(new PathSuggestOracle(project, changeId, revision));
- path.addSelectionHandler(
- new SelectionHandler<String>() {
- @Override
- public void onSelection(SelectionEvent<String> event) {
- delete(event.getSelectedItem());
- }
- });
- path.addCloseHandler(
- new CloseHandler<RemoteSuggestBox>() {
- @Override
- public void onClose(CloseEvent<RemoteSuggestBox> event) {
- hide();
- }
- });
-
- initWidget(uiBinder.createAndBindUi(this));
- }
-
- void setFocus(boolean focus) {
- path.setFocus(focus);
- }
-
- void clearPath() {
- path.setText("");
- }
-
- @UiHandler("delete")
- void onDelete(@SuppressWarnings("unused") ClickEvent e) {
- delete(path.getText());
- }
-
- private void delete(String path) {
- hide();
- ChangeEditApi.delete(
- project.get(),
- changeId.get(),
- path,
- new AsyncCallback<VoidResult>() {
- @Override
- public void onSuccess(VoidResult result) {
- Gerrit.display(PageLinks.toChangeInEditMode(project, changeId));
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- });
- }
-
- @UiHandler("cancel")
- void onCancel(@SuppressWarnings("unused") ClickEvent e) {
- hide();
- }
-
- private void hide() {
- for (Widget w = getParent(); w != null; w = w.getParent()) {
- if (w instanceof PopupPanel) {
- ((PopupPanel) w).hide();
- break;
- }
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DeleteFileBox.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DeleteFileBox.ui.xml
deleted file mode 100644
index 9e79f752..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DeleteFileBox.ui.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:u='urn:import:com.google.gerrit.client.ui'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:with field='res' type='com.google.gerrit.client.change.Resources'/>
- <ui:style gss='false'>
- .cancel { float: right; }
- </ui:style>
- <g:HTMLPanel>
- <div class='{res.style.section}'>
- <ui:msg>Path: <u:RemoteSuggestBox ui:field='path' visibleLength='86'/></ui:msg>
- </div>
- <div class='{res.style.section}'>
- <g:Button ui:field='delete'
- title='Delete file from the repository'
- styleName='{res.style.button}'>
- <ui:attribute name='title'/>
- <div><ui:msg>Delete</ui:msg></div>
- </g:Button>
- <g:Button ui:field='cancel'
- styleName='{res.style.button}'
- addStyleNames='{style.cancel}'>
- <div>Cancel</div>
- </g:Button>
- </div>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DownloadAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DownloadAction.java
deleted file mode 100644
index 8e4ea84..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DownloadAction.java
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwt.user.client.ui.Widget;
-
-class DownloadAction extends RightSidePopdownAction {
- private final DownloadBox downloadBox;
-
- DownloadAction(
- ChangeInfo info,
- String revision,
- ChangeScreen.Style style,
- UIObject relativeTo,
- Widget downloadButton) {
- super(style, relativeTo, downloadButton);
- this.downloadBox =
- new DownloadBox(
- info, revision, new PatchSet.Id(info.legacyId(), info.revision(revision)._number()));
- }
-
- @Override
- Widget getWidget() {
- return downloadBox;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DownloadBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DownloadBox.java
deleted file mode 100644
index 547f3d5..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/DownloadBox.java
+++ /dev/null
@@ -1,261 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.account.AccountApi;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.ChangeList;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.EditInfo;
-import com.google.gerrit.client.info.ChangeInfo.FetchInfo;
-import com.google.gerrit.client.info.GeneralPreferences;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.extensions.client.ListChangesOption;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.event.dom.client.ChangeEvent;
-import com.google.gwt.event.dom.client.ChangeHandler;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.FlexTable;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.InlineLabel;
-import com.google.gwt.user.client.ui.ListBox;
-import com.google.gwt.user.client.ui.VerticalPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.clippy.client.CopyableLabel;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.Iterator;
-import java.util.List;
-
-class DownloadBox extends VerticalPanel {
- private final ChangeInfo change;
- private final String revision;
- private final PatchSet.Id psId;
- private final FlexTable commandTable;
- private final ListBox scheme;
- private NativeMap<FetchInfo> fetch;
-
- DownloadBox(ChangeInfo change, String revision, PatchSet.Id psId) {
- this.change = change;
- this.revision = revision;
- this.psId = psId;
- this.commandTable = new FlexTable();
- this.scheme = new ListBox();
- this.scheme.addChangeHandler(
- new ChangeHandler() {
- @Override
- public void onChange(ChangeEvent event) {
- renderCommands();
- if (Gerrit.isSignedIn()) {
- saveScheme();
- }
- }
- });
-
- setStyleName(Gerrit.RESOURCES.css().downloadBox());
- commandTable.setStyleName(Gerrit.RESOURCES.css().downloadBoxTable());
- scheme.setStyleName(Gerrit.RESOURCES.css().downloadBoxScheme());
- add(commandTable);
- }
-
- @Override
- protected void onLoad() {
- if (fetch == null) {
- if (psId.get() == 0) {
- ChangeApi.editWithCommands(change.project(), change.legacyId().get())
- .get(
- new AsyncCallback<EditInfo>() {
- @Override
- public void onSuccess(EditInfo result) {
- fetch = result.fetch();
- renderScheme();
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- });
- } else {
- RestApi call = ChangeApi.detail(change.project(), change.legacyId().get());
- ChangeList.addOptions(
- call,
- EnumSet.of(
- revision.equals(change.currentRevision())
- ? ListChangesOption.CURRENT_REVISION
- : ListChangesOption.ALL_REVISIONS,
- ListChangesOption.DOWNLOAD_COMMANDS));
- call.get(
- new AsyncCallback<ChangeInfo>() {
- @Override
- public void onSuccess(ChangeInfo result) {
- fetch = result.revision(revision).fetch();
- renderScheme();
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- });
- }
- }
- }
-
- private void renderCommands() {
- commandTable.removeAllRows();
-
- if (scheme.getItemCount() > 0) {
- FetchInfo fetchInfo = fetch.get(scheme.getValue(scheme.getSelectedIndex()));
- for (String commandName : fetchInfo.commands().sortedKeys()) {
- CopyableLabel copyLabel = new CopyableLabel(fetchInfo.command(commandName));
- copyLabel.setStyleName(Gerrit.RESOURCES.css().downloadBoxCopyLabel());
- insertCommand(commandName, copyLabel);
- }
- }
- if (change.revision(revision).commit().parents().length() == 1) {
- insertPatch();
- }
- insertArchive();
- insertCommand(null, scheme);
- }
-
- private void insertPatch() {
- String id = revision.substring(0, 7);
- Anchor patchBase64 = new Anchor(id + ".diff.base64");
- patchBase64.setHref(
- new RestApi("/changes/")
- .id(psId.getParentKey().get())
- .view("revisions")
- .id(revision)
- .view("patch")
- .addParameterTrue("download")
- .url());
-
- Anchor patchZip = new Anchor(id + ".diff.zip");
- patchZip.setHref(
- new RestApi("/changes/")
- .id(psId.getParentKey().get())
- .view("revisions")
- .id(revision)
- .view("patch")
- .addParameterTrue("zip")
- .url());
-
- HorizontalPanel p = new HorizontalPanel();
- p.add(patchBase64);
- InlineLabel spacer = new InlineLabel("|");
- spacer.setStyleName(Gerrit.RESOURCES.css().downloadBoxSpacer());
- p.add(spacer);
- p.add(patchZip);
- insertCommand("Patch-File", p);
- }
-
- private void insertArchive() {
- List<String> activated = Gerrit.info().download().archives();
- if (activated.isEmpty()) {
- return;
- }
-
- List<Anchor> anchors = new ArrayList<>(activated.size());
- for (String f : activated) {
- Anchor archive = new Anchor(f);
- archive.setHref(
- new RestApi("/changes/")
- .id(psId.getParentKey().get())
- .view("revisions")
- .id(revision)
- .view("archive")
- .addParameter("format", f)
- .url());
- anchors.add(archive);
- }
-
- HorizontalPanel p = new HorizontalPanel();
- Iterator<Anchor> it = anchors.iterator();
- while (it.hasNext()) {
- Anchor a = it.next();
- p.add(a);
- if (it.hasNext()) {
- InlineLabel spacer = new InlineLabel("|");
- spacer.setStyleName(Gerrit.RESOURCES.css().downloadBoxSpacer());
- p.add(spacer);
- }
- }
- insertCommand("Archive", p);
- }
-
- private void insertCommand(String commandName, Widget w) {
- int row = commandTable.getRowCount();
- commandTable.insertRow(row);
- commandTable
- .getCellFormatter()
- .addStyleName(row, 0, Gerrit.RESOURCES.css().downloadBoxTableCommandColumn());
- if (commandName != null) {
- commandTable.setText(row, 0, commandName);
- }
- if (w != null) {
- commandTable.setWidget(row, 1, w);
- }
- }
-
- private void renderScheme() {
- for (String id : fetch.sortedKeys()) {
- scheme.addItem(id);
- }
- if (scheme.getItemCount() == 0) {
- scheme.setVisible(false);
- } else {
- if (scheme.getItemCount() == 1) {
- scheme.setSelectedIndex(0);
- scheme.setVisible(false);
- } else {
- int select = 0;
- String find = Gerrit.getUserPreferences().downloadScheme();
- if (find != null) {
- for (int i = 0; i < scheme.getItemCount(); i++) {
- if (find.equals(scheme.getValue(i))) {
- select = i;
- break;
- }
- }
- }
- scheme.setSelectedIndex(select);
- }
- }
- renderCommands();
- }
-
- private void saveScheme() {
- String schemeStr = scheme.getValue(scheme.getSelectedIndex());
- GeneralPreferences prefs = Gerrit.getUserPreferences();
- if (Gerrit.isSignedIn() && !schemeStr.equals(prefs.downloadScheme())) {
- prefs.downloadScheme(schemeStr);
- GeneralPreferences in = GeneralPreferences.create();
- in.downloadScheme(schemeStr);
- AccountApi.self()
- .view("preferences")
- .put(
- in,
- new AsyncCallback<JavaScriptObject>() {
- @Override
- public void onSuccess(JavaScriptObject result) {}
-
- @Override
- public void onFailure(Throwable caught) {}
- });
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/EditActions.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/EditActions.java
deleted file mode 100644
index f075c16..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/EditActions.java
+++ /dev/null
@@ -1,69 +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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.user.client.ui.Button;
-
-public class EditActions {
-
- static void deleteEdit(Project.NameKey project, Change.Id id, Button... editButtons) {
- ChangeApi.deleteEdit(project.get(), id.get(), cs(project, id, editButtons));
- }
-
- static void publishEdit(Project.NameKey project, Change.Id id, Button... editButtons) {
- ChangeApi.publishEdit(project.get(), id.get(), cs(project, id, editButtons));
- }
-
- static void rebaseEdit(Project.NameKey project, Change.Id id, Button... editButtons) {
- ChangeApi.rebaseEdit(project.get(), id.get(), cs(project, id, editButtons));
- }
-
- public static GerritCallback<JavaScriptObject> cs(
- Project.NameKey project, final Change.Id id, Button... editButtons) {
- setEnabled(false, editButtons);
- return new GerritCallback<JavaScriptObject>() {
- @Override
- public void onSuccess(JavaScriptObject result) {
- Gerrit.display(PageLinks.toChange(project, id));
- }
-
- @Override
- public void onFailure(Throwable err) {
- setEnabled(true, editButtons);
- if (SubmitFailureDialog.isConflict(err)) {
- new SubmitFailureDialog(err.getMessage()).center();
- Gerrit.display(PageLinks.toChange(project, id));
- } else {
- super.onFailure(err);
- }
- }
- };
- }
-
- private static void setEnabled(boolean enabled, Button... editButtons) {
- if (editButtons != null) {
- for (Button b : editButtons) {
- b.setEnabled(enabled);
- }
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/FileComments.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/FileComments.java
deleted file mode 100644
index 083c824..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/FileComments.java
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.changes.CommentInfo;
-import com.google.gerrit.client.ui.CommentLinkProcessor;
-import com.google.gerrit.client.ui.InlineHyperlink;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import java.util.List;
-
-class FileComments extends Composite {
- interface Binder extends UiBinder<HTMLPanel, FileComments> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- @UiField InlineHyperlink path;
- @UiField FlowPanel comments;
-
- FileComments(
- CommentLinkProcessor clp,
- Project.NameKey project,
- PatchSet.Id defaultPs,
- String title,
- List<CommentInfo> list) {
- initWidget(uiBinder.createAndBindUi(this));
-
- path.setTargetHistoryToken(url(project, defaultPs, list.get(0)));
- path.setText(title);
- for (CommentInfo c : list) {
- comments.add(new LineComment(clp, project, defaultPs, c));
- }
- }
-
- private static String url(Project.NameKey project, PatchSet.Id ps, CommentInfo info) {
- return Dispatcher.toPatch(project, null, ps, info.path());
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/FileComments.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/FileComments.ui.xml
deleted file mode 100644
index e463e95..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/FileComments.ui.xml
+++ /dev/null
@@ -1,37 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:c='urn:import:com.google.gerrit.client.ui'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:style gss='false'>
- .box {
- }
- .path {
- display: block;
- white-space: nowrap;
- }
- .comments {
- margin-left: 1em;
- }
- </ui:style>
-
- <g:HTMLPanel styleName='{style.box}'>
- <c:InlineHyperlink styleName='{style.path}' ui:field='path'/>
- <g:FlowPanel styleName='{style.comments}' ui:field='comments'/>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/FileTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/FileTable.java
deleted file mode 100644
index 30554b6..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/FileTable.java
+++ /dev/null
@@ -1,940 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import static com.google.gerrit.client.FormatUtil.formatAbsBytes;
-import static com.google.gerrit.client.FormatUtil.formatAbsPercentage;
-import static com.google.gerrit.client.FormatUtil.formatBytes;
-import static com.google.gerrit.client.FormatUtil.formatPercentage;
-
-import com.google.gerrit.client.DiffObject;
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.VoidResult;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.ChangeEditApi;
-import com.google.gerrit.client.changes.CommentInfo;
-import com.google.gerrit.client.changes.ReviewInfo;
-import com.google.gerrit.client.changes.Util;
-import com.google.gerrit.client.info.FileInfo;
-import com.google.gerrit.client.patches.PatchUtil;
-import com.google.gerrit.client.rpc.CallbackGroup;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.client.ui.NavigationTable;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.extensions.client.Side;
-import com.google.gerrit.reviewdb.client.Patch;
-import com.google.gerrit.reviewdb.client.Patch.ChangeType;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.core.client.Scheduler.RepeatingCommand;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.InputElement;
-import com.google.gwt.dom.client.NativeEvent;
-import com.google.gwt.event.dom.client.KeyCodes;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.resources.client.ClientBundle;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Event;
-import com.google.gwt.user.client.EventListener;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
-import com.google.gwt.user.client.ui.ImageResourceRenderer;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
-import com.google.gwtexpui.globalkey.client.KeyCommand;
-import com.google.gwtexpui.progress.client.ProgressBar;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-import java.sql.Timestamp;
-
-public class FileTable extends FlowPanel {
- private static final FileTableResources R = GWT.create(FileTableResources.class);
-
- interface FileTableResources extends ClientBundle {
- @Source("file_table.css")
- FileTableCss css();
- }
-
- interface FileTableCss extends CssResource {
- String table();
-
- String nohover();
-
- String pointer();
-
- String reviewed();
-
- String status();
-
- String pathColumn();
-
- String commonPrefix();
-
- String renameCopySource();
-
- String draftColumn();
-
- String newColumn();
-
- String commentColumn();
-
- String deltaColumn1();
-
- String deltaColumn2();
-
- String inserted();
-
- String deleted();
-
- String restoreDelete();
-
- String error();
- }
-
- public enum Mode {
- REVIEW,
- EDIT
- }
-
- private static final String DELETE;
- private static final String RESTORE;
- private static final String REVIEWED;
- private static final String OPEN;
- private static final int C_PATH = 3;
- private static final HyperlinkImpl link = GWT.create(HyperlinkImpl.class);
-
- static {
- DELETE = DOM.createUniqueId().replace('-', '_');
- RESTORE = DOM.createUniqueId().replace('-', '_');
- REVIEWED = DOM.createUniqueId().replace('-', '_');
- OPEN = DOM.createUniqueId().replace('-', '_');
- init(DELETE, RESTORE, REVIEWED, OPEN);
- }
-
- private static native void init(String d, String t, String r, String o) /*-{
- $wnd[d] = $entry(function(e,i) {
- @com.google.gerrit.client.change.FileTable::onDelete(Lcom/google/gwt/dom/client/NativeEvent;I)(e,i)
- });
- $wnd[t] = $entry(function(e,i) {
- @com.google.gerrit.client.change.FileTable::onRestore(Lcom/google/gwt/dom/client/NativeEvent;I)(e,i)
- });
- $wnd[r] = $entry(function(e,i) {
- @com.google.gerrit.client.change.FileTable::onReviewed(Lcom/google/gwt/dom/client/NativeEvent;I)(e,i)
- });
- $wnd[o] = $entry(function(e,i) {
- return @com.google.gerrit.client.change.FileTable::onOpen(Lcom/google/gwt/dom/client/NativeEvent;I)(e,i);
- });
- }-*/;
-
- private static void onDelete(NativeEvent e, int idx) {
- MyTable t = getMyTable(e);
- if (t != null) {
- t.onDelete(idx);
- }
- }
-
- private static boolean onRestore(NativeEvent e, int idx) {
- MyTable t = getMyTable(e);
- if (t != null) {
- t.onRestore(idx);
- e.preventDefault();
- e.stopPropagation();
- return false;
- }
- return true;
- }
-
- private static void onReviewed(NativeEvent e, int idx) {
- MyTable t = getMyTable(e);
- if (t != null) {
- t.onReviewed(InputElement.as(Element.as(e.getEventTarget())), idx);
- }
- }
-
- private static boolean onOpen(NativeEvent e, int idx) {
- if (link.handleAsClick(e.<Event>cast())) {
- MyTable t = getMyTable(e);
- if (t != null) {
- t.onOpenRow(1 + idx);
- e.preventDefault();
- e.stopPropagation();
- return false;
- }
- }
- return true;
- }
-
- private static MyTable getMyTable(NativeEvent event) {
- Element e = event.getEventTarget().cast();
- for (e = DOM.getParent(e); e != null; e = DOM.getParent(e)) {
- EventListener l = DOM.getEventListener(e);
- if (l instanceof MyTable) {
- return (MyTable) l;
- }
- }
- return null;
- }
-
- private DiffObject base;
- private PatchSet.Id curr;
- private Project.NameKey project;
- private MyTable table;
- private boolean register;
- private JsArrayString reviewed;
- private String scrollToPath;
- private ChangeScreen.Style style;
- private Widget replyButton;
- private boolean editExists;
- private Mode mode;
-
- @Override
- protected void onLoad() {
- super.onLoad();
- R.css().ensureInjected();
- }
-
- public void set(
- DiffObject base,
- PatchSet.Id curr,
- Project.NameKey project,
- ChangeScreen.Style style,
- Widget replyButton,
- Mode mode,
- boolean editExists) {
- this.base = base;
- this.curr = curr;
- this.project = project;
- this.style = style;
- this.replyButton = replyButton;
- this.mode = mode;
- this.editExists = editExists;
- }
-
- void setValue(
- NativeMap<FileInfo> fileMap,
- Timestamp myLastReply,
- @Nullable NativeMap<JsArray<CommentInfo>> comments,
- @Nullable NativeMap<JsArray<CommentInfo>> drafts) {
- JsArray<FileInfo> list = fileMap.values();
- FileInfo.sortFileInfoByPath(list);
-
- DisplayCommand cmd = new DisplayCommand(fileMap, list, myLastReply, comments, drafts);
- if (cmd.execute()) {
- cmd.showProgressBar();
- Scheduler.get().scheduleIncremental(cmd);
- }
- }
-
- void showError(Throwable t) {
- clear();
- Label l = new Label(Resources.M.failedToLoadFileList(t.getMessage()));
- add(l);
- l.setStyleName(R.css().error());
- }
-
- void markReviewed(JsArrayString reviewed) {
- if (table != null) {
- table.markReviewed(reviewed);
- } else {
- this.reviewed = reviewed;
- }
- }
-
- void unregisterKeys() {
- register = false;
-
- if (table != null) {
- table.setRegisterKeys(false);
- }
- }
-
- void registerKeys() {
- register = true;
-
- if (table != null) {
- table.setRegisterKeys(true);
- }
- }
-
- void scrollToPath(String path) {
- if (table != null) {
- table.scrollToPath(path);
- } else {
- scrollToPath = path;
- }
- }
-
- void openAll() {
- if (table != null) {
- String self = Gerrit.selfRedirect(null);
- for (FileInfo info : Natives.asList(table.list)) {
- if (canOpen(info.path())) {
- Window.open(self + "#" + url(info), "_blank", null);
- }
- }
- }
- }
-
- private boolean canOpen(String path) {
- return mode != Mode.EDIT || !Patch.isMagic(path) || Patch.COMMIT_MSG.equals(path);
- }
-
- private void setTable(MyTable table) {
- clear();
- add(table);
- this.table = table;
-
- if (register) {
- table.setRegisterKeys(true);
- }
- if (reviewed != null) {
- table.markReviewed(reviewed);
- reviewed = null;
- }
- if (scrollToPath != null) {
- table.scrollToPath(scrollToPath);
- scrollToPath = null;
- }
- }
-
- private String url(FileInfo info) {
- return info.binary()
- ? Dispatcher.toUnified(project, base, curr, info.path())
- : mode == Mode.REVIEW
- ? Dispatcher.toPatch(project, base, curr, info.path())
- : Dispatcher.toEditScreen(project, curr, info.path());
- }
-
- private final class MyTable extends NavigationTable<FileInfo> {
- private final NativeMap<FileInfo> map;
- private final JsArray<FileInfo> list;
-
- MyTable(NativeMap<FileInfo> map, JsArray<FileInfo> list) {
- this.map = map;
- this.list = list;
- table.setWidth("");
-
- keysNavigation.add(
- new PrevKeyCommand(0, 'k', Util.C.patchTablePrev()),
- new NextKeyCommand(0, 'j', Util.C.patchTableNext()));
- keysNavigation.add(new OpenKeyCommand(0, 'o', Util.C.patchTableOpenDiff()));
- keysNavigation.add(new OpenKeyCommand(0, KeyCodes.KEY_ENTER, Util.C.patchTableOpenDiff()));
-
- keysNavigation.add(
- new OpenFileCommand(list.length() - 1, 0, '[', Resources.C.openLastFile()),
- new OpenFileCommand(0, 0, ']', Resources.C.openCommitMessage()));
-
- keysAction.add(
- new KeyCommand(0, 'r', PatchUtil.C.toggleReviewed()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- int row = getCurrentRow();
- if (1 <= row && row <= MyTable.this.list.length()) {
- FileInfo info = MyTable.this.list.get(row - 1);
- InputElement b = getReviewed(info);
- boolean c = !b.isChecked();
- setReviewed(info, c);
- b.setChecked(c);
- }
- }
- });
-
- setSavePointerId((!base.isBase() ? base.asString() + ".." : "") + curr.toString());
- }
-
- void onDelete(int idx) {
- String path = list.get(idx).path();
- ChangeEditApi.delete(
- project.get(),
- curr.getParentKey().get(),
- path,
- new AsyncCallback<VoidResult>() {
- @Override
- public void onSuccess(VoidResult result) {
- Gerrit.display(PageLinks.toChangeInEditMode(project, curr.getParentKey()));
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- });
- }
-
- void onRestore(int idx) {
- String path = list.get(idx).path();
- ChangeEditApi.restore(
- project.get(),
- curr.getParentKey().get(),
- path,
- new AsyncCallback<VoidResult>() {
- @Override
- public void onSuccess(VoidResult result) {
- Gerrit.display(PageLinks.toChangeInEditMode(project, curr.getParentKey()));
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- });
- }
-
- void onReviewed(InputElement checkbox, int idx) {
- setReviewed(list.get(idx), checkbox.isChecked());
- }
-
- private void setReviewed(FileInfo info, boolean r) {
- RestApi api =
- ChangeApi.revision(project.get(), curr).view("files").id(info.path()).view("reviewed");
- if (r) {
- api.put(CallbackGroup.<ReviewInfo>emptyCallback());
- } else {
- api.delete(CallbackGroup.<ReviewInfo>emptyCallback());
- }
- }
-
- void markReviewed(JsArrayString reviewed) {
- for (int i = 0; i < reviewed.length(); i++) {
- FileInfo info = map.get(reviewed.get(i));
- if (info != null) {
- getReviewed(info).setChecked(true);
- }
- }
- }
-
- private InputElement getReviewed(FileInfo info) {
- CellFormatter fmt = table.getCellFormatter();
- Element e = fmt.getElement(1 + info._row(), 1);
- return InputElement.as(e.getFirstChildElement());
- }
-
- void scrollToPath(String path) {
- FileInfo info = map.get(path);
- if (info != null) {
- movePointerTo(1 + info._row(), true);
- }
- }
-
- @Override
- protected Object getRowItemKey(FileInfo item) {
- return item.path();
- }
-
- @Override
- protected int findRow(Object id) {
- FileInfo info = map.get((String) id);
- return info != null ? 1 + info._row() : -1;
- }
-
- @Override
- protected FileInfo getRowItem(int row) {
- if (1 <= row && row <= list.length()) {
- return list.get(row - 1);
- }
- return null;
- }
-
- @Override
- protected void onOpenRow(int row) {
- if (1 <= row && row <= list.length()) {
- FileInfo info = list.get(row - 1);
- if (canOpen(info.path())) {
- Gerrit.display(url(info));
- }
- }
- }
-
- @Override
- protected void onCellSingleClick(Event event, int row, int column) {
- if (column == C_PATH && link.handleAsClick(event)) {
- onOpenRow(row);
- } else {
- super.onCellSingleClick(event, row, column);
- }
- }
-
- private class OpenFileCommand extends KeyCommand {
- private final int index;
-
- OpenFileCommand(int index, int modifiers, char c, String helpText) {
- super(modifiers, c, helpText);
- this.index = index;
- }
-
- @Override
- public void onKeyPress(KeyPressEvent event) {
- FileInfo info = list.get(index);
- if (canOpen(info.path())) {
- Gerrit.display(url(info));
- }
- }
- }
- }
-
- private final class DisplayCommand implements RepeatingCommand {
- private final SafeHtmlBuilder sb = new SafeHtmlBuilder();
- private final MyTable myTable;
- private final JsArray<FileInfo> list;
- private final Timestamp myLastReply;
- private final NativeMap<JsArray<CommentInfo>> comments;
- private final NativeMap<JsArray<CommentInfo>> drafts;
- private final boolean hasUser;
- private final boolean showChangeSizeBars;
- private boolean attached;
- private int row;
- private double start;
- private ProgressBar meter;
- private String lastPath = "";
-
- private boolean hasBinaryFile;
- private boolean hasNonBinaryFile;
- private int inserted;
- private int deleted;
- private long binOldSize;
- private long bytesInserted;
- private long bytesDeleted;
-
- private DisplayCommand(
- NativeMap<FileInfo> map,
- JsArray<FileInfo> list,
- Timestamp myLastReply,
- @Nullable NativeMap<JsArray<CommentInfo>> comments,
- @Nullable NativeMap<JsArray<CommentInfo>> drafts) {
- this.myTable = new MyTable(map, list);
- this.list = list;
- this.myLastReply = myLastReply;
- this.comments = comments;
- this.drafts = drafts;
- this.hasUser = Gerrit.isSignedIn();
- this.showChangeSizeBars = Gerrit.getUserPreferences().sizeBarInChangeTable();
- myTable.addStyleName(R.css().table());
- }
-
- @Override
- public boolean execute() {
- boolean attachedNow = isAttached();
- if (!attached && attachedNow) {
- // Remember that we have been attached at least once. If
- // later we find we aren't attached we should stop running.
- attached = true;
- } else if (attached && !attachedNow) {
- // If the user navigated away, we aren't in the DOM anymore.
- // Don't continue to render.
- return false;
- }
-
- start = System.currentTimeMillis();
- if (row == 0) {
- header(sb);
- computeInsertedDeleted();
- }
- while (row < list.length()) {
- FileInfo info = list.get(row);
- info._row(row);
- render(sb, info);
- if ((++row % 10) == 0 && longRunning()) {
- updateMeter();
- return true;
- }
- }
- footer(sb);
- myTable.resetHtml(sb);
- myTable.finishDisplay();
- setTable(myTable);
- return false;
- }
-
- private void computeInsertedDeleted() {
- inserted = 0;
- deleted = 0;
- binOldSize = 0;
- bytesInserted = 0;
- bytesDeleted = 0;
- for (int i = 0; i < list.length(); i++) {
- FileInfo info = list.get(i);
- if (!Patch.isMagic(info.path())) {
- if (!info.binary()) {
- hasNonBinaryFile = true;
- inserted += info.linesInserted();
- deleted += info.linesDeleted();
- } else {
- hasBinaryFile = true;
- binOldSize += info.size() - info.sizeDelta();
- if (info.sizeDelta() >= 0) {
- bytesInserted += info.sizeDelta();
- } else {
- bytesDeleted += info.sizeDelta();
- }
- }
- }
- }
- }
-
- void showProgressBar() {
- if (meter == null) {
- meter = new ProgressBar(Util.M.loadingPatchSet(curr.get()));
- FileTable.this.clear();
- FileTable.this.add(meter);
- }
- updateMeter();
- }
-
- void updateMeter() {
- if (meter != null) {
- int n = list.length();
- meter.setValue((100 * row) / n);
- }
- }
-
- private boolean longRunning() {
- return System.currentTimeMillis() - start > 200;
- }
-
- private void header(SafeHtmlBuilder sb) {
- sb.openTr().setStyleName(R.css().nohover());
- sb.openTh().setStyleName(R.css().pointer()).closeTh();
- if (mode == Mode.REVIEW) {
- sb.openTh().setStyleName(R.css().reviewed()).closeTh();
- } else {
- sb.openTh().setStyleName(R.css().restoreDelete()).closeTh();
- }
- sb.openTh().setStyleName(R.css().status()).closeTh();
- sb.openTh().append(Util.C.patchTableColumnName()).closeTh();
- sb.openTh().setAttribute("colspan", 3).append(Util.C.patchTableColumnComments()).closeTh();
- sb.openTh().setAttribute("colspan", 2).append(Util.C.patchTableColumnSize()).closeTh();
- sb.closeTr();
- }
-
- private void render(SafeHtmlBuilder sb, FileInfo info) {
- sb.openTr();
- sb.openTd().setStyleName(R.css().pointer()).closeTd();
- if (mode == Mode.REVIEW) {
- columnReviewed(sb, info);
- } else {
- columnDeleteRestore(sb, info);
- }
- columnStatus(sb, info);
- columnPath(sb, info);
- columnComments(sb, info);
- columnDelta1(sb, info);
- columnDelta2(sb, info);
- sb.closeTr();
- }
-
- private void columnReviewed(SafeHtmlBuilder sb, FileInfo info) {
- sb.openTd().setStyleName(R.css().reviewed());
- if (hasUser) {
- sb.openElement("input")
- .setAttribute("title", Resources.C.reviewedFileTitle())
- .setAttribute("type", "checkbox")
- .setAttribute("onclick", REVIEWED + "(event," + info._row() + ")")
- .closeSelf();
- }
- sb.closeTd();
- }
-
- private void columnDeleteRestore(SafeHtmlBuilder sb, FileInfo info) {
- sb.openTd().setStyleName(R.css().restoreDelete());
- if (hasUser) {
- if (!Patch.isMagic(info.path())) {
- boolean editable = isEditable(info);
- sb.openDiv()
- .openElement("button")
- .setAttribute("title", Resources.C.restoreFileInline())
- .setAttribute("onclick", RESTORE + "(event," + info._row() + ")")
- .append(new ImageResourceRenderer().render(Gerrit.RESOURCES.editUndo()))
- .closeElement("button");
- if (editable) {
- sb.openElement("button")
- .setAttribute("title", Resources.C.removeFileInline())
- .setAttribute("onclick", DELETE + "(event," + info._row() + ")")
- .append(new ImageResourceRenderer().render(Gerrit.RESOURCES.redNot()))
- .closeElement("button");
- }
- sb.closeDiv();
- }
- }
- sb.closeTd();
- }
-
- private boolean isEditable(FileInfo info) {
- String status = info.status();
- return status == null || !ChangeType.DELETED.matches(status);
- }
-
- private void columnStatus(SafeHtmlBuilder sb, FileInfo info) {
- sb.openTd().setStyleName(R.css().status());
- if (!Patch.isMagic(info.path())
- && info.status() != null
- && !ChangeType.MODIFIED.matches(info.status())) {
- sb.append(info.status());
- }
- sb.closeTd();
- }
-
- private void columnPath(SafeHtmlBuilder sb, FileInfo info) {
- String path = info.path();
-
- sb.openTd().setStyleName(R.css().pathColumn());
-
- if (!canOpen(path)) {
- sb.openDiv();
- appendPath(path);
- sb.closeDiv();
- sb.closeTd();
- return;
- }
-
- sb.openAnchor();
-
- if (mode == Mode.EDIT && !isEditable(info)) {
- sb.setAttribute("onclick", RESTORE + "(event," + info._row() + ")");
- } else {
- sb.setAttribute("href", "#" + url(info))
- .setAttribute("onclick", OPEN + "(event," + info._row() + ")");
- }
- appendPath(path);
- sb.closeAnchor();
- if (info.oldPath() != null) {
- sb.br();
- sb.openSpan().setStyleName(R.css().renameCopySource()).append(info.oldPath()).closeSpan();
- }
- sb.closeTd();
- }
-
- private void appendPath(String path) {
- if (Patch.COMMIT_MSG.equals(path)) {
- sb.append(Util.C.commitMessage());
- } else if (Patch.MERGE_LIST.equals(path)) {
- sb.append(Util.C.mergeList());
- } else if (Gerrit.getUserPreferences().muteCommonPathPrefixes()) {
- int commonPrefixLen = commonPrefix(path);
- if (commonPrefixLen > 0) {
- sb.openSpan()
- .setStyleName(R.css().commonPrefix())
- .append(path.substring(0, commonPrefixLen))
- .closeSpan();
- }
- sb.append(path.substring(commonPrefixLen));
- lastPath = path;
- } else {
- sb.append(path);
- }
- }
-
- private int commonPrefix(String path) {
- for (int n = path.length(); n > 0; ) {
- int s = path.lastIndexOf('/', n);
- if (s < 0) {
- return 0;
- }
-
- String p = path.substring(0, s + 1);
- if (lastPath.startsWith(p)) {
- return s + 1;
- }
- n = s - 1;
- }
- return 0;
- }
-
- private void columnComments(SafeHtmlBuilder sb, FileInfo info) {
- JsArray<CommentInfo> cList = filterForParent(get(info.path(), comments));
- JsArray<CommentInfo> dList = filterForParent(get(info.path(), drafts));
-
- sb.openTd().setStyleName(R.css().draftColumn());
- if (dList.length() > 0) {
- sb.append("drafts: ").append(dList.length());
- }
- sb.closeTd();
-
- int cntAll = cList.length();
- int cntNew = 0;
- if (myLastReply != null) {
- for (int i = cntAll - 1; i >= 0; i--) {
- CommentInfo m = cList.get(i);
- if (m.updated().compareTo(myLastReply) > 0) {
- cntNew++;
- } else {
- break;
- }
- }
- }
-
- sb.openTd().setStyleName(R.css().newColumn());
- if (cntNew > 0) {
- sb.append("new: ").append(cntNew);
- }
- sb.closeTd();
-
- sb.openTd().setStyleName(R.css().commentColumn());
- if (cntAll - cntNew > 0) {
- sb.append("comments: ").append(cntAll - cntNew);
- }
- sb.closeTd();
- }
-
- private JsArray<CommentInfo> filterForParent(JsArray<CommentInfo> list) {
- JsArray<CommentInfo> result = JsArray.createArray().cast();
- for (CommentInfo c : Natives.asList(list)) {
- if (c.side() == Side.REVISION) {
- result.push(c);
- } else if (base.isBaseOrAutoMerge() && !c.hasParent()) {
- result.push(c);
- } else if (base.isParent() && c.parent() == base.getParentNum()) {
- result.push(c);
- }
- }
- return result;
- }
-
- private JsArray<CommentInfo> get(String p, NativeMap<JsArray<CommentInfo>> m) {
- JsArray<CommentInfo> r = null;
- if (m != null) {
- r = m.get(p);
- }
- if (r == null) {
- r = JsArray.createArray().cast();
- }
- return r;
- }
-
- private void columnDelta1(SafeHtmlBuilder sb, FileInfo info) {
- sb.openTd().setStyleName(R.css().deltaColumn1());
- if (!Patch.isMagic(info.path()) && !info.binary()) {
- if (showChangeSizeBars) {
- sb.append(info.linesInserted() + info.linesDeleted());
- } else if (!ChangeType.DELETED.matches(info.status())) {
- if (ChangeType.ADDED.matches(info.status())) {
- sb.append(info.linesInserted()).append(" lines");
- } else {
- sb.append("+").append(info.linesInserted()).append(", -").append(info.linesDeleted());
- }
- }
- } else if (info.binary()) {
- sb.append(formatBytes(info.sizeDelta()));
- long oldSize = info.size() - info.sizeDelta();
- if (oldSize != 0) {
- sb.append(" (").append(formatPercentage(oldSize, info.sizeDelta())).append(")");
- }
- }
- sb.closeTd();
- }
-
- private void columnDelta2(SafeHtmlBuilder sb, FileInfo info) {
- sb.openTd().setStyleName(R.css().deltaColumn2());
- if (showChangeSizeBars
- && !Patch.isMagic(info.path())
- && !info.binary()
- && (info.linesInserted() != 0 || info.linesDeleted() != 0)) {
- int w = 80;
- int t = inserted + deleted;
- int i = Math.max(5, (int) (((double) w) * info.linesInserted() / t));
- int d = Math.max(5, (int) (((double) w) * info.linesDeleted() / t));
-
- sb.setAttribute(
- "title", Util.M.patchTableSize_LongModify(info.linesInserted(), info.linesDeleted()));
-
- if (0 < info.linesInserted()) {
- sb.openDiv()
- .setStyleName(R.css().inserted())
- .setAttribute("style", "width:" + i + "px")
- .closeDiv();
- }
- if (0 < info.linesDeleted()) {
- sb.openDiv()
- .setStyleName(R.css().deleted())
- .setAttribute("style", "width:" + d + "px")
- .closeDiv();
- }
- }
- sb.closeTd();
- }
-
- private void footer(SafeHtmlBuilder sb) {
- sb.openTr().setStyleName(R.css().nohover());
- sb.openTh().setStyleName(R.css().pointer()).closeTh();
- if (mode == Mode.REVIEW) {
- sb.openTh().setStyleName(R.css().reviewed()).closeTh();
- } else {
- sb.openTh().setStyleName(R.css().restoreDelete()).closeTh();
- }
- sb.openTh().setStyleName(R.css().status()).closeTh();
- sb.openTd().closeTd(); // path
- sb.openTd().setAttribute("colspan", 3).closeTd(); // comments
-
- // delta1
- sb.openTh().setStyleName(R.css().deltaColumn1());
- if (hasNonBinaryFile) {
- sb.append(Util.M.patchTableSize_Modify(inserted, deleted));
- }
- if (hasBinaryFile) {
- if (hasNonBinaryFile) {
- sb.br();
- }
- if (binOldSize != 0) {
- sb.append(
- Util.M.patchTableSize_ModifyBinaryFilesWithPercentages(
- formatAbsBytes(bytesInserted),
- formatAbsPercentage(binOldSize, bytesInserted),
- formatAbsBytes(bytesDeleted),
- formatAbsPercentage(binOldSize, bytesDeleted)));
- } else {
- sb.append(
- Util.M.patchTableSize_ModifyBinaryFiles(
- formatAbsBytes(bytesInserted), formatAbsBytes(bytesDeleted)));
- }
- }
- sb.closeTh();
-
- // delta2
- sb.openTh().setStyleName(R.css().deltaColumn2());
- if (showChangeSizeBars) {
- int w = 80;
- int t = inserted + deleted;
- int i = Math.max(1, (int) (((double) w) * inserted / t));
- int d = Math.max(1, (int) (((double) w) * deleted / t));
- if (i + d > w && i > d) {
- i = w - d;
- } else if (i + d > w && d > i) {
- d = w - i;
- }
- if (0 < inserted) {
- sb.openDiv()
- .setStyleName(R.css().inserted())
- .setAttribute("style", "width:" + i + "px")
- .closeDiv();
- }
- if (0 < deleted) {
- sb.openDiv()
- .setStyleName(R.css().deleted())
- .setAttribute("style", "width:" + d + "px")
- .closeDiv();
- }
- }
- sb.closeTh();
-
- sb.closeTr();
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/FollowUpAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/FollowUpAction.java
deleted file mode 100644
index a4c90b8..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/FollowUpAction.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.common.PageLinks;
-import com.google.gwt.user.client.ui.Button;
-
-class FollowUpAction extends ActionMessageBox {
- private final String project;
- private final String branch;
- private final String topic;
- private final String base;
-
- FollowUpAction(Button b, String project, String branch, String topic, String key) {
- super(b);
- this.project = project;
- this.branch = branch;
- this.topic = topic;
- this.base = project + "~" + branch + "~" + key;
- }
-
- @Override
- void send(String message) {
- ChangeApi.createChange(
- project,
- branch,
- topic,
- message,
- base,
- new GerritCallback<ChangeInfo>() {
- @Override
- public void onSuccess(ChangeInfo result) {
- Gerrit.display(PageLinks.toChange(result.projectNameKey(), result.legacyId()));
- hide();
- }
- });
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Hashtags.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Hashtags.java
deleted file mode 100644
index 1044828..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Hashtags.java
+++ /dev/null
@@ -1,272 +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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.NativeEvent;
-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.KeyDownEvent;
-import com.google.gwt.event.dom.client.KeyDownHandler;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.rpc.StatusCodeException;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.ImageResourceRenderer;
-import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwtexpui.globalkey.client.NpTextBox;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-import java.util.Iterator;
-
-public class Hashtags extends Composite {
-
- interface Binder extends UiBinder<HTMLPanel, Hashtags> {}
-
- private static final int VISIBLE_LENGTH = 55;
- private static final Binder uiBinder = GWT.create(Binder.class);
- private static final String REMOVE;
- private static final String DATA_ID = "data-id";
-
- private PatchSet.Id psId;
- private boolean canEdit;
-
- static {
- REMOVE = DOM.createUniqueId().replace('-', '_');
- init(REMOVE);
- }
-
- private static native void init(String r) /*-{
- $wnd[r] = $entry(function(e) {
- @com.google.gerrit.client.change.Hashtags::onRemove(Lcom/google/gwt/dom/client/NativeEvent;)(e)
- });
- }-*/;
-
- private static void onRemove(NativeEvent event) {
- String hashtags = getDataId(event);
- if (hashtags != null) {
- final ChangeScreen screen = ChangeScreen.get(event);
- final PatchSet.Id psId = screen.getPatchSetId();
- ChangeApi.hashtags(screen.getProject().get(), psId.getParentKey().get())
- .post(
- PostInput.create(null, hashtags),
- new GerritCallback<JavaScriptObject>() {
- @Override
- public void onSuccess(JavaScriptObject result) {
- if (screen.isCurrentView()) {
- Gerrit.display(PageLinks.toChange(screen.getProject(), psId));
- }
- }
- });
- }
- }
-
- private static String getDataId(NativeEvent event) {
- Element e = event.getEventTarget().cast();
- while (e != null) {
- String v = e.getAttribute(DATA_ID);
- if (!v.isEmpty()) {
- return v;
- }
- e = e.getParentElement();
- }
- return null;
- }
-
- @UiField Element hashtagsText;
- @UiField Image addHashtagIcon;
- @UiField Element form;
- @UiField Element error;
- @UiField NpTextBox hashtagTextBox;
-
- private ChangeScreen.Style style;
- private Change.Id changeId;
- private Project.NameKey project;
-
- public Hashtags() {
-
- initWidget(uiBinder.createAndBindUi(this));
-
- hashtagTextBox.setVisibleLength(VISIBLE_LENGTH);
- hashtagTextBox.addKeyDownHandler(
- new KeyDownHandler() {
- @Override
- public void onKeyDown(KeyDownEvent e) {
- if (e.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
- onCancel(null);
- } else if (e.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
- onAdd(null);
- }
- }
- });
-
- addHashtagIcon.addDomHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- onOpenForm();
- }
- },
- ClickEvent.getType());
- }
-
- void init(ChangeScreen.Style style) {
- this.style = style;
- }
-
- void set(ChangeInfo info, String revision) {
- psId = new PatchSet.Id(info.legacyId(), info.revisions().get(revision)._number());
- project = info.projectNameKey();
-
- canEdit = info.hasActions() && info.actions().containsKey("hashtags");
- this.changeId = info.legacyId();
- display(info);
- addHashtagIcon.setVisible(canEdit);
- }
-
- void onOpenForm() {
- UIObject.setVisible(form, true);
- UIObject.setVisible(error, false);
- addHashtagIcon.setVisible(false);
- hashtagTextBox.setFocus(true);
- }
-
- private void display(ChangeInfo info) {
- hashtagsText.setInnerSafeHtml(formatHashtags(info));
- }
-
- private void display(JsArrayString hashtags) {
- hashtagsText.setInnerSafeHtml(formatHashtags(hashtags));
- }
-
- private SafeHtmlBuilder formatHashtags(ChangeInfo info) {
- if (info.hashtags() != null) {
- return formatHashtags(info.hashtags());
- }
- return new SafeHtmlBuilder();
- }
-
- private SafeHtmlBuilder formatHashtags(JsArrayString hashtags) {
- SafeHtmlBuilder html = new SafeHtmlBuilder();
- Iterator<String> itr = Natives.asList(hashtags).iterator();
- while (itr.hasNext()) {
- String hashtagName = itr.next();
- html.openSpan()
- .setAttribute(DATA_ID, hashtagName)
- .setStyleName(style.hashtagName())
- .openAnchor()
- .setAttribute("href", "#" + PageLinks.toChangeQuery("hashtag:\"" + hashtagName + "\""))
- .setAttribute("role", "listitem")
- .openSpan()
- .setStyleName(style.hashtagIcon())
- .append(new ImageResourceRenderer().render(Gerrit.RESOURCES.hashtag()))
- .closeSpan()
- .append(" ")
- .append(hashtagName)
- .closeAnchor();
- if (canEdit) {
- html.openElement("button")
- .setAttribute("title", "Remove hashtag")
- .setAttribute("onclick", REMOVE + "(event)")
- .append("×")
- .closeElement("button");
- }
- html.closeSpan();
- if (itr.hasNext()) {
- html.append(' ');
- }
- }
- return html;
- }
-
- @UiHandler("cancel")
- void onCancel(@SuppressWarnings("unused") ClickEvent e) {
- addHashtagIcon.setVisible(true);
- UIObject.setVisible(form, false);
- hashtagTextBox.setFocus(false);
- }
-
- @UiHandler("add")
- void onAdd(@SuppressWarnings("unused") ClickEvent e) {
- String hashtag = hashtagTextBox.getText();
- if (!hashtag.isEmpty()) {
- addHashtag(hashtag);
- }
- }
-
- private void addHashtag(String hashtags) {
- ChangeApi.hashtags(project.get(), changeId.get())
- .post(
- PostInput.create(hashtags, null),
- new GerritCallback<JsArrayString>() {
- @Override
- public void onSuccess(JsArrayString result) {
- Gerrit.display(
- PageLinks.toChange(project, psId.getParentKey(), String.valueOf(psId.get())));
- }
-
- @Override
- public void onFailure(Throwable err) {
- UIObject.setVisible(error, true);
- error.setInnerText(
- err instanceof StatusCodeException
- ? ((StatusCodeException) err).getEncodedResponse()
- : err.getMessage());
- hashtagTextBox.setEnabled(true);
- }
- });
- }
-
- public static class PostInput extends JavaScriptObject {
- public static PostInput create(String add, String remove) {
- PostInput input = createObject().cast();
- input.init(toJsArrayString(add), toJsArrayString(remove));
- return input;
- }
-
- private static JsArrayString toJsArrayString(String commaSeparated) {
- if (commaSeparated == null || commaSeparated.equals("")) {
- return null;
- }
- JsArrayString array = JsArrayString.createArray().cast();
- for (String hashtag : commaSeparated.split(",")) {
- array.push(hashtag.trim());
- }
- return array;
- }
-
- private native void init(JsArrayString add, JsArrayString remove) /*-{
- this.add = add;
- this.remove = remove;
- }-*/;
-
- protected PostInput() {}
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Hashtags.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Hashtags.ui.xml
deleted file mode 100644
index c0bfd1c..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Hashtags.ui.xml
+++ /dev/null
@@ -1,82 +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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:c='urn:import:com.google.gwtexpui.globalkey.client'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:with field='ico' type='com.google.gerrit.client.GerritResources'/>
- <ui:with field='res' type='com.google.gerrit.client.change.Resources'/>
- <ui:style gss='false'>
- button.openAdd {
- margin: 3px 3px 0 0;
- float: right;
- color: rgba(0, 0, 0, 0.15);
- background-color: #f5f5f5;
- background-image: -webkit-linear-gradient(top, #f5f5f5, #f1f1f1);
- -webkit-border-radius: 2px;
- -moz-border-radius: 2px;
- border-radius: 2px;
- -webkit-box-sizing: content-box;
- -moz-box-sizing: content-box;
- box-sizing: content-box;
- }
- button.openAdd div {
- width: auto;
- color: #444;
- }
-
- .hashtagTextBox {
- margin-bottom: 2px;
- }
-
- .error {
- color: #D33D3D;
- font-weight: bold;
- }
-
- .addHashtag,
- .cancel {
- cursor: pointer;
- float: right;
- }
- </ui:style>
- <g:HTMLPanel>
- <div>
- <span ui:field='hashtagsText'/>
- <g:Image ui:field='addHashtagIcon'
- resource='{ico.addHashtag}'
- styleName='{style.addHashtag}'
- title='Add Hashtag'/>
- </div>
- <div ui:field='form' style='display: none' aria-hidden='true'>
- <c:NpTextBox ui:field='hashtagTextBox' styleName='{style.hashtagTextBox}'/>
- <div ui:field='error'
- class='{style.error}'
- style='display: none' aria-hidden='true'/>
- <div>
- <g:Button ui:field='add' styleName='{res.style.button}'>
- <div>Add</div>
- </g:Button>
- <g:Button ui:field='cancel'
- styleName='{res.style.button}'
- addStyleNames='{style.cancel}'>
- <div>Cancel</div>
- </g:Button>
- </div>
- </div>
- </g:HTMLPanel>
- </ui:UiBinder>
\ No newline at end of file
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/History.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/History.java
deleted file mode 100644
index 55e021f..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/History.java
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.changes.CommentInfo;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.MessageInfo;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.CommentLinkProcessor;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Widget;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-class History extends FlowPanel {
- private CommentLinkProcessor clp;
- private ReplyAction replyAction;
- private Change.Id changeId;
- private Project.NameKey project;
-
- private final Map<Integer, List<CommentInfo>> byAuthor = new HashMap<>();
-
- void set(CommentLinkProcessor clp, ReplyAction ra, Change.Id id, ChangeInfo info) {
- this.clp = clp;
- this.replyAction = ra;
- this.changeId = id;
- this.project = info.projectNameKey();
-
- JsArray<MessageInfo> messages = info.messages();
- if (messages != null) {
- for (MessageInfo msg : Natives.asList(messages)) {
- Message ui = new Message(this, msg);
- ui.addComments(comments(msg));
- add(ui);
- }
- autoOpen(ChangeScreen.myLastReply(info));
- }
- }
-
- private void autoOpen(Timestamp lastReply) {
- if (lastReply == null) {
- for (Widget child : getChildren()) {
- ((Message) child).autoOpen();
- }
- } else {
- for (int i = getChildren().size() - 1; i >= 0; i--) {
- Message ui = (Message) getChildren().get(i);
- MessageInfo msg = ui.getMessageInfo();
- if (lastReply.compareTo(msg.date()) < 0) {
- ui.autoOpen();
- } else {
- break;
- }
- }
- }
- }
-
- CommentLinkProcessor getCommentLinkProcessor() {
- return clp;
- }
-
- Change.Id getChangeId() {
- return changeId;
- }
-
- Project.NameKey getProject() {
- return project;
- }
-
- void replyTo(MessageInfo info) {
- replyAction.onReply(info);
- }
-
- void addComments(NativeMap<JsArray<CommentInfo>> map) {
- for (String path : map.keySet()) {
- for (CommentInfo c : Natives.asList(map.get(path))) {
- c.path(path);
- if (c.author() != null) {
- int authorId = c.author()._accountId();
- List<CommentInfo> l = byAuthor.get(authorId);
- if (l == null) {
- l = new ArrayList<>();
- byAuthor.put(authorId, l);
- }
- l.add(c);
- }
- }
- }
- }
-
- private List<CommentInfo> comments(MessageInfo msg) {
- if (msg.author() == null) {
- return Collections.emptyList();
- }
-
- int authorId = msg.author()._accountId();
- List<CommentInfo> list = byAuthor.get(authorId);
- if (list == null) {
- return Collections.emptyList();
- }
-
- Timestamp when = msg.date();
- List<CommentInfo> match = new ArrayList<>();
- List<CommentInfo> other = new ArrayList<>();
- for (CommentInfo c : list) {
- if (c.updated().compareTo(when) <= 0) {
- match.add(c);
- } else {
- other.add(c);
- }
- }
- if (match.isEmpty()) {
- return Collections.emptyList();
- } else if (other.isEmpty()) {
- byAuthor.remove(authorId);
- } else {
- byAuthor.put(authorId, other);
- }
- return match;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/IncludedInAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/IncludedInAction.java
deleted file mode 100644
index 5557f90..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/IncludedInAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwt.user.client.ui.Widget;
-
-class IncludedInAction extends RightSidePopdownAction {
- private final IncludedInBox includedInBox;
-
- IncludedInAction(
- Project.NameKey project,
- Change.Id changeId,
- ChangeScreen.Style style,
- UIObject relativeTo,
- Widget includedInButton) {
- super(style, relativeTo, includedInButton);
- this.includedInBox = new IncludedInBox(project, changeId);
- }
-
- @Override
- Widget getWidget() {
- return includedInBox;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/IncludedInBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/IncludedInBox.java
deleted file mode 100644
index 9751f54..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/IncludedInBox.java
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.info.ChangeInfo.IncludedInInfo;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwt.dom.client.Document;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.TableCellElement;
-import com.google.gwt.dom.client.TableElement;
-import com.google.gwt.dom.client.TableRowElement;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.safehtml.shared.SafeHtml;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-
-class IncludedInBox extends Composite {
- interface Binder extends UiBinder<HTMLPanel, IncludedInBox> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- interface Style extends CssResource {
- String includedInElement();
- }
-
- private final Project.NameKey project;
- private final Change.Id changeId;
- private boolean loaded;
-
- @UiField Style style;
- @UiField TableElement table;
- @UiField Element branches;
- @UiField Element tags;
-
- IncludedInBox(Project.NameKey project, Change.Id changeId) {
- this.project = project;
- this.changeId = changeId;
- initWidget(uiBinder.createAndBindUi(this));
- }
-
- @Override
- protected void onLoad() {
- if (!loaded) {
- ChangeApi.includedIn(
- project.get(),
- changeId.get(),
- new AsyncCallback<IncludedInInfo>() {
- @Override
- public void onSuccess(IncludedInInfo r) {
- branches.setInnerSafeHtml(formatList(r.branches()));
- tags.setInnerSafeHtml(formatList(r.tags()));
- for (String n : r.externalNames()) {
- JsArrayString external = r.external(n);
- if (external.length() > 0) {
- appendRow(n, external);
- }
- }
- loaded = true;
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- });
- }
- }
-
- private SafeHtml formatList(JsArrayString l) {
- SafeHtmlBuilder html = new SafeHtmlBuilder();
- int size = l.length();
- for (int i = 0; i < size; i++) {
- html.openSpan().addStyleName(style.includedInElement()).append(l.get(i)).closeSpan();
- if (i < size - 1) {
- html.append(", ");
- }
- }
- return html;
- }
-
- private void appendRow(String title, JsArrayString l) {
- TableRowElement row = table.insertRow(-1);
- TableCellElement th = Document.get().createTHElement();
- th.setInnerText(title);
- row.appendChild(th);
- row.insertCell(-1).setInnerSafeHtml(formatList(l));
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/IncludedInBox.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/IncludedInBox.ui.xml
deleted file mode 100644
index 36ac734..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/IncludedInBox.ui.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:style gss='false' type='com.google.gerrit.client.change.IncludedInBox.Style'>
- .includedInBox {
- min-width: 300px;
- max-width: 580px;
- margin: 5px;
- }
-
- .includedInTable {
- border-spacing: 0;
- }
-
- .includedInTable th {
- width: 60px;
- color: #444;
- font-weight: normal;
- vertical-align: top;
- text-align: left;
- padding-right: 5px;
- }
-
- .includedInElement {
- font-size: smaller;
- font-family: monospace;
- }
-
- .includedInElement span {
- width: 500px;
- white-space: nowrap;
- display: inline-block;
- overflow: hidden;
- text-overflow: ellipsis;
- }
-
- .includedInElement .gwt-TextBox {
- padding: 0;
- margin: 0;
- border: 0;
- max-height: 18px;
- width: 500px;
- }
-
- .includedInElement div {
- float: right;
- }
- </ui:style>
- <g:HTMLPanel styleName='{style.includedInBox}'>
- <table class='{style.includedInTable}' ui:field='table'>
- <tr>
- <th><ui:msg>Branches</ui:msg></th>
- <td ui:field='branches'/>
- </tr>
- <tr>
- <th><ui:msg>Tags</ui:msg></th>
- <td ui:field='tags'/>
- </tr>
- </table>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Labels.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Labels.java
deleted file mode 100644
index 267a983..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Labels.java
+++ /dev/null
@@ -1,353 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import static java.util.stream.Collectors.collectingAndThen;
-import static java.util.stream.Collectors.toCollection;
-import static java.util.stream.Collectors.toList;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.Util;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.info.AccountInfo.AvatarInfo;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.ApprovalInfo;
-import com.google.gerrit.client.info.ChangeInfo.LabelInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.common.data.LabelValue;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.NativeEvent;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.Grid;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.safehtml.client.SafeHtml;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/** Displays a table of label and reviewer scores. */
-class Labels extends Grid {
- private static final String DATA_ID = "data-id";
- private static final String DATA_VOTE = "data-vote";
- private static final String REMOVE_REVIEWER;
- private static final String REMOVE_VOTE;
-
- static {
- REMOVE_REVIEWER = DOM.createUniqueId().replace('-', '_');
- REMOVE_VOTE = DOM.createUniqueId().replace('-', '_');
- init(REMOVE_REVIEWER, REMOVE_VOTE);
- }
-
- private static native void init(String r, String v) /*-{
- $wnd[r] = $entry(function(e) {
- @com.google.gerrit.client.change.Labels::onRemoveReviewer(Lcom/google/gwt/dom/client/NativeEvent;)(e)
- });
- $wnd[v] = $entry(function(e) {
- @com.google.gerrit.client.change.Labels::onRemoveVote(Lcom/google/gwt/dom/client/NativeEvent;)(e)
- });
- }-*/;
-
- private static void onRemoveReviewer(NativeEvent event) {
- Integer user = getDataId(event);
- if (user != null) {
- final ChangeScreen screen = ChangeScreen.get(event);
- final Change.Id changeId = screen.getPatchSetId().getParentKey();
- ChangeApi.reviewer(screen.getProject().get(), changeId.get(), user)
- .delete(
- new GerritCallback<JavaScriptObject>() {
- @Override
- public void onSuccess(JavaScriptObject result) {
- if (screen.isCurrentView()) {
- Gerrit.display(PageLinks.toChange(screen.getProject(), changeId));
- }
- }
- });
- }
- }
-
- private static void onRemoveVote(NativeEvent event) {
- Integer user = getDataId(event);
- String vote = getVoteId(event);
- if (user != null && vote != null) {
- final ChangeScreen screen = ChangeScreen.get(event);
- final Change.Id changeId = screen.getPatchSetId().getParentKey();
- ChangeApi.vote(screen.getProject().get(), changeId.get(), user, vote)
- .delete(
- new GerritCallback<JavaScriptObject>() {
- @Override
- public void onSuccess(JavaScriptObject result) {
- if (screen.isCurrentView()) {
- Gerrit.display(PageLinks.toChange(screen.getProject(), changeId));
- }
- }
- });
- }
- }
-
- private static Integer getDataId(NativeEvent event) {
- Element e = event.getEventTarget().cast();
- while (e != null) {
- String v = e.getAttribute(DATA_ID);
- if (!v.isEmpty()) {
- return Integer.parseInt(v);
- }
- e = e.getParentElement();
- }
- return null;
- }
-
- private static String getVoteId(NativeEvent event) {
- Element e = event.getEventTarget().cast();
- while (e != null) {
- String v = e.getAttribute(DATA_VOTE);
- if (!v.isEmpty()) {
- return v;
- }
- e = e.getParentElement();
- }
- return null;
- }
-
- private ChangeScreen.Style style;
-
- void init(ChangeScreen.Style style) {
- this.style = style;
- }
-
- void set(ChangeInfo info) {
- List<String> names =
- info.labels().stream()
- .sorted()
- .collect(collectingAndThen(toList(), Collections::unmodifiableList));
- Set<Integer> removable = info.removableReviewerIds();
-
- resize(names.size(), 2);
-
- for (int row = 0; row < names.size(); row++) {
- String name = names.get(row);
- LabelInfo label = info.label(name);
- setText(row, 0, name);
- if (label.all() != null) {
- setWidget(row, 1, renderUsers(label, removable));
- }
- getCellFormatter().setStyleName(row, 0, style.labelName());
- getCellFormatter().addStyleName(row, 0, getStyleForLabel(label));
- }
- }
-
- private Widget renderUsers(LabelInfo label, Set<Integer> removable) {
- Map<Integer, List<ApprovalInfo>> m = new HashMap<>(4);
- int approved = 0;
- int rejected = 0;
-
- for (ApprovalInfo ai : Natives.asList(label.all())) {
- if (ai.value() != 0) {
- List<ApprovalInfo> l = m.get(Integer.valueOf(ai.value()));
- if (l == null) {
- l = new ArrayList<>(label.all().length());
- m.put(Integer.valueOf(ai.value()), l);
- }
- l.add(ai);
-
- if (isRejected(label, ai)) {
- rejected = ai.value();
- } else if (isApproved(label, ai)) {
- approved = ai.value();
- }
- }
- }
-
- SafeHtmlBuilder html = new SafeHtmlBuilder();
- for (Integer v : sort(m.keySet(), approved, rejected)) {
- if (!html.isEmpty()) {
- html.br();
- }
-
- String val = LabelValue.formatValue(v.shortValue());
- html.openSpan();
- html.setAttribute("title", label.valueText(val));
- if (v.intValue() == approved) {
- html.setStyleName(style.label_ok());
- } else if (v.intValue() == rejected) {
- html.setStyleName(style.label_reject());
- }
- html.append(val).append(" ");
- html.append(formatUserList(style, m.get(v), removable, label.name(), null));
- html.closeSpan();
- }
- return html.toBlockWidget();
- }
-
- private static List<Integer> sort(Set<Integer> keySet, int a, int b) {
- List<Integer> r = keySet.stream().sorted().collect(toCollection(ArrayList::new));
- if (keySet.contains(a)) {
- r.remove(Integer.valueOf(a));
- r.add(0, a);
- } else if (keySet.contains(b)) {
- r.remove(Integer.valueOf(b));
- r.add(0, b);
- }
- return r;
- }
-
- private static boolean isApproved(LabelInfo label, ApprovalInfo ai) {
- return label.approved() != null && label.approved()._accountId() == ai._accountId();
- }
-
- private static boolean isRejected(LabelInfo label, ApprovalInfo ai) {
- return label.rejected() != null && label.rejected()._accountId() == ai._accountId();
- }
-
- private String getStyleForLabel(LabelInfo label) {
- switch (label.status()) {
- case OK:
- return style.label_ok();
- case NEED:
- return style.label_need();
- case REJECT:
- case IMPOSSIBLE:
- return style.label_reject();
- default:
- case MAY:
- return style.label_may();
- }
- }
-
- static SafeHtml formatUserList(
- ChangeScreen.Style style,
- Collection<? extends AccountInfo> in,
- Set<Integer> removable,
- String label,
- Map<Integer, VotableInfo> votable) {
- List<AccountInfo> users =
- in.stream()
- .sorted(
- new Comparator<AccountInfo>() {
- @Override
- public int compare(AccountInfo a, AccountInfo b) {
- String as = name(a);
- String bs = name(b);
- if (as.isEmpty()) {
- return 1;
- } else if (bs.isEmpty()) {
- return -1;
- }
- return as.compareTo(bs);
- }
-
- private String name(AccountInfo a) {
- if (a.name() != null) {
- return a.name();
- } else if (a.email() != null) {
- return a.email();
- }
- return "";
- }
- })
- .collect(collectingAndThen(toList(), Collections::unmodifiableList));
-
- SafeHtmlBuilder html = new SafeHtmlBuilder();
- Iterator<? extends AccountInfo> itr = users.iterator();
- while (itr.hasNext()) {
- AccountInfo ai = itr.next();
- AvatarInfo img = ai.avatar(AvatarInfo.DEFAULT_SIZE);
- String name;
- if (ai.name() != null) {
- name = ai.name();
- } else if (ai.email() != null) {
- name = ai.email();
- } else {
- name = Integer.toString(ai._accountId());
- }
-
- String votableCategories = "";
- if (votable != null) {
- VotableInfo vi = votable.get(ai._accountId());
- if (vi != null) {
- Set<String> s = vi.votableLabels();
- if (!s.isEmpty()) {
- StringBuilder sb = new StringBuilder(Util.C.votable());
- sb.append(" ");
- for (Iterator<String> it = vi.votableLabels().iterator(); it.hasNext(); ) {
- sb.append(it.next());
- if (it.hasNext()) {
- sb.append(", ");
- }
- }
- votableCategories = sb.toString();
- }
- }
- }
- html.openSpan()
- .setAttribute("role", "listitem")
- .setAttribute(DATA_ID, ai._accountId())
- .setAttribute("title", getTitle(ai, votableCategories))
- .setStyleName(style.label_user());
- if (label != null) {
- html.setAttribute(DATA_VOTE, label);
- }
- if (img != null) {
- html.openElement("img").setStyleName(style.avatar()).setAttribute("src", img.url());
- if (img.width() > 0) {
- html.setAttribute("width", img.width());
- }
- if (img.height() > 0) {
- html.setAttribute("height", img.height());
- }
- html.closeSelf();
- }
- html.append(name);
- if (removable.contains(ai._accountId())) {
- html.openElement("button");
- if (label != null) {
- html.setAttribute("title", Util.M.removeVote(label))
- .setAttribute("onclick", REMOVE_VOTE + "(event)");
- } else {
- html.setAttribute("title", Util.M.removeReviewer(name))
- .setAttribute("onclick", REMOVE_REVIEWER + "(event)");
- }
- html.append("×").closeElement("button");
- }
- html.closeSpan();
- if (itr.hasNext()) {
- html.append(' ');
- }
- }
- return html;
- }
-
- private static String getTitle(AccountInfo ai, String votableCategories) {
- String title = ai.email() != null ? ai.email() : "";
- if (!votableCategories.isEmpty()) {
- if (!title.isEmpty()) {
- title += " ";
- }
- title += votableCategories;
- }
- return title;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/LineComment.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/LineComment.java
deleted file mode 100644
index 5a0cc59..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/LineComment.java
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.api.ApiGlue;
-import com.google.gerrit.client.changes.CommentInfo;
-import com.google.gerrit.client.diff.DisplaySide;
-import com.google.gerrit.client.ui.CommentLinkProcessor;
-import com.google.gerrit.client.ui.InlineHyperlink;
-import com.google.gerrit.extensions.client.Side;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-
-class LineComment extends Composite {
- interface Binder extends UiBinder<HTMLPanel, LineComment> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- @UiField Element sideLoc;
- @UiField Element psLoc;
- @UiField Element psNum;
- @UiField Element fileLoc;
- @UiField Element lineLoc;
- @UiField InlineHyperlink line;
- @UiField Element message;
-
- LineComment(
- CommentLinkProcessor clp, Project.NameKey project, PatchSet.Id defaultPs, CommentInfo info) {
- initWidget(uiBinder.createAndBindUi(this));
-
- PatchSet.Id ps;
- if (info.patchSet() != defaultPs.get()) {
- ps = new PatchSet.Id(defaultPs.getParentKey(), info.patchSet());
- psNum.setInnerText(Integer.toString(info.patchSet()));
- sideLoc.removeFromParent();
- sideLoc = null;
- } else if (info.side() == Side.PARENT) {
- ps = defaultPs;
- psLoc.removeFromParent();
- psLoc = null;
- psNum = null;
- } else {
- ps = defaultPs;
- sideLoc.removeFromParent();
- sideLoc = null;
- psLoc.removeFromParent();
- psLoc = null;
- psNum = null;
- }
-
- if (info.hasLine()) {
- fileLoc.removeFromParent();
- fileLoc = null;
-
- line.setTargetHistoryToken(url(project, ps, info));
- line.setText(Integer.toString(info.line()));
-
- } else {
- lineLoc.removeFromParent();
- lineLoc = null;
- line = null;
- }
-
- if (info.message() != null) {
- message.setInnerSafeHtml(
- clp.apply(new SafeHtmlBuilder().append(info.message().trim()).wikify()));
- ApiGlue.fireEvent("comment", message);
- }
- }
-
- private static String url(Project.NameKey project, PatchSet.Id ps, CommentInfo info) {
- return Dispatcher.toPatch(
- project,
- null,
- ps,
- info.path(),
- info.side() == Side.PARENT ? DisplaySide.A : DisplaySide.B,
- info.line());
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/LineComment.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/LineComment.ui.xml
deleted file mode 100644
index f33ba51..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/LineComment.ui.xml
+++ /dev/null
@@ -1,45 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:c='urn:import:com.google.gerrit.client.ui'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:style gss='false'>
- .box {
- position: relative;
- }
- .location {
- position: absolute;
- top: 0;
- left: 0;
- font-weight: bold;
- }
- .message {
- margin-left: 135px;
- }
- </ui:style>
-
- <g:HTMLPanel styleName='{style.box}'>
- <div class='{style.location}'>
- <span ui:field='sideLoc'><ui:msg>Base, </ui:msg></span>
- <span ui:field='psLoc'><ui:msg>PS<span ui:field='psNum'/>, </ui:msg></span>
- <span ui:field='fileLoc'><ui:msg>File Comment</ui:msg></span>
- <span ui:field='lineLoc'><ui:msg>Line <c:InlineHyperlink ui:field='line'/>:</ui:msg></span>
- </div>
- <div class='{style.message}' ui:field='message'/>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/LocalComments.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/LocalComments.java
deleted file mode 100644
index d2f031a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/LocalComments.java
+++ /dev/null
@@ -1,276 +0,0 @@
-// Copyright (C) 2015 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.client.change;
-
-import com.google.gerrit.client.changes.CommentApi;
-import com.google.gerrit.client.changes.CommentInfo;
-import com.google.gerrit.client.diff.CommentRange;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.extensions.client.Side;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.storage.client.Storage;
-import com.google.gwt.user.client.Cookies;
-import java.util.ArrayList;
-import java.util.Collection;
-
-public class LocalComments {
- @Nullable private final Project.NameKey project;
- private final Change.Id changeId;
- private final PatchSet.Id psId;
- private final StorageBackend storage;
-
- private static class InlineComment {
- @Nullable final Project.NameKey project;
- final PatchSet.Id psId;
- final CommentInfo commentInfo;
-
- InlineComment(@Nullable Project.NameKey project, PatchSet.Id psId, CommentInfo commentInfo) {
- this.project = project;
- this.psId = psId;
- this.commentInfo = commentInfo;
- }
- }
-
- private static class StorageBackend {
- private final Storage storageBackend;
-
- StorageBackend() {
- storageBackend =
- (Storage.isLocalStorageSupported())
- ? Storage.getLocalStorageIfSupported()
- : Storage.getSessionStorageIfSupported();
- }
-
- String getItem(String key) {
- if (storageBackend == null) {
- return Cookies.getCookie(key);
- }
- return storageBackend.getItem(key);
- }
-
- void setItem(String key, String value) {
- if (storageBackend == null) {
- Cookies.setCookie(key, value);
- return;
- }
- storageBackend.setItem(key, value);
- }
-
- void removeItem(String key) {
- if (storageBackend == null) {
- Cookies.removeCookie(key);
- return;
- }
- storageBackend.removeItem(key);
- }
-
- Collection<String> getKeys() {
- if (storageBackend == null) {
- return Cookies.getCookieNames();
- }
- ArrayList<String> result = new ArrayList<>(storageBackend.getLength());
- for (int i = 0; i < storageBackend.getLength(); i++) {
- result.add(storageBackend.key(i));
- }
- return result;
- }
- }
-
- public LocalComments(@Nullable Project.NameKey project, Change.Id changeId) {
- this.project = project;
- this.changeId = changeId;
- this.psId = null;
- this.storage = new StorageBackend();
- }
-
- public LocalComments(@Nullable Project.NameKey project, PatchSet.Id psId) {
- this.project = project;
- this.changeId = psId.getParentKey();
- this.psId = psId;
- this.storage = new StorageBackend();
- }
-
- public String getReplyComment() {
- String comment = storage.getItem(getReplyCommentName());
- storage.removeItem(getReplyCommentName());
- return comment;
- }
-
- public void setReplyComment(String comment) {
- storage.setItem(getReplyCommentName(), comment.trim());
- }
-
- public boolean hasReplyComment() {
- return storage.getKeys().contains(getReplyCommentName());
- }
-
- public void removeReplyComment() {
- if (hasReplyComment()) {
- storage.removeItem(getReplyCommentName());
- }
- }
-
- private String getReplyCommentName() {
- return "savedReplyComment~" + PageLinks.toChangeId(project, changeId);
- }
-
- public static void saveInlineComments() {
- final StorageBackend storage = new StorageBackend();
- for (String cookie : storage.getKeys()) {
- if (isInlineComment(cookie)) {
- InlineComment input = getInlineComment(cookie);
- if (input.commentInfo.id() == null) {
- CommentApi.createDraft(
- Project.NameKey.asStringOrNull(input.project),
- input.psId,
- input.commentInfo,
- new GerritCallback<CommentInfo>() {
- @Override
- public void onSuccess(CommentInfo result) {
- storage.removeItem(cookie);
- }
- });
- } else {
- CommentApi.updateDraft(
- Project.NameKey.asStringOrNull(input.project),
- input.psId,
- input.commentInfo.id(),
- input.commentInfo,
- new GerritCallback<CommentInfo>() {
- @Override
- public void onSuccess(CommentInfo result) {
- storage.removeItem(cookie);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- if (RestApi.isNotFound(caught)) {
- // the draft comment, that was supposed to be updated,
- // was deleted in the meantime
- storage.removeItem(cookie);
- } else {
- super.onFailure(caught);
- }
- }
- });
- }
- }
- }
- }
-
- public void setInlineComment(CommentInfo comment) {
- String name = getInlineCommentName(comment);
- if (name == null) {
- // Failed to get the store key -- so we can't continue.
- return;
- }
- storage.setItem(name, comment.message().trim());
- }
-
- public boolean hasInlineComments() {
- for (String cookie : storage.getKeys()) {
- if (isInlineComment(cookie)) {
- return true;
- }
- }
- return false;
- }
-
- private static boolean isInlineComment(String key) {
- return key.startsWith("patchCommentEdit~")
- || key.startsWith("patchReply~")
- || key.startsWith("patchComment~");
- }
-
- private static InlineComment getInlineComment(String key) {
- String path;
- Side side;
- int line;
- CommentRange range;
- StorageBackend storage = new StorageBackend();
-
- String[] elements = key.split("~");
- int offset = 1;
- if (key.startsWith("patchReply~") || key.startsWith("patchCommentEdit~")) {
- offset = 2;
- }
- ProjectChangeId id = ProjectChangeId.create(elements[offset + 0]);
- PatchSet.Id psId = new PatchSet.Id(id.getChangeId(), Integer.parseInt(elements[offset + 1]));
- path = atob(elements[offset + 2]);
- side = (Side.PARENT.toString().equals(elements[offset + 3])) ? Side.PARENT : Side.REVISION;
- range = null;
- if (elements[offset + 4].startsWith("R")) {
- String rangeStart = elements[offset + 4].substring(1);
- String rangeEnd = elements[offset + 5];
- String[] split = rangeStart.split(",");
- int sl = Integer.parseInt(split[0]);
- int sc = Integer.parseInt(split[1]);
- split = rangeEnd.split(",");
- int el = Integer.parseInt(split[0]);
- int ec = Integer.parseInt(split[1]);
- range = CommentRange.create(sl, sc, el, ec);
- line = sl;
- } else {
- line = Integer.parseInt(elements[offset + 4]);
- }
- CommentInfo info = CommentInfo.create(path, side, line, range, false);
- info.message(storage.getItem(key));
- if (key.startsWith("patchReply~")) {
- info.inReplyTo(elements[1]);
- } else if (key.startsWith("patchCommentEdit~")) {
- info.id(elements[1]);
- }
- InlineComment inlineComment = new InlineComment(id.getProject(), psId, info);
- return inlineComment;
- }
-
- private String getInlineCommentName(CommentInfo comment) {
- if (psId == null) {
- return null;
- }
- String result = "patchComment~";
- if (comment.id() != null) {
- result = "patchCommentEdit~" + comment.id() + "~";
- } else if (comment.inReplyTo() != null) {
- result = "patchReply~" + comment.inReplyTo() + "~";
- }
-
- result += PageLinks.toChangeId(project, changeId);
- result += "~" + psId.getId() + "~" + btoa(comment.path()) + "~" + comment.side() + "~";
- if (comment.hasRange()) {
- result +=
- "R"
- + comment.range().startLine()
- + ","
- + comment.range().startCharacter()
- + "~"
- + comment.range().endLine()
- + ","
- + comment.range().endCharacter();
- } else {
- result += comment.line();
- }
- return result;
- }
-
- private static native String btoa(String a) /*-{ return btoa(a); }-*/;
-
- private static native String atob(String b) /*-{ return atob(b); }-*/;
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Message.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Message.java
deleted file mode 100644
index cadaf97..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Message.java
+++ /dev/null
@@ -1,209 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.AvatarImage;
-import com.google.gerrit.client.FormatUtil;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.api.ApiGlue;
-import com.google.gerrit.client.changes.CommentInfo;
-import com.google.gerrit.client.changes.Util;
-import com.google.gerrit.client.info.ChangeInfo.MessageInfo;
-import com.google.gerrit.client.ui.CommentLinkProcessor;
-import com.google.gerrit.reviewdb.client.Patch;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.Style.Visibility;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-class Message extends Composite {
- interface Binder extends UiBinder<HTMLPanel, Message> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- interface Style extends CssResource {
- String closed();
- }
-
- @UiField Style style;
- @UiField HTMLPanel header;
- @UiField Element name;
- @UiField Element summary;
- @UiField Element date;
- @UiField Button reply;
- @UiField Element message;
- @UiField FlowPanel comments;
-
- private final History history;
- private final MessageInfo info;
- private List<CommentInfo> commentList;
- private boolean autoOpen;
-
- @UiField(provided = true)
- AvatarImage avatar;
-
- Message(History parent, MessageInfo info) {
- if (info.author() != null) {
- avatar = new AvatarImage(info.author());
- avatar.setSize("", "");
- } else {
- avatar = new AvatarImage();
- }
-
- initWidget(uiBinder.createAndBindUi(this));
- header.addDomHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- setOpen(!isOpen());
- }
- },
- ClickEvent.getType());
-
- this.history = parent;
- this.info = info;
-
- setName(false);
- date.setInnerText(FormatUtil.shortFormatDayTime(info.date()));
- if (info.message() != null) {
- String msg = info.message().trim();
- summary.setInnerText(msg);
- message.setInnerSafeHtml(
- history.getCommentLinkProcessor().apply(new SafeHtmlBuilder().append(msg).wikify()));
- ApiGlue.fireEvent("comment", message);
- } else {
- reply.getElement().getStyle().setVisibility(Visibility.HIDDEN);
- }
- }
-
- @UiHandler("reply")
- void onReply(ClickEvent e) {
- e.stopPropagation();
-
- if (Gerrit.isSignedIn()) {
- history.replyTo(info);
- } else {
- Gerrit.doSignIn(com.google.gwt.user.client.History.getToken());
- }
- }
-
- MessageInfo getMessageInfo() {
- return info;
- }
-
- private boolean isOpen() {
- return UIObject.isVisible(message);
- }
-
- void setOpen(boolean open) {
- if (open && info._revisionNumber() > 0 && !commentList.isEmpty()) {
- renderComments(commentList);
- commentList = Collections.emptyList();
- }
- setName(open);
-
- UIObject.setVisible(summary, !open);
- UIObject.setVisible(message, open);
- comments.setVisible(open && comments.getWidgetCount() > 0);
- if (open) {
- removeStyleName(style.closed());
- } else {
- addStyleName(style.closed());
- }
- }
-
- private void setName(boolean open) {
- name.setInnerText(
- open ? authorName(info) : com.google.gerrit.common.FormatUtil.elide(authorName(info), 20));
- }
-
- void autoOpen() {
- if (commentList == null) {
- autoOpen = true;
- } else if (!commentList.isEmpty()) {
- setOpen(true);
- }
- }
-
- void addComments(List<CommentInfo> list) {
- if (isOpen()) {
- renderComments(list);
- comments.setVisible(comments.getWidgetCount() > 0);
- commentList = Collections.emptyList();
- } else {
- commentList = list;
- if (autoOpen && !commentList.isEmpty()) {
- setOpen(true);
- }
- }
- }
-
- private void renderComments(List<CommentInfo> list) {
- CommentLinkProcessor clp = history.getCommentLinkProcessor();
- PatchSet.Id ps = new PatchSet.Id(history.getChangeId(), info._revisionNumber());
- TreeMap<String, List<CommentInfo>> m = byPath(list);
- List<CommentInfo> l = m.remove(Patch.COMMIT_MSG);
- if (l != null) {
- comments.add(new FileComments(clp, history.getProject(), ps, Util.C.commitMessage(), l));
- }
- l = m.remove(Patch.MERGE_LIST);
- if (l != null) {
- comments.add(new FileComments(clp, history.getProject(), ps, Util.C.mergeList(), l));
- }
- for (Map.Entry<String, List<CommentInfo>> e : m.entrySet()) {
- comments.add(new FileComments(clp, history.getProject(), ps, e.getKey(), e.getValue()));
- }
- }
-
- private static TreeMap<String, List<CommentInfo>> byPath(List<CommentInfo> list) {
- TreeMap<String, List<CommentInfo>> m = new TreeMap<>();
- for (CommentInfo c : list) {
- List<CommentInfo> l = m.get(c.path());
- if (l == null) {
- l = new ArrayList<>();
- m.put(c.path(), l);
- }
- l.add(c);
- }
- return m;
- }
-
- static String authorName(MessageInfo info) {
- if (info.author() != null) {
- if (info.author().name() != null) {
- return info.author().name();
- }
- return Gerrit.info().user().anonymousCowardName();
- }
- return Util.C.messageNoAuthor();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Message.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Message.ui.xml
deleted file mode 100644
index e362c07..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Message.ui.xml
+++ /dev/null
@@ -1,136 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:c='urn:import:com.google.gerrit.client'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:style gss='false' type='com.google.gerrit.client.change.Message.Style'>
- .messageBox {
- position: relative;
- width: 1168px;
- padding: 2px 0 2px 0;
- border-left: 1px solid #e3e9ff;
- border-right: 1px solid #e3e9ff;
- border-bottom: 1px solid #e3e9ff;
- -webkit-border-bottom-left-radius: 8px;
- -webkit-border-bottom-right-radius: 8px;
- }
-
- .header {
- cursor: pointer;
- }
-
- .avatar {
- position: absolute;
- width: 26px;
- height: 26px;
- }
- .closed .avatar {
- position: absolute;
- top: 0;
- left: -1px;
- width: 20px;
- height: 20px;
- }
-
- .contents {
- margin-left: 28px;
- position: relative;
- }
-
- .contents p,
- .contents blockquote {
- -webkit-margin-before: 0;
- -webkit-margin-after: 0.3em;
- white-space: pre-wrap;
- }
-
- .name {
- white-space: nowrap;
- font-weight: bold;
- }
- .closed .name {
- width: 150px;
- overflow: hidden;
- font-weight: normal;
- }
-
- .summary {
- color: #777;
- position: absolute;
- top: 0;
- left: 150px;
- width: 880px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-
- .date {
- white-space: nowrap;
- position: absolute;
- top: 0;
- right: 18px;
- }
-
- .reply {
- position: absolute;
- top: 0;
- right: 1px;
- cursor: pointer;
- outline: none;
- border: none;
- background: transparent;
- margin: 0;
- padding: 0;
- line-height: 15px;
- font-family: Arial Unicode MS, sans-serif;
- font-size: 18px;
- }
- .closed .reply {
- visibility: hidden;
- }
- .comment {
- }
- </ui:style>
-
- <g:HTMLPanel
- styleName='{style.messageBox}'
- addStyleNames='{style.closed}'>
- <c:AvatarImage ui:field='avatar' styleName='{style.avatar}'/>
- <div class='{style.contents}'>
- <g:HTMLPanel ui:field='header' styleName='{style.header}'>
- <div class='{style.name}' ui:field='name'/>
- <div ui:field='summary' class='{style.summary}'/>
- <div class='{style.date}' ui:field='date'/>
- <g:Button styleName='{style.reply}'
- ui:field='reply'
- title='Reply to this message'>
- <ui:attribute name='title'/>
- <div>↩</div>
- </g:Button>
- </g:HTMLPanel>
- <div style='overflow: auto'>
- <div ui:field='message'
- aria-hidden='true'
- style='display: NONE'
- styleName='{style.comment}'/>
- <g:FlowPanel ui:field='comments' visible='false'/>
- </div>
- </div>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/MoveAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/MoveAction.java
deleted file mode 100644
index e3e9525..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/MoveAction.java
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (C) 2017 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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.Util;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.ui.MoveDialog;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.PopupPanel;
-
-class MoveAction {
- static void call(Button b, ChangeInfo info, Project.NameKey project) {
- b.setEnabled(false);
- new MoveDialog(project) {
- {
- sendButton.setText(Util.C.moveChangeSend());
- }
-
- @Override
- public void onSend() {
- ChangeApi.move(
- info.project(),
- info.legacyId().get(),
- getDestinationBranch(),
- getMessageText(),
- new GerritCallback<ChangeInfo>() {
- @Override
- public void onSuccess(ChangeInfo result) {
- sent = true;
- hide();
- Gerrit.display(PageLinks.toChange(project, result.legacyId()));
- }
-
- @Override
- public void onFailure(Throwable caught) {
- enableButtons(true);
- super.onFailure(caught);
- }
- });
- }
-
- @Override
- public void onClose(CloseEvent<PopupPanel> event) {
- super.onClose(event);
- b.setEnabled(true);
- }
- }.center();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/PatchSetsAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/PatchSetsAction.java
deleted file mode 100644
index faf2516..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/PatchSetsAction.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.info.ChangeInfo.EditInfo;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwt.user.client.ui.Widget;
-
-class PatchSetsAction extends RightSidePopdownAction {
- private final PatchSetsBox revisionBox;
-
- PatchSetsAction(
- Project.NameKey project,
- Change.Id changeId,
- String revision,
- EditInfo edit,
- ChangeScreen.Style style,
- UIObject relativeTo,
- Widget downloadButton) {
- super(style, relativeTo, downloadButton);
- this.revisionBox = new PatchSetsBox(project, changeId, revision, edit);
- }
-
- @Override
- Widget getWidget() {
- return revisionBox;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/PatchSetsBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/PatchSetsBox.java
deleted file mode 100644
index 35cab4e..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/PatchSetsBox.java
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.FormatUtil;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.ChangeList;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.CommitInfo;
-import com.google.gerrit.client.info.ChangeInfo.EditInfo;
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.client.ui.FancyFlexTableImpl;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.extensions.client.ListChangesOption;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.NativeEvent;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Event;
-import com.google.gwt.user.client.EventListener;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlexTable;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-import java.util.Collections;
-import java.util.EnumSet;
-
-class PatchSetsBox extends Composite {
- interface Binder extends UiBinder<HTMLPanel, PatchSetsBox> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- private static final String OPEN;
- private static final HyperlinkImpl link = GWT.create(HyperlinkImpl.class);
-
- static {
- OPEN = DOM.createUniqueId().replace('-', '_');
- init(OPEN);
- }
-
- private static native void init(String o) /*-{
- $wnd[o] = $entry(function(e,i) {
- return @com.google.gerrit.client.change.PatchSetsBox::onOpen(Lcom/google/gwt/dom/client/NativeEvent;I)(e,i);
- });
- }-*/;
-
- private static boolean onOpen(NativeEvent e, int idx) {
- if (link.handleAsClick(e.<Event>cast())) {
- PatchSetsBox t = getRevisionBox(e);
- if (t != null) {
- t.onOpenRow(idx);
- e.preventDefault();
- return false;
- }
- }
- return true;
- }
-
- private static PatchSetsBox getRevisionBox(NativeEvent event) {
- Element e = event.getEventTarget().cast();
- for (e = DOM.getParent(e); e != null; e = DOM.getParent(e)) {
- EventListener l = DOM.getEventListener(e);
- if (l instanceof PatchSetsBox) {
- return (PatchSetsBox) l;
- }
- }
- return null;
- }
-
- interface Style extends CssResource {
- String current();
-
- String legacy_id();
-
- String commit();
-
- String draft_comment();
- }
-
- private final Change.Id changeId;
- private final Project.NameKey project;
- private final String revision;
- private final EditInfo edit;
- private boolean loaded;
- private JsArray<RevisionInfo> revisions;
-
- @UiField FlexTable table;
- @UiField Style style;
-
- PatchSetsBox(Project.NameKey project, Change.Id changeId, String revision, EditInfo edit) {
- this.project = project;
- this.changeId = changeId;
- this.revision = revision;
- this.edit = edit;
- initWidget(uiBinder.createAndBindUi(this));
- }
-
- @Override
- protected void onLoad() {
- if (!loaded) {
- RestApi call = ChangeApi.detail(project.get(), changeId.get());
- ChangeList.addOptions(
- call, EnumSet.of(ListChangesOption.ALL_COMMITS, ListChangesOption.ALL_REVISIONS));
- call.get(
- new AsyncCallback<ChangeInfo>() {
- @Override
- public void onSuccess(ChangeInfo result) {
- if (edit != null) {
- edit.setName(edit.commit().commit());
- result.revisions().put(edit.name(), RevisionInfo.fromEdit(edit));
- }
- render(result.revisions());
- loaded = true;
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- });
- }
- }
-
- private void onOpenRow(int idx) {
- closeParent();
- Gerrit.display(url(revisions.get(idx)));
- }
-
- private void render(NativeMap<RevisionInfo> map) {
- map.copyKeysIntoChildren("name");
-
- revisions = map.values();
- RevisionInfo.sortRevisionInfoByNumber(revisions);
- Collections.reverse(Natives.asList(revisions));
-
- SafeHtmlBuilder sb = new SafeHtmlBuilder();
- header(sb);
- for (int i = 0; i < revisions.length(); i++) {
- revision(sb, i, revisions.get(i));
- }
-
- GWT.<FancyFlexTableImpl>create(FancyFlexTableImpl.class).resetHtml(table, sb);
- }
-
- private void header(SafeHtmlBuilder sb) {
- sb.openTr()
- .openTh()
- .setStyleName(style.legacy_id())
- .append(Resources.C.patchSet())
- .closeTh()
- .openTh()
- .append(Resources.C.commit())
- .closeTh()
- .openTh()
- .append(Resources.C.date())
- .closeTh()
- .openTh()
- .append(Resources.C.author())
- .closeTh()
- .closeTr();
- }
-
- private void revision(SafeHtmlBuilder sb, int index, RevisionInfo r) {
- CommitInfo c = r.commit();
- sb.openTr();
- if (revision.equals(r.name())) {
- sb.setStyleName(style.current());
- }
-
- sb.openTd().setStyleName(style.legacy_id());
- sb.append(r.id());
- sb.closeTd();
-
- sb.openTd()
- .setStyleName(style.commit())
- .openAnchor()
- .setAttribute("href", "#" + url(r))
- .setAttribute("onclick", OPEN + "(event," + index + ")")
- .append(r.name().substring(0, 10))
- .closeAnchor()
- .closeTd();
-
- sb.openTd().append(FormatUtil.shortFormatDayTime(c.committer().date())).closeTd();
-
- String an = c.author() != null ? c.author().name() : "";
- String cn = c.committer() != null ? c.committer().name() : "";
- sb.openTd();
- sb.append(an);
- if (!"".equals(an) && !"".equals(cn) && !an.equals(cn)) {
- sb.append(" / ").append(cn);
- }
- sb.closeTd();
-
- sb.closeTr();
- }
-
- private String url(RevisionInfo r) {
- return PageLinks.toChange(project, changeId, r.id());
- }
-
- private void closeParent() {
- for (Widget w = getParent(); w != null; w = w.getParent()) {
- if (w instanceof PopupPanel) {
- ((PopupPanel) w).hide(true);
- break;
- }
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/PatchSetsBox.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/PatchSetsBox.ui.xml
deleted file mode 100644
index 7537aa4..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/PatchSetsBox.ui.xml
+++ /dev/null
@@ -1,76 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:with field='res' type='com.google.gerrit.client.change.Resources'/>
- <ui:style gss='false' type='com.google.gerrit.client.change.PatchSetsBox.Style'>
- @eval selectionColor com.google.gerrit.client.Gerrit.getTheme().selectionColor;
-
- .revisionBox {
- min-width: 300px;
- margin: 10px 0px 5px 5px;
- }
-
- .scroll {
- min-width: 300px;
- height: 200px;
- }
-
- .table {
- border-spacing: 0;
- width: 100%;
- }
-
- .table td, .table th {
- padding-left: 5px;
- padding-right: 5px;
- border-right: 2px solid #ddd;
- white-space: nowrap;
- }
-
- .table tr.current {
- background-color: selectionColor;
- }
- .table tr.current a {
- pointer-events: none;
- color: #000;
- }
-
- .legacy_id {
- min-width: 50px;
- text-align: right;
- font-weight: bold;
- }
-
- .commit {
- font-family: monospace;
- }
-
- .draft_comment {
- margin: 0 2px 0 0;
- width: 16px;
- height: 16px;
- vertical-align: bottom;
- }
- </ui:style>
- <g:HTMLPanel styleName='{style.revisionBox}'>
- <g:ScrollPanel styleName='{style.scroll}'>
- <g:FlexTable ui:field='table' styleName='{style.table}'/>
- </g:ScrollPanel>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/PathSuggestOracle.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/PathSuggestOracle.java
deleted file mode 100644
index 7668f0f..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/PathSuggestOracle.java
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (C) 2015 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.client.change;
-
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwtexpui.safehtml.client.HighlightSuggestOracle;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-class PathSuggestOracle extends HighlightSuggestOracle {
-
- private final Project.NameKey project;
- private final Change.Id changeId;
- private final RevisionInfo revision;
-
- PathSuggestOracle(Project.NameKey project, Change.Id changeId, RevisionInfo revision) {
- this.project = project;
- this.changeId = changeId;
- this.revision = revision;
- }
-
- @Override
- protected void onRequestSuggestions(Request req, Callback cb) {
- RestApi api = ChangeApi.revision(project.get(), changeId.get(), revision.name()).view("files");
- if (req.getQuery() != null) {
- api.addParameter("q", req.getQuery() == null ? "" : req.getQuery());
- }
- api.background()
- .get(
- new AsyncCallback<JsArrayString>() {
- @Override
- public void onSuccess(JsArrayString result) {
- List<Suggestion> r = new ArrayList<>();
- for (String path : Natives.asList(result)) {
- r.add(new PathSuggestion(path));
- }
- cb.onSuggestionsReady(req, new Response(r));
- }
-
- @Override
- public void onFailure(Throwable caught) {
- List<Suggestion> none = Collections.emptyList();
- cb.onSuggestionsReady(req, new Response(none));
- }
- });
- }
-
- private static class PathSuggestion implements Suggestion {
- private final String path;
-
- PathSuggestion(String path) {
- this.path = path;
- }
-
- @Override
- public String getDisplayString() {
- return path;
- }
-
- @Override
- public String getReplacementString() {
- return path;
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ProjectChangeId.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ProjectChangeId.java
deleted file mode 100644
index 684867b..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ProjectChangeId.java
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright (C) 2017 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.client.change;
-
-import com.google.common.annotations.VisibleForTesting;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import java.util.Objects;
-
-/** Provides logic for parsing a numeric change id and project from a URL. */
-public class ProjectChangeId {
-
- /** Parses a {@link ProjectChangeId} from it's string representation. */
- public static ProjectChangeId create(String token) {
- String mutableToken = token;
- // Try parsing /c/project/+/numericChangeId where token is project/+/numericChangeId
- int delimiter = mutableToken.indexOf(PageLinks.PROJECT_CHANGE_DELIMITER);
- Project.NameKey project = null;
- if (delimiter > 0) {
- project = new Project.NameKey(token.substring(0, delimiter));
- mutableToken =
- mutableToken.substring(delimiter + PageLinks.PROJECT_CHANGE_DELIMITER.length());
- }
-
- // Try parsing /c/numericChangeId where token is numericChangeId
- int s = mutableToken.indexOf('/');
- if (s > 0) {
- mutableToken = mutableToken.substring(0, s);
- }
- // Special case: project/+/1233,edit/
- s = mutableToken.indexOf(",edit");
- if (s > 0) {
- mutableToken = mutableToken.substring(0, s);
- }
- Integer cId = tryParse(mutableToken);
- if (cId != null) {
- return new ProjectChangeId(project, new Change.Id(cId));
- }
-
- throw new IllegalArgumentException(token + " is not a valid change identifier");
- }
-
- @Nullable private final Project.NameKey project;
- private final Change.Id changeId;
-
- @VisibleForTesting
- ProjectChangeId(@Nullable Project.NameKey project, Change.Id changeId) {
- this.project = project;
- this.changeId = changeId;
- }
-
- @Nullable
- public Project.NameKey getProject() {
- return project;
- }
-
- public Change.Id getChangeId() {
- return changeId;
- }
-
- /**
- * Calculate the length of the string representation of the change ID that was parsed from the
- * token.
- *
- * @return the length of the {@link com.google.gerrit.reviewdb.client.Change.Id} if no project was
- * parsed from the token. The length of {@link
- * com.google.gerrit.reviewdb.client.Project.NameKey} + the delimiter + the length of {@link
- * com.google.gerrit.reviewdb.client.Change.Id} otherwise.
- */
- public int identifierLength() {
- if (project == null) {
- return String.valueOf(changeId).length();
- }
- return PageLinks.toChangeId(project, changeId).length();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof ProjectChangeId) {
- ProjectChangeId other = (ProjectChangeId) obj;
- return Objects.equals(changeId, other.changeId) && Objects.equals(project, other.project);
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(changeId, project);
- }
-
- @Override
- public String toString() {
- return "ProjectChangeId.Result{changeId: " + changeId + ", project: " + project + "}";
- }
-
- private static Integer tryParse(String s) {
- try {
- return Integer.parseInt(s);
- } catch (NumberFormatException e) {
- return null;
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/QuickApprove.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/QuickApprove.java
deleted file mode 100644
index 56cc7a7..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/QuickApprove.java
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.ReviewInput;
-import com.google.gerrit.client.changes.ReviewInput.DraftHandling;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.LabelInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-
-/** Applies a label with one mouse click. */
-class QuickApprove extends Button implements ClickHandler {
- private Change.Id changeId;
- private Project.NameKey project;
- private String revision;
- private ReviewInput input;
- private ReplyAction replyAction;
-
- QuickApprove() {
- addClickHandler(this);
- }
-
- void set(ChangeInfo info, String commit, ReplyAction action) {
- if (!info.hasPermittedLabels() || !info.status().isOpen()) {
- // Quick approve needs at least one label on an open change.
- setVisible(false);
- return;
- }
- if (info.revision(commit).isEdit()) {
- setVisible(false);
- return;
- }
-
- String qName = null;
- String qValueStr = null;
- short qValue = 0;
-
- int index = info.getMissingLabelIndex();
- if (index != -1) {
- LabelInfo label = Natives.asList(info.allLabels().values()).get(index);
- JsArrayString values = info.permittedValues(label.name());
- String s = values.get(values.length() - 1);
- short v = LabelInfo.parseValue(s);
- if (v > 0 && s.equals(label.maxValue())) {
- qName = label.name();
- qValueStr = s;
- qValue = v;
- }
- }
-
- if (qName != null) {
- changeId = info.legacyId();
- project = info.projectNameKey();
- revision = commit;
- input = ReviewInput.create();
- input.drafts(DraftHandling.PUBLISH_ALL_REVISIONS);
- input.label(qName, qValue);
- replyAction = action;
- setText(qName + qValueStr);
- setVisible(true);
- } else {
- setVisible(false);
- }
- }
-
- @Override
- public void setText(String text) {
- setHTML(new SafeHtmlBuilder().openDiv().append(text).closeDiv());
- }
-
- @Override
- public void onClick(ClickEvent event) {
- if (replyAction != null && replyAction.isVisible()) {
- replyAction.quickApprove(input);
- } else {
- ChangeApi.revision(project.get(), changeId.get(), revision)
- .view("review")
- .post(
- input,
- new GerritCallback<ReviewInput>() {
- @Override
- public void onSuccess(ReviewInput result) {
- Gerrit.display(PageLinks.toChange(project, changeId));
- }
- });
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RebaseAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RebaseAction.java
deleted file mode 100644
index 0e3e835..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RebaseAction.java
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.ui.RebaseDialog;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.PopupPanel;
-
-class RebaseAction {
- static void call(
- final Button b,
- final Project.NameKey project,
- final String branch,
- final Change.Id id,
- final String revision,
- final boolean enabled) {
- b.setEnabled(false);
-
- new RebaseDialog(project, branch, id, enabled) {
- @Override
- public void onSend() {
- ChangeApi.rebase(
- project.get(),
- id.get(),
- revision,
- getBase(),
- new GerritCallback<ChangeInfo>() {
- @Override
- public void onSuccess(ChangeInfo result) {
- sent = true;
- hide();
- Gerrit.display(PageLinks.toChange(project, id));
- }
-
- @Override
- public void onFailure(Throwable caught) {
- enableButtons(true);
- super.onFailure(caught);
- }
- });
- }
-
- @Override
- public void onClose(CloseEvent<PopupPanel> event) {
- super.onClose(event);
- b.setEnabled(true);
- }
- }.center();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChanges.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChanges.java
deleted file mode 100644
index 2c52800..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChanges.java
+++ /dev/null
@@ -1,459 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import static com.google.gerrit.common.PageLinks.op;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.ChangeList;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.CommitInfo;
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.extensions.client.ListChangesOption;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.event.logical.shared.SelectionEvent;
-import com.google.gwt.event.logical.shared.SelectionHandler;
-import com.google.gwt.resources.client.ClientBundle;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.TabBar;
-import com.google.gwt.user.client.ui.TabPanel;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.List;
-
-public class RelatedChanges extends TabPanel {
- static final RelatedChangesResources R = GWT.create(RelatedChangesResources.class);
-
- interface RelatedChangesResources extends ClientBundle {
- @Source("related_changes.css")
- RelatedChangesCss css();
- }
-
- interface RelatedChangesCss extends CssResource {
- String activeRow();
-
- String current();
-
- String gitweb();
-
- String indirect();
-
- String notCurrent();
-
- String pointer();
-
- String row();
-
- String subject();
-
- String strikedSubject();
-
- String submittable();
-
- String tabPanel();
- }
-
- enum Tab {
- RELATED_CHANGES(Resources.C.relatedChanges(), Resources.C.relatedChangesTooltip()) {
- @Override
- String getTitle(int count) {
- return Resources.M.relatedChanges(count);
- }
-
- @Override
- String getTitle(String count) {
- return Resources.M.relatedChanges(count);
- }
- },
-
- SUBMITTED_TOGETHER(Resources.C.submittedTogether(), Resources.C.submittedTogether()) {
- @Override
- String getTitle(int count) {
- return Resources.M.submittedTogether(count);
- }
-
- @Override
- String getTitle(String count) {
- return Resources.M.submittedTogether(count);
- }
- },
-
- SAME_TOPIC(Resources.C.sameTopic(), Resources.C.sameTopicTooltip()) {
- @Override
- String getTitle(int count) {
- return Resources.M.sameTopic(count);
- }
-
- @Override
- String getTitle(String count) {
- return Resources.M.sameTopic(count);
- }
- },
-
- CONFLICTING_CHANGES(Resources.C.conflictingChanges(), Resources.C.conflictingChangesTooltip()) {
- @Override
- String getTitle(int count) {
- return Resources.M.conflictingChanges(count);
- }
-
- @Override
- String getTitle(String count) {
- return Resources.M.conflictingChanges(count);
- }
- },
-
- CHERRY_PICKS(Resources.C.cherryPicks(), Resources.C.cherryPicksTooltip()) {
- @Override
- String getTitle(int count) {
- return Resources.M.cherryPicks(count);
- }
-
- @Override
- String getTitle(String count) {
- return Resources.M.cherryPicks(count);
- }
- };
-
- final String defaultTitle;
- final String tooltip;
-
- abstract String getTitle(int count);
-
- abstract String getTitle(String count);
-
- Tab(String defaultTitle, String tooltip) {
- this.defaultTitle = defaultTitle;
- this.tooltip = tooltip;
- }
- }
-
- private static Tab savedTab;
-
- private final List<RelatedChangesTab> tabs;
- private int maxHeightWithHeader;
- private int selectedTab;
- private int outstandingCallbacks;
-
- RelatedChanges() {
- tabs = new ArrayList<>(Tab.values().length);
- selectedTab = -1;
-
- setVisible(false);
- addStyleName(R.css().tabPanel());
- initTabBar();
- }
-
- private void initTabBar() {
- TabBar tabBar = getTabBar();
- tabBar.addSelectionHandler(
- new SelectionHandler<Integer>() {
- @Override
- public void onSelection(SelectionEvent<Integer> event) {
- if (selectedTab >= 0) {
- tabs.get(selectedTab).registerKeys(false);
- }
- selectedTab = event.getSelectedItem();
- tabs.get(selectedTab).registerKeys(true);
- }
- });
-
- for (Tab tabInfo : Tab.values()) {
- RelatedChangesTab panel = new RelatedChangesTab(tabInfo);
- add(panel, tabInfo.defaultTitle);
- tabs.add(panel);
-
- TabBar.Tab tab = tabBar.getTab(tabInfo.ordinal());
- tab.setWordWrap(false);
- ((Composite) tab).setTitle(tabInfo.tooltip);
-
- setTabEnabled(tabInfo, false);
- }
- getTab(Tab.RELATED_CHANGES).setShowIndirectAncestors(true);
- getTab(Tab.CHERRY_PICKS).setShowBranches(true);
- getTab(Tab.SAME_TOPIC).setShowBranches(true);
- getTab(Tab.SAME_TOPIC).setShowProjects(true);
- getTab(Tab.SAME_TOPIC).setShowSubmittable(true);
- getTab(Tab.SUBMITTED_TOGETHER).setShowBranches(true);
- getTab(Tab.SUBMITTED_TOGETHER).setShowProjects(true);
- getTab(Tab.SUBMITTED_TOGETHER).setShowSubmittable(true);
- }
-
- void set(ChangeInfo info, String revision) {
- if (info.status().isOpen()) {
- setForOpenChange(info, revision);
- }
-
- ChangeApi.revision(info.project(), info.legacyId().get(), revision)
- .view("related")
- .get(
- new TabCallback<RelatedInfo>(Tab.RELATED_CHANGES, info.project(), revision) {
- @Override
- public JsArray<ChangeAndCommit> convert(RelatedInfo result) {
- return result.changes();
- }
- });
-
- StringBuilder cherryPicksQuery = new StringBuilder();
- cherryPicksQuery.append(op("project", info.project()));
- cherryPicksQuery.append(" ").append(op("change", info.changeId()));
- cherryPicksQuery.append(" ").append(op("-change", info.legacyId().get()));
- cherryPicksQuery.append(" -is:abandoned");
- ChangeList.query(
- cherryPicksQuery.toString(),
- EnumSet.of(ListChangesOption.CURRENT_REVISION, ListChangesOption.CURRENT_COMMIT),
- new TabChangeListCallback(Tab.CHERRY_PICKS, info.project(), revision));
-
- if (info.currentRevision() != null && info.currentRevision().equals(revision)) {
- ChangeApi.change(info.project(), info.legacyId().get())
- .view("submitted_together")
- .addParameter("o", "CURRENT_COMMIT")
- .get(new TabChangeListCallback(Tab.SUBMITTED_TOGETHER, info.project(), revision));
- }
-
- if (!Gerrit.info().change().isSubmitWholeTopicEnabled()
- && info.topic() != null
- && !"".equals(info.topic())) {
- StringBuilder topicQuery =
- new StringBuilder()
- .append("status:open")
- .append(" ")
- .append(op("-change", info.legacyId().get()))
- .append(" ")
- .append(op("topic", info.topic()));
- ChangeList.query(
- topicQuery.toString(),
- EnumSet.of(
- ListChangesOption.CURRENT_REVISION,
- ListChangesOption.CURRENT_COMMIT,
- ListChangesOption.DETAILED_LABELS,
- ListChangesOption.LABELS),
- new TabChangeListCallback(Tab.SAME_TOPIC, info.project(), revision));
- }
- }
-
- private void setForOpenChange(ChangeInfo info, String revision) {
- if (info.mergeable()) {
- StringBuilder conflictsQuery = new StringBuilder();
- conflictsQuery.append("status:open");
- conflictsQuery.append(" is:mergeable");
- conflictsQuery.append(" ").append(op("conflicts", info.legacyId().get()));
- ChangeList.query(
- conflictsQuery.toString(),
- EnumSet.of(ListChangesOption.CURRENT_REVISION, ListChangesOption.CURRENT_COMMIT),
- new TabChangeListCallback(Tab.CONFLICTING_CHANGES, info.project(), revision));
- }
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- R.css().ensureInjected();
- }
-
- static void setSavedTab(Tab subject) {
- savedTab = subject;
- }
-
- private RelatedChangesTab getTab(Tab tabInfo) {
- return tabs.get(tabInfo.ordinal());
- }
-
- private void setTabTitle(Tab tabInfo, String title) {
- getTabBar().setTabText(tabInfo.ordinal(), title);
- }
-
- private void setTabEnabled(Tab tabInfo, boolean enabled) {
- getTabBar().setTabEnabled(tabInfo.ordinal(), enabled);
- }
-
- void setMaxHeight(int height) {
- maxHeightWithHeader = height;
- if (isVisible()) {
- applyMaxHeight();
- }
- }
-
- private void applyMaxHeight() {
- int header = getTabBar().getOffsetHeight() + 2 /* padding */;
- for (int i = 0; i < getTabBar().getTabCount(); i++) {
- tabs.get(i).setMaxHeight(maxHeightWithHeader - header);
- }
- }
-
- private abstract class TabCallback<T> implements AsyncCallback<T> {
- private final Tab tabInfo;
- private final String project;
- private final String revision;
-
- TabCallback(Tab tabInfo, String project, String revision) {
- this.tabInfo = tabInfo;
- this.project = project;
- this.revision = revision;
- outstandingCallbacks++;
- }
-
- protected abstract JsArray<ChangeAndCommit> convert(T result);
-
- @Override
- public void onSuccess(T result) {
- if (isAttached()) {
- JsArray<ChangeAndCommit> changes = convert(result);
- if (changes.length() > 0) {
- setTabTitle(tabInfo, tabInfo.getTitle(changes.length()));
- getTab(tabInfo).setChanges(project, revision, changes);
- }
- onDone(changes.length() > 0);
- }
- }
-
- @Override
- public void onFailure(Throwable err) {
- if (isAttached()) {
- setTabTitle(tabInfo, tabInfo.getTitle(Resources.C.notAvailable()));
- getTab(tabInfo).setError(err.getMessage());
- onDone(true);
- }
- }
-
- private void onDone(boolean enabled) {
- setTabEnabled(tabInfo, enabled);
- outstandingCallbacks--;
- if (outstandingCallbacks == 0 || (enabled && tabInfo == Tab.RELATED_CHANGES)) {
- outstandingCallbacks = 0; // Only execute this block once
- for (int i = 0; i < getTabBar().getTabCount(); i++) {
- if (getTabBar().isTabEnabled(i)) {
- selectTab(i);
- setVisible(true);
- applyMaxHeight();
- break;
- }
- }
- }
-
- if (tabInfo == savedTab && enabled) {
- selectTab(savedTab.ordinal());
- }
- }
- }
-
- private class TabChangeListCallback extends TabCallback<ChangeList> {
- TabChangeListCallback(Tab tabInfo, String project, String revision) {
- super(tabInfo, project, revision);
- }
-
- @Override
- protected JsArray<ChangeAndCommit> convert(ChangeList l) {
- JsArray<ChangeAndCommit> arr = JavaScriptObject.createArray().cast();
- for (ChangeInfo i : Natives.asList(l)) {
- if (i.currentRevision() != null && i.revisions().containsKey(i.currentRevision())) {
- RevisionInfo currentRevision = i.revision(i.currentRevision());
- ChangeAndCommit c = ChangeAndCommit.create();
- c.setId(i.id());
- c.setCommit(currentRevision.commit());
- c.setChangeNumber(i.legacyId().get());
- c.setRevisionNumber(currentRevision._number());
- c.setBranch(i.branch());
- c.setProject(i.project());
- c.setSubmittable(i.submittable() && i.mergeable());
- c.setStatus(i.status().asChangeStatus().toString());
- arr.push(c);
- }
- }
- return arr;
- }
- }
-
- public static class RelatedInfo extends JavaScriptObject {
- public final native JsArray<ChangeAndCommit> changes() /*-{ return this.changes }-*/;
-
- protected RelatedInfo() {}
- }
-
- public static class ChangeAndCommit extends JavaScriptObject {
- static ChangeAndCommit create() {
- return (ChangeAndCommit) createObject();
- }
-
- public final native String id() /*-{ return this.change_id }-*/;
-
- public final native CommitInfo commit() /*-{ return this.commit }-*/;
-
- final native String branch() /*-{ return this.branch }-*/;
-
- final native String project() /*-{ return this.project }-*/;
-
- final native boolean submittable() /*-{ return this._submittable ? true : false; }-*/;
-
- final Change.Status status() {
- String s = statusRaw();
- return s != null ? Change.Status.valueOf(s) : null;
- }
-
- private native String statusRaw() /*-{ return this.status; }-*/;
-
- final native void setId(String i) /*-{ if(i)this.change_id=i; }-*/;
-
- final native void setCommit(CommitInfo c) /*-{ if(c)this.commit=c; }-*/;
-
- final native void setBranch(String b) /*-{ if(b)this.branch=b; }-*/;
-
- final native void setProject(String b) /*-{ if(b)this.project=b; }-*/;
-
- public final Change.Id legacyId() {
- return hasChangeNumber() ? new Change.Id(_changeNumber()) : null;
- }
-
- public final PatchSet.Id patchSetId() {
- return hasChangeNumber() && hasRevisionNumber()
- ? new PatchSet.Id(legacyId(), _revisionNumber())
- : null;
- }
-
- public final native boolean hasChangeNumber()
- /*-{ return this.hasOwnProperty('_change_number') }-*/ ;
-
- final native boolean hasRevisionNumber()
- /*-{ return this.hasOwnProperty('_revision_number') }-*/ ;
-
- final native boolean hasCurrentRevisionNumber()
- /*-{ return this.hasOwnProperty('_current_revision_number') }-*/ ;
-
- final native int _changeNumber() /*-{ return this._change_number }-*/;
-
- final native int _revisionNumber() /*-{ return this._revision_number }-*/;
-
- final native int _currentRevisionNumber() /*-{ return this._current_revision_number }-*/;
-
- final native void setChangeNumber(int n) /*-{ this._change_number=n; }-*/;
-
- final native void setRevisionNumber(int n) /*-{ this._revision_number=n; }-*/;
-
- final native void setCurrentRevisionNumber(int n) /*-{ this._current_revision_number=n; }-*/;
-
- final native void setSubmittable(boolean s) /*-{ this._submittable=s; }-*/;
-
- final native void setStatus(String s) /*-{ if(s)this.status=s; }-*/;
-
- protected ChangeAndCommit() {}
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChangesTab.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChangesTab.java
deleted file mode 100644
index c53427b..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RelatedChangesTab.java
+++ /dev/null
@@ -1,594 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.change.RelatedChanges.ChangeAndCommit;
-import com.google.gerrit.client.changes.Util;
-import com.google.gerrit.client.info.ChangeInfo.CommitInfo;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.core.client.Scheduler.RepeatingCommand;
-import com.google.gwt.dom.client.AnchorElement;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.NativeEvent;
-import com.google.gwt.dom.client.Node;
-import com.google.gwt.dom.client.NodeList;
-import com.google.gwt.dom.client.Style;
-import com.google.gwt.dom.client.Style.Visibility;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.DoubleClickEvent;
-import com.google.gwt.event.dom.client.DoubleClickHandler;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.event.dom.client.ScrollEvent;
-import com.google.gwt.event.dom.client.ScrollHandler;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.safehtml.shared.SafeHtml;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Event;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.AbstractImagePrototype;
-import com.google.gwt.user.client.ui.InlineLabel;
-import com.google.gwt.user.client.ui.IsWidget;
-import com.google.gwt.user.client.ui.ScrollPanel;
-import com.google.gwt.user.client.ui.SimplePanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.globalkey.client.KeyCommand;
-import com.google.gwtexpui.globalkey.client.KeyCommandSet;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-class RelatedChangesTab implements IsWidget {
- private static final String OPEN = init(DOM.createUniqueId().replace('-', '_'));
- private static final HyperlinkImpl LINK = GWT.create(HyperlinkImpl.class);
- private static final SafeHtml POINTER_HTML =
- AbstractImagePrototype.create(Gerrit.RESOURCES.arrowRight()).getSafeHtml();
-
- private static native String init(String o) /*-{
- $wnd[o] = $entry(@com.google.gerrit.client.change.RelatedChangesTab::onOpen(
- Lcom/google/gwt/dom/client/NativeEvent;Lcom/google/gwt/dom/client/Element;));
- return o + '(event,this)';
- }-*/;
-
- private static boolean onOpen(NativeEvent evt, Element e) {
- if (LINK.handleAsClick(evt.<Event>cast())) {
- Gerrit.display(e.getAttribute("href").substring(1));
- evt.preventDefault();
- return false;
- }
- return true;
- }
-
- private final SimplePanel panel;
- private final RelatedChanges.Tab subject;
-
- private boolean showBranches;
- private boolean showProjects;
- private boolean showSubmittable;
- private boolean showIndirectAncestors;
- private boolean registerKeys;
- private int maxHeight;
-
- private String project;
- private NavigationList view;
-
- RelatedChangesTab(RelatedChanges.Tab subject) {
- panel = new SimplePanel();
- this.subject = subject;
- }
-
- @Override
- public Widget asWidget() {
- return panel;
- }
-
- void setShowBranches(boolean showBranches) {
- this.showBranches = showBranches;
- }
-
- void setShowProjects(boolean showProjects) {
- this.showProjects = showProjects;
- }
-
- void setShowSubmittable(boolean submittable) {
- this.showSubmittable = submittable;
- }
-
- void setShowIndirectAncestors(boolean showIndirectAncestors) {
- this.showIndirectAncestors = showIndirectAncestors;
- }
-
- void setMaxHeight(int height) {
- maxHeight = height;
- if (view != null) {
- view.setHeight(height + "px");
- view.ensureRowMeasurements();
- view.movePointerTo(view.selectedRow, true);
- }
- }
-
- void registerKeys(boolean on) {
- registerKeys = on;
- if (view != null) {
- view.setRegisterKeys(on);
- }
- }
-
- void setError(String message) {
- panel.setWidget(new InlineLabel(message));
- view = null;
- project = null;
- }
-
- void setChanges(String project, String revision, JsArray<ChangeAndCommit> changes) {
- if (0 == changes.length()) {
- setError(Resources.C.noChanges());
- return;
- }
-
- this.project = project;
- view = new NavigationList();
- panel.setWidget(view);
-
- DisplayCommand display = new DisplayCommand(revision, changes, view);
- if (display.execute()) {
- Scheduler.get().scheduleIncremental(display);
- }
- }
-
- private final class DisplayCommand implements RepeatingCommand {
- private final String revision;
- private final JsArray<ChangeAndCommit> changes;
- private final List<SafeHtml> rows;
- private final Set<String> connected;
- private final NavigationList navList;
-
- private double start;
- private int row;
- private int connectedPos;
- private int selected;
-
- private DisplayCommand(
- String revision, JsArray<ChangeAndCommit> changes, NavigationList navList) {
- this.revision = revision;
- this.changes = changes;
- this.navList = navList;
- rows = new ArrayList<>(changes.length());
- connectedPos = changes.length() - 1;
- connected =
- showIndirectAncestors ? new HashSet<>(Math.max(changes.length() * 4 / 3, 16)) : null;
- }
-
- private boolean computeConnected() {
- // Since TOPO sorted, when can walk the list in reverse and find all
- // the connections.
- if (!connected.contains(revision)) {
- while (connectedPos >= 0) {
- CommitInfo c = changes.get(connectedPos).commit();
- connected.add(c.commit());
- if (longRunning(--connectedPos)) {
- return true;
- }
- if (c.commit().equals(revision)) {
- break;
- }
- }
- }
- while (connectedPos >= 0) {
- CommitInfo c = changes.get(connectedPos).commit();
- for (int j = 0; j < c.parents().length(); j++) {
- if (connected.contains(c.parents().get(j).commit())) {
- connected.add(c.commit());
- break;
- }
- }
- if (longRunning(--connectedPos)) {
- return true;
- }
- }
- return false;
- }
-
- @Override
- public boolean execute() {
- if (navList != view || !panel.isAttached()) {
- // If the user navigated away, we aren't in the DOM anymore.
- // Don't continue to render.
- return false;
- }
-
- start = System.currentTimeMillis();
-
- if (connected != null && computeConnected()) {
- return true;
- }
-
- while (row < changes.length()) {
- ChangeAndCommit info = changes.get(row);
- String commit = info.commit().commit();
- rows.add(new RowSafeHtml(info, connected != null && !connected.contains(commit)));
- if (revision.equals(commit)) {
- selected = row;
- }
- if (longRunning(++row)) {
- return true;
- }
- }
-
- navList.rows = rows;
- navList.ensureRowMeasurements();
- navList.movePointerTo(selected, true);
- return false;
- }
-
- private boolean longRunning(int i) {
- return (i % 10) == 0 && System.currentTimeMillis() - start > 50;
- }
- }
-
- private class RowSafeHtml implements SafeHtml {
- private static final long serialVersionUID = 1L;
-
- private String html;
- private ChangeAndCommit info;
- private final boolean notConnected;
-
- RowSafeHtml(ChangeAndCommit info, boolean notConnected) {
- this.info = info;
- this.notConnected = notConnected;
- }
-
- @Override
- public String asString() {
- if (html == null) {
- SafeHtmlBuilder sb = new SafeHtmlBuilder();
- renderRow(sb);
- html = sb.asString();
- info = null;
- }
- return html;
- }
-
- private void renderRow(SafeHtmlBuilder sb) {
- sb.openDiv().setStyleName(RelatedChanges.R.css().row());
-
- sb.openSpan().setStyleName(RelatedChanges.R.css().pointer());
- sb.append(POINTER_HTML);
- sb.closeSpan();
-
- if (info.status() == Change.Status.ABANDONED) {
- sb.openSpan().setStyleName(RelatedChanges.R.css().strikedSubject());
- } else {
- sb.openSpan().setStyleName(RelatedChanges.R.css().subject());
- }
- sb.setAttribute("data-branch", info.branch());
- sb.setAttribute("data-project", info.project());
- String url = url();
- if (url != null) {
- sb.openAnchor().setAttribute("href", url);
- if (url.startsWith("#")) {
- sb.setAttribute("onclick", OPEN);
- }
- sb.setAttribute("title", info.commit().subject());
- if (showProjects) {
- sb.append(info.project()).append(": ");
- }
- if (showBranches) {
- sb.append(info.branch()).append(": ");
- }
- sb.append(info.commit().subject());
- sb.closeAnchor();
- } else {
- sb.append(info.commit().subject());
- }
- sb.closeSpan();
-
- sb.openSpan();
- if (info.status() != null && !info.status().isOpen()) {
- sb.setStyleName(RelatedChanges.R.css().gitweb());
- sb.setAttribute("title", Util.toLongString(info.status()));
- sb.append('\u25CF'); // Unicode 'BLACK CIRCLE'
- } else if (notConnected) {
- sb.setStyleName(RelatedChanges.R.css().indirect());
- sb.setAttribute("title", Resources.C.indirectAncestor());
- sb.append('~');
- } else if (info.hasCurrentRevisionNumber()
- && info.hasRevisionNumber()
- && info._currentRevisionNumber() != info._revisionNumber()) {
- sb.setStyleName(RelatedChanges.R.css().notCurrent());
- sb.setAttribute("title", Util.C.notCurrent());
- sb.append('\u25CF'); // Unicode 'BLACK CIRCLE'
- } else if (showSubmittable && info.submittable()) {
- sb.setStyleName(RelatedChanges.R.css().submittable());
- sb.setAttribute("title", Util.C.submittable());
- sb.append('\u2713'); // Unicode 'CHECK MARK'
- } else {
- sb.setStyleName(RelatedChanges.R.css().current());
- }
- sb.closeSpan();
-
- sb.closeDiv();
- }
-
- private String url() {
- if (info.hasChangeNumber() && info.hasRevisionNumber()) {
- return "#" + PageLinks.toChange(new Project.NameKey(info.project()), info.patchSetId());
- }
- return null;
- }
- }
-
- private class NavigationList extends ScrollPanel
- implements ClickHandler, DoubleClickHandler, ScrollHandler {
- private final KeyCommandSet keysNavigation;
- private final Element body;
- private final Element surrogate;
- private final Node fragment = createDocumentFragment();
-
- List<SafeHtml> rows;
- private HandlerRegistration regNavigation;
- private int selectedRow;
- private int startRow;
- private int rowHeight;
- private int rowWidth;
-
- NavigationList() {
- addDomHandler(this, ClickEvent.getType());
- addDomHandler(this, DoubleClickEvent.getType());
- addScrollHandler(this);
-
- keysNavigation = new KeyCommandSet(Resources.C.relatedChanges());
- keysNavigation.add(
- new KeyCommand(0, 'K', Resources.C.previousChange()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- movePointerTo(selectedRow - 1, true);
- }
- },
- new KeyCommand(0, 'J', Resources.C.nextChange()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- movePointerTo(selectedRow + 1, true);
- }
- });
- keysNavigation.add(
- new KeyCommand(0, 'O', Resources.C.openChange()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- onOpenRow(getRow(selectedRow));
- }
- });
-
- if (maxHeight > 0) {
- setHeight(maxHeight + "px");
- }
-
- body = DOM.createDiv();
- body.getStyle().setPosition(Style.Position.RELATIVE);
- body.getStyle().setVisibility(Visibility.HIDDEN);
- getContainerElement().appendChild(body);
-
- surrogate = DOM.createDiv();
- surrogate.getStyle().setVisibility(Visibility.HIDDEN);
- }
-
- private boolean ensureRowMeasurements() {
- if (rowHeight == 0 && rows != null) {
- surrogate.setInnerSafeHtml(rows.get(0));
- getContainerElement().appendChild(surrogate);
- rowHeight = surrogate.getOffsetHeight();
- rowWidth = surrogate.getOffsetWidth();
- getContainerElement().removeChild(surrogate);
- getContainerElement().getStyle().setHeight(rowHeight * rows.size(), Style.Unit.PX);
- return true;
- }
- return false;
- }
-
- public void movePointerTo(int row, boolean scroll) {
- if (rows != null && 0 <= row && row < rows.size()) {
- renderSelected(selectedRow, false);
- selectedRow = row;
-
- if (scroll && rowHeight != 0) {
- // Position the selected row in the middle.
- setVerticalScrollPosition(Math.max(rowHeight * selectedRow - maxHeight / 2, 0));
- render();
- }
- renderSelected(selectedRow, true);
- }
- }
-
- private void renderSelected(int row, boolean selected) {
- Element e = getRow(row);
- if (e != null) {
- if (selected) {
- e.addClassName(RelatedChanges.R.css().activeRow());
- } else {
- e.removeClassName(RelatedChanges.R.css().activeRow());
- }
- }
- }
-
- private void render() {
- if (rows == null || rowHeight == 0) {
- return;
- }
-
- int currStart = startRow;
- int currEnd = startRow + body.getChildCount();
-
- int vpos = getVerticalScrollPosition();
- int start = Math.max(vpos / rowHeight - 5, 0);
- int end = Math.min((vpos + maxHeight) / rowHeight + 5, rows.size());
- if (currStart <= start && end <= currEnd) {
- return; // All of the required nodes are already in the DOM.
- }
-
- if (end <= currStart) {
- renderRange(start, end, true, true);
- } else if (start < currStart) {
- renderRange(start, currStart, false, true);
- } else if (start >= currEnd) {
- renderRange(start, end, true, false);
- } else if (end > currEnd) {
- renderRange(currEnd, end, false, false);
- }
-
- renderSelected(selectedRow, true);
-
- if (currEnd == 0) {
- // Account for the scroll bars
- int width = body.getOffsetWidth();
- if (rowWidth > width) {
- int w = 2 * rowWidth - width;
- setWidth(w + "px");
- }
- body.getStyle().clearVisibility();
- }
- }
-
- private void renderRange(int start, int end, boolean removeAll, boolean insertFirst) {
- SafeHtmlBuilder sb = new SafeHtmlBuilder();
- for (int i = start; i < end; i++) {
- sb.append(rows.get(i));
- }
-
- if (removeAll) {
- body.setInnerSafeHtml(sb);
- } else {
- surrogate.setInnerSafeHtml(sb);
- for (int cnt = surrogate.getChildCount(); cnt > 0; cnt--) {
- fragment.appendChild(surrogate.getFirstChild());
- }
- if (insertFirst) {
- body.insertFirst(fragment);
- } else {
- body.appendChild(fragment);
- }
- }
-
- if (insertFirst || removeAll) {
- startRow = start;
- body.getStyle().setTop(start * rowHeight, Style.Unit.PX);
- }
- }
-
- @Override
- public void onClick(ClickEvent event) {
- Element row = getRow(event.getNativeEvent().getEventTarget().<Element>cast());
- if (row != null) {
- movePointerTo(startRow + DOM.getChildIndex(body, row), false);
- event.stopPropagation();
- }
- saveSelectedTab();
- }
-
- @Override
- public void onDoubleClick(DoubleClickEvent event) {
- Element row = getRow(event.getNativeEvent().getEventTarget().<Element>cast());
- if (row != null) {
- movePointerTo(startRow + DOM.getChildIndex(body, row), false);
- onOpenRow(row);
- event.stopPropagation();
- }
- }
-
- @Override
- public void onScroll(ScrollEvent event) {
- render();
- }
-
- private Element getRow(Element e) {
- for (Element prev = e; e != null; prev = e) {
- if ((e = DOM.getParent(e)) == body) {
- return prev;
- }
- }
- return null;
- }
-
- private Element getRow(int row) {
- if (startRow <= row && row < startRow + body.getChildCount()) {
- return body.getChild(row - startRow).cast();
- }
- return null;
- }
-
- private void onOpenRow(Element row) {
- // Find the first HREF of the anchor of the select row (if any)
- if (row != null) {
- NodeList<Element> nodes = row.getElementsByTagName(AnchorElement.TAG);
- for (int i = 0; i < nodes.getLength(); i++) {
- String url = nodes.getItem(i).getAttribute("href");
- if (!url.isEmpty()) {
- if (url.startsWith("#")) {
- Gerrit.display(url.substring(1));
- } else {
- Window.Location.assign(url);
- }
- break;
- }
- }
- }
-
- saveSelectedTab();
- }
-
- private void saveSelectedTab() {
- RelatedChanges.setSavedTab(subject);
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- setRegisterKeys(registerKeys);
- }
-
- @Override
- protected void onUnload() {
- setRegisterKeys(false);
- super.onUnload();
- }
-
- public void setRegisterKeys(boolean on) {
- if (on && isAttached()) {
- if (regNavigation == null) {
- regNavigation = GlobalKey.add(this, keysNavigation);
- }
- if (view.ensureRowMeasurements()) {
- view.movePointerTo(view.selectedRow, true);
- }
- } else if (regNavigation != null) {
- regNavigation.removeHandler();
- regNavigation = null;
- }
- }
- }
-
- private static native Node createDocumentFragment() /*-{
- return $doc.createDocumentFragment();
- }-*/;
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RenameFileAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RenameFileAction.java
deleted file mode 100644
index 1e7063a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RenameFileAction.java
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (C) 2015 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.client.change;
-
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-
-class RenameFileAction {
- private final Project.NameKey project;
- private final Change.Id changeId;
- private final RevisionInfo revision;
- private final ChangeScreen.Style style;
- private final Widget renameButton;
-
- private RenameFileBox renameBox;
- private PopupPanel popup;
-
- RenameFileAction(
- Project.NameKey project,
- Change.Id changeId,
- RevisionInfo revision,
- ChangeScreen.Style style,
- Widget renameButton) {
- this.project = project;
- this.changeId = changeId;
- this.revision = revision;
- this.style = style;
- this.renameButton = renameButton;
- }
-
- void onRename() {
- if (popup != null) {
- popup.hide();
- return;
- }
-
- if (renameBox == null) {
- renameBox = new RenameFileBox(project, changeId, revision);
- }
- renameBox.clearPath();
-
- final PopupPanel p = new PopupPanel(true);
- p.setStyleName(style.replyBox());
- p.addAutoHidePartner(renameButton.getElement());
- p.addCloseHandler(
- new CloseHandler<PopupPanel>() {
- @Override
- public void onClose(CloseEvent<PopupPanel> event) {
- if (popup == p) {
- popup = null;
- }
- }
- });
- p.add(renameBox);
- p.showRelativeTo(renameButton);
- GlobalKey.dialog(p);
- renameBox.setFocus(true);
- popup = p;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RenameFileBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RenameFileBox.java
deleted file mode 100644
index f288dbe..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RenameFileBox.java
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright (C) 2015 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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.VoidResult;
-import com.google.gerrit.client.changes.ChangeEditApi;
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.client.ui.RemoteSuggestBox;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.globalkey.client.NpTextBox;
-
-class RenameFileBox extends Composite {
- interface Binder extends UiBinder<HTMLPanel, RenameFileBox> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- private final Project.NameKey project;
- private final Change.Id changeId;
-
- @UiField Button rename;
- @UiField Button cancel;
-
- @UiField(provided = true)
- RemoteSuggestBox path;
-
- @UiField NpTextBox newPath;
-
- RenameFileBox(Project.NameKey project, Change.Id changeId, RevisionInfo revision) {
- this.project = project;
- this.changeId = changeId;
-
- path = new RemoteSuggestBox(new PathSuggestOracle(project, changeId, revision));
- path.addCloseHandler(
- new CloseHandler<RemoteSuggestBox>() {
- @Override
- public void onClose(CloseEvent<RemoteSuggestBox> event) {
- hide();
- }
- });
-
- initWidget(uiBinder.createAndBindUi(this));
- }
-
- void setFocus(boolean focus) {
- path.setFocus(focus);
- }
-
- void clearPath() {
- path.setText("");
- }
-
- @UiHandler("rename")
- void onRename(@SuppressWarnings("unused") ClickEvent e) {
- rename(path.getText(), newPath.getText());
- }
-
- private void rename(String path, String newPath) {
- hide();
- ChangeEditApi.rename(
- project.get(),
- changeId.get(),
- path,
- newPath,
- new AsyncCallback<VoidResult>() {
- @Override
- public void onSuccess(VoidResult result) {
- Gerrit.display(PageLinks.toChangeInEditMode(project, changeId));
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- });
- }
-
- @UiHandler("cancel")
- void onCancel(@SuppressWarnings("unused") ClickEvent e) {
- hide();
- }
-
- private void hide() {
- for (Widget w = getParent(); w != null; w = w.getParent()) {
- if (w instanceof PopupPanel) {
- ((PopupPanel) w).hide();
- break;
- }
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RenameFileBox.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RenameFileBox.ui.xml
deleted file mode 100644
index 17e8797..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RenameFileBox.ui.xml
+++ /dev/null
@@ -1,47 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:c='urn:import:com.google.gwtexpui.globalkey.client'
- xmlns:u='urn:import:com.google.gerrit.client.ui'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:with field='res' type='com.google.gerrit.client.change.Resources'/>
- <ui:style gss='false'>
- .cancel { float: right; }
- </ui:style>
- <g:HTMLPanel>
- <div class='{res.style.section}'>
- <ui:msg>Old: <u:RemoteSuggestBox ui:field='path' visibleLength='86'/></ui:msg>
- </div>
- <div class='{res.style.section}'>
- <ui:msg>New: <c:NpTextBox ui:field='newPath' visibleLength='86'/></ui:msg>
- </div>
- <div class='{res.style.section}'>
- <g:Button ui:field='rename'
- title='Rename file in the repository'
- styleName='{res.style.button}'>
- <ui:attribute name='title'/>
- <div><ui:msg>Rename</ui:msg></div>
- </g:Button>
- <g:Button ui:field='cancel'
- styleName='{res.style.button}'
- addStyleNames='{style.cancel}'>
- <div>Cancel</div>
- </g:Button>
- </div>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyAction.java
deleted file mode 100644
index ff09ff5..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyAction.java
+++ /dev/null
@@ -1,127 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.changes.ReviewInput;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.LabelInfo;
-import com.google.gerrit.client.info.ChangeInfo.MessageInfo;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.ui.CommentLinkProcessor;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-
-class ReplyAction {
- private final PatchSet.Id psId;
- private final Project.NameKey project;
- private final String revision;
- private final boolean hasDraftComments;
- private final ChangeScreen.Style style;
- private final CommentLinkProcessor clp;
- private final Widget replyButton;
- private final Widget quickApproveButton;
-
- private NativeMap<LabelInfo> allLabels;
- private NativeMap<JsArrayString> permittedLabels;
-
- private ReplyBox replyBox;
- private PopupPanel popup;
-
- ReplyAction(
- ChangeInfo info,
- String revision,
- boolean hasDraftComments,
- ChangeScreen.Style style,
- CommentLinkProcessor clp,
- Widget replyButton,
- Widget quickApproveButton) {
- this.psId = new PatchSet.Id(info.legacyId(), info.revisions().get(revision)._number());
- this.project = info.projectNameKey();
- this.revision = revision;
- this.hasDraftComments = hasDraftComments;
- this.style = style;
- this.clp = clp;
- this.replyButton = replyButton;
- this.quickApproveButton = quickApproveButton;
-
- boolean current = revision.equals(info.currentRevision());
- allLabels = info.allLabels();
- permittedLabels =
- current && info.hasPermittedLabels()
- ? info.permittedLabels()
- : NativeMap.<JsArrayString>create();
- }
-
- boolean isVisible() {
- return popup != null;
- }
-
- void quickApprove(ReviewInput input) {
- replyBox.quickApprove(input);
- }
-
- void hide() {
- if (popup != null) {
- popup.hide();
- }
- return;
- }
-
- void onReply(MessageInfo msg) {
- if (popup != null) {
- popup.hide();
- return;
- }
-
- if (replyBox == null) {
- replyBox = new ReplyBox(clp, project, psId, revision, allLabels, permittedLabels);
- allLabels = null;
- permittedLabels = null;
- }
- if (msg != null) {
- replyBox.replyTo(msg);
- }
-
- final PopupPanel p = new PopupPanel(true, false);
- p.setStyleName(style.replyBox());
- p.addAutoHidePartner(replyButton.getElement());
- p.addAutoHidePartner(quickApproveButton.getElement());
- p.addCloseHandler(
- new CloseHandler<PopupPanel>() {
- @Override
- public void onClose(CloseEvent<PopupPanel> event) {
- if (popup == p) {
- popup = null;
- if (hasDraftComments || replyBox.hasMessage()) {
- replyButton.setStyleName(style.highlight());
- }
- }
- }
- });
- p.add(replyBox);
- Window.scrollTo(0, 0);
- replyButton.removeStyleName(style.highlight());
- p.showRelativeTo(replyButton);
- GlobalKey.dialog(p);
- popup = p;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyBox.java
deleted file mode 100644
index addd692..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyBox.java
+++ /dev/null
@@ -1,541 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import static com.google.gwt.event.dom.client.KeyCodes.KEY_ENTER;
-import static com.google.gwt.event.dom.client.KeyCodes.KEY_MAC_ENTER;
-import static java.util.stream.Collectors.collectingAndThen;
-import static java.util.stream.Collectors.toList;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.CommentInfo;
-import com.google.gerrit.client.changes.ReviewInput;
-import com.google.gerrit.client.changes.ReviewInput.DraftHandling;
-import com.google.gerrit.client.changes.Util;
-import com.google.gerrit.client.info.ChangeInfo.ApprovalInfo;
-import com.google.gerrit.client.info.ChangeInfo.LabelInfo;
-import com.google.gerrit.client.info.ChangeInfo.MessageInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.client.ui.CommentLinkProcessor;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.common.data.LabelValue;
-import com.google.gerrit.reviewdb.client.Patch;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.core.client.Scheduler.RepeatingCommand;
-import com.google.gwt.core.client.Scheduler.ScheduledCommand;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-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.MouseOutEvent;
-import com.google.gwt.event.dom.client.MouseOutHandler;
-import com.google.gwt.event.dom.client.MouseOverEvent;
-import com.google.gwt.event.dom.client.MouseOverHandler;
-import com.google.gwt.event.logical.shared.ValueChangeEvent;
-import com.google.gwt.event.logical.shared.ValueChangeHandler;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Grid;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.RadioButton;
-import com.google.gwt.user.client.ui.ScrollPanel;
-import com.google.gwt.user.client.ui.TextArea;
-import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwt.user.client.ui.Widget;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-
-public class ReplyBox extends Composite {
- interface Binder extends UiBinder<HTMLPanel, ReplyBox> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- interface Styles extends CssResource {
- String label_name();
-
- String label_value();
-
- String label_help();
- }
-
- private final CommentLinkProcessor clp;
- private final Project.NameKey project;
- private final PatchSet.Id psId;
- private final String revision;
- private ReviewInput in = ReviewInput.create();
- private int labelHelpColumn;
- private LocalComments lc;
-
- @UiField Styles style;
- @UiField TextArea message;
- @UiField Element labelsParent;
- @UiField Grid labelsTable;
- @UiField Button post;
- @UiField Button cancel;
- @UiField ScrollPanel commentsPanel;
- @UiField FlowPanel comments;
-
- ReplyBox(
- CommentLinkProcessor clp,
- Project.NameKey project,
- PatchSet.Id psId,
- String revision,
- NativeMap<LabelInfo> all,
- NativeMap<JsArrayString> permitted) {
- this.clp = clp;
- this.project = project;
- this.psId = psId;
- this.revision = revision;
- this.lc = new LocalComments(project, psId.getParentKey());
- initWidget(uiBinder.createAndBindUi(this));
-
- List<String> names =
- permitted.keySet().stream()
- .sorted()
- .collect(collectingAndThen(toList(), Collections::unmodifiableList));
- if (names.isEmpty()) {
- UIObject.setVisible(labelsParent, false);
- } else {
- renderLabels(names, all, permitted);
- }
-
- addDomHandler(
- new KeyDownHandler() {
- @Override
- public void onKeyDown(KeyDownEvent e) {
- e.stopPropagation();
- if ((e.getNativeKeyCode() == KEY_ENTER || e.getNativeKeyCode() == KEY_MAC_ENTER)
- && (e.isControlKeyDown() || e.isMetaKeyDown())) {
- e.preventDefault();
- if (post.isEnabled()) {
- onPost(null);
- }
- }
- }
- },
- KeyDownEvent.getType());
- addDomHandler(
- new KeyPressHandler() {
- @Override
- public void onKeyPress(KeyPressEvent e) {
- e.stopPropagation();
- }
- },
- KeyPressEvent.getType());
- }
-
- @Override
- protected void onLoad() {
- commentsPanel.setVisible(false);
- post.setEnabled(false);
- if (lc.hasReplyComment()) {
- message.setText(lc.getReplyComment());
- lc.removeReplyComment();
- }
- ChangeApi.drafts(project.get(), psId.getParentKey().get())
- .get(
- new AsyncCallback<NativeMap<JsArray<CommentInfo>>>() {
- @Override
- public void onSuccess(NativeMap<JsArray<CommentInfo>> result) {
- displayComments(result);
- post.setEnabled(true);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- post.setEnabled(true);
- }
- });
-
- Scheduler.get()
- .scheduleDeferred(
- new ScheduledCommand() {
- @Override
- public void execute() {
- message.setFocus(true);
- }
- });
- Scheduler.get()
- .scheduleFixedDelay(
- new RepeatingCommand() {
- @Override
- public boolean execute() {
- String t = message.getText();
- if (t != null) {
- message.setCursorPos(t.length());
- }
- return false;
- }
- },
- 0);
- }
-
- @UiHandler("post")
- void onPost(@SuppressWarnings("unused") ClickEvent e) {
- postReview();
- }
-
- void quickApprove(ReviewInput quickApproveInput) {
- in.mergeLabels(quickApproveInput);
- postReview();
- }
-
- boolean hasMessage() {
- return !message.getText().trim().isEmpty();
- }
-
- private void postReview() {
- in.message(message.getText().trim());
- // Don't send any comments in the request; just publish everything, even if
- // e.g. a draft was modified in another tab since we last looked it up.
- in.drafts(DraftHandling.PUBLISH_ALL_REVISIONS);
- in.prePost();
- ChangeApi.revision(project.get(), psId.getParentKey().get(), revision)
- .view("review")
- .post(
- in,
- new GerritCallback<ReviewInput>() {
- @Override
- public void onSuccess(ReviewInput result) {
- Gerrit.display(PageLinks.toChange(project, psId));
- }
-
- @Override
- public void onFailure(Throwable caught) {
- if (RestApi.isNotSignedIn(caught)) {
- lc.setReplyComment(message.getText());
- }
- super.onFailure(caught);
- }
- });
- hide();
- }
-
- @UiHandler("cancel")
- void onCancel(@SuppressWarnings("unused") ClickEvent e) {
- message.setText("");
- hide();
- }
-
- void replyTo(MessageInfo msg) {
- if (msg.message() != null) {
- String t = message.getText();
- String m = quote(removePatchSetHeaderLine(msg.message()));
- if (t == null || t.isEmpty()) {
- t = m;
- } else if (t.endsWith("\n\n")) {
- t += m;
- } else if (t.endsWith("\n")) {
- t += "\n" + m;
- } else {
- t += "\n\n" + m;
- }
- message.setText(t);
- }
- }
-
- private static String removePatchSetHeaderLine(String msg) {
- msg = msg.trim();
- if (msg.startsWith("Patch Set ")) {
- int i = msg.indexOf('\n');
- if (i > 0) {
- msg = msg.substring(i + 1).trim();
- }
- }
- return msg;
- }
-
- public static String quote(String msg) {
- msg = msg.trim();
- StringBuilder quotedMsg = new StringBuilder();
- for (String line : msg.split("\\n")) {
- line = line.trim();
- while (line.length() > 67) {
- int i = line.lastIndexOf(' ', 67);
- if (i < 50) {
- i = line.indexOf(' ', 67);
- }
- if (i > 0) {
- quotedMsg.append(" > ").append(line.substring(0, i)).append("\n");
- line = line.substring(i + 1);
- } else {
- break;
- }
- }
- quotedMsg.append(" > ").append(line).append("\n");
- }
- quotedMsg.append("\n");
- return quotedMsg.toString();
- }
-
- private void hide() {
- for (Widget w = getParent(); w != null; w = w.getParent()) {
- if (w instanceof PopupPanel) {
- ((PopupPanel) w).hide();
- break;
- }
- }
- }
-
- private void renderLabels(
- List<String> names, NativeMap<LabelInfo> all, NativeMap<JsArrayString> permitted) {
- TreeSet<Short> values = new TreeSet<>();
- List<LabelAndValues> labels = new ArrayList<>(permitted.size());
- for (String id : names) {
- JsArrayString p = permitted.get(id);
- if (p != null) {
- if (!all.containsKey(id)) {
- continue;
- }
- Set<Short> a = new TreeSet<>();
- for (int i = 0; i < p.length(); i++) {
- a.add(LabelInfo.parseValue(p.get(i)));
- }
- labels.add(new LabelAndValues(all.get(id), a));
- values.addAll(a);
- }
- }
- List<Short> columns = new ArrayList<>(values);
-
- labelsTable.resize(1 + labels.size(), 2 + values.size());
- for (int c = 0; c < columns.size(); c++) {
- labelsTable.setText(0, 1 + c, LabelValue.formatValue(columns.get(c)));
- labelsTable.getCellFormatter().setStyleName(0, 1 + c, style.label_value());
- }
-
- List<LabelAndValues> checkboxes = new ArrayList<>(labels.size());
- int row = 1;
- for (LabelAndValues lv : labels) {
- if (isCheckBox(lv.info.valueSet())) {
- checkboxes.add(lv);
- } else {
- renderRadio(row++, columns, lv);
- }
- }
- for (LabelAndValues lv : checkboxes) {
- renderCheckBox(row++, lv);
- }
- }
-
- private Short normalizeDefaultValue(Short defaultValue, Set<Short> permittedValues) {
- Short pmin = Collections.min(permittedValues);
- Short pmax = Collections.max(permittedValues);
- Short dv = defaultValue;
- if (dv > pmax) {
- dv = pmax;
- } else if (dv < pmin) {
- dv = pmin;
- }
- return dv;
- }
-
- private void renderRadio(int row, List<Short> columns, LabelAndValues lv) {
- String id = lv.info.name();
- Short dv = normalizeDefaultValue(lv.info.defaultValue(), lv.permitted);
-
- labelHelpColumn = 1 + columns.size();
- labelsTable.setText(row, 0, id);
-
- CellFormatter fmt = labelsTable.getCellFormatter();
- fmt.setStyleName(row, 0, style.label_name());
- fmt.setStyleName(row, labelHelpColumn, style.label_help());
-
- ApprovalInfo self =
- Gerrit.isSignedIn() ? lv.info.forUser(Gerrit.getUserAccount()._accountId()) : null;
-
- final LabelRadioGroup group = new LabelRadioGroup(row, id, lv.permitted.size());
- for (int i = 0; i < columns.size(); i++) {
- Short v = columns.get(i);
- if (lv.permitted.contains(v)) {
- String text = lv.info.valueText(LabelValue.formatValue(v));
- LabelRadioButton b = new LabelRadioButton(group, text, v);
- if ((self != null && v == self.value()) || (self == null && v.equals(dv))) {
- b.setValue(true);
- group.select(b);
- in.label(group.label, v);
- labelsTable.setText(row, labelHelpColumn, b.text);
- }
- group.buttons.add(b);
- labelsTable.setWidget(row, 1 + i, b);
- }
- }
- }
-
- private void renderCheckBox(int row, LabelAndValues lv) {
- ApprovalInfo self =
- Gerrit.isSignedIn() ? lv.info.forUser(Gerrit.getUserAccount()._accountId()) : null;
-
- final String id = lv.info.name();
- final CheckBox b = new CheckBox();
- b.setText(id);
- b.setEnabled(lv.permitted.contains((short) 1));
- if (self != null && self.value() == 1) {
- b.setValue(true);
- }
- b.addValueChangeHandler(
- new ValueChangeHandler<Boolean>() {
- @Override
- public void onValueChange(ValueChangeEvent<Boolean> event) {
- in.label(id, event.getValue() ? (short) 1 : (short) 0);
- }
- });
- b.setStyleName(style.label_name());
- labelsTable.setWidget(row, 0, b);
-
- CellFormatter fmt = labelsTable.getCellFormatter();
- fmt.setStyleName(row, labelHelpColumn, style.label_help());
- labelsTable.setText(row, labelHelpColumn, lv.info.valueText("+1"));
- }
-
- private static boolean isCheckBox(Set<Short> values) {
- return values.size() == 2 && values.contains((short) 0) && values.contains((short) 1);
- }
-
- private void displayComments(NativeMap<JsArray<CommentInfo>> m) {
- comments.clear();
-
- JsArray<CommentInfo> l = m.get(Patch.COMMIT_MSG);
- if (l != null) {
- comments.add(
- new FileComments(
- clp, project, psId, Util.C.commitMessage(), copyPath(Patch.COMMIT_MSG, l)));
- }
- l = m.get(Patch.MERGE_LIST);
- if (l != null) {
- comments.add(
- new FileComments(
- clp, project, psId, Util.C.commitMessage(), copyPath(Patch.MERGE_LIST, l)));
- }
-
- List<String> paths =
- m.keySet().stream()
- .sorted()
- .collect(collectingAndThen(toList(), Collections::unmodifiableList));
-
- for (String path : paths) {
- if (!Patch.isMagic(path)) {
- comments.add(new FileComments(clp, project, psId, path, copyPath(path, m.get(path))));
- }
- }
-
- commentsPanel.setVisible(comments.getWidgetCount() > 0);
- }
-
- private static List<CommentInfo> copyPath(String path, JsArray<CommentInfo> l) {
- for (int i = 0; i < l.length(); i++) {
- l.get(i).path(path);
- }
- return Natives.asList(l);
- }
-
- private static class LabelAndValues {
- final LabelInfo info;
- final Set<Short> permitted;
-
- LabelAndValues(LabelInfo info, Set<Short> permitted) {
- this.info = info;
- this.permitted = permitted;
- }
- }
-
- private class LabelRadioGroup {
- final int row;
- final String label;
- final List<LabelRadioButton> buttons;
- LabelRadioButton selected;
-
- LabelRadioGroup(int row, String label, int cnt) {
- this.row = row;
- this.label = label;
- this.buttons = new ArrayList<>(cnt);
- }
-
- void select(LabelRadioButton b) {
- selected = b;
- labelsTable.setText(row, labelHelpColumn, b.text);
- }
- }
-
- private class LabelRadioButton extends RadioButton
- implements ValueChangeHandler<Boolean>, ClickHandler, MouseOverHandler, MouseOutHandler {
- private final LabelRadioGroup group;
- private final String text;
- private final short value;
-
- LabelRadioButton(LabelRadioGroup group, String text, short value) {
- super(group.label);
- this.group = group;
- this.text = text;
- this.value = value;
- addValueChangeHandler(this);
- addClickHandler(this);
- addMouseOverHandler(this);
- addMouseOutHandler(this);
- }
-
- @Override
- public void onValueChange(ValueChangeEvent<Boolean> event) {
- if (event.getValue()) {
- select();
- }
- }
-
- @Override
- public void onClick(ClickEvent event) {
- select();
- }
-
- void select() {
- group.select(this);
- in.label(group.label, value);
- }
-
- @Override
- public void onMouseOver(MouseOverEvent event) {
- labelsTable.setText(group.row, labelHelpColumn, text);
- }
-
- @Override
- public void onMouseOut(MouseOutEvent event) {
- LabelRadioButton b = group.selected;
- String s = b != null ? b.text : "";
- labelsTable.setText(group.row, labelHelpColumn, s);
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyBox.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyBox.ui.xml
deleted file mode 100644
index 6903b91..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReplyBox.ui.xml
+++ /dev/null
@@ -1,85 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:with field='res' type='com.google.gerrit.client.change.Resources'/>
- <ui:style gss='false' type='com.google.gerrit.client.change.ReplyBox.Styles'>
- .replyBox {
- }
- .label_name {
- font-weight: bold;
- text-align: left;
- white-space: nowrap;
- }
- .label_name input { margin-left: 0; }
- .label_help {
- padding-left: 5px;
- white-space: nowrap;
- }
- .label_value {
- text-align: center;
- }
- .cancel {
- position: absolute;
- bottom: 5px;
- right: 5px;
- background-color: #eee;
- background-image: -webkit-linear-gradient(top, #eee, #eee);
- }
- .cancel div { color: #444; }
- .comments {
- max-height: 275px;
- width: 526px;
- }
- .comments p {
- margin: 5px 0 5px 0;
- }
- </ui:style>
- <g:HTMLPanel styleName='{style.replyBox}'>
- <div class='{res.style.section}'>
- <g:TextArea
- visibleLines='5'
- characterWidth='70'
- ui:field='message'/>
- </div>
- <div class='{res.style.section}' ui:field='labelsParent'>
- <g:Grid ui:field='labelsTable'/>
- </div>
- <g:ScrollPanel ui:field='commentsPanel'
- styleName='{style.comments}'
- addStyleNames='{res.style.section}'>
- <g:FlowPanel ui:field='comments'/>
- </g:ScrollPanel>
- <div class='{res.style.section}' style='position: relative'>
- <g:Button ui:field='post'
- title='Post reply (Shortcut: Ctrl-Enter)'
- styleName='{res.style.button}'>
- <ui:attribute name='title'/>
- <div><ui:msg>Post</ui:msg></div>
- </g:Button>
-
- <g:Button ui:field='cancel'
- title='Close reply form (Shortcut: Esc)'
- styleName='{res.style.button}'
- addStyleNames='{style.cancel}'>
- <ui:attribute name='title'/>
- <div><ui:msg>Cancel</ui:msg></div>
- </g:Button>
- </div>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Resources.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Resources.java
deleted file mode 100644
index cfc4e23..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Resources.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.resources.client.ClientBundle;
-import com.google.gwt.resources.client.CssResource;
-
-public interface Resources extends ClientBundle {
- Resources I = GWT.create(Resources.class);
- ChangeConstants C = GWT.create(ChangeConstants.class);
- ChangeMessages M = GWT.create(ChangeMessages.class);
-
- @Source("common.css")
- Style style();
-
- public interface Style extends CssResource {
- String button();
-
- String popup();
-
- String popupContent();
-
- String section();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RestoreAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RestoreAction.java
deleted file mode 100644
index aa3a9ef..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RestoreAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.user.client.ui.Button;
-
-class RestoreAction extends ActionMessageBox {
- private final Project.NameKey project;
- private final Change.Id id;
-
- RestoreAction(Button b, Project.NameKey project, Change.Id id) {
- super(b);
- this.project = project;
- this.id = id;
- }
-
- @Override
- void send(String message) {
- ChangeApi.restore(
- project.get(),
- id.get(),
- message,
- new GerritCallback<ChangeInfo>() {
- @Override
- public void onSuccess(ChangeInfo result) {
- Gerrit.display(PageLinks.toChange(project, id));
- hide();
- }
- });
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RevertAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RevertAction.java
deleted file mode 100644
index 3fba125..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RevertAction.java
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.Util;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.ui.TextAreaActionDialog;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.PopupPanel;
-
-class RevertAction {
-
- static void call(
- final Button b,
- Change.Id id,
- Project.NameKey project,
- String revision,
- String commitSubject) {
- // TODO Replace ActionDialog with a nicer looking display.
- b.setEnabled(false);
- new TextAreaActionDialog(Util.C.revertChangeTitle(), Util.C.headingRevertMessage()) {
- {
- sendButton.setText(Util.C.buttonRevertChangeSend());
- message.setText(Util.M.revertChangeDefaultMessage(commitSubject, revision));
- }
-
- @Override
- public void onSend() {
- ChangeApi.revert(
- project.get(),
- id.get(),
- getMessageText(),
- new GerritCallback<ChangeInfo>() {
- @Override
- public void onSuccess(ChangeInfo result) {
- sent = true;
- hide();
- Gerrit.display(PageLinks.toChange(result.projectNameKey(), result.legacyId()));
- }
-
- @Override
- public void onFailure(Throwable caught) {
- enableButtons(true);
- super.onFailure(caught);
- }
- });
- }
-
- @Override
- public void onClose(CloseEvent<PopupPanel> event) {
- super.onClose(event);
- b.setEnabled(true);
- }
- }.center();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReviewerSuggestOracle.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReviewerSuggestOracle.java
deleted file mode 100644
index 4e464df..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/ReviewerSuggestOracle.java
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.admin.AdminConstants;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.info.GroupBaseInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.AccountSuggestOracle;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwtexpui.safehtml.client.HighlightSuggestOracle;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/** REST API based suggestion Oracle for reviewers. */
-public class ReviewerSuggestOracle extends HighlightSuggestOracle {
- private Project.NameKey project;
- private Change.Id changeId;
-
- @Override
- protected void onRequestSuggestions(Request req, Callback cb) {
- ChangeApi.suggestReviewers(project.get(), changeId.get(), req.getQuery(), req.getLimit(), false)
- .get(
- new GerritCallback<JsArray<SuggestReviewerInfo>>() {
- @Override
- public void onSuccess(JsArray<SuggestReviewerInfo> result) {
- List<RestReviewerSuggestion> r = new ArrayList<>(result.length());
- for (SuggestReviewerInfo reviewer : Natives.asList(result)) {
- r.add(new RestReviewerSuggestion(reviewer, req.getQuery()));
- }
- cb.onSuggestionsReady(req, new Response(r));
- }
-
- @Override
- public void onFailure(Throwable err) {
- List<Suggestion> r = Collections.emptyList();
- cb.onSuggestionsReady(req, new Response(r));
- }
- });
- }
-
- @Override
- public void requestDefaultSuggestions(Request req, Callback cb) {
- requestSuggestions(req, cb);
- }
-
- public void setChange(Project.NameKey project, Change.Id changeId) {
- this.project = project;
- this.changeId = changeId;
- }
-
- public static class RestReviewerSuggestion implements Suggestion {
- private final String displayString;
- private final String replacementString;
-
- RestReviewerSuggestion(SuggestReviewerInfo reviewer, String query) {
- if (reviewer.account() != null) {
- this.replacementString =
- AccountSuggestOracle.AccountSuggestion.format(reviewer.account(), query);
- this.displayString = replacementString;
- } else {
- this.replacementString = reviewer.group().name();
- this.displayString =
- replacementString + " (" + AdminConstants.I.suggestedGroupLabel() + ")";
- }
- }
-
- @Override
- public String getDisplayString() {
- return displayString;
- }
-
- @Override
- public String getReplacementString() {
- return replacementString;
- }
- }
-
- public static class SuggestReviewerInfo extends JavaScriptObject {
- public final native AccountInfo account() /*-{ return this.account; }-*/;
-
- public final native GroupBaseInfo group() /*-{ return this.group; }-*/;
-
- protected SuggestReviewerInfo() {}
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Reviewers.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Reviewers.java
deleted file mode 100644
index 859af19..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Reviewers.java
+++ /dev/null
@@ -1,328 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.ConfirmationCallback;
-import com.google.gerrit.client.ConfirmationDialog;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.NotSignedInDialog;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.Util;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.ApprovalInfo;
-import com.google.gerrit.client.info.ChangeInfo.LabelInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.RemoteSuggestBox;
-import com.google.gerrit.extensions.client.ReviewerState;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.event.logical.shared.SelectionEvent;
-import com.google.gwt.event.logical.shared.SelectionHandler;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.rpc.StatusCodeException;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwtexpui.safehtml.client.SafeHtml;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/** Add reviewers. */
-public class Reviewers extends Composite {
- interface Binder extends UiBinder<HTMLPanel, Reviewers> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- @UiField Element reviewersText;
- @UiField Image addReviewerIcon;
- @UiField Button addMe;
- @UiField Element form;
- @UiField Element error;
-
- @UiField(provided = true)
- RemoteSuggestBox suggestBox;
-
- private ChangeScreen.Style style;
- private Element ccText;
-
- private ReviewerSuggestOracle reviewerSuggestOracle;
- private Change.Id changeId;
- private Project.NameKey project;
-
- Reviewers() {
- reviewerSuggestOracle = new ReviewerSuggestOracle();
- suggestBox = new RemoteSuggestBox(reviewerSuggestOracle);
- suggestBox.enableDefaultSuggestions();
- suggestBox.setVisibleLength(55);
- suggestBox.setHintText(Util.C.approvalTableAddReviewerHint());
- suggestBox.addCloseHandler(
- new CloseHandler<RemoteSuggestBox>() {
- @Override
- public void onClose(CloseEvent<RemoteSuggestBox> event) {
- Reviewers.this.onCancel(null);
- }
- });
- suggestBox.addSelectionHandler(
- new SelectionHandler<String>() {
- @Override
- public void onSelection(SelectionEvent<String> event) {
- addReviewer(event.getSelectedItem(), false);
- }
- });
-
- initWidget(uiBinder.createAndBindUi(this));
- addReviewerIcon.addDomHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- onOpenForm();
- }
- },
- ClickEvent.getType());
- }
-
- void init(ChangeScreen.Style style, Element ccText) {
- this.style = style;
- this.ccText = ccText;
- }
-
- void set(ChangeInfo info) {
- this.changeId = info.legacyId();
- this.project = info.projectNameKey();
- display(info);
- reviewerSuggestOracle.setChange(project, changeId);
- addReviewerIcon.setVisible(Gerrit.isSignedIn());
- }
-
- void onOpenForm() {
- UIObject.setVisible(form, true);
- UIObject.setVisible(error, false);
- addReviewerIcon.setVisible(false);
- suggestBox.setServeSuggestionsOnOracle(true);
- suggestBox.setFocus(true);
- }
-
- @UiHandler("add")
- void onAdd(@SuppressWarnings("unused") ClickEvent e) {
- addReviewer(suggestBox.getText(), false);
- }
-
- @UiHandler("addMe")
- void onAddMe(@SuppressWarnings("unused") ClickEvent e) {
- String accountId = String.valueOf(Gerrit.getUserAccount()._accountId());
- addReviewer(accountId, false);
- }
-
- @UiHandler("cancel")
- void onCancel(@SuppressWarnings("unused") ClickEvent e) {
- addReviewerIcon.setVisible(true);
- UIObject.setVisible(form, false);
- suggestBox.setFocus(false);
- suggestBox.setText("");
- suggestBox.setServeSuggestionsOnOracle(false);
- }
-
- private void addReviewer(String reviewer, boolean confirmed) {
- if (reviewer.isEmpty()) {
- return;
- }
-
- ChangeApi.reviewers(project.get(), changeId.get())
- .post(
- PostInput.create(reviewer, confirmed),
- new GerritCallback<PostResult>() {
- @Override
- public void onSuccess(PostResult result) {
- if (result.confirm()) {
- askForConfirmation(result.error());
- } else if (result.error() != null) {
- UIObject.setVisible(error, true);
- error.setInnerText(result.error());
- } else {
- UIObject.setVisible(error, false);
- error.setInnerText("");
- suggestBox.setText("");
-
- if (result.reviewers() != null && result.reviewers().length() > 0) {
- updateReviewerList();
- }
- }
- }
-
- private void askForConfirmation(String text) {
- new ConfirmationDialog(
- Util.C.approvalTableAddManyReviewersConfirmationDialogTitle(),
- new SafeHtmlBuilder().append(text),
- new ConfirmationCallback() {
- @Override
- public void onOk() {
- addReviewer(reviewer, true);
- }
- })
- .center();
- }
-
- @Override
- public void onFailure(Throwable err) {
- if (isSigninFailure(err)) {
- new NotSignedInDialog().center();
- } else {
- UIObject.setVisible(error, true);
- error.setInnerText(
- err instanceof StatusCodeException
- ? ((StatusCodeException) err).getEncodedResponse()
- : err.getMessage());
- }
- }
- });
- }
-
- void updateReviewerList() {
- ChangeApi.detail(
- project.get(),
- changeId.get(),
- new GerritCallback<ChangeInfo>() {
- @Override
- public void onSuccess(ChangeInfo result) {
- display(result);
- }
- });
- }
-
- private void display(ChangeInfo info) {
- Map<ReviewerState, List<AccountInfo>> reviewers = info.reviewers();
- Map<Integer, AccountInfo> r = byAccount(reviewers, ReviewerState.REVIEWER);
- Map<Integer, AccountInfo> cc = byAccount(reviewers, ReviewerState.CC);
- for (Integer i : r.keySet()) {
- cc.remove(i);
- }
- cc.remove(info.owner()._accountId());
- Set<Integer> removable = info.removableReviewerIds();
- Map<Integer, VotableInfo> votable = votable(info);
-
- SafeHtml rHtml = Labels.formatUserList(style, r.values(), removable, null, votable);
- SafeHtml ccHtml = Labels.formatUserList(style, cc.values(), removable, null, votable);
-
- reviewersText.setInnerSafeHtml(rHtml);
- ccText.setInnerSafeHtml(ccHtml);
- if (Gerrit.isSignedIn()) {
- int currentUser = Gerrit.getUserAccount()._accountId();
- boolean showAddMeButton =
- info.owner()._accountId() != currentUser
- && !cc.containsKey(currentUser)
- && !r.containsKey(currentUser);
- addMe.setVisible(showAddMeButton);
- }
- }
-
- private static Map<Integer, AccountInfo> byAccount(
- Map<ReviewerState, List<AccountInfo>> reviewers, ReviewerState state) {
- List<AccountInfo> accounts = reviewers.get(state);
- if (accounts == null) {
- return Collections.emptyMap();
- }
- Map<Integer, AccountInfo> result = new HashMap<>();
- for (AccountInfo a : accounts) {
- result.put(a._accountId(), a);
- }
- return result;
- }
-
- private static Map<Integer, VotableInfo> votable(ChangeInfo change) {
- Map<Integer, VotableInfo> d = new HashMap<>();
- for (String name : change.labels()) {
- LabelInfo label = change.label(name);
- Short labelMaxValue =
- label.valueSet().isEmpty() ? null : LabelInfo.parseValue(label.maxValue());
- if (label.all() != null) {
- for (ApprovalInfo ai : Natives.asList(label.all())) {
- int id = ai._accountId();
- VotableInfo ad = d.get(id);
- if (ad == null) {
- ad = new VotableInfo();
- d.put(id, ad);
- }
- if (labelMaxValue != null
- && ai.permittedVotingRange() != null
- && ai.permittedVotingRange().max() == labelMaxValue) {
- ad.votable(name + " (" + label.maxValue() + ") ");
- } else if (ai.hasValue()) {
- ad.votable(name);
- }
- }
- }
- }
- return d;
- }
-
- public static class PostInput extends JavaScriptObject {
- public static PostInput create(String reviewer, boolean confirmed) {
- PostInput input = createObject().cast();
- input.init(reviewer, confirmed);
- return input;
- }
-
- private native void init(String reviewer, boolean confirmed) /*-{
- this.reviewer = reviewer;
- if (confirmed) {
- this.confirmed = true;
- }
- }-*/;
-
- protected PostInput() {}
- }
-
- public static class ReviewerInfo extends AccountInfo {
- final Set<String> approvals() {
- return Natives.keys(_approvals());
- }
-
- final native String approval(String l) /*-{ return this.approvals[l]; }-*/;
-
- private native NativeMap<NativeString> _approvals() /*-{ return this.approvals; }-*/;
-
- protected ReviewerInfo() {}
- }
-
- public static class PostResult extends JavaScriptObject {
- public final native JsArray<ReviewerInfo> reviewers() /*-{ return this.reviewers; }-*/;
-
- public final native boolean confirm() /*-{ return this.confirm || false; }-*/;
-
- public final native String error() /*-{ return this.error; }-*/;
-
- protected PostResult() {}
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Reviewers.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Reviewers.ui.xml
deleted file mode 100644
index cf506e5..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Reviewers.ui.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:c='urn:import:com.google.gwtexpui.globalkey.client'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:u='urn:import:com.google.gerrit.client.ui'>
- <ui:with field='ico' type='com.google.gerrit.client.GerritResources'/>
- <ui:with field='res' type='com.google.gerrit.client.change.Resources'/>
- <ui:style gss='false'>
- .suggestBox {
- margin-bottom: 2px;
- }
-
- .error {
- color: #D33D3D;
- font-weight: bold;
- }
-
- .addReviewer,
- .cancel {
- cursor: pointer;
- float: right;
- }
- </ui:style>
- <g:HTMLPanel>
- <div>
- <span ui:field='reviewersText'/>
- <g:Image ui:field='addReviewerIcon'
- resource='{ico.addUser}'
- styleName='{style.addReviewer}'
- title='Add Reviewer'/>
- </div>
- <div ui:field='form' style='display: none' aria-hidden='true'>
- <u:RemoteSuggestBox ui:field='suggestBox' styleName='{style.suggestBox}'/>
- <div ui:field='error'
- class='{style.error}'
- style='display: none' aria-hidden='true'/>
- <div>
- <g:Button ui:field='add' styleName='{res.style.button}'>
- <div>Add</div>
- </g:Button>
- <g:Button ui:field='addMe'
- styleName='{res.style.button}' visible='false'>
- <div>Add Me</div>
- </g:Button>
- <g:Button ui:field='cancel'
- styleName='{res.style.button}'
- addStyleNames='{style.cancel}'>
- <div>Cancel</div>
- </g:Button>
- </div>
- </div>
- </g:HTMLPanel>
- </ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RightSidePopdownAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RightSidePopdownAction.java
deleted file mode 100644
index 1383c5d..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/RightSidePopdownAction.java
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gwt.dom.client.Document;
-import com.google.gwt.dom.client.Style;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-
-abstract class RightSidePopdownAction {
- private final ChangeScreen.Style style;
- private final Widget button;
- private final UIObject relativeTo;
- private PopupPanel popup;
-
- RightSidePopdownAction(ChangeScreen.Style style, UIObject relativeTo, Widget button) {
- this.style = style;
- this.relativeTo = relativeTo;
- this.button = button;
- }
-
- abstract Widget getWidget();
-
- void show() {
- if (popup != null) {
- button.removeStyleName(style.selected());
- popup.hide();
- return;
- }
-
- final PopupPanel p =
- new PopupPanel(true) {
- @Override
- public void setPopupPosition(int left, int top) {
- top -= Document.get().getBodyOffsetTop();
-
- int w = Window.getScrollLeft() + Window.getClientWidth();
- int r = relativeTo.getAbsoluteLeft() + relativeTo.getOffsetWidth();
- int right = w - r;
- Style style = getElement().getStyle();
- style.clearProperty("left");
- style.setPropertyPx("right", right);
- style.setPropertyPx("top", top);
- }
- };
- p.setStyleName(style.replyBox());
- p.addAutoHidePartner(button.getElement());
- p.addCloseHandler(
- new CloseHandler<PopupPanel>() {
- @Override
- public void onClose(CloseEvent<PopupPanel> event) {
- if (popup == p) {
- button.removeStyleName(style.selected());
- popup = null;
- }
- }
- });
- p.add(getWidget());
- p.showRelativeTo(relativeTo);
- GlobalKey.dialog(p);
- button.addStyleName(style.selected());
- popup = p;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/StarIcon.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/StarIcon.java
deleted file mode 100644
index b7bf8de..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/StarIcon.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (C) 2012 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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.ToggleButton;
-
-class StarIcon extends ToggleButton {
- StarIcon() {
- super(new Image(Gerrit.RESOURCES.starOpen()), new Image(Gerrit.RESOURCES.starFilled()));
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/SubmitAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/SubmitAction.java
deleted file mode 100644
index 4446e65..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/SubmitAction.java
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.api.ChangeGlue;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.SubmitInfo;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-
-class SubmitAction {
- static void call(ChangeInfo changeInfo, RevisionInfo revisionInfo) {
- if (ChangeGlue.onSubmitChange(changeInfo, revisionInfo)) {
- final Change.Id changeId = changeInfo.legacyId();
- ChangeApi.submit(
- changeInfo.project(),
- changeId.get(),
- revisionInfo.name(),
- new GerritCallback<SubmitInfo>() {
- @Override
- public void onSuccess(SubmitInfo result) {
- redisplay();
- }
-
- @Override
- public void onFailure(Throwable err) {
- if (SubmitFailureDialog.isConflict(err)) {
- new SubmitFailureDialog(err.getMessage()).center();
- } else {
- super.onFailure(err);
- }
- redisplay();
- }
-
- private void redisplay() {
- Gerrit.display(PageLinks.toChange(changeInfo.projectNameKey(), changeId));
- }
- });
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/SubmitFailureDialog.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/SubmitFailureDialog.java
deleted file mode 100644
index 77bf217..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/SubmitFailureDialog.java
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (C) 2009 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.client.change;
-
-import com.google.gerrit.client.ErrorDialog;
-import com.google.gerrit.client.changes.Util;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-import com.google.gwtjsonrpc.client.RemoteJsonException;
-
-class SubmitFailureDialog extends ErrorDialog {
- static boolean isConflict(Throwable err) {
- return err instanceof RemoteJsonException && 409 == ((RemoteJsonException) err).getCode();
- }
-
- SubmitFailureDialog(String msg) {
- super(new SafeHtmlBuilder().append(msg.trim()).wikify());
- setText(Util.C.submitFailed());
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Topic.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Topic.java
deleted file mode 100644
index f5c921b..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Topic.java
+++ /dev/null
@@ -1,148 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.ui.InlineHyperlink;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Element;
-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.KeyDownEvent;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwtexpui.globalkey.client.NpTextBox;
-
-/** Displays (and edits) the change topic string. */
-class Topic extends Composite {
- interface Binder extends UiBinder<HTMLPanel, Topic> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- private PatchSet.Id psId;
- private Project.NameKey project;
- private boolean canEdit;
-
- @UiField Element show;
- @UiField InlineHyperlink text;
- @UiField Image editIcon;
-
- @UiField Element form;
- @UiField NpTextBox input;
- @UiField Button save;
- @UiField Button cancel;
-
- Topic() {
- initWidget(uiBinder.createAndBindUi(this));
- editIcon.addDomHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- onEdit();
- }
- },
- ClickEvent.getType());
- }
-
- void set(ChangeInfo info, String revision) {
- canEdit = info.hasActions() && info.actions().containsKey("topic");
-
- psId = new PatchSet.Id(info.legacyId(), info.revisions().get(revision)._number());
- project = info.projectNameKey();
-
- initTopicLink(info);
- editIcon.setVisible(canEdit);
- if (!canEdit) {
- show.setTitle(null);
- }
- }
-
- private void initTopicLink(ChangeInfo info) {
- if (info.topic() != null && !info.topic().isEmpty()) {
- String topic = info.topic();
- text.setText(topic);
- text.setTargetHistoryToken(PageLinks.topicQuery(info.status(), topic));
- }
- }
-
- boolean canEdit() {
- return canEdit;
- }
-
- void onEdit() {
- if (canEdit) {
- UIObject.setVisible(show, false);
- UIObject.setVisible(form, true);
-
- input.setText(text.getText());
- input.setFocus(true);
- input.selectAll();
- }
- }
-
- @UiHandler("cancel")
- void onCancel(@SuppressWarnings("unused") ClickEvent e) {
- input.setFocus(false);
- UIObject.setVisible(form, false);
- UIObject.setVisible(show, true);
- }
-
- @UiHandler("input")
- void onKeyDownInput(KeyDownEvent e) {
- if (e.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
- onCancel(null);
- } else if (e.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
- e.stopPropagation();
- e.preventDefault();
- onSave(null);
- }
- }
-
- @UiHandler("save")
- void onSave(@SuppressWarnings("unused") ClickEvent e) {
- ChangeApi.topic(
- project.get(),
- psId.getParentKey().get(),
- input.getValue().trim(),
- new GerritCallback<String>() {
- @Override
- public void onSuccess(String result) {
- Gerrit.display(PageLinks.toChange(project, psId));
- }
- });
- onCancel(null);
- }
-
- @UiHandler("save")
- void onSaveKeyPress(KeyPressEvent e) {
- if (e.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) {
- e.stopPropagation();
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Topic.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Topic.ui.xml
deleted file mode 100644
index c2a6fbd..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/Topic.ui.xml
+++ /dev/null
@@ -1,54 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:c='urn:import:com.google.gwtexpui.globalkey.client'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:x='urn:import:com.google.gerrit.client.ui'>
- <ui:with field='ico' type='com.google.gerrit.client.GerritResources'/>
- <ui:with field='res' type='com.google.gerrit.client.change.Resources'/>
- <ui:style gss='false'>
- .edit { cursor: pointer; }
- .edit, .cancel { float: right; }
- </ui:style>
- <g:HTMLPanel>
- <div ui:field='show'>
- <x:InlineHyperlink ui:field='text'
- title='Search for changes on this topic'/>
- <g:Image ui:field='editIcon'
- resource='{ico.edit}'
- styleName='{style.edit}'
- title='Edit topic (Shortcut: t)'/>
- </div>
-
- <div ui:field='form' style='display: none' aria-hidden='true'>
- <div>
- <c:NpTextBox ui:field='input' visibleLength='55'/>
- </div>
- <div>
- <g:Button ui:field='save' styleName='{res.style.button}'>
- <div>Update</div>
- </g:Button>
- <g:Button ui:field='cancel'
- styleName='{res.style.button}'
- addStyleNames='{style.cancel}'>
- <div>Cancel</div>
- </g:Button>
- </div>
- </div>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/UpdateAvailableBar.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/UpdateAvailableBar.java
deleted file mode 100644
index 520dc69..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/UpdateAvailableBar.java
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.info.ChangeInfo.MessageInfo;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import java.sql.Timestamp;
-import java.util.HashSet;
-import java.util.List;
-
-/** Displays the "New Message From ..." panel in bottom right on updates. */
-abstract class UpdateAvailableBar extends Composite {
- interface Binder extends UiBinder<HTMLPanel, UpdateAvailableBar> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- private Timestamp updated;
-
- @UiField Element author;
- @UiField Anchor show;
- @UiField Anchor ignore;
-
- UpdateAvailableBar() {
- initWidget(uiBinder.createAndBindUi(this));
- }
-
- void set(List<MessageInfo> newMessages, Timestamp newTime) {
- HashSet<Integer> seen = new HashSet<>();
- StringBuilder r = new StringBuilder();
- for (MessageInfo m : newMessages) {
- int a = m.author() != null ? m.author()._accountId() : 0;
- if (seen.add(a)) {
- if (r.length() > 0) {
- r.append(", ");
- }
- r.append(Message.authorName(m));
- }
- }
- author.setInnerText(r.toString());
- updated = newTime;
- }
-
- @UiHandler("show")
- void onShow(@SuppressWarnings("unused") ClickEvent e) {
- onShow();
- }
-
- @UiHandler("ignore")
- void onIgnore(@SuppressWarnings("unused") ClickEvent e) {
- onIgnore(updated);
- removeFromParent();
- }
-
- abstract void onShow();
-
- abstract void onIgnore(Timestamp newTime);
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/UpdateAvailableBar.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/UpdateAvailableBar.ui.xml
deleted file mode 100644
index 1d5592b..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/UpdateAvailableBar.ui.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:c='urn:import:com.google.gwtexpui.globalkey.client'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:style gss='false'>
- .popup {
- position: fixed;
- bottom: 0;
- right: 0;
- z-index: 10;
- padding: 5px;
- }
- .bar {
- background-color: #fff1a8;
- border: 1px solid #ccc;
- padding: 5px 10px;
- font-size: 80%;
- color: #222;
- white-space: nowrap;
- width: auto;
- height: auto;
- }
- a.action {
- color: #222;
- text-decoration: underline;
- display: inline-block;
- margin-left: 0.5em;
- }
- </ui:style>
- <g:HTMLPanel styleName='{style.popup}'>
- <div class='{style.bar}'>
- <ui:msg>Update from <span ui:field='author'/></ui:msg>
- <g:Anchor ui:field='show'
- styleName='{style.action}'
- href='javascript:;'
- title='Refresh screen and display updates'>
- <ui:attribute name='title'/>
- <ui:msg>Show</ui:msg>
- </g:Anchor>
- <g:Anchor ui:field='ignore'
- styleName='{style.action}'
- href='javascript:;'
- title='Ignore this update'>
- <ui:attribute name='title'/>
- <ui:msg>Ignore</ui:msg>
- </g:Anchor>
- </div>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/UpdateCheckTimer.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/UpdateCheckTimer.java
deleted file mode 100644
index 4a5af0551..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/UpdateCheckTimer.java
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright (C) 2013 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.client.change;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.ui.UserActivityMonitor;
-import com.google.gwt.event.logical.shared.ValueChangeEvent;
-import com.google.gwt.event.logical.shared.ValueChangeHandler;
-import com.google.gwt.user.client.Timer;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-class UpdateCheckTimer extends Timer implements ValueChangeHandler<Boolean> {
- private static final int MAX_PERIOD = 3 * 60 * 1000;
- private static final int IDLE_PERIOD = 2 * 3600 * 1000;
- private static final int POLL_PERIOD = Gerrit.info().change().updateDelay() * 1000;
-
- private final ChangeScreen screen;
- private int delay;
- private boolean running;
-
- UpdateCheckTimer(ChangeScreen screen) {
- this.screen = screen;
- this.delay = POLL_PERIOD;
- }
-
- void schedule() {
- scheduleRepeating(delay);
- }
-
- @Override
- public void run() {
- if (!screen.isAttached()) {
- // screen should have cancelled this timer.
- cancel();
- return;
- } else if (running) {
- return;
- }
-
- running = true;
- screen.loadChangeInfo(
- false,
- new AsyncCallback<ChangeInfo>() {
- @Override
- public void onSuccess(ChangeInfo info) {
- running = false;
- screen.showUpdates(info);
-
- int d = UserActivityMonitor.isActive() ? POLL_PERIOD : IDLE_PERIOD;
- if (d != delay) {
- delay = d;
- schedule();
- }
- }
-
- @Override
- public void onFailure(Throwable caught) {
- // On failures increase the delay time and try again,
- // but place an upper bound on the delay.
- running = false;
- delay =
- (int)
- Math.max(
- delay * (1.5 + Math.random()),
- UserActivityMonitor.isActive() ? MAX_PERIOD : IDLE_PERIOD + MAX_PERIOD);
- schedule();
- }
- });
- }
-
- @Override
- public void onValueChange(ValueChangeEvent<Boolean> event) {
- if (event.getValue()) {
- delay = POLL_PERIOD;
- run();
- } else {
- delay = IDLE_PERIOD;
- }
- schedule();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/VotableInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/VotableInfo.java
deleted file mode 100644
index 33d8d12..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/VotableInfo.java
+++ /dev/null
@@ -1,37 +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.client.change;
-
-import java.util.HashSet;
-import java.util.Set;
-
-class VotableInfo {
- private Set<String> votable;
-
- void votable(String label) {
- if (votable == null) {
- votable = new HashSet<>();
- }
- votable.add(label);
- }
-
- Set<String> votableLabels() {
- Set<String> s = new HashSet<>();
- if (votable != null) {
- s.addAll(votable);
- }
- return s;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/common.css b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/common.css
deleted file mode 100644
index bb7cb27..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/common.css
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Copyright (C) 2013 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.
- */
-
-@eval trimColor com.google.gerrit.client.Gerrit.getTheme().trimColor;
-
-.popup {
- background-color: trimColor;
- min-width: 300px;
- min-height: 90px;
-}
-
-.popupContent {
- padding: 5px;
-}
-
-.button,
-.popup button,
-.popup input[type='button'] {
- margin: 0 3px 0 0;
- border-color: rgba(0, 0, 0, 0.15) !important;
- text-align: center;
- font-size: 11px;
- font-weight: bold;
- border: 2px solid;
- cursor: pointer;
- color: #fff;
- background-color: #4d90fe;
- background-image: -webkit-linear-gradient(top, #4d90fe, #4d90fe);
- -webkit-border-radius: 2px;
- -webkit-box-sizing: content-box;
-}
-
-.button:disabled,
-.popup button:disabled,
-.popup input[type='button']:disabled {
- background-color: #999;
- background-image: -webkit-linear-gradient(top, #999, #999);
-}
-
-.button div, .popup button div {
- width: 54px;
- white-space: nowrap;
- color: #fff;
- height: 14px;
- line-height: 14px;
-}
-
-.section {
- padding: 5px 5px;
- border-bottom: 1px solid #b8b8b8;
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/file_table.css b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/file_table.css
deleted file mode 100644
index 6f514df..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/file_table.css
+++ /dev/null
@@ -1,115 +0,0 @@
-/* Copyright (C) 2013 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.
- */
-
-.pointer, .reviewed, .restoreDelete {
- padding: 0px;
- vertical-align: top;
-}
-.pointer {
- width: 12px;
-}
-.reviewed {
- height: 19px;
- width: 20px;
-}
-
-.table th {
- vertical-align: top;
- text-align: left;
-}
-.table tr {
- vertical-align: top;
-}
-.table tr:hover {
- background: rgba(209, 245, 248, 0.32);
-}
-.table tr.nohover:hover {
- background: transparent;
-}
-
-.status {
- padding-right: 4px;
- color: #888;
-}
-
-.pathColumn {
- white-space: nowrap;
- min-width: 600px;
-}
-.pathColumn a {
- color: #000;
- cursor: pointer;
-}
-.commonPrefix {
- color: #888;
-}
-.renameCopySource {
- color: #888;
- font-size: smaller;
-}
-
-.draftColumn,
-.newColumn,
-.commentColumn {
- white-space: nowrap;
-}
-.draftColumn {
- color: #d44;
- font-weight: bold;
-}
-.newColumn {
- font-weight: bold;
-}
-
-.deltaColumn1 {
- white-space: nowrap;
- text-align: right !important;
-}
-
-.deltaColumn2 {
- padding-left: 5px;
- white-space: nowrap;
- text-align: right;
-}
-
-.inserted {
- height: 10px;
- display: inline-block;
- background-color: #4d4;
-}
-
-.deleted {
- height: 10px;
- display: inline-block;
- background-color: #d44;
-}
-
-.restoreDelete div {
- white-space: nowrap;
-}
-
-.restoreDelete button {
- cursor: pointer;
- padding: 0;
- margin: 0 0 0 5px;
- border: 0;
- background-color: transparent;
- white-space: nowrap;
-}
-
-.error {
- color: #D33D3D;
- font-weight: bold;
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/moreLess.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/moreLess.png
deleted file mode 100644
index 298514f..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/moreLess.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/related_changes.css b/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/related_changes.css
deleted file mode 100644
index 5e0e402..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/change/related_changes.css
+++ /dev/null
@@ -1,98 +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.
- */
-
-@external .gwt-TabBarItem;
-@external .gwt-TabBarItem-disabled;
-@external .gwt-TabBarItem-selected;
-@external .gwt-TabBarRest;
-@external .gwt-TabPanelBottom;
-@eval selectionColor com.google.gerrit.client.Gerrit.getTheme().selectionColor;
-
-.row {
- white-space: nowrap;
-}
-
-.activeRow {
- background-color: selectionColor !important;
-}
-
-.activeRow .pointer {
- visibility: visible;
-}
-
-.pointer {
- display: inline-block;
- vertical-align: top;
- visibility: hidden;
-}
-
-.subject, .strikedSubject {
- display: inline-block;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- width: 355px;
-}
-.strikedSubject {
- text-decoration: line-through;
-}
-
-.tabPanel .gwt-TabBarItem,
-.tabPanel .gwt-TabBarItem-selected,
-.tabPanel .gwt-TabBarRest {
- background: none repeat scroll 0 0 #FFF !important;
-}
-
-.tabPanel .gwt-TabPanelBottom {
- padding: 2px 0 0 0;
-}
-
-.tabPanel .gwt-TabBarItem-selected {
- border-bottom-color: #000 !important;
- color: #000 !important;
-}
-
-.tabPanel .gwt-TabBarItem-disabled {
- display: none;
-}
-
-.current,
-.gitweb,
-.indirect,
-.notCurrent,
-.submittable {
- display: inline-block;
- text-align: center;
- vertical-align: top;
- width: 12px;
-}
-
-.gitweb {
- color: #000;
-}
-
-.indirect {
- color: #090; /* green */
- font-weight: bold;
-}
-
-.notCurrent {
- color: #FFA62F; /* orange */
-}
-
-.submittable {
- color: #090; /* green */
- font-weight: bold;
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/AccountDashboardScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/AccountDashboardScreen.java
deleted file mode 100644
index 7ec1102..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/AccountDashboardScreen.java
+++ /dev/null
@@ -1,212 +0,0 @@
-// Copyright (C) 2008 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.client.changes;
-
-import static java.util.Comparator.comparing;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.NotFoundScreen;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.rpc.ScreenLoadCallback;
-import com.google.gerrit.client.ui.InlineHyperlink;
-import com.google.gerrit.client.ui.Screen;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.extensions.client.ListChangesOption;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwtexpui.globalkey.client.KeyCommand;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.EnumSet;
-import java.util.Set;
-
-public class AccountDashboardScreen extends Screen implements ChangeListScreen {
- // If changing default options, also update in
- // ChangeIT#defaultSearchDoesNotTouchDatabase().
- private static final Set<ListChangesOption> MY_DASHBOARD_OPTIONS;
-
- static {
- EnumSet<ListChangesOption> options = EnumSet.copyOf(ChangeTable.OPTIONS);
- options.add(ListChangesOption.REVIEWED);
- MY_DASHBOARD_OPTIONS = Collections.unmodifiableSet(options);
- }
-
- private final Integer ownerId;
- private final boolean mine;
- private ChangeTable table;
- private ChangeTable.Section workInProgress;
- private ChangeTable.Section outgoing;
- private ChangeTable.Section incoming;
- private ChangeTable.Section closed;
-
- public AccountDashboardScreen(Integer accountId) {
- ownerId = accountId;
- mine = Gerrit.isSignedIn() && ownerId == Gerrit.getUserAccount()._accountId();
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- table =
- new ChangeTable() {
- {
- keysNavigation.add(
- new KeyCommand(0, 'R', Util.C.keyReloadSearch()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- Gerrit.display(getToken());
- }
- });
- }
- };
- table.addStyleName(Gerrit.RESOURCES.css().accountDashboard());
-
- workInProgress = new ChangeTable.Section();
- outgoing = new ChangeTable.Section();
- incoming = new ChangeTable.Section();
- closed = new ChangeTable.Section();
-
- String who = mine ? "self" : ownerId.toString();
- workInProgress.setTitleWidget(
- new InlineHyperlink(
- Util.C.workInProgress(), PageLinks.toChangeQuery(queryWorkInProgress(who))));
- outgoing.setTitleWidget(
- new InlineHyperlink(Util.C.outgoingReviews(), PageLinks.toChangeQuery(queryOutgoing(who))));
- incoming.setTitleWidget(
- new InlineHyperlink(Util.C.incomingReviews(), PageLinks.toChangeQuery(queryIncoming(who))));
- incoming.setHighlightUnreviewed(mine);
- closed.setTitleWidget(
- new InlineHyperlink(Util.C.recentlyClosed(), PageLinks.toChangeQuery(queryClosed(who))));
-
- table.addSection(workInProgress);
- table.addSection(outgoing);
- table.addSection(incoming);
- table.addSection(closed);
- add(table);
- table.setSavePointerId("owner:" + ownerId);
- }
-
- private static String queryWorkInProgress(String who) {
- return "is:open is:wip owner:" + who;
- }
-
- private static String queryOutgoing(String who) {
- return "is:open -is:wip owner:" + who;
- }
-
- private static String queryIncoming(String who) {
- return "is:open ((reviewer:"
- + who
- + " -owner:"
- + who
- + " -is:ignored) OR assignee:"
- + who
- + ")";
- }
-
- private static String queryClosed(String who) {
- return "is:closed (owner:" + who + " OR reviewer:" + who + " OR assignee:" + who + ")";
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
-
- String who = mine ? "self" : ownerId.toString();
- ChangeList.queryMultiple(
- new ScreenLoadCallback<JsArray<ChangeList>>(this) {
- @Override
- protected void preDisplay(JsArray<ChangeList> result) {
- display(result);
- }
- },
- mine ? MY_DASHBOARD_OPTIONS : DashboardTable.OPTIONS,
- queryWorkInProgress(who),
- queryOutgoing(who),
- queryIncoming(who),
- queryClosed(who) + " -age:4w limit:10");
- }
-
- @Override
- public void registerKeys() {
- super.registerKeys();
- table.setRegisterKeys(true);
- }
-
- private void display(JsArray<ChangeList> result) {
- if (!mine && !hasChanges(result)) {
- // When no results are returned and the data is not for the
- // current user, the target user is presumed to not exist.
- Gerrit.display(getToken(), new NotFoundScreen());
- return;
- }
-
- ChangeList wip = result.get(0);
- ChangeList out = result.get(1);
- ChangeList in = result.get(2);
- ChangeList done = result.get(3);
-
- if (mine) {
- setWindowTitle(Util.C.myDashboardTitle());
- setPageTitle(Util.C.myDashboardTitle());
- } else {
- // The server doesn't tell us who the dashboard is for. Try to guess
- // by looking at a change started by the owner and extract the name.
- String name = guessName(out);
- if (name == null) {
- name = guessName(done);
- }
- if (name != null) {
- setWindowTitle(name);
- setPageTitle(Util.M.accountDashboardTitle(name));
- } else {
- setWindowTitle(Util.C.unknownDashboardTitle());
- setWindowTitle(Util.C.unknownDashboardTitle());
- }
- }
-
- Natives.asList(out).sort(outComparator());
-
- table.updateColumnsForLabels(wip, out, in, done);
- workInProgress.display(wip);
- outgoing.display(out);
- incoming.display(in);
- closed.display(done);
- table.finishDisplay();
- }
-
- private Comparator<ChangeInfo> outComparator() {
- return comparing(ChangeInfo::created).thenComparing(ChangeInfo::_number);
- }
-
- private boolean hasChanges(JsArray<ChangeList> result) {
- for (ChangeList list : Natives.asList(result)) {
- if (list.length() != 0) {
- return true;
- }
- }
- return false;
- }
-
- private static String guessName(ChangeList list) {
- for (ChangeInfo change : Natives.asList(list)) {
- if (change.owner() != null && change.owner().name() != null) {
- return change.owner().name();
- }
- }
- return null;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeApi.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeApi.java
deleted file mode 100644
index 02be8c7..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeApi.java
+++ /dev/null
@@ -1,401 +0,0 @@
-// Copyright (C) 2012 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.client.changes;
-
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.CommitInfo;
-import com.google.gerrit.client.info.ChangeInfo.EditInfo;
-import com.google.gerrit.client.info.ChangeInfo.IncludedInInfo;
-import com.google.gerrit.client.rpc.CallbackGroup.Callback;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-/** A collection of static methods which work on the Gerrit REST API for specific changes. */
-public class ChangeApi {
- /** Abandon the change, ending its review. */
- public static void abandon(
- @Nullable String project, int id, String msg, AsyncCallback<ChangeInfo> cb) {
- MessageInput input = MessageInput.create();
- input.message(emptyToNull(msg));
- call(project, id, "abandon").post(input, cb);
- }
-
- /** Create a new work-in-progress change. */
- public static void createChange(
- String project,
- String branch,
- String topic,
- String subject,
- String base,
- AsyncCallback<ChangeInfo> cb) {
- CreateChangeInput input = CreateChangeInput.create();
- input.project(emptyToNull(project));
- input.branch(emptyToNull(branch));
- input.topic(emptyToNull(topic));
- input.subject(emptyToNull(subject));
- input.baseChange(emptyToNull(base));
- input.workInProgress(true);
-
- new RestApi("/changes/").post(input, cb);
- }
-
- /** Restore a previously abandoned change to be open again. */
- public static void restore(
- @Nullable String project, int id, String msg, AsyncCallback<ChangeInfo> cb) {
- MessageInput input = MessageInput.create();
- input.message(emptyToNull(msg));
- call(project, id, "restore").post(input, cb);
- }
-
- /** Create a new change that reverts the delta caused by this change. */
- public static void revert(
- @Nullable String project, int id, String msg, AsyncCallback<ChangeInfo> cb) {
- MessageInput input = MessageInput.create();
- input.message(emptyToNull(msg));
- call(project, id, "revert").post(input, cb);
- }
-
- /** Update the topic of a change. */
- public static void topic(
- @Nullable String project, int id, String topic, AsyncCallback<String> cb) {
- RestApi call = call(project, id, "topic");
- topic = emptyToNull(topic);
- if (topic != null) {
- TopicInput input = TopicInput.create();
- input.topic(topic);
- call.put(input, NativeString.unwrap(cb));
- } else {
- call.delete(NativeString.unwrap(cb));
- }
- }
-
- public static void detail(@Nullable String project, int id, AsyncCallback<ChangeInfo> cb) {
- detail(project, id).get(cb);
- }
-
- public static RestApi detail(@Nullable String project, int id) {
- return call(project, id, "detail");
- }
-
- public static RestApi blame(@Nullable String project, PatchSet.Id id, String path, boolean base) {
- return revision(project, id).view("files").id(path).view("blame").addParameter("base", base);
- }
-
- public static RestApi actions(@Nullable String project, int id, String revision) {
- if (revision == null || revision.equals("")) {
- revision = "current";
- }
- return call(project, id, revision, "actions");
- }
-
- public static void deleteAssignee(
- @Nullable String project, int id, AsyncCallback<AccountInfo> cb) {
- change(project, id).view("assignee").delete(cb);
- }
-
- public static void setAssignee(
- @Nullable String project, int id, String user, AsyncCallback<AccountInfo> cb) {
- AssigneeInput input = AssigneeInput.create();
- input.assignee(user);
- change(project, id).view("assignee").put(input, cb);
- }
-
- public static void markPrivate(
- @Nullable String project, int id, AsyncCallback<JavaScriptObject> cb) {
- change(project, id).view("private").post(PrivateInput.create(), cb);
- }
-
- public static void unmarkPrivate(
- @Nullable String project, int id, AsyncCallback<JavaScriptObject> cb) {
- change(project, id).view("private.delete").post(PrivateInput.create(), cb);
- }
-
- public static RestApi comments(@Nullable String project, int id) {
- return call(project, id, "comments");
- }
-
- public static RestApi drafts(@Nullable String project, int id) {
- return call(project, id, "drafts");
- }
-
- public static void edit(@Nullable String project, int id, AsyncCallback<EditInfo> cb) {
- edit(project, id).get(cb);
- }
-
- public static void editWithFiles(@Nullable String project, int id, AsyncCallback<EditInfo> cb) {
- edit(project, id).addParameterTrue("list").get(cb);
- }
-
- public static RestApi edit(@Nullable String project, int id) {
- return change(project, id).view("edit");
- }
-
- public static RestApi editWithCommands(@Nullable String project, int id) {
- return edit(project, id).addParameterTrue("download-commands");
- }
-
- public static void includedIn(
- @Nullable String project, int id, AsyncCallback<IncludedInInfo> cb) {
- call(project, id, "in").get(cb);
- }
-
- public static RestApi revision(@Nullable String project, int id, String revision) {
- return change(project, id).view("revisions").id(revision);
- }
-
- public static RestApi revision(@Nullable String project, PatchSet.Id id) {
- int cn = id.getParentKey().get();
- String revision = RevisionInfoCache.get(id);
- if (revision != null) {
- return revision(project, cn, revision);
- }
- return change(project, cn).view("revisions").id(id.get());
- }
-
- public static RestApi reviewers(@Nullable String project, int id) {
- return change(project, id).view("reviewers");
- }
-
- public static RestApi suggestReviewers(
- @Nullable String project, int id, String q, int n, boolean e) {
- RestApi api =
- change(project, id).view("suggest_reviewers").addParameter("n", n).addParameter("e", e);
- if (q != null) {
- api.addParameter("q", q);
- }
- return api;
- }
-
- public static RestApi vote(@Nullable String project, int id, int reviewer, String vote) {
- return reviewer(project, id, reviewer).view("votes").id(vote);
- }
-
- public static RestApi reviewer(@Nullable String project, int id, int reviewer) {
- return change(project, id).view("reviewers").id(reviewer);
- }
-
- public static RestApi reviewer(@Nullable String project, int id, String reviewer) {
- return change(project, id).view("reviewers").id(reviewer);
- }
-
- public static RestApi hashtags(@Nullable String project, int changeId) {
- return change(project, changeId).view("hashtags");
- }
-
- public static RestApi hashtag(@Nullable String project, int changeId, String hashtag) {
- return change(project, changeId).view("hashtags").id(hashtag);
- }
-
- /** Submit a specific revision of a change. */
- public static void cherrypick(
- String project,
- int id,
- String commit,
- String destination,
- String message,
- AsyncCallback<ChangeInfo> cb) {
- CherryPickInput cherryPickInput = CherryPickInput.create();
- cherryPickInput.setMessage(message);
- cherryPickInput.setDestination(destination);
- call(project, id, commit, "cherrypick").post(cherryPickInput, cb);
- }
-
- /** Move change to another branch. */
- public static void move(
- String project, int id, String destination, String message, AsyncCallback<ChangeInfo> cb) {
- MoveInput moveInput = MoveInput.create();
- moveInput.setMessage(message);
- moveInput.setDestinationBranch(destination);
- change(project, id).view("move").post(moveInput, cb);
- }
-
- /** Edit commit message for specific revision of a change. */
- public static void message(
- @Nullable String project,
- int id,
- String commit,
- String message,
- AsyncCallback<JavaScriptObject> cb) {
- CherryPickInput input = CherryPickInput.create();
- input.setMessage(message);
- call(project, id, commit, "message").post(input, cb);
- }
-
- /** Submit a specific revision of a change. */
- public static void submit(
- @Nullable String project, int id, String commit, AsyncCallback<SubmitInfo> cb) {
- JavaScriptObject in = JavaScriptObject.createObject();
- call(project, id, commit, "submit").post(in, cb);
- }
-
- /** Delete a specific draft change. */
- public static void deleteChange(
- @Nullable String project, int id, AsyncCallback<JavaScriptObject> cb) {
- change(project, id).delete(cb);
- }
-
- /** Delete change edit. */
- public static void deleteEdit(
- @Nullable String project, int id, AsyncCallback<JavaScriptObject> cb) {
- edit(project, id).delete(cb);
- }
-
- /** Publish change edit. */
- public static void publishEdit(
- @Nullable String project, int id, AsyncCallback<JavaScriptObject> cb) {
- JavaScriptObject in = JavaScriptObject.createObject();
- change(project, id).view("edit:publish").post(in, cb);
- }
-
- /** Rebase change edit on latest patch set. */
- public static void rebaseEdit(
- @Nullable String project, int id, AsyncCallback<JavaScriptObject> cb) {
- JavaScriptObject in = JavaScriptObject.createObject();
- change(project, id).view("edit:rebase").post(in, cb);
- }
-
- /** Rebase a revision onto the branch tip or another change. */
- public static void rebase(
- @Nullable String project, int id, String commit, String base, AsyncCallback<ChangeInfo> cb) {
- RebaseInput rebaseInput = RebaseInput.create();
- rebaseInput.setBase(base);
- call(project, id, commit, "rebase").post(rebaseInput, cb);
- }
-
- private static class MessageInput extends JavaScriptObject {
- final native void message(String m) /*-{ if(m)this.message=m; }-*/;
-
- static MessageInput create() {
- return (MessageInput) createObject();
- }
-
- protected MessageInput() {}
- }
-
- private static class AssigneeInput extends JavaScriptObject {
- final native void assignee(String a) /*-{ if(a)this.assignee=a; }-*/;
-
- static AssigneeInput create() {
- return (AssigneeInput) createObject();
- }
-
- protected AssigneeInput() {}
- }
-
- private static class TopicInput extends JavaScriptObject {
- final native void topic(String t) /*-{ if(t)this.topic=t; }-*/;
-
- static TopicInput create() {
- return (TopicInput) createObject();
- }
-
- protected TopicInput() {}
- }
-
- private static class CreateChangeInput extends JavaScriptObject {
- static CreateChangeInput create() {
- return (CreateChangeInput) createObject();
- }
-
- public final native void branch(String b) /*-{ if(b)this.branch=b; }-*/;
-
- public final native void topic(String t) /*-{ if(t)this.topic=t; }-*/;
-
- public final native void project(String p) /*-{ if(p)this.project=p; }-*/;
-
- public final native void subject(String s) /*-{ if(s)this.subject=s; }-*/;
-
- public final native void status(String s) /*-{ if(s)this.status=s; }-*/;
-
- public final native void baseChange(String b) /*-{ if(b)this.base_change=b; }-*/;
-
- public final native void workInProgress(Boolean b) /*-{ if(b)this.work_in_progress=b; }-*/;
-
- protected CreateChangeInput() {}
- }
-
- private static class CherryPickInput extends JavaScriptObject {
- static CherryPickInput create() {
- return (CherryPickInput) createObject();
- }
-
- final native void setDestination(String d) /*-{ this.destination = d; }-*/;
-
- final native void setMessage(String m) /*-{ this.message = m; }-*/;
-
- protected CherryPickInput() {}
- }
-
- private static class MoveInput extends JavaScriptObject {
- static MoveInput create() {
- return (MoveInput) createObject();
- }
-
- final native void setDestinationBranch(String d) /*-{ this.destination_branch = d; }-*/;
-
- final native void setMessage(String m) /*-{ this.message = m; }-*/;
-
- protected MoveInput() {}
- }
-
- private static class PrivateInput extends JavaScriptObject {
- static PrivateInput create() {
- return (PrivateInput) createObject();
- }
-
- final native void setMessage(String m) /*-{ this.message = m; }-*/;
-
- protected PrivateInput() {}
- }
-
- private static class RebaseInput extends JavaScriptObject {
- final native void setBase(String b) /*-{ this.base = b; }-*/;
-
- static RebaseInput create() {
- return (RebaseInput) createObject();
- }
-
- protected RebaseInput() {}
- }
-
- private static RestApi call(@Nullable String project, int id, String action) {
- return change(project, id).view(action);
- }
-
- private static RestApi call(@Nullable String project, int id, String commit, String action) {
- return change(project, id).view("revisions").id(commit).view(action);
- }
-
- public static RestApi change(@Nullable String project, int id) {
- if (project == null) {
- return new RestApi("/changes/").id(String.valueOf(id));
- }
- return new RestApi("/changes/").id(project, id);
- }
-
- public static String emptyToNull(String str) {
- return str == null || str.isEmpty() ? null : str;
- }
-
- public static void commitWithLinks(
- @Nullable String project, int changeId, String revision, Callback<CommitInfo> callback) {
- revision(project, changeId, revision).view("commit").addParameterTrue("links").get(callback);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeConstants.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeConstants.java
deleted file mode 100644
index aa6c4ec..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeConstants.java
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright (C) 2008 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.client.changes;
-
-import com.google.gwt.i18n.client.Constants;
-
-public interface ChangeConstants extends Constants {
- String statusLongNew();
-
- String statusLongMerged();
-
- String statusLongAbandoned();
-
- String statusLongDraft();
-
- String submittable();
-
- String readyToSubmit();
-
- String mergeConflict();
-
- String notCurrent();
-
- String isPrivate();
-
- String isWorkInProgress();
-
- String changeEdit();
-
- String myDashboardTitle();
-
- String unknownDashboardTitle();
-
- String workInProgress();
-
- String incomingReviews();
-
- String outgoingReviews();
-
- String recentlyClosed();
-
- String changeTableColumnSubject();
-
- String changeTableColumnSize();
-
- String changeTableColumnStatus();
-
- String changeTableColumnOwner();
-
- String changeTableColumnAssignee();
-
- String changeTableColumnProject();
-
- String changeTableColumnBranch();
-
- String changeTableColumnLastUpdate();
-
- String changeTableColumnID();
-
- String changeTableNone();
-
- String changeTableNotMergeable();
-
- String changeItemHelp();
-
- String changeTableStar();
-
- String changeTablePagePrev();
-
- String changeTablePageNext();
-
- String upToChangeList();
-
- String keyReloadChange();
-
- String keyNextPatchSet();
-
- String keyPreviousPatchSet();
-
- String keyReloadSearch();
-
- String keyPublishComments();
-
- String keyEditTopic();
-
- String keyAddReviewers();
-
- String keyExpandAllMessages();
-
- String keyCollapseAllMessages();
-
- String patchTableColumnName();
-
- String patchTableColumnComments();
-
- String patchTableColumnSize();
-
- String commitMessage();
-
- String mergeList();
-
- String patchTablePrev();
-
- String patchTableNext();
-
- String patchTableOpenDiff();
-
- String approvalTableEditAssigneeHint();
-
- String approvalTableAddReviewerHint();
-
- String approvalTableAddManyReviewersConfirmationDialogTitle();
-
- String changeInfoBlockUploaded();
-
- String changeInfoBlockUpdated();
-
- String messageNoAuthor();
-
- String sideBySide();
-
- String unifiedDiff();
-
- String buttonRevertChangeSend();
-
- String headingRevertMessage();
-
- String revertChangeTitle();
-
- String buttonCherryPickChangeSend();
-
- String headingCherryPickBranch();
-
- String cherryPickCommitMessage();
-
- String cherryPickTitle();
-
- String moveChangeSend();
-
- String headingMoveBranch();
-
- String moveChangeMessage();
-
- String moveTitle();
-
- String buttonRebaseChangeSend();
-
- String rebaseConfirmMessage();
-
- String rebaseNotPossibleMessage();
-
- String rebasePlaceholderMessage();
-
- String rebaseTitle();
-
- String baseDiffItem();
-
- String autoMerge();
-
- String pagedChangeListPrev();
-
- String pagedChangeListNext();
-
- String submitFailed();
-
- String votable();
-
- String pushCertMissing();
-
- String pushCertBad();
-
- String pushCertOk();
-
- String pushCertTrusted();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeConstants.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeConstants.properties
deleted file mode 100644
index 2d5a9f9..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeConstants.properties
+++ /dev/null
@@ -1,103 +0,0 @@
-statusLongNew = Review in Progress
-statusLongMerged = Merged
-statusLongAbandoned = Abandoned
-statusLongDraft = Draft
-submittable = Submittable
-readyToSubmit = Ready to Submit
-mergeConflict = Merge Conflict
-notCurrent = Not Current
-changeEdit = Change Edit
-isPrivate = (Private)
-isWorkInProgress = (Work in Progress)
-
-myDashboardTitle = My Reviews
-unknownDashboardTitle = Code Review Dashboard
-workInProgress Work in progress
-incomingReviews = Incoming reviews
-outgoingReviews = Outgoing reviews
-recentlyClosed = Recently closed
-
-changeTableColumnSubject = Subject
-changeTableColumnSize = Size
-changeTableColumnStatus = Status
-changeTableColumnOwner = Owner
-changeTableColumnAssignee = Assignee
-changeTableColumnProject = Project
-changeTableColumnBranch = Branch
-changeTableColumnLastUpdate = Updated
-changeTableColumnID = ID
-changeTableNone = (None)
-changeTableNotMergeable = Merge Conflict
-
-changeItemHelp = change
-changeTableStar = Star (or unstar) change
-changeTablePagePrev = Previous page of changes
-changeTablePageNext = Next page of changes
-upToChangeList = Up to change list
-keyReloadChange = Reload change
-keyNextPatchSet = Next patch set
-keyPreviousPatchSet = Previous patch set
-keyReloadSearch = Reload change list
-keyPublishComments = Review and publish comments
-keyEditTopic = Edit change topic
-keyAddReviewers = Add reviewers
-keyExpandAllMessages = Expand all messages
-keyCollapseAllMessages = Collapse all messages
-
-patchTableColumnName = File Path
-patchTableColumnComments = Comments
-patchTableColumnSize = Size
-commitMessage = Commit Message
-mergeList = Merge List
-
-patchTablePrev = Previous file
-patchTableNext = Next file
-patchTableOpenDiff = Open diff
-
-approvalTableEditAssigneeHint = Name or Email
-
-approvalTableAddReviewerHint = Name or Email or Group
-approvalTableAddManyReviewersConfirmationDialogTitle = Adding Group Members as Reviewers
-
-changeInfoBlockUploaded = Uploaded
-changeInfoBlockUpdated = Updated
-
-messageNoAuthor = Gerrit Code Review
-
-sideBySide = Side by Side
-unifiedDiff = Unified Diff
-
-baseDiffItem = Base
-autoMerge = Auto Merge
-
-buttonRevertChangeSend = Revert Change
-headingRevertMessage = Revert Commit Message:
-revertChangeTitle = Code Review - Revert Merged Change
-
-buttonCherryPickChangeSend = Cherry Pick Change
-headingCherryPickBranch = Cherry Pick to Branch:
-cherryPickCommitMessage = Cherry Pick Commit Message:
-cherryPickTitle = Code Review - Cherry Pick Change to Another Branch
-
-headingMoveBranch = Move Change to Branch:
-moveChangeSend = Move Change
-moveChangeMessage = Move Change Message:
-moveTitle = Code Review - Move Change to Another Branch
-
-buttonRebaseChangeSend = Rebase
-rebaseConfirmMessage = Change parent revision
-rebaseNotPossibleMessage = Change is already up to date
-rebasePlaceholderMessage = (subject, change number, or leave empty)
-rebaseTitle = Code Review - Rebase Change
-
-pagedChangeListPrev = ⇦Prev
-pagedChangeListNext = Next⇨
-
-submitFailed = Submit Failed
-
-votable = Votable:
-
-pushCertMissing = This patch set was created without a push certificate
-pushCertBad = Push certificate is invalid
-pushCertOk = Push certificate is valid, but key is not trusted
-pushCertTrusted = Push certificate is valid and key is trusted
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeEditApi.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeEditApi.java
deleted file mode 100644
index 71b54f7d..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeEditApi.java
+++ /dev/null
@@ -1,142 +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.client.changes;
-
-import com.google.gerrit.client.VoidResult;
-import com.google.gerrit.client.editor.EditFileInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.HttpCallback;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.reviewdb.client.Patch;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-/** REST API helpers to remotely edit a change. */
-public class ChangeEditApi {
- /** Get file (or commit message) contents. */
- public static void get(
- @Nullable Project.NameKey project,
- PatchSet.Id id,
- String path,
- boolean base,
- HttpCallback<NativeString> cb) {
- RestApi api;
- if (id.get() != 0) {
- // Read from a published revision, when change edit doesn't
- // exist for the caller, or is not currently active.
- api =
- ChangeApi.revision(Project.NameKey.asStringOrNull(project), id)
- .view("files")
- .id(path)
- .view("content");
- } else if (Patch.COMMIT_MSG.equals(path)) {
- api =
- editMessage(Project.NameKey.asStringOrNull(project), id.getParentKey().get())
- .addParameter("base", base);
- } else {
- api =
- editFile(Project.NameKey.asStringOrNull(project), id.getParentKey().get(), path)
- .addParameter("base", base);
- }
- api.get(cb);
- }
-
- /** Get file (or commit message) contents of the edit. */
- public static void get(
- @Nullable Project.NameKey project,
- PatchSet.Id id,
- String path,
- HttpCallback<NativeString> cb) {
- get(project, id, path, false, cb);
- }
-
- /** Get meta info for change edit. */
- public static void getMeta(
- @Nullable String project, PatchSet.Id id, String path, AsyncCallback<EditFileInfo> cb) {
- if (id.get() != 0) {
- throw new IllegalStateException("only supported for edits");
- }
- editFile(project, id.getParentKey().get(), path).view("meta").get(cb);
- }
-
- /** Put message into a change edit. */
- public static void putMessage(
- @Nullable String project, int id, String m, GerritCallback<VoidResult> cb) {
- editMessage(project, id).put(m, cb);
- }
-
- /** Put contents into a file or commit message in a change edit. */
- public static void put(
- @Nullable String project,
- int id,
- String path,
- String content,
- GerritCallback<VoidResult> cb) {
- if (Patch.COMMIT_MSG.equals(path)) {
- putMessage(project, id, content, cb);
- } else {
- editFile(project, id, path).put(content, cb);
- }
- }
-
- /** Delete a file in the pending edit. */
- public static void delete(
- @Nullable String project, int id, String path, AsyncCallback<VoidResult> cb) {
- editFile(project, id, path).delete(cb);
- }
-
- /** Rename a file in the pending edit. */
- public static void rename(
- @Nullable String project, int id, String path, String newPath, AsyncCallback<VoidResult> cb) {
- Input in = Input.create();
- in.oldPath(path);
- in.newPath(newPath);
- ChangeApi.edit(project, id).post(in, cb);
- }
-
- /** Restore (undo delete/modify) a file in the pending edit. */
- public static void restore(
- @Nullable String project, int id, String path, AsyncCallback<VoidResult> cb) {
- Input in = Input.create();
- in.restorePath(path);
- ChangeApi.edit(project, id).post(in, cb);
- }
-
- private static RestApi editMessage(@Nullable String project, int id) {
- return ChangeApi.change(project, id).view("edit:message");
- }
-
- private static RestApi editFile(@Nullable String project, int id, String path) {
- return ChangeApi.edit(project, id).id(path);
- }
-
- private static class Input extends JavaScriptObject {
- static Input create() {
- return createObject().cast();
- }
-
- final native void restorePath(String p) /*-{ this.restore_path=p }-*/;
-
- final native void oldPath(String p) /*-{ this.old_path=p }-*/;
-
- final native void newPath(String p) /*-{ this.new_path=p }-*/;
-
- protected Input() {}
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeList.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeList.java
deleted file mode 100644
index 5d525b6..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeList.java
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright (C) 2012 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.client.changes;
-
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.extensions.client.ListChangesOption;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwtorm.client.KeyUtil;
-import java.util.Set;
-
-/** List of changes available from {@code /changes/}. */
-public class ChangeList extends JsArray<ChangeInfo> {
- private static final String URI = "/changes/";
-
- /** Run multiple queries in a single remote invocation. */
- public static void queryMultiple(
- final AsyncCallback<JsArray<ChangeList>> callback,
- Set<ListChangesOption> options,
- String... queries) {
- if (queries.length == 0) {
- return;
- }
- RestApi call = new RestApi(URI);
- for (String q : queries) {
- call.addParameterRaw("q", KeyUtil.encode(q));
- }
- addOptions(call, options);
- if (queries.length == 1) {
- // Server unwraps a single query, so wrap it back in an array for the
- // callback.
- call.get(
- new AsyncCallback<ChangeList>() {
- @Override
- public void onSuccess(ChangeList result) {
- JsArray<ChangeList> wrapped = JsArray.createArray(1).cast();
- wrapped.set(0, result);
- callback.onSuccess(wrapped);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- callback.onFailure(caught);
- }
- });
- } else {
- call.get(callback);
- }
- }
-
- public static void query(
- String query, Set<ListChangesOption> options, AsyncCallback<ChangeList> callback) {
- query(query, options, callback, 0, 0);
- }
-
- public static void query(
- String query,
- Set<ListChangesOption> options,
- AsyncCallback<ChangeList> callback,
- int start,
- int limit) {
- RestApi call = newQuery(query);
- if (limit > 0) {
- call.addParameter("n", limit);
- }
- addOptions(call, options);
- if (start != 0) {
- call.addParameter("S", start);
- }
- call.get(callback);
- }
-
- public static void addOptions(RestApi call, Set<ListChangesOption> s) {
- call.addParameterRaw("O", Integer.toHexString(ListChangesOption.toBits(s)));
- }
-
- private static RestApi newQuery(String query) {
- RestApi call = new RestApi(URI);
- // The server default is ?q=status:open so don't repeat it.
- if (!"status:open".equals(query) && !"is:open".equals(query)) {
- call.addParameterRaw("q", KeyUtil.encode(query));
- }
- return call;
- }
-
- protected ChangeList() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeListScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeListScreen.java
deleted file mode 100644
index ed5a6f2..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeListScreen.java
+++ /dev/null
@@ -1,17 +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.google.gerrit.client.changes;
-
-public interface ChangeListScreen {}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeMessages.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeMessages.java
deleted file mode 100644
index c64fe91..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeMessages.java
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright (C) 2008 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.client.changes;
-
-import com.google.gwt.i18n.client.Messages;
-
-public interface ChangeMessages extends Messages {
- String accountDashboardTitle(String fullName);
-
- String revertChangeDefaultMessage(String commitMsg, String commitId);
-
- String cherryPickedChangeDefaultMessage(String commitMsg, String commitId);
-
- String changeScreenTitleId(String changeId);
-
- String loadingPatchSet(int id);
-
- String patchTableSize_Modify(int insertions, int deletions);
-
- String patchTableSize_ModifyBinaryFiles(String bytesInserted, String bytesDeleted);
-
- String patchTableSize_ModifyBinaryFilesWithPercentages(
- String bytesInserted,
- String percentageInserted,
- String bytesDeleted,
- String percentageDeleted);
-
- String patchTableSize_LongModify(int insertions, int deletions);
-
- String removeReviewer(String fullName);
-
- String removeVote(String label);
-
- String blockedOn(String labelName);
-
- String needs(String labelName);
-
- String changeQueryWindowTitle(String query);
-
- String changeQueryPageTitle(String query);
-
- String insertionsAndDeletions(int insertions, int deletions);
-
- String diffBaseParent(int parentNum);
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeMessages.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeMessages.properties
deleted file mode 100644
index 2b68492..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeMessages.properties
+++ /dev/null
@@ -1,27 +0,0 @@
-# Changes to this file should also be made in
-# gerrit-server/src/main/resources/com/google/gerrit/server/change/ChangeMessages.properties
-accountDashboardTitle = Code Review Dashboard for {0}
-
-revertChangeDefaultMessage = Revert \"{0}\"\n\nThis reverts commit {1}.
-cherryPickedChangeDefaultMessage = {0}\n(cherry picked from commit {1})
-
-changeScreenTitleId = Change {0}
-loadingPatchSet = Loading Patch Set {0} ...
-
-patchTableSize_Modify = +{0}, -{1}
-patchTableSize_ModifyBinaryFiles = +{0}, -{1}
-patchTableSize_ModifyBinaryFilesWithPercentages = +{0} (+{1}), -{2} (-{3})
-patchTableSize_LongModify = {0} inserted, {1} deleted
-
-removeReviewer = Remove reviewer {0}
-removeVote = Remove vote {0}
-
-blockedOn = Blocked on {0} Label
-needs = Needs {0} Label
-
-changeQueryWindowTitle = {0}
-changeQueryPageTitle = Search for {0}
-
-insertionsAndDeletions = +{0}, -{1}
-
-diffBaseParent = Parent {0}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java
deleted file mode 100644
index 4fda78b..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ChangeTable.java
+++ /dev/null
@@ -1,558 +0,0 @@
-// Copyright (C) 2008 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.client.changes;
-
-import static com.google.gerrit.client.FormatUtil.relativeFormat;
-import static com.google.gerrit.client.FormatUtil.shortFormat;
-import static java.util.stream.Collectors.toList;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.LabelInfo;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.AccountLinkPanel;
-import com.google.gerrit.client.ui.BranchLink;
-import com.google.gerrit.client.ui.ChangeLink;
-import com.google.gerrit.client.ui.NavigationTable;
-import com.google.gerrit.client.ui.NeedsSignInKeyCommand;
-import com.google.gerrit.client.ui.ProjectLink;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.extensions.client.GeneralPreferencesInfo.ReviewCategoryStrategy;
-import com.google.gerrit.extensions.client.ListChangesOption;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HTMLTable.Cell;
-import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.InlineLabel;
-import com.google.gwt.user.client.ui.SimplePanel;
-import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwt.user.client.ui.Widget;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.EnumSet;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
-
-public class ChangeTable extends NavigationTable<ChangeInfo> {
- // If changing default options, also update in
- // ChangeIT#defaultSearchDoesNotTouchDatabase().
- static final Set<ListChangesOption> OPTIONS =
- Collections.unmodifiableSet(
- EnumSet.of(ListChangesOption.LABELS, ListChangesOption.DETAILED_ACCOUNTS));
-
- private static final int C_STAR = 1;
- private static final int C_ID = 2;
- private static final int C_SUBJECT = 3;
- private static final int C_STATUS = 4;
- private static final int C_OWNER = 5;
- private static final int C_ASSIGNEE = 6;
- private static final int C_PROJECT = 7;
- private static final int C_BRANCH = 8;
- private static final int C_LAST_UPDATE = 9;
- private static final int C_SIZE = 10;
- private static final int BASE_COLUMNS = 11;
-
- private final List<Section> sections;
- private int columns;
- private final boolean showAssignee;
- private final boolean showLegacyId;
- private List<String> labelNames;
-
- public ChangeTable() {
- super(Util.C.changeItemHelp());
- columns = BASE_COLUMNS;
- labelNames = Collections.emptyList();
- showAssignee = Gerrit.info().change().showAssigneeInChangesTable();
- showLegacyId = Gerrit.getUserPreferences().legacycidInChangeTable();
-
- if (Gerrit.isSignedIn()) {
- keysAction.add(new StarKeyCommand(0, 's', Util.C.changeTableStar()));
- }
-
- sections = new ArrayList<>();
- table.setText(0, C_STAR, "");
- table.setText(0, C_ID, Util.C.changeTableColumnID());
- table.setText(0, C_SUBJECT, Util.C.changeTableColumnSubject());
- table.setText(0, C_STATUS, Util.C.changeTableColumnStatus());
- table.setText(0, C_OWNER, Util.C.changeTableColumnOwner());
- table.setText(0, C_ASSIGNEE, Util.C.changeTableColumnAssignee());
- table.setText(0, C_PROJECT, Util.C.changeTableColumnProject());
- table.setText(0, C_BRANCH, Util.C.changeTableColumnBranch());
- table.setText(0, C_LAST_UPDATE, Util.C.changeTableColumnLastUpdate());
- table.setText(0, C_SIZE, Util.C.changeTableColumnSize());
-
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(0, C_STAR, Gerrit.RESOURCES.css().iconHeader());
- for (int i = C_ID; i < columns; i++) {
- fmt.addStyleName(0, i, Gerrit.RESOURCES.css().dataHeader());
- }
- if (!showLegacyId) {
- fmt.addStyleName(0, C_ID, Gerrit.RESOURCES.css().dataHeaderHidden());
- }
- if (!showAssignee) {
- fmt.addStyleName(0, C_ASSIGNEE, Gerrit.RESOURCES.css().dataHeaderHidden());
- }
-
- table.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- final Cell cell = table.getCellForEvent(event);
- if (cell == null) {
- return;
- }
- if (cell.getCellIndex() == C_STAR) {
- // Don't do anything (handled by star itself).
- } else if (cell.getCellIndex() == C_STATUS) {
- // Don't do anything.
- } else if (cell.getCellIndex() == C_OWNER) {
- // Don't do anything.
- } else if (getRowItem(cell.getRowIndex()) != null) {
- movePointerTo(cell.getRowIndex());
- }
- }
- });
- }
-
- @Override
- protected Object getRowItemKey(ChangeInfo item) {
- return item.legacyId();
- }
-
- @Override
- protected void onOpenRow(int row) {
- final ChangeInfo c = getRowItem(row);
- Gerrit.display(PageLinks.toChange(c.projectNameKey(), c.legacyId()));
- }
-
- private void insertNoneRow(int row) {
- insertRow(row);
- table.setText(row, 0, Util.C.changeTableNone());
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.setColSpan(row, 0, columns);
- fmt.setStyleName(row, 0, Gerrit.RESOURCES.css().emptySection());
- }
-
- private void insertChangeRow(int row) {
- insertRow(row);
- applyDataRowStyle(row);
- }
-
- @Override
- protected void applyDataRowStyle(int row) {
- super.applyDataRowStyle(row);
- final CellFormatter fmt = table.getCellFormatter();
- fmt.addStyleName(row, C_STAR, Gerrit.RESOURCES.css().iconCell());
- for (int i = C_ID; i < columns; i++) {
- fmt.addStyleName(row, i, Gerrit.RESOURCES.css().dataCell());
- }
- if (!showLegacyId) {
- fmt.addStyleName(row, C_ID, Gerrit.RESOURCES.css().dataCellHidden());
- }
- fmt.addStyleName(row, C_SUBJECT, Gerrit.RESOURCES.css().cSUBJECT());
- fmt.addStyleName(row, C_STATUS, Gerrit.RESOURCES.css().cSTATUS());
- fmt.addStyleName(row, C_OWNER, Gerrit.RESOURCES.css().cOWNER());
- fmt.addStyleName(
- row,
- C_ASSIGNEE,
- showAssignee
- ? Gerrit.RESOURCES.css().cASSIGNEE()
- : Gerrit.RESOURCES.css().dataCellHidden());
- fmt.addStyleName(row, C_LAST_UPDATE, Gerrit.RESOURCES.css().cLastUpdate());
- fmt.addStyleName(row, C_SIZE, Gerrit.RESOURCES.css().cSIZE());
-
- for (int i = C_SIZE + 1; i < columns; i++) {
- fmt.addStyleName(row, i, Gerrit.RESOURCES.css().cAPPROVAL());
- }
- }
-
- public void updateColumnsForLabels(ChangeList... lists) {
- labelNames =
- Arrays.stream(lists)
- .flatMap(l -> Natives.asList(l).stream())
- .flatMap(c -> c.labels().stream())
- .distinct()
- .sorted()
- .collect(toList());
-
- int baseColumns = BASE_COLUMNS;
- if (baseColumns + labelNames.size() < columns) {
- int n = columns - (baseColumns + labelNames.size());
- for (int row = 0; row < table.getRowCount(); row++) {
- table.removeCells(row, columns, n);
- }
- }
- columns = baseColumns + labelNames.size();
-
- FlexCellFormatter fmt = table.getFlexCellFormatter();
- for (int i = 0; i < labelNames.size(); i++) {
- String name = labelNames.get(i);
- int col = baseColumns + i;
-
- String abbrev = getAbbreviation(name, "-");
- table.setText(0, col, abbrev);
- table.getCellFormatter().getElement(0, col).setTitle(name);
- fmt.addStyleName(0, col, Gerrit.RESOURCES.css().dataHeader());
- }
-
- for (Section s : sections) {
- if (s.titleRow >= 0) {
- fmt.setColSpan(s.titleRow, 0, columns);
- }
- }
- }
-
- private void populateChangeRow(int row, ChangeInfo c, boolean highlightUnreviewed) {
- CellFormatter fmt = table.getCellFormatter();
- if (Gerrit.isSignedIn()) {
- table.setWidget(row, C_STAR, StarredChanges.createIcon(c.legacyId(), c.starred()));
- }
- table.setWidget(row, C_ID, new TableChangeLink(String.valueOf(c.legacyId()), c));
-
- String subject = Util.cropSubject(c.subject());
- table.setWidget(row, C_SUBJECT, new TableChangeLink(subject, c));
-
- Change.Status status = c.status();
- if (status != Change.Status.NEW) {
- table.setText(
- row,
- C_STATUS,
- Util.toLongString(status) + (c.isPrivate() ? (" " + Util.C.isPrivate()) : ""));
- } else if (c.isWorkInProgress()) {
- table.setText(
- row,
- C_STATUS,
- Util.C.workInProgress() + (c.isPrivate() ? (" " + Util.C.isPrivate()) : ""));
- } else if (!c.mergeable()) {
- table.setText(
- row,
- C_STATUS,
- Util.C.changeTableNotMergeable() + (c.isPrivate() ? (" " + Util.C.isPrivate()) : ""));
- } else if (c.isPrivate()) {
- table.setText(row, C_STATUS, Util.C.isPrivate());
- }
-
- if (c.owner() != null) {
- table.setWidget(row, C_OWNER, AccountLinkPanel.withStatus(c.owner(), status));
- } else {
- table.setText(row, C_OWNER, "");
- }
-
- if (showAssignee) {
- if (c.assignee() != null) {
- table.setWidget(row, C_ASSIGNEE, AccountLinkPanel.forAssignee(c.assignee()));
- if (Gerrit.getUserPreferences().highlightAssigneeInChangeTable()
- && Objects.equals(c.assignee()._accountId(), Gerrit.getUserAccount()._accountId())) {
- table.getRowFormatter().addStyleName(row, Gerrit.RESOURCES.css().cASSIGNEDTOME());
- }
- } else {
- table.setText(row, C_ASSIGNEE, "");
- }
- }
-
- table.setWidget(row, C_PROJECT, new ProjectLink(c.projectNameKey()));
- table.setWidget(
- row, C_BRANCH, new BranchLink(c.projectNameKey(), c.status(), c.branch(), c.topic()));
- if (Gerrit.getUserPreferences().relativeDateInChangeTable()) {
- table.setText(row, C_LAST_UPDATE, relativeFormat(c.updated()));
- } else {
- table.setText(row, C_LAST_UPDATE, shortFormat(c.updated()));
- }
-
- int col = C_SIZE;
- if (!Gerrit.getUserPreferences().sizeBarInChangeTable()) {
- table.setText(row, col, Util.M.insertionsAndDeletions(c.insertions(), c.deletions()));
- } else {
- table.setWidget(row, col, getSizeWidget(c));
- fmt.getElement(row, col)
- .setTitle(Util.M.insertionsAndDeletions(c.insertions(), c.deletions()));
- }
- col++;
-
- for (int idx = 0; idx < labelNames.size(); idx++, col++) {
- String name = labelNames.get(idx);
-
- LabelInfo label = c.label(name);
- if (label == null) {
- fmt.getElement(row, col).setTitle(Gerrit.C.labelNotApplicable());
- fmt.addStyleName(row, col, Gerrit.RESOURCES.css().labelNotApplicable());
- continue;
- }
-
- String user;
- String info;
- ReviewCategoryStrategy reviewCategoryStrategy =
- Gerrit.getUserPreferences().reviewCategoryStrategy();
- if (label.rejected() != null) {
- user = label.rejected().name();
- info = getReviewCategoryDisplayInfo(reviewCategoryStrategy, label.rejected());
- if (info != null) {
- FlowPanel panel = new FlowPanel();
- panel.add(new Image(Gerrit.RESOURCES.redNot()));
- panel.add(new InlineLabel(info));
- table.setWidget(row, col, panel);
- } else {
- table.setWidget(row, col, new Image(Gerrit.RESOURCES.redNot()));
- }
- } else if (label.approved() != null) {
- user = label.approved().name();
- info = getReviewCategoryDisplayInfo(reviewCategoryStrategy, label.approved());
- if (info != null) {
- FlowPanel panel = new FlowPanel();
- panel.add(new Image(Gerrit.RESOURCES.greenCheck()));
- panel.add(new InlineLabel(info));
- table.setWidget(row, col, panel);
- } else {
- table.setWidget(row, col, new Image(Gerrit.RESOURCES.greenCheck()));
- }
- } else if (label.disliked() != null) {
- user = label.disliked().name();
- info = getReviewCategoryDisplayInfo(reviewCategoryStrategy, label.disliked());
- String vstr = String.valueOf(label._value());
- if (info != null) {
- vstr = vstr + " " + info;
- }
- fmt.addStyleName(row, col, Gerrit.RESOURCES.css().negscore());
- table.setText(row, col, vstr);
- } else if (label.recommended() != null) {
- user = label.recommended().name();
- info = getReviewCategoryDisplayInfo(reviewCategoryStrategy, label.recommended());
- String vstr = "+" + label._value();
- if (info != null) {
- vstr = vstr + " " + info;
- }
- fmt.addStyleName(row, col, Gerrit.RESOURCES.css().posscore());
- table.setText(row, col, vstr);
- } else {
- table.clearCell(row, col);
- continue;
- }
- fmt.addStyleName(row, col, Gerrit.RESOURCES.css().singleLine());
-
- if (user != null) {
- // Some web browsers ignore the embedded newline; some like it;
- // so we include a space before the newline to accommodate both.
- fmt.getElement(row, col).setTitle(name + " \nby " + user);
- }
- }
-
- boolean needHighlight = false;
- if (highlightUnreviewed && !c.reviewed()) {
- needHighlight = true;
- }
- final Element tr = fmt.getElement(row, 0).getParentElement();
- UIObject.setStyleName(tr, Gerrit.RESOURCES.css().needsReview(), needHighlight);
-
- setRowItem(row, c);
- }
-
- private static String getReviewCategoryDisplayInfo(
- ReviewCategoryStrategy reviewCategoryStrategy, AccountInfo accountInfo) {
- switch (reviewCategoryStrategy) {
- case NAME:
- return accountInfo.name();
- case EMAIL:
- return accountInfo.email();
- case USERNAME:
- return accountInfo.username();
- case ABBREV:
- return getAbbreviation(accountInfo.name(), " ");
- case NONE:
- default:
- return null;
- }
- }
-
- private static String getAbbreviation(String name, String token) {
- StringBuilder abbrev = new StringBuilder();
- if (name != null) {
- for (String t : name.split(token)) {
- abbrev.append(t.substring(0, 1).toUpperCase());
- }
- }
- return abbrev.toString();
- }
-
- private static Widget getSizeWidget(ChangeInfo c) {
- int largeChangeSize = Gerrit.info().change().largeChange();
- int changedLines = c.insertions() + c.deletions();
- int p = 100;
- if (changedLines < largeChangeSize) {
- p = changedLines * 100 / largeChangeSize;
- }
-
- int width = Math.max(2, 70 * p / 100);
- int red = p >= 50 ? 255 : (int) Math.round((p) * 5.12);
- int green = p <= 50 ? 255 : (int) Math.round(256 - (p - 50) * 5.12);
- String bg = "#" + toHex(red) + toHex(green) + "00";
-
- SimplePanel panel = new SimplePanel();
- panel.setStyleName(Gerrit.RESOURCES.css().changeSize());
- panel.setWidth(width + "px");
- panel.getElement().getStyle().setBackgroundColor(bg);
- return panel;
- }
-
- private static String toHex(int i) {
- String hex = Integer.toHexString(i);
- return hex.length() == 1 ? "0" + hex : hex;
- }
-
- public void addSection(Section s) {
- assert s.parent == null;
-
- s.parent = this;
- s.titleRow = table.getRowCount();
- if (s.displayTitle()) {
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.setColSpan(s.titleRow, 0, columns);
- fmt.addStyleName(s.titleRow, 0, Gerrit.RESOURCES.css().sectionHeader());
- } else {
- s.titleRow = -1;
- }
-
- s.dataBegin = table.getRowCount();
- insertNoneRow(s.dataBegin);
- sections.add(s);
- }
-
- private int insertRow(int beforeRow) {
- for (Section s : sections) {
- if (beforeRow <= s.titleRow) {
- s.titleRow++;
- }
- if (beforeRow < s.dataBegin) {
- s.dataBegin++;
- }
- }
- return table.insertRow(beforeRow);
- }
-
- private void removeRow(int row) {
- for (Section s : sections) {
- if (row < s.titleRow) {
- s.titleRow--;
- }
- if (row < s.dataBegin) {
- s.dataBegin--;
- }
- }
- table.removeRow(row);
- }
-
- public class StarKeyCommand extends NeedsSignInKeyCommand {
- public StarKeyCommand(int mask, char key, String help) {
- super(mask, key, help);
- }
-
- @Override
- public void onKeyPress(KeyPressEvent event) {
- int row = getCurrentRow();
- ChangeInfo c = getRowItem(row);
- if (c != null && Gerrit.isSignedIn()) {
- ((StarredChanges.Icon) table.getWidget(row, C_STAR)).toggleStar();
- }
- }
- }
-
- private final class TableChangeLink extends ChangeLink {
- private TableChangeLink(String text, ChangeInfo c) {
- super(c.projectNameKey(), c.legacyId(), text);
- }
-
- @Override
- public void go() {
- movePointerTo(cid);
- super.go();
- }
- }
-
- public static class Section {
- ChangeTable parent;
- String titleText;
- Widget titleWidget;
- int titleRow = -1;
- int dataBegin;
- int rows;
- private boolean highlightUnreviewed;
-
- public void setHighlightUnreviewed(boolean value) {
- this.highlightUnreviewed = value;
- }
-
- public void setTitleText(String text) {
- titleText = text;
- titleWidget = null;
- if (titleRow >= 0) {
- parent.table.setText(titleRow, 0, titleText);
- }
- }
-
- public void setTitleWidget(Widget title) {
- titleWidget = title;
- titleText = null;
- if (titleRow >= 0) {
- parent.table.setWidget(titleRow, 0, title);
- }
- }
-
- public boolean displayTitle() {
- if (titleText != null) {
- setTitleText(titleText);
- return true;
- } else if (titleWidget != null) {
- setTitleWidget(titleWidget);
- return true;
- }
- return false;
- }
-
- public void display(ChangeList changeList) {
- final int sz = changeList != null ? changeList.length() : 0;
- final boolean hadData = rows > 0;
-
- if (hadData) {
- while (sz < rows) {
- parent.removeRow(dataBegin);
- rows--;
- }
- } else {
- parent.removeRow(dataBegin);
- }
-
- if (sz == 0) {
- parent.insertNoneRow(dataBegin);
- return;
- }
-
- while (rows < sz) {
- parent.insertChangeRow(dataBegin + rows);
- rows++;
- }
- for (int i = 0; i < sz; i++) {
- parent.populateChangeRow(dataBegin + i, changeList.get(i), highlightUnreviewed);
- }
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/CommentApi.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/CommentApi.java
deleted file mode 100644
index 987b382..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/CommentApi.java
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (C) 2013 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.client.changes;
-
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-public class CommentApi {
-
- public static void comments(
- @Nullable String project, PatchSet.Id id, AsyncCallback<NativeMap<JsArray<CommentInfo>>> cb) {
- revision(project, id, "comments").get(cb);
- }
-
- public static void comment(
- @Nullable String project, PatchSet.Id id, String commentId, AsyncCallback<CommentInfo> cb) {
- revision(project, id, "comments").id(commentId).get(cb);
- }
-
- public static void drafts(
- @Nullable String project, PatchSet.Id id, AsyncCallback<NativeMap<JsArray<CommentInfo>>> cb) {
- revision(project, id, "drafts").get(cb);
- }
-
- public static void draft(
- @Nullable String project, PatchSet.Id id, String draftId, AsyncCallback<CommentInfo> cb) {
- revision(project, id, "drafts").id(draftId).get(cb);
- }
-
- public static void createDraft(
- @Nullable String project,
- PatchSet.Id id,
- CommentInfo content,
- AsyncCallback<CommentInfo> cb) {
- revision(project, id, "drafts").put(content, cb);
- }
-
- public static void updateDraft(
- @Nullable String project,
- PatchSet.Id id,
- String draftId,
- CommentInfo content,
- AsyncCallback<CommentInfo> cb) {
- revision(project, id, "drafts").id(draftId).put(content, cb);
- }
-
- public static void deleteDraft(
- @Nullable String project,
- PatchSet.Id id,
- String draftId,
- AsyncCallback<JavaScriptObject> cb) {
- revision(project, id, "drafts").id(draftId).delete(cb);
- }
-
- private static RestApi revision(@Nullable String project, PatchSet.Id id, String type) {
- return ChangeApi.revision(project, id).view(type);
- }
-
- private CommentApi() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/CommentInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/CommentInfo.java
deleted file mode 100644
index a111860..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/CommentInfo.java
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright (C) 2013 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.client.changes;
-
-import com.google.gerrit.client.diff.CommentRange;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.extensions.client.Side;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwtjsonrpc.client.impl.ser.JavaSqlTimestamp_JsonSerializer;
-import java.sql.Timestamp;
-
-public class CommentInfo extends JavaScriptObject {
- public static CommentInfo create(
- String path, Side side, int line, CommentRange range, Boolean unresolved) {
- return create(path, side, 0, line, range, unresolved);
- }
-
- public static CommentInfo create(
- String path, Side side, int parent, int line, CommentRange range, boolean unresolved) {
- CommentInfo n = createObject().cast();
- n.path(path);
- n.side(side);
- n.parent(parent);
- if (range != null) {
- n.line(range.endLine());
- n.range(range);
- } else if (line > 0) {
- n.line(line);
- }
- n.unresolved(unresolved);
- return n;
- }
-
- public static CommentInfo createReply(CommentInfo r) {
- CommentInfo n = createObject().cast();
- n.path(r.path());
- n.side(r.side());
- n.parent(r.parent());
- n.inReplyTo(r.id());
- if (r.hasRange()) {
- n.line(r.range().endLine());
- n.range(r.range());
- } else if (r.hasLine()) {
- n.line(r.line());
- }
- n.unresolved(r.unresolved());
- return n;
- }
-
- public static CommentInfo copy(CommentInfo s) {
- CommentInfo n = createObject().cast();
- n.path(s.path());
- n.side(s.side());
- n.parent(s.parent());
- n.id(s.id());
- n.inReplyTo(s.inReplyTo());
- n.message(s.message());
- if (s.hasRange()) {
- n.line(s.range().endLine());
- n.range(s.range());
- } else if (s.hasLine()) {
- n.line(s.line());
- }
- n.unresolved(s.unresolved());
- return n;
- }
-
- public final native void path(String p) /*-{ this.path = p }-*/;
-
- public final native void id(String i) /*-{ this.id = i }-*/;
-
- public final native void line(int n) /*-{ this.line = n }-*/;
-
- public final native void range(CommentRange r) /*-{ this.range = r }-*/;
-
- public final native void inReplyTo(String i) /*-{ this.in_reply_to = i }-*/;
-
- public final native void message(String m) /*-{ this.message = m }-*/;
-
- public final native void unresolved(boolean b) /*-{ this.unresolved = b }-*/;
-
- public final void side(Side side) {
- sideRaw(side.toString());
- }
-
- private native void sideRaw(String s) /*-{ this.side = s }-*/;
-
- public final native void parent(int n) /*-{ this.parent = n }-*/;
-
- public final native boolean hasParent() /*-{ return this.hasOwnProperty('parent') }-*/;
-
- public final native String path() /*-{ return this.path }-*/;
-
- public final native String id() /*-{ return this.id }-*/;
-
- public final native String inReplyTo() /*-{ return this.in_reply_to }-*/;
-
- public final native int patchSet() /*-{ return this.patch_set }-*/;
-
- public final native boolean unresolved() /*-{ return this.unresolved }-*/;
-
- public final Side side() {
- String s = sideRaw();
- return s != null ? Side.valueOf(s) : Side.REVISION;
- }
-
- private native String sideRaw() /*-{ return this.side }-*/;
-
- public final native int parent() /*-{ return this.parent }-*/;
-
- public final Timestamp updated() {
- Timestamp r = updatedTimestamp();
- if (r == null) {
- String s = updatedRaw();
- if (s != null) {
- r = JavaSqlTimestamp_JsonSerializer.parseTimestamp(s);
- updatedTimestamp(r);
- }
- }
- return r;
- }
-
- private native String updatedRaw() /*-{ return this.updated }-*/;
-
- private native Timestamp updatedTimestamp() /*-{ return this._ts }-*/;
-
- private native void updatedTimestamp(Timestamp t) /*-{ this._ts = t }-*/;
-
- public final native AccountInfo author() /*-{ return this.author }-*/;
-
- public final native int line() /*-{ return this.line || 0 }-*/;
-
- public final native boolean hasLine() /*-{ return this.hasOwnProperty('line') }-*/;
-
- public final native boolean hasRange() /*-{ return this.hasOwnProperty('range') }-*/;
-
- public final native CommentRange range() /*-{ return this.range }-*/;
-
- public final native String message() /*-{ return this.message }-*/;
-
- protected CommentInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/CustomDashboardScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/CustomDashboardScreen.java
deleted file mode 100644
index 802e56c..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/CustomDashboardScreen.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (C) 2012 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.client.changes;
-
-import com.google.gerrit.client.ui.Screen;
-
-public class CustomDashboardScreen extends Screen implements ChangeListScreen {
- private DashboardTable table;
- private String params;
-
- public CustomDashboardScreen(String params) {
- this.params = params;
- }
-
- @Override
- protected void onInitUI() {
- table =
- new DashboardTable(this, params) {
- @Override
- public void finishDisplay() {
- super.finishDisplay();
- display();
- }
- };
-
- super.onInitUI();
-
- String title = table.getTitle();
- if (title != null) {
- setWindowTitle(title);
- setPageTitle(title);
- }
-
- add(table);
- }
-
- @Override
- public void registerKeys() {
- super.registerKeys();
- table.setRegisterKeys(true);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/DashboardTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/DashboardTable.java
deleted file mode 100644
index aba4ee0..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/DashboardTable.java
+++ /dev/null
@@ -1,119 +0,0 @@
-// Copyright (C) 2012 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.client.changes;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.InlineHyperlink;
-import com.google.gerrit.client.ui.Screen;
-import com.google.gerrit.common.PageLinks;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.http.client.URL;
-import com.google.gwtexpui.globalkey.client.KeyCommand;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.ListIterator;
-
-public class DashboardTable extends ChangeTable {
- private List<Section> sections;
- private String title;
- private List<String> titles;
- private List<String> queries;
-
- public DashboardTable(Screen screen, String params) {
- titles = new ArrayList<>();
- queries = new ArrayList<>();
- String foreach = null;
- for (String kvPair : params.split("[,;&]")) {
- String[] kv = kvPair.split("=", 2);
- if (kv.length != 2 || kv[0].isEmpty()) {
- continue;
- }
-
- if ("title".equals(kv[0])) {
- title = URL.decodeQueryString(kv[1]);
- } else if ("foreach".equals(kv[0])) {
- foreach = URL.decodeQueryString(kv[1]);
- } else {
- titles.add(URL.decodeQueryString(kv[0]));
- queries.add(URL.decodeQueryString(kv[1]));
- }
- }
-
- if (foreach != null) {
- ListIterator<String> it = queries.listIterator();
- while (it.hasNext()) {
- it.set(it.next() + " " + foreach);
- }
- }
-
- addStyleName(Gerrit.RESOURCES.css().accountDashboard());
-
- sections = new ArrayList<>();
- int i = 0;
- for (String title : titles) {
- Section s = new Section();
- String query = removeLimitAndAge(queries.get(i++));
- s.setTitleWidget(new InlineHyperlink(title, PageLinks.toChangeQuery(query)));
- addSection(s);
- sections.add(s);
- }
-
- keysNavigation.add(
- new KeyCommand(0, 'R', Util.C.keyReloadSearch()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- Gerrit.display(screen.getToken());
- }
- });
- }
-
- private String removeLimitAndAge(String query) {
- StringBuilder unlimitedQuery = new StringBuilder();
- String[] operators = query.split(" ");
- for (String o : operators) {
- if (!o.startsWith("limit:") && !o.startsWith("age:") && !o.startsWith("-age:")) {
- unlimitedQuery.append(o).append(" ");
- }
- }
- return unlimitedQuery.toString().trim();
- }
-
- @Override
- public String getTitle() {
- return title;
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- ChangeList.queryMultiple(
- new GerritCallback<JsArray<ChangeList>>() {
- @Override
- public void onSuccess(JsArray<ChangeList> result) {
- List<ChangeList> cls = Natives.asList(result);
- updateColumnsForLabels(cls.toArray(new ChangeList[cls.size()]));
- for (int i = 0; i < cls.size(); i++) {
- sections.get(i).display(cls.get(i));
- }
- finishDisplay();
- }
- },
- OPTIONS,
- queries.toArray(new String[queries.size()]));
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PagedSingleListScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PagedSingleListScreen.java
deleted file mode 100644
index 1695eb9..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/PagedSingleListScreen.java
+++ /dev/null
@@ -1,135 +0,0 @@
-// Copyright (C) 2008 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.client.changes;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.rpc.ScreenLoadCallback;
-import com.google.gerrit.client.ui.Hyperlink;
-import com.google.gerrit.client.ui.Screen;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.user.client.History;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwtexpui.globalkey.client.KeyCommand;
-
-public abstract class PagedSingleListScreen extends Screen {
- protected final int pageSize;
- protected final int start;
- private final String anchorPrefix;
-
- protected ChangeList changes;
- private ChangeTable table;
- private ChangeTable.Section section;
- private Hyperlink prev;
- private Hyperlink next;
-
- protected PagedSingleListScreen(String anchorToken, int start) {
- anchorPrefix = anchorToken;
- this.start = start;
- pageSize = Gerrit.getUserPreferences().changesPerPage();
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- prev = new Hyperlink(Util.C.pagedChangeListPrev(), true, "");
- prev.setVisible(false);
-
- next = new Hyperlink(Util.C.pagedChangeListNext(), true, "");
- next.setVisible(false);
-
- table =
- new ChangeTable() {
- {
- keysNavigation.add(
- new DoLinkCommand(0, 'p', Util.C.changeTablePagePrev(), prev),
- new DoLinkCommand(0, 'n', Util.C.changeTablePageNext(), next));
-
- keysNavigation.add(
- new DoLinkCommand(0, '[', Util.C.changeTablePagePrev(), prev),
- new DoLinkCommand(0, ']', Util.C.changeTablePageNext(), next));
-
- keysNavigation.add(
- new KeyCommand(0, 'R', Util.C.keyReloadSearch()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- Gerrit.display(getToken());
- }
- });
- }
- };
- section = new ChangeTable.Section();
- table.addSection(section);
- table.setSavePointerId(anchorPrefix);
- add(table);
-
- final HorizontalPanel buttons = new HorizontalPanel();
- buttons.setStyleName(Gerrit.RESOURCES.css().changeTablePrevNextLinks());
- buttons.add(prev);
- buttons.add(next);
- add(buttons);
- }
-
- @Override
- public void registerKeys() {
- super.registerKeys();
- table.setRegisterKeys(true);
- }
-
- protected AsyncCallback<ChangeList> loadCallback() {
- return new ScreenLoadCallback<ChangeList>(this) {
- @Override
- protected void preDisplay(ChangeList result) {
- display(result);
- }
- };
- }
-
- protected void display(ChangeList result) {
- changes = result;
- if (changes.length() != 0) {
- if (start > 0) {
- int p = start - pageSize;
- prev.setTargetHistoryToken(anchorPrefix + (p > 0 ? "," + p : ""));
- prev.setVisible(true);
- } else {
- prev.setVisible(false);
- }
-
- int n = start + changes.length();
- next.setTargetHistoryToken(anchorPrefix + "," + n);
- next.setVisible(changes.get(changes.length() - 1)._more_changes());
- }
- table.updateColumnsForLabels(result);
- section.display(result);
- table.finishDisplay();
- }
-
- private static final class DoLinkCommand extends KeyCommand {
- private final Hyperlink link;
-
- private DoLinkCommand(int mask, char key, String help, Hyperlink l) {
- super(mask, key, help);
- link = l;
- }
-
- @Override
- public void onKeyPress(KeyPressEvent event) {
- if (link.isVisible()) {
- History.newItem(link.getTargetHistoryToken());
- }
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ProjectDashboardScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ProjectDashboardScreen.java
deleted file mode 100644
index f511308..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ProjectDashboardScreen.java
+++ /dev/null
@@ -1,62 +0,0 @@
-// Copyright (C) 2012 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.client.changes;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.admin.ProjectScreen;
-import com.google.gerrit.client.ui.InlineHyperlink;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.user.client.ui.FlowPanel;
-
-public class ProjectDashboardScreen extends ProjectScreen implements ChangeListScreen {
- private DashboardTable table;
- private String params;
-
- public ProjectDashboardScreen(Project.NameKey toShow, String params) {
- super(toShow);
- this.params = params;
- }
-
- @Override
- protected void onInitUI() {
- table =
- new DashboardTable(this, params) {
- @Override
- public void finishDisplay() {
- super.finishDisplay();
- display();
- }
- };
-
- super.onInitUI();
-
- String title = table.getTitle();
- if (title != null) {
- FlowPanel fp = new FlowPanel();
- fp.setStyleName(Gerrit.RESOURCES.css().screenHeader());
- fp.add(new InlineHyperlink(title, PageLinks.toCustomDashboard(params)));
- add(fp);
- }
-
- add(table);
- }
-
- @Override
- public void registerKeys() {
- super.registerKeys();
- table.setRegisterKeys(true);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/QueryScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/QueryScreen.java
deleted file mode 100644
index 8d580a3..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/QueryScreen.java
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (C) 2008 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.client.changes;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.RevId;
-import com.google.gwt.regexp.shared.RegExp;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwtorm.client.KeyUtil;
-
-public class QueryScreen extends PagedSingleListScreen implements ChangeListScreen {
- // Legacy numeric identifier.
- private static final RegExp NUMERIC_ID = RegExp.compile("^[1-9][0-9]*$");
- // Commit SHA1 hash
- private static final RegExp COMMIT_SHA1 = RegExp.compile("^([0-9a-fA-F]{4," + RevId.LEN + "})$");
- // Change-Id
- private static final String ID_PATTERN = "[iI][0-9a-f]{4,}$";
- private static final RegExp CHANGE_ID = RegExp.compile("^" + ID_PATTERN);
- private static final RegExp CHANGE_ID_TRIPLET = RegExp.compile("^(.)+~(.)+~" + ID_PATTERN);
-
- public static QueryScreen forQuery(String query) {
- return forQuery(query, 0);
- }
-
- public static QueryScreen forQuery(String query, int start) {
- return new QueryScreen(KeyUtil.encode(query), start);
- }
-
- private final String query;
-
- public QueryScreen(String encQuery, int start) {
- super(PageLinks.QUERY + encQuery, start);
- query = KeyUtil.decode(encQuery);
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- setWindowTitle(Util.M.changeQueryWindowTitle(query));
- setPageTitle(Util.M.changeQueryPageTitle(query));
- }
-
- @Override
- protected AsyncCallback<ChangeList> loadCallback() {
- return new GerritCallback<ChangeList>() {
- @Override
- public void onSuccess(ChangeList result) {
- if (isAttached()) {
- if (result.length() == 1 && isSingleQuery(query)) {
- ChangeInfo c = result.get(0);
- Change.Id id = c.legacyId();
- Gerrit.display(PageLinks.toChange(c.projectNameKey(), id));
- } else {
- display(result);
- QueryScreen.this.display();
- }
- }
- }
- };
- }
-
- @Override
- public void onShowView() {
- super.onShowView();
- Gerrit.setQueryString(query);
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- ChangeList.query(query, ChangeTable.OPTIONS, loadCallback(), start, pageSize);
- }
-
- private static boolean isSingleQuery(String query) {
- return NUMERIC_ID.test(query)
- || CHANGE_ID.test(query)
- || CHANGE_ID_TRIPLET.test(query)
- || COMMIT_SHA1.test(query);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ReviewInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ReviewInfo.java
deleted file mode 100644
index 06d2484..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ReviewInfo.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (C) 2013 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.client.changes;
-
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class ReviewInfo extends JavaScriptObject {
-
- public final native NativeMap<?> labels() /*-{ return this.labels }-*/;
-
- protected ReviewInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ReviewInput.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ReviewInput.java
deleted file mode 100644
index f851d5e..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/ReviewInput.java
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (C) 2013 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.client.changes;
-
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-
-public class ReviewInput extends JavaScriptObject {
- public enum NotifyHandling {
- NONE,
- OWNER,
- OWNER_REVIEWERS,
- ALL
- }
-
- public enum DraftHandling {
- DELETE,
- PUBLISH,
- KEEP,
- PUBLISH_ALL_REVISIONS
- }
-
- public static ReviewInput create() {
- ReviewInput r = createObject().cast();
- r.init();
- r.drafts(DraftHandling.PUBLISH);
- return r;
- }
-
- public final native void message(String m) /*-{ if(m)this.message=m; }-*/;
-
- public final native void label(String n, short v) /*-{ this.labels[n]=v; }-*/;
-
- public final native void comments(NativeMap<JsArray<CommentInfo>> m) /*-{ this.comments=m }-*/;
-
- public final void notify(NotifyHandling e) {
- _notify(e.name());
- }
-
- private native void _notify(String n) /*-{ this.notify=n; }-*/;
-
- public final void drafts(DraftHandling e) {
- _drafts(e.name());
- }
-
- private native void _drafts(String n) /*-{ this.drafts=n; }-*/;
-
- private native void init() /*-{
- this.labels = {};
- }-*/;
-
- public final native void prePost() /*-{
- var m=this.comments;
- if (m) {
- for (var p in m) {
- var l=m[p];
- for (var i=0;i<l.length;i++) {
- var c=l[i];
- delete c['path'];
- delete c['updated'];
- }
- }
- }
- }-*/;
-
- public final native void mergeLabels(ReviewInput o) /*-{
- var l=o.labels;
- if (l) {
- for (var n in l)
- this.labels[n]=l[n];
- }
- }-*/;
-
- protected ReviewInput() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/RevisionInfoCache.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/RevisionInfoCache.java
deleted file mode 100644
index fde2b05..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/RevisionInfoCache.java
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright (C) 2013 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.client.changes;
-
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/** Cache of PatchSet.Id to revision SHA-1 strings. */
-public class RevisionInfoCache {
- private static final int LIMIT = 10;
- private static final RevisionInfoCache IMPL = new RevisionInfoCache();
-
- public static void add(Change.Id change, RevisionInfo info) {
- IMPL.psToCommit.put(new PatchSet.Id(change, info._number()), info.name());
- }
-
- static String get(PatchSet.Id id) {
- return IMPL.psToCommit.get(id);
- }
-
- private final LinkedHashMap<PatchSet.Id, String> psToCommit;
-
- private RevisionInfoCache() {
- psToCommit =
- new LinkedHashMap<PatchSet.Id, String>(LIMIT) {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected boolean removeEldestEntry(Map.Entry<PatchSet.Id, String> e) {
- return size() > LIMIT;
- }
- };
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java
deleted file mode 100644
index b1028420..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/StarredChanges.java
+++ /dev/null
@@ -1,201 +0,0 @@
-// Copyright (C) 2012 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.client.changes;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.account.AccountApi;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.resources.client.ImageResource;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwtexpui.globalkey.client.KeyCommand;
-import com.google.web.bindery.event.shared.Event;
-import com.google.web.bindery.event.shared.HandlerRegistration;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-/** Supports the star icon displayed on changes and tracking the status. */
-public class StarredChanges {
- private static final Event.Type<ChangeStarHandler> TYPE = new Event.Type<>();
-
- /** Handler that can receive notifications of a change's starred status. */
- public interface ChangeStarHandler {
- void onChangeStar(ChangeStarEvent event);
- }
-
- /** Event fired when a star changes status. The new status is reported. */
- public static class ChangeStarEvent extends Event<ChangeStarHandler> {
- private boolean starred;
-
- public ChangeStarEvent(Change.Id source, boolean starred) {
- setSource(source);
- this.starred = starred;
- }
-
- public boolean isStarred() {
- return starred;
- }
-
- @Override
- public Type<ChangeStarHandler> getAssociatedType() {
- return TYPE;
- }
-
- @Override
- protected void dispatch(ChangeStarHandler handler) {
- handler.onChangeStar(this);
- }
- }
-
- /**
- * Create a star icon for the given change, and current status. Returns null if the user is not
- * signed in and cannot support starred changes.
- */
- public static Icon createIcon(Change.Id source, boolean starred) {
- return Gerrit.isSignedIn() ? new Icon(source, starred) : null;
- }
-
- /** Make a key command that toggles the star for a change. */
- public static KeyCommand newKeyCommand(Icon icon) {
- return new KeyCommand(0, 's', Util.C.changeTableStar()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- icon.toggleStar();
- }
- };
- }
-
- /** Add a handler to listen for starred status to change. */
- public static HandlerRegistration addHandler(Change.Id source, ChangeStarHandler handler) {
- return Gerrit.EVENT_BUS.addHandlerToSource(TYPE, source, handler);
- }
-
- /**
- * Broadcast the current starred value of a change to UI widgets. This does not RPC to the server
- * and does not alter the starred status of a change.
- */
- public static void fireChangeStarEvent(Change.Id id, boolean starred) {
- Gerrit.EVENT_BUS.fireEventFromSource(new ChangeStarEvent(id, starred), id);
- }
-
- /**
- * Set the starred status of a change. This method broadcasts to all interested UI widgets and
- * sends an RPC to the server to record the updated status.
- */
- public static void toggleStar(Change.Id changeId, boolean newValue) {
- pending.put(changeId, newValue);
- fireChangeStarEvent(changeId, newValue);
- if (!busy) {
- startRequest();
- }
- }
-
- private static boolean busy;
- private static final Map<Change.Id, Boolean> pending = new LinkedHashMap<>(4);
-
- private static void startRequest() {
- busy = true;
-
- final Change.Id id = pending.keySet().iterator().next();
- final boolean starred = pending.remove(id);
- RestApi call = AccountApi.self().view("starred.changes").id(id.get());
- AsyncCallback<JavaScriptObject> cb =
- new AsyncCallback<JavaScriptObject>() {
- @Override
- public void onSuccess(JavaScriptObject none) {
- if (pending.isEmpty()) {
- busy = false;
- } else {
- startRequest();
- }
- }
-
- @Override
- public void onFailure(Throwable caught) {
- if (!starred && RestApi.isStatus(caught, 404)) {
- onSuccess(null);
- return;
- }
-
- fireChangeStarEvent(id, !starred);
- for (Map.Entry<Change.Id, Boolean> e : pending.entrySet()) {
- fireChangeStarEvent(e.getKey(), !e.getValue());
- }
- pending.clear();
- busy = false;
- }
- };
- if (starred) {
- call.put(cb);
- } else {
- call.delete(cb);
- }
- }
-
- public static class Icon extends Image implements ChangeStarHandler, ClickHandler {
- private final Change.Id changeId;
- private boolean starred;
- private HandlerRegistration handler;
-
- Icon(Change.Id changeId, boolean starred) {
- super(resource(starred));
- this.changeId = changeId;
- this.starred = starred;
- addClickHandler(this);
- }
-
- /**
- * Toggles the state of the star, as if the user clicked on the image. This will broadcast the
- * new star status to all interested UI widgets, and RPC to the server to store the changed
- * value.
- */
- public void toggleStar() {
- StarredChanges.toggleStar(changeId, !starred);
- }
-
- @Override
- protected void onLoad() {
- handler = StarredChanges.addHandler(changeId, this);
- }
-
- @Override
- protected void onUnload() {
- handler.removeHandler();
- handler = null;
- }
-
- @Override
- public void onChangeStar(ChangeStarEvent event) {
- setResource(resource(event.isStarred()));
- starred = event.isStarred();
- }
-
- @Override
- public void onClick(ClickEvent event) {
- toggleStar();
- }
-
- private static ImageResource resource(boolean starred) {
- return starred ? Gerrit.RESOURCES.starFilled() : Gerrit.RESOURCES.starOpen();
- }
- }
-
- private StarredChanges() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/SubmitInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/SubmitInfo.java
deleted file mode 100644
index 9027c5b..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/SubmitInfo.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (C) 2012 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.client.changes;
-
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class SubmitInfo extends JavaScriptObject {
- final Change.Status status() {
- return Change.Status.valueOf(statusRaw());
- }
-
- private native String statusRaw() /*-{ return this.status; }-*/;
-
- protected SubmitInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/Util.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/Util.java
deleted file mode 100644
index 8d949d1..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/changes/Util.java
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (C) 2008 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.client.changes;
-
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gwt.core.client.GWT;
-
-public class Util {
- public static final ChangeConstants C = GWT.create(ChangeConstants.class);
- public static final ChangeMessages M = GWT.create(ChangeMessages.class);
-
- private static final int SUBJECT_MAX_LENGTH = 80;
- private static final String SUBJECT_CROP_APPENDIX = "...";
- private static final int SUBJECT_CROP_RANGE = 10;
-
- public static String toLongString(Change.Status status) {
- if (status == null) {
- return "";
- }
- switch (status) {
- case NEW:
- return C.statusLongNew();
- case MERGED:
- return C.statusLongMerged();
- case ABANDONED:
- return C.statusLongAbandoned();
- default:
- return status.name();
- }
- }
-
- /**
- * Crops the given change subject if needed so that it has at most {@link #SUBJECT_MAX_LENGTH}
- * characters.
- *
- * <p>If the given subject is not longer than {@link #SUBJECT_MAX_LENGTH} characters it is
- * returned unchanged.
- *
- * <p>If the length of the given subject exceeds {@link #SUBJECT_MAX_LENGTH} characters it is
- * cropped. In this case {@link #SUBJECT_CROP_APPENDIX} is appended to the cropped subject, the
- * cropped subject including the appendix has at most {@link #SUBJECT_MAX_LENGTH} characters.
- *
- * <p>If cropping is needed, the subject will be cropped after the last space character that is
- * found within the last {@link #SUBJECT_CROP_RANGE} characters of the potentially visible
- * characters. If no such space is found, the subject will be cropped so that the cropped subject
- * including the appendix has exactly {@link #SUBJECT_MAX_LENGTH} characters.
- *
- * @return the subject, cropped if needed
- */
- @SuppressWarnings("deprecation")
- public static String cropSubject(String subject) {
- if (subject.length() > SUBJECT_MAX_LENGTH) {
- final int maxLength = SUBJECT_MAX_LENGTH - SUBJECT_CROP_APPENDIX.length();
- for (int cropPosition = maxLength;
- cropPosition > maxLength - SUBJECT_CROP_RANGE;
- cropPosition--) {
- // Character.isWhitespace(char) can't be used because this method is not supported by GWT,
- // see https://developers.google.com/web-toolkit/doc/1.6/RefJreEmulation#Package_java_lang
- if (Character.isSpace(subject.charAt(cropPosition - 1))) {
- return subject.substring(0, cropPosition) + SUBJECT_CROP_APPENDIX;
- }
- }
- return subject.substring(0, maxLength) + SUBJECT_CROP_APPENDIX;
- }
- return subject;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/config/CapabilityInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/config/CapabilityInfo.java
deleted file mode 100644
index 1d7f4ab..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/config/CapabilityInfo.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (C) 2013 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.client.config;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class CapabilityInfo extends JavaScriptObject {
- public final native String id() /*-{ return this.id; }-*/;
-
- public final native String name() /*-{ return this.name; }-*/;
-
- protected CapabilityInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/config/ConfigServerApi.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/config/ConfigServerApi.java
deleted file mode 100644
index e71929c..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/config/ConfigServerApi.java
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (C) 2013 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.client.config;
-
-import com.google.gerrit.client.VoidResult;
-import com.google.gerrit.client.info.GeneralPreferences;
-import com.google.gerrit.client.info.ServerInfo;
-import com.google.gerrit.client.info.TopMenuList;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-/** A collection of static methods which work on the Gerrit REST API for server configuration. */
-public class ConfigServerApi {
- /** map of the server wide capabilities (core & plugins). */
- public static void capabilities(AsyncCallback<NativeMap<CapabilityInfo>> cb) {
- new RestApi("/config/server/capabilities/").get(cb);
- }
-
- public static void topMenus(AsyncCallback<TopMenuList> cb) {
- new RestApi("/config/server/top-menus").get(cb);
- }
-
- public static void defaultPreferences(AsyncCallback<GeneralPreferences> cb) {
- new RestApi("/config/server/preferences").get(cb);
- }
-
- public static void serverInfo(AsyncCallback<ServerInfo> cb) {
- new RestApi("/config/server/info").get(cb);
- }
-
- public static void confirmEmail(String token, AsyncCallback<VoidResult> cb) {
- EmailConfirmationInput input = EmailConfirmationInput.create();
- input.setToken(token);
- new RestApi("/config/server/email.confirm").put(input, cb);
- }
-
- private static class EmailConfirmationInput extends JavaScriptObject {
- final native void setToken(String token) /*-{ this.token = token; }-*/;
-
- static EmailConfirmationInput create() {
- return createObject().cast();
- }
-
- protected EmailConfirmationInput() {}
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/DashboardConstants.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/DashboardConstants.java
deleted file mode 100644
index ecb2938..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/DashboardConstants.java
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (C) 2012 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.client.dashboards;
-
-import com.google.gwt.i18n.client.Constants;
-
-public interface DashboardConstants extends Constants {
- String dashboardName();
-
- String dashboardTitle();
-
- String dashboardDescription();
-
- String dashboardInherited();
-
- String dashboardItem();
-
- String dashboardDefaultToolTip();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/DashboardConstants.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/DashboardConstants.properties
deleted file mode 100644
index ac4de7c..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/DashboardConstants.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-dashboardName = Dashboard Name
-dashboardTitle = Dashboard Title
-dashboardDescription = Dashboard Description
-dashboardInherited = Inherited From
-dashboardItem = dashboard
-dashboardDefaultToolTip = Project Default Dashboard
\ No newline at end of file
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/DashboardInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/DashboardInfo.java
deleted file mode 100644
index 5c6b51a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/DashboardInfo.java
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (C) 2012 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.client.dashboards;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class DashboardInfo extends JavaScriptObject {
- public final native String id() /*-{ return this.id; }-*/;
-
- public final native String title() /*-{ return this.title; }-*/;
-
- public final native String project() /*-{ return this.project; }-*/;
-
- public final native String definingProject() /*-{ return this.defining_project; }-*/;
-
- public final native String ref() /*-{ return this.ref; }-*/;
-
- public final native String path() /*-{ return this.path; }-*/;
-
- public final native String description() /*-{ return this.description; }-*/;
-
- public final native String foreach() /*-{ return this.foreach; }-*/;
-
- public final native String url() /*-{ return this.url; }-*/;
-
- private final native boolean isDefaultLegacy() /*-{ return this['default'] ? true : false; }-*/;
-
- private final native boolean isDefaultNew() /*-{ return this.is_default ? true : false; }-*/;
-
- public final boolean isDefault() {
- return isDefaultLegacy() || isDefaultNew();
- }
-
- protected DashboardInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/DashboardList.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/DashboardList.java
deleted file mode 100644
index 7ba3580..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/DashboardList.java
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright (C) 2012 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.client.dashboards;
-
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.http.client.URL;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-/** Project dashboards from {@code /projects/<name>/dashboards/}. */
-public class DashboardList extends JsArray<DashboardInfo> {
- public static void all(Project.NameKey project, AsyncCallback<JsArray<DashboardList>> callback) {
- base(project).addParameterTrue("inherited").get(callback);
- }
-
- public static void getDefault(Project.NameKey project, AsyncCallback<DashboardInfo> callback) {
- base(project).view("default").addParameterTrue("inherited").get(callback);
- }
-
- public static void get(
- Project.NameKey project, String id, AsyncCallback<DashboardInfo> callback) {
- base(project).idRaw(encodeDashboardId(id)).get(callback);
- }
-
- private static RestApi base(Project.NameKey project) {
- return new RestApi("/projects/").id(project.get()).view("dashboards");
- }
-
- private static String encodeDashboardId(String id) {
- int c = id.indexOf(':');
- if (0 <= c) {
- String ref = URL.encodeQueryString(id.substring(0, c));
- String path = URL.encodeQueryString(id.substring(c + 1));
- return ref + ':' + path;
- }
- return URL.encodeQueryString(id);
- }
-
- protected DashboardList() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/DashboardsTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/DashboardsTable.java
deleted file mode 100644
index dcb9c01..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/DashboardsTable.java
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright (C) 2012 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.client.dashboards;
-
-import static java.util.Comparator.comparing;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.NavigationTable;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.History;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
-import com.google.gwt.user.client.ui.Image;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class DashboardsTable extends NavigationTable<DashboardInfo> {
- Project.NameKey project;
-
- public DashboardsTable(Project.NameKey project) {
- super(Util.C.dashboardItem());
- this.project = project;
- initColumnHeaders();
- }
-
- protected void initColumnHeaders() {
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.setColSpan(0, 0, 2);
- fmt.addStyleName(0, 1, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 2, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 3, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, 4, Gerrit.RESOURCES.css().dataHeader());
-
- table.setText(0, 1, Util.C.dashboardName());
- table.setText(0, 2, Util.C.dashboardTitle());
- table.setText(0, 3, Util.C.dashboardDescription());
- table.setText(0, 4, Util.C.dashboardInherited());
- }
-
- public void display(DashboardList dashes) {
- display(Natives.asList(dashes));
- }
-
- public void display(JsArray<DashboardList> in) {
- Map<String, DashboardInfo> map = new HashMap<>();
- for (DashboardList list : Natives.asList(in)) {
- for (DashboardInfo d : Natives.asList(list)) {
- if (!map.containsKey(d.id())) {
- map.put(d.id(), d);
- }
- }
- }
- display(new ArrayList<>(map.values()));
- }
-
- public void display(List<DashboardInfo> list) {
- while (1 < table.getRowCount()) {
- table.removeRow(table.getRowCount() - 1);
- }
-
- list.sort(comparing(DashboardInfo::id));
-
- String ref = null;
- for (DashboardInfo d : list) {
- if (!d.ref().equals(ref)) {
- ref = d.ref();
- insertTitleRow(table.getRowCount(), ref);
- }
- insert(table.getRowCount(), d);
- }
-
- finishDisplay();
- }
-
- protected void insertTitleRow(int row, String section) {
- table.insertRow(row);
-
- table.setText(row, 0, section);
-
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.setColSpan(row, 0, 6);
- fmt.addStyleName(row, 0, Gerrit.RESOURCES.css().sectionHeader());
- }
-
- protected void insert(int row, DashboardInfo k) {
- table.insertRow(row);
-
- applyDataRowStyle(row);
-
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(row, 1, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 2, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 3, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 4, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, 5, Gerrit.RESOURCES.css().dataCell());
-
- populate(row, k);
- }
-
- protected void populate(int row, DashboardInfo k) {
- if (k.isDefault()) {
- table.setWidget(row, 1, new Image(Gerrit.RESOURCES.greenCheck()));
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.getElement(row, 1).setTitle(Util.C.dashboardDefaultToolTip());
- }
- table.setWidget(
- row,
- 2,
- new Anchor(
- k.path(),
- "#" + PageLinks.toProjectDashboard(new Project.NameKey(k.project()), k.id())));
- table.setText(row, 3, k.title() != null ? k.title() : k.path());
- table.setText(row, 4, k.description());
- if (k.definingProject() != null && !k.definingProject().equals(k.project())) {
- table.setWidget(
- row,
- 5,
- new Anchor(
- k.definingProject(),
- "#" + PageLinks.toProjectDashboards(new Project.NameKey(k.definingProject()))));
- }
- setRowItem(row, k);
- }
-
- @Override
- protected Object getRowItemKey(DashboardInfo item) {
- return item.id();
- }
-
- @Override
- protected void onOpenRow(int row) {
- if (row > 0) {
- movePointerTo(row);
- }
- History.newItem(getRowItem(row).url());
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/Util.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/Util.java
deleted file mode 100644
index b15bf73..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/dashboards/Util.java
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (C) 2012 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.client.dashboards;
-
-import com.google.gwt.core.client.GWT;
-
-public class Util {
- public static final DashboardConstants C = GWT.create(DashboardConstants.class);
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/ChunkManager.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/ChunkManager.java
deleted file mode 100644
index 0091f53..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/ChunkManager.java
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import static com.google.gerrit.client.diff.DisplaySide.A;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.dom.client.Element;
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import net.codemirror.lib.CodeMirror;
-import net.codemirror.lib.CodeMirror.LineClassWhere;
-import net.codemirror.lib.Pos;
-import net.codemirror.lib.TextMarker;
-
-/** Colors modified regions for {@link SideBySide} and {@link Unified}. */
-abstract class ChunkManager {
- static final native void onClick(Element e, JavaScriptObject f) /*-{ e.onclick = f }-*/;
-
- final Scrollbar scrollbar;
- final LineMapper lineMapper;
-
- private List<TextMarker> markers;
- private List<Runnable> undo;
-
- ChunkManager(Scrollbar scrollbar) {
- this.scrollbar = scrollbar;
- this.lineMapper = new LineMapper();
- }
-
- abstract DiffChunkInfo getFirst();
-
- List<TextMarker> getMarkers() {
- return markers;
- }
-
- void reset() {
- lineMapper.reset();
- for (TextMarker m : markers) {
- m.clear();
- }
- for (Runnable r : undo) {
- r.run();
- }
- }
-
- abstract void render(DiffInfo diff);
-
- void render() {
- markers = new ArrayList<>();
- undo = new ArrayList<>();
- }
-
- void colorLines(CodeMirror cm, String color, int line, int cnt) {
- colorLines(cm, LineClassWhere.WRAP, color, line, line + cnt);
- }
-
- void colorLines(CodeMirror cm, LineClassWhere where, String className, int start, int end) {
- if (start < end) {
- for (int line = start; line < end; line++) {
- cm.addLineClass(line, where, className);
- }
- undo.add(
- () -> {
- for (int line = start; line < end; line++) {
- cm.removeLineClass(line, where, className);
- }
- });
- }
- }
-
- abstract Runnable diffChunkNav(CodeMirror cm, Direction dir);
-
- void diffChunkNavHelper(
- List<? extends DiffChunkInfo> chunks, DiffScreen host, int res, Direction dir) {
- if (res < 0) {
- res = -res - (dir == Direction.PREV ? 1 : 2);
- }
- res = res + (dir == Direction.PREV ? -1 : 1);
- if (res < 0 || chunks.size() <= res) {
- return;
- }
-
- DiffChunkInfo lookUp = chunks.get(res);
- // If edit, skip the deletion chunk and set focus on the insertion one.
- if (lookUp.isEdit() && lookUp.getSide() == A) {
- res = res + (dir == Direction.PREV ? -1 : 1);
- if (res < 0 || chunks.size() <= res) {
- return;
- }
- }
-
- DiffChunkInfo target = chunks.get(res);
- CodeMirror targetCm = host.getCmFromSide(target.getSide());
- int cmLine = getCmLine(target.getStart(), target.getSide());
- targetCm.setCursor(Pos.create(cmLine));
- targetCm.focus();
- targetCm.scrollToY(
- targetCm.heightAtLine(cmLine, "local") - 0.5 * targetCm.scrollbarV().getClientHeight());
- }
-
- Comparator<DiffChunkInfo> getDiffChunkComparator() {
- // Chunks are ordered by their starting line. If it's a deletion,
- // use its corresponding line on the revision side for comparison.
- // In the edit case, put the deletion chunk right before the
- // insertion chunk. This placement guarantees well-ordering.
- return new Comparator<DiffChunkInfo>() {
- @Override
- public int compare(DiffChunkInfo a, DiffChunkInfo b) {
- if (a.getSide() == b.getSide()) {
- return a.getStart() - b.getStart();
- } else if (a.getSide() == A) {
- int comp = lineMapper.lineOnOther(a.getSide(), a.getStart()).getLine() - b.getStart();
- return comp == 0 ? -1 : comp;
- } else {
- int comp = a.getStart() - lineMapper.lineOnOther(b.getSide(), b.getStart()).getLine();
- return comp == 0 ? 1 : comp;
- }
- }
- };
- }
-
- abstract int getCmLine(int line, DisplaySide side);
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentBox.css b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentBox.css
deleted file mode 100644
index b4216eb..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentBox.css
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Copyright (C) 2013 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.
- */
-
-@external .cm-s-midnight;
-@external .cm-s-night;
-@external .cm-s-twilight;
-@external .com-google-gerrit-client-diff-PublishedBox_BinderImpl_GenCss_style-name;
-@external .com-google-gerrit-client-diff-CommentBox-Style-message;
-@external .com-google-gerrit-client-diff-CommentBox-Style-date;
-@external .com-google-gerrit-client-diff-DiffTable_BinderImpl_GenCss_style-range;
-@external .com-google-gerrit-client-diff-DiffTable_BinderImpl_GenCss_style-rangeHighlight;
-@external .net-codemirror-lib-CodeMirror-Style-activeLine;
-@external .CodeMirror-linenumber;
-
-.cm-s-midnight .com-google-gerrit-client-diff-PublishedBox_BinderImpl_GenCss_style-name { color: black }
-.cm-s-midnight .com-google-gerrit-client-diff-CommentBox-Style-message { color: black }
-.cm-s-midnight .com-google-gerrit-client-diff-CommentBox-Style-date { color: black }
-.cm-s-midnight .com-google-gerrit-client-diff-DiffTable_BinderImpl_GenCss_style-range { color: #777 }
-.cm-s-midnight .com-google-gerrit-client-diff-DiffTable_BinderImpl_GenCss_style-rangeHighlight { color: #777 }
-.cm-s-midnight .net-codemirror-lib-CodeMirror-Style-activeLine .CodeMirror-linenumber { color: black }
-
-.cm-s-night .com-google-gerrit-client-diff-PublishedBox_BinderImpl_GenCss_style-name { color: black }
-.cm-s-night .com-google-gerrit-client-diff-CommentBox-Style-message { color: black }
-.cm-s-night .com-google-gerrit-client-diff-CommentBox-Style-date { color: black }
-.cm-s-night .com-google-gerrit-client-diff-DiffTable_BinderImpl_GenCss_style-range { color: #777 }
-.cm-s-night .com-google-gerrit-client-diff-DiffTable_BinderImpl_GenCss_style-rangeHighlight { color: #777 }
-.cm-s-night .net-codemirror-lib-CodeMirror-Style-activeLine .CodeMirror-linenumber { color: black }
-
-.cm-s-twilight .com-google-gerrit-client-diff-PublishedBox_BinderImpl_GenCss_style-name { color: black }
-.cm-s-twilight .com-google-gerrit-client-diff-CommentBox-Style-message { color: black }
-.cm-s-twilight .com-google-gerrit-client-diff-CommentBox-Style-date { color: black }
-.cm-s-twilight .com-google-gerrit-client-diff-DiffTable_BinderImpl_GenCss_style-range { color: #777 }
-.cm-s-twilight .com-google-gerrit-client-diff-DiffTable_BinderImpl_GenCss_style-rangeHighlight { color: #777 }
-.cm-s-twilight .net-codemirror-lib-CodeMirror-Style-activeLine .CodeMirror-linenumber { color: black }
-
-.commentWidgets {
- max-width: 650px;
-
- font-family: sans-serif;
- background-color: #fcfa96;
- border: 1px solid black;
- -webkit-box-shadow: 3px 3px 3px #888888;
- -moz-box-shadow: 3px 3px 3px #888888;
- box-shadow: 3px 3px 3px #888888;
-
- /* margin-bottom is fixed in CommentGroup.computeHeight() */
- margin-bottom: 5px;
- margin-right: 5px;
-
- -webkit-touch-callout: initial;
- -webkit-user-select: text;
- -khtml-user-select: text;
- -moz-user-select: text;
- -ms-user-select: text;
- user-select: text;
-}
-
-.commentBox {
- position: relative;
- min-height: 16px;
-}
-
-.header {
- cursor: pointer;
-}
-
-.summary {
- color: #777;
- position: absolute;
- top: 1px;
- left: 120px;
- width: 408px;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- padding-bottom: 0.1em;
-}
-
-.date {
- white-space: nowrap;
- position: absolute;
- top: 2px;
- right: 5px;
-}
-
-.contents {
- margin-left: 28px;
- padding-top: 2px;
- position: relative;
-}
-.message {
- overflow-x: auto;
-}
-.message p,
-.message ul,
-.message blockquote {
- -webkit-margin-before: 0.2em;
- -webkit-margin-after: 0.3em;
-}
-.message {
- white-space: pre-wrap;
-}
-.commentBox button {
- margin-right: 3px;
- margin-bottom: 1px;
- padding: 1px;
- text-align: center;
- font-size: 8px;
- font-weight: bold;
- border: 1px solid black;
- cursor: pointer;
- color: #fff;
- background-color: #4d90fe;
- background-image: -webkit-linear-gradient(top, #4d90fe, #4d90fe);
- -webkit-border-radius: 2px;
- -webkit-box-sizing: content-box;
-}
-.commentBox button div {
- width: 25px;
- white-space: nowrap;
- color: #fff;
-}
-
-@sprite .goPrev {
- gwt-image: "goPrev";
- display: inline-block;
-}
-@sprite .goNext {
- gwt-image: "goNext";
- display: inline-block;
-}
-@sprite .goUp {
- gwt-image: "goUp";
- display: inline-block;
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentBox.java
deleted file mode 100644
index 6f9e694..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentBox.java
+++ /dev/null
@@ -1,158 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gerrit.client.changes.CommentInfo;
-import com.google.gwt.event.dom.client.MouseOutEvent;
-import com.google.gwt.event.dom.client.MouseOutHandler;
-import com.google.gwt.event.dom.client.MouseOverEvent;
-import com.google.gwt.event.dom.client.MouseOverHandler;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.user.client.ui.Composite;
-import net.codemirror.lib.CodeMirror;
-import net.codemirror.lib.Configuration;
-import net.codemirror.lib.Pos;
-import net.codemirror.lib.TextMarker;
-import net.codemirror.lib.TextMarker.FromTo;
-
-/** An HtmlPanel for displaying a comment */
-abstract class CommentBox extends Composite {
- static {
- Resources.I.style().ensureInjected();
- }
-
- interface Style extends CssResource {
- String commentWidgets();
-
- String commentBox();
-
- String contents();
-
- String message();
-
- String header();
-
- String summary();
-
- String date();
-
- String goPrev();
-
- String goNext();
-
- String goUp();
- }
-
- private final CommentGroup group;
- private ScrollbarAnnotation annotation;
- private FromTo fromTo;
- private TextMarker rangeMarker;
- private TextMarker rangeHighlightMarker;
-
- CommentBox(CommentGroup group, CommentRange range) {
- this.group = group;
- if (range != null) {
- DiffScreen screen = group.getManager().host;
- int startCmLine = screen.getCmLine(range.startLine() - 1, group.getSide());
- int endCmLine = screen.getCmLine(range.endLine() - 1, group.getSide());
- fromTo =
- FromTo.create(
- Pos.create(startCmLine, range.startCharacter()),
- Pos.create(endCmLine, range.endCharacter()));
- rangeMarker =
- group
- .getCm()
- .markText(
- fromTo.from(),
- fromTo.to(),
- Configuration.create().set("className", Resources.I.diffTableStyle().range()));
- }
- addDomHandler(
- new MouseOverHandler() {
- @Override
- public void onMouseOver(MouseOverEvent event) {
- setRangeHighlight(true);
- }
- },
- MouseOverEvent.getType());
- addDomHandler(
- new MouseOutHandler() {
- @Override
- public void onMouseOut(MouseOutEvent event) {
- setRangeHighlight(isOpen());
- }
- },
- MouseOutEvent.getType());
- }
-
- abstract CommentInfo getCommentInfo();
-
- abstract boolean isOpen();
-
- void setOpen(boolean open) {
- group.resize();
- setRangeHighlight(open);
- getCm().focus();
- }
-
- CommentGroup getCommentGroup() {
- return group;
- }
-
- CommentManager getCommentManager() {
- return group.getCommentManager();
- }
-
- ScrollbarAnnotation getAnnotation() {
- return annotation;
- }
-
- void setAnnotation(ScrollbarAnnotation mh) {
- annotation = mh;
- }
-
- void setRangeHighlight(boolean highlight) {
- if (fromTo != null) {
- if (highlight && rangeHighlightMarker == null) {
- rangeHighlightMarker =
- group
- .getCm()
- .markText(
- fromTo.from(),
- fromTo.to(),
- Configuration.create()
- .set("className", Resources.I.diffTableStyle().rangeHighlight()));
- } else if (!highlight && rangeHighlightMarker != null) {
- rangeHighlightMarker.clear();
- rangeHighlightMarker = null;
- }
- }
- }
-
- void clearRange() {
- if (rangeMarker != null) {
- rangeMarker.clear();
- rangeMarker = null;
- }
- }
-
- CodeMirror getCm() {
- return group.getCm();
- }
-
- FromTo getFromTo() {
- return fromTo;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentGroup.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentGroup.java
deleted file mode 100644
index 414e82e..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentGroup.java
+++ /dev/null
@@ -1,202 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gwt.user.client.Timer;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.SimplePanel;
-import net.codemirror.lib.CodeMirror;
-import net.codemirror.lib.Configuration;
-import net.codemirror.lib.LineWidget;
-import net.codemirror.lib.TextMarker.FromTo;
-
-/**
- * LineWidget attached to a CodeMirror container.
- *
- * <p>When a comment is placed on a line a CommentWidget is created.
- */
-abstract class CommentGroup extends Composite {
-
- final DisplaySide side;
- final int line;
-
- private final CommentManager manager;
- private final CodeMirror cm;
- private final FlowPanel comments;
- private LineWidget lineWidget;
- private Timer resizeTimer;
-
- CommentGroup(CommentManager manager, CodeMirror cm, DisplaySide side, int line) {
- this.manager = manager;
- this.cm = cm;
- this.side = side;
- this.line = line;
-
- comments = new FlowPanel();
- comments.setStyleName(Resources.I.style().commentWidgets());
- comments.setVisible(false);
- initWidget(new SimplePanel(comments));
- }
-
- CommentManager getCommentManager() {
- return manager;
- }
-
- CodeMirror getCm() {
- return cm;
- }
-
- int getLine() {
- return line;
- }
-
- DisplaySide getSide() {
- return side;
- }
-
- void add(PublishedBox box) {
- comments.add(box);
- comments.setVisible(true);
- }
-
- void add(DraftBox box) {
- PublishedBox p = box.getReplyToBox();
- if (p != null) {
- for (int i = 0; i < getBoxCount(); i++) {
- if (p == getCommentBox(i)) {
- comments.insert(box, i + 1);
- comments.setVisible(true);
- resize();
- return;
- }
- }
- }
- comments.add(box);
- comments.setVisible(true);
- resize();
- }
-
- CommentBox getCommentBox(int i) {
- return (CommentBox) comments.getWidget(i);
- }
-
- int getBoxCount() {
- return comments.getWidgetCount();
- }
-
- void openCloseLast() {
- if (0 < getBoxCount()) {
- CommentBox box = getCommentBox(getBoxCount() - 1);
- box.setOpen(!box.isOpen());
- }
- }
-
- void openCloseAll() {
- boolean open = false;
- for (int i = 0; i < getBoxCount(); i++) {
- if (!getCommentBox(i).isOpen()) {
- open = true;
- break;
- }
- }
- setOpenAll(open);
- }
-
- void setOpenAll(boolean open) {
- for (int i = 0; i < getBoxCount(); i++) {
- getCommentBox(i).setOpen(open);
- }
- }
-
- void remove(DraftBox box) {
- comments.remove(box);
- comments.setVisible(0 < getBoxCount());
- }
-
- void detach() {
- if (lineWidget != null) {
- lineWidget.clear();
- lineWidget = null;
- updateSelection();
- }
- manager.clearLine(side, line, this);
- removeFromParent();
- }
-
- void attach(DiffTable parent) {
- parent.add(this);
- lineWidget =
- cm.addLineWidget(
- Math.max(0, line - 1),
- getElement(),
- Configuration.create()
- .set("coverGutter", true)
- .set("noHScroll", true)
- .set("above", line <= 0)
- .set("insertAt", 0));
- }
-
- @Override
- protected void onUnload() {
- super.onUnload();
- if (resizeTimer != null) {
- resizeTimer.cancel();
- }
- }
-
- void updateSelection() {
- if (cm.somethingSelected()) {
- FromTo r = cm.getSelectedRange();
- if (r.to().line() >= line) {
- cm.setSelection(r.from(), r.to());
- }
- }
- }
-
- boolean canComputeHeight() {
- return !comments.isVisible() || comments.getOffsetHeight() > 0;
- }
-
- LineWidget getLineWidget() {
- return lineWidget;
- }
-
- void setLineWidget(LineWidget widget) {
- lineWidget = widget;
- }
-
- Timer getResizeTimer() {
- return resizeTimer;
- }
-
- void setResizeTimer(Timer timer) {
- resizeTimer = timer;
- }
-
- FlowPanel getComments() {
- return comments;
- }
-
- CommentManager getManager() {
- return manager;
- }
-
- abstract void init(DiffTable parent);
-
- abstract void handleRedraw();
-
- abstract void resize();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentManager.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentManager.java
deleted file mode 100644
index ef1ec1e..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentManager.java
+++ /dev/null
@@ -1,451 +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.client.diff;
-
-import com.google.gerrit.client.DiffObject;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.CommentInfo;
-import com.google.gerrit.client.patches.SkippedLine;
-import com.google.gerrit.client.rpc.CallbackGroup;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.CommentLinkProcessor;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.extensions.client.Side;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JsArray;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedMap;
-import java.util.TreeMap;
-import net.codemirror.lib.CodeMirror;
-import net.codemirror.lib.Pos;
-import net.codemirror.lib.TextMarker.FromTo;
-
-/** Tracks comment widgets for {@link DiffScreen}. */
-abstract class CommentManager {
- @Nullable private final Project.NameKey project;
- private final DiffObject base;
- private final PatchSet.Id revision;
- private final String path;
- private final CommentLinkProcessor commentLinkProcessor;
- final SortedMap<Integer, CommentGroup> sideA;
- final SortedMap<Integer, CommentGroup> sideB;
- private final Map<String, PublishedBox> published;
- private final Set<DraftBox> unsavedDrafts;
- final DiffScreen host;
- private boolean attached;
- private boolean expandAll;
- private boolean open;
-
- CommentManager(
- DiffScreen host,
- @Nullable Project.NameKey project,
- DiffObject base,
- PatchSet.Id revision,
- String path,
- CommentLinkProcessor clp,
- boolean open) {
- this.host = host;
- this.project = project;
- this.base = base;
- this.revision = revision;
- this.path = path;
- this.commentLinkProcessor = clp;
- this.open = open;
-
- published = new HashMap<>();
- unsavedDrafts = new HashSet<>();
- sideA = new TreeMap<>();
- sideB = new TreeMap<>();
- }
-
- void setAttached(boolean attached) {
- this.attached = attached;
- }
-
- boolean isAttached() {
- return attached;
- }
-
- void setExpandAll(boolean expandAll) {
- this.expandAll = expandAll;
- }
-
- boolean isExpandAll() {
- return expandAll;
- }
-
- boolean isOpen() {
- return open;
- }
-
- String getPath() {
- return path;
- }
-
- Map<String, PublishedBox> getPublished() {
- return published;
- }
-
- CommentLinkProcessor getCommentLinkProcessor() {
- return commentLinkProcessor;
- }
-
- void renderDrafts(DisplaySide forSide, JsArray<CommentInfo> in) {
- for (CommentInfo info : Natives.asList(in)) {
- DisplaySide side = displaySide(info, forSide);
- if (side != null) {
- addDraftBox(side, info);
- }
- }
- }
-
- void setUnsaved(DraftBox box, boolean isUnsaved) {
- if (isUnsaved) {
- unsavedDrafts.add(box);
- } else {
- unsavedDrafts.remove(box);
- }
- }
-
- void saveAllDrafts(CallbackGroup cb) {
- for (DraftBox box : unsavedDrafts) {
- box.save(cb);
- }
- }
-
- Side getStoredSideFromDisplaySide(DisplaySide side) {
- if (side == DisplaySide.A && (base.isBaseOrAutoMerge() || base.isParent())) {
- return Side.PARENT;
- }
- return Side.REVISION;
- }
-
- int getParentNumFromDisplaySide(DisplaySide side) {
- if (side == DisplaySide.A) {
- return base.getParentNum();
- }
- return 0;
- }
-
- PatchSet.Id getPatchSetIdFromSide(DisplaySide side) {
- if (side == DisplaySide.A && (base.isPatchSet() || base.isEdit())) {
- return base.asPatchSetId();
- }
- return revision;
- }
-
- DisplaySide displaySide(CommentInfo info, DisplaySide forSide) {
- if (info.side() == Side.PARENT) {
- return (base.isBaseOrAutoMerge() || base.isParent()) ? DisplaySide.A : null;
- }
- return forSide;
- }
-
- static FromTo adjustSelection(CodeMirror cm) {
- FromTo fromTo = cm.getSelectedRange();
- Pos to = fromTo.to();
- if (to.ch() == 0) {
- to.line(to.line() - 1);
- to.ch(cm.getLine(to.line()).length());
- }
- return fromTo;
- }
-
- abstract CommentGroup group(DisplaySide side, int cmLinePlusOne);
-
- /**
- * Create a new {@link DraftBox} at the specified line and focus it.
- *
- * @param side which side the draft will appear on.
- * @param line the line the draft will be at. Lines are 1-based. Line 0 is a special case creating
- * a file level comment.
- */
- void insertNewDraft(DisplaySide side, int line) {
- if (line == 0) {
- host.skipManager.ensureFirstLineIsVisible();
- }
-
- CommentGroup group = group(side, line);
- if (0 < group.getBoxCount()) {
- CommentBox last = group.getCommentBox(group.getBoxCount() - 1);
- if (last instanceof DraftBox) {
- ((DraftBox) last).setEdit(true);
- } else {
- ((PublishedBox) last).doReply();
- }
- } else {
- addDraftBox(
- side,
- CommentInfo.create(
- getPath(),
- getStoredSideFromDisplaySide(side),
- getParentNumFromDisplaySide(side),
- line,
- null,
- false))
- .setEdit(true);
- }
- }
-
- abstract String getTokenSuffixForActiveLine(CodeMirror cm);
-
- Runnable signInCallback(CodeMirror cm) {
- return () -> {
- String token = host.getToken();
- if (cm.extras().hasActiveLine()) {
- token += "@" + getTokenSuffixForActiveLine(cm);
- }
- Gerrit.doSignIn(token);
- };
- }
-
- abstract void newDraft(CodeMirror cm);
-
- Runnable newDraftCallback(CodeMirror cm) {
- if (!Gerrit.isSignedIn()) {
- return signInCallback(cm);
- }
-
- return () -> {
- if (cm.extras().hasActiveLine()) {
- newDraft(cm);
- }
- };
- }
-
- DraftBox addDraftBox(DisplaySide side, CommentInfo info) {
- int cmLinePlusOne = host.getCmLine(info.line() - 1, side) + 1;
- CommentGroup group = group(side, cmLinePlusOne);
- DraftBox box =
- new DraftBox(
- group,
- getCommentLinkProcessor(),
- project,
- getPatchSetIdFromSide(side),
- info,
- isExpandAll());
-
- if (info.inReplyTo() != null) {
- PublishedBox r = getPublished().get(info.inReplyTo());
- if (r != null) {
- r.setReplyBox(box);
- }
- }
-
- group.add(box);
- box.setAnnotation(
- host.getDiffTable()
- .scrollbar
- .draft(host.getCmFromSide(side), Math.max(0, cmLinePlusOne - 1)));
- return box;
- }
-
- void setExpandAllComments(boolean b) {
- setExpandAll(b);
- for (CommentGroup g : sideA.values()) {
- g.setOpenAll(b);
- }
- for (CommentGroup g : sideB.values()) {
- g.setOpenAll(b);
- }
- }
-
- abstract SortedMap<Integer, CommentGroup> getMapForNav(DisplaySide side);
-
- Runnable commentNav(CodeMirror src, Direction dir) {
- return () -> {
- // Every comment appears in both side maps as a linked pair.
- // It is only necessary to search one side to find a comment
- // on either side of the editor pair.
- SortedMap<Integer, CommentGroup> map = getMapForNav(src.side());
- int line =
- src.extras().hasActiveLine() ? src.getLineNumber(src.extras().activeLine()) + 1 : 0;
-
- CommentGroup g;
- if (dir == Direction.NEXT) {
- map = map.tailMap(line + 1);
- if (map.isEmpty()) {
- return;
- }
- g = map.get(map.firstKey());
- while (g.getBoxCount() == 0) {
- map = map.tailMap(map.firstKey() + 1);
- if (map.isEmpty()) {
- return;
- }
- g = map.get(map.firstKey());
- }
- } else {
- map = map.headMap(line);
- if (map.isEmpty()) {
- return;
- }
- g = map.get(map.lastKey());
- while (g.getBoxCount() == 0) {
- map = map.headMap(map.lastKey());
- if (map.isEmpty()) {
- return;
- }
- g = map.get(map.lastKey());
- }
- }
-
- CodeMirror cm = g.getCm();
- double y = cm.heightAtLine(g.getLine() - 1, "local");
- cm.setCursor(Pos.create(g.getLine() - 1));
- cm.scrollToY(y - 0.5 * cm.scrollbarV().getClientHeight());
- cm.focus();
- };
- }
-
- void clearLine(DisplaySide side, int line, CommentGroup group) {
- SortedMap<Integer, CommentGroup> map = map(side);
- if (map.get(line) == group) {
- map.remove(line);
- }
- }
-
- void render(CommentsCollections in, boolean expandAll) {
- if (in.publishedBase != null) {
- renderPublished(DisplaySide.A, in.publishedBase);
- }
- if (in.publishedRevision != null) {
- renderPublished(DisplaySide.B, in.publishedRevision);
- }
- if (in.draftsBase != null) {
- renderDrafts(DisplaySide.A, in.draftsBase);
- }
- if (in.draftsRevision != null) {
- renderDrafts(DisplaySide.B, in.draftsRevision);
- }
- if (expandAll) {
- setExpandAllComments(true);
- }
- for (CommentGroup g : sideA.values()) {
- g.init(host.getDiffTable());
- }
- for (CommentGroup g : sideB.values()) {
- g.init(host.getDiffTable());
- g.handleRedraw();
- }
- setAttached(true);
- }
-
- void renderPublished(DisplaySide forSide, JsArray<CommentInfo> in) {
- for (CommentInfo info : Natives.asList(in)) {
- DisplaySide side = displaySide(info, forSide);
- if (side != null) {
- int cmLinePlusOne = host.getCmLine(info.line() - 1, side) + 1;
- CommentGroup group = group(side, cmLinePlusOne);
- PublishedBox box =
- new PublishedBox(
- group,
- getCommentLinkProcessor(),
- project,
- getPatchSetIdFromSide(side),
- info,
- side,
- isOpen());
- group.add(box);
- box.setAnnotation(
- host.getDiffTable().scrollbar.comment(host.getCmFromSide(side), cmLinePlusOne - 1));
- getPublished().put(info.id(), box);
- }
- }
- }
-
- abstract Collection<Integer> getLinesWithCommentGroups();
-
- private static void checkAndAddSkip(List<SkippedLine> out, SkippedLine s) {
- if (s.getSize() > 1) {
- out.add(s);
- }
- }
-
- List<SkippedLine> splitSkips(int context, List<SkippedLine> skips) {
- if (sideA.containsKey(0) || sideB.containsKey(0)) {
- // Special case of file comment; cannot skip first line.
- for (SkippedLine skip : skips) {
- if (skip.getStartA() == 0) {
- skip.incrementStart(1);
- break;
- }
- }
- }
-
- for (int boxLine : getLinesWithCommentGroups()) {
- List<SkippedLine> temp = new ArrayList<>(skips.size() + 2);
- for (SkippedLine skip : skips) {
- int startLine = host.getCmLine(skip.getStartB(), DisplaySide.B);
- int deltaBefore = boxLine - startLine;
- int deltaAfter = startLine + skip.getSize() - boxLine;
- if (deltaBefore < -context || deltaAfter < -context) {
- temp.add(skip); // Size guaranteed to be greater than 1
- } else if (deltaBefore > context && deltaAfter > context) {
- SkippedLine before =
- new SkippedLine(
- skip.getStartA(), skip.getStartB(), skip.getSize() - deltaAfter - context);
- skip.incrementStart(deltaBefore + context);
- checkAndAddSkip(temp, before);
- checkAndAddSkip(temp, skip);
- } else if (deltaAfter > context) {
- skip.incrementStart(deltaBefore + context);
- checkAndAddSkip(temp, skip);
- } else if (deltaBefore > context) {
- skip.reduceSize(deltaAfter + context);
- checkAndAddSkip(temp, skip);
- }
- }
- if (temp.isEmpty()) {
- return temp;
- }
- skips = temp;
- }
- return skips;
- }
-
- abstract void newDraftOnGutterClick(CodeMirror cm, String gutterClass, int line);
-
- abstract CommentGroup getCommentGroupOnActiveLine(CodeMirror cm);
-
- Runnable toggleOpenBox(CodeMirror cm) {
- return () -> {
- CommentGroup group = getCommentGroupOnActiveLine(cm);
- if (group != null) {
- group.openCloseLast();
- }
- };
- }
-
- Runnable openCloseAll(CodeMirror cm) {
- return () -> {
- CommentGroup group = getCommentGroupOnActiveLine(cm);
- if (group != null) {
- group.openCloseAll();
- }
- };
- }
-
- SortedMap<Integer, CommentGroup> map(DisplaySide side) {
- return side == DisplaySide.A ? sideA : sideB;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentRange.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentRange.java
deleted file mode 100644
index 0f357d5..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentRange.java
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gwt.core.client.JavaScriptObject;
-import net.codemirror.lib.Pos;
-import net.codemirror.lib.TextMarker.FromTo;
-
-public class CommentRange extends JavaScriptObject {
- public static CommentRange create(int sl, int sc, int el, int ec) {
- CommentRange r = createObject().cast();
- r.set(sl, sc, el, ec);
- return r;
- }
-
- public static CommentRange create(FromTo fromTo) {
- if (fromTo == null) {
- return null;
- }
-
- Pos from = fromTo.from();
- Pos to = fromTo.to();
- return create(
- from.line() + 1, from.ch(),
- to.line() + 1, to.ch());
- }
-
- public final native int startLine() /*-{ return this.start_line; }-*/;
-
- public final native int startCharacter() /*-{ return this.start_character; }-*/;
-
- public final native int endLine() /*-{ return this.end_line; }-*/;
-
- public final native int endCharacter() /*-{ return this.end_character; }-*/;
-
- private native void set(int sl, int sc, int el, int ec) /*-{
- this.start_line = sl;
- this.start_character = sc;
- this.end_line = el;
- this.end_character = ec;
- }-*/;
-
- protected CommentRange() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentsCollections.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentsCollections.java
deleted file mode 100644
index 2698584..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/CommentsCollections.java
+++ /dev/null
@@ -1,165 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import static java.util.Comparator.comparing;
-
-import com.google.gerrit.client.DiffObject;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.CommentApi;
-import com.google.gerrit.client.changes.CommentInfo;
-import com.google.gerrit.client.rpc.CallbackGroup;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.extensions.client.Side;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-/** Collection of published and draft comments loaded from the server. */
-class CommentsCollections {
- @Nullable private final Project.NameKey project;
- private final String path;
- private final DiffObject base;
- private final PatchSet.Id revision;
- private NativeMap<JsArray<CommentInfo>> publishedBaseAll;
- private NativeMap<JsArray<CommentInfo>> publishedRevisionAll;
- JsArray<CommentInfo> publishedBase;
- JsArray<CommentInfo> publishedRevision;
- JsArray<CommentInfo> draftsBase;
- JsArray<CommentInfo> draftsRevision;
-
- CommentsCollections(
- @Nullable Project.NameKey project, DiffObject base, PatchSet.Id revision, String path) {
- this.project = project;
- this.path = path;
- this.base = base;
- this.revision = revision;
- }
-
- void load(CallbackGroup group) {
- if (base.isPatchSet()) {
- CommentApi.comments(
- Project.NameKey.asStringOrNull(project), base.asPatchSetId(), group.add(publishedBase()));
- }
- CommentApi.comments(
- Project.NameKey.asStringOrNull(project), revision, group.add(publishedRevision()));
-
- if (Gerrit.isSignedIn()) {
- if (base.isPatchSet()) {
- CommentApi.drafts(
- Project.NameKey.asStringOrNull(project), base.asPatchSetId(), group.add(draftsBase()));
- }
- CommentApi.drafts(
- Project.NameKey.asStringOrNull(project), revision, group.add(draftsRevision()));
- }
- }
-
- boolean hasCommentForPath(String filePath) {
- if (base.isPatchSet()) {
- JsArray<CommentInfo> forBase = publishedBaseAll.get(filePath);
- if (forBase != null && forBase.length() > 0) {
- return true;
- }
- }
- JsArray<CommentInfo> forRevision = publishedRevisionAll.get(filePath);
- if (forRevision != null && forRevision.length() > 0) {
- return true;
- }
- return false;
- }
-
- private AsyncCallback<NativeMap<JsArray<CommentInfo>>> publishedBase() {
- return new AsyncCallback<NativeMap<JsArray<CommentInfo>>>() {
- @Override
- public void onSuccess(NativeMap<JsArray<CommentInfo>> result) {
- publishedBaseAll = result;
- publishedBase = sort(result.get(path));
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- };
- }
-
- private AsyncCallback<NativeMap<JsArray<CommentInfo>>> publishedRevision() {
- return new AsyncCallback<NativeMap<JsArray<CommentInfo>>>() {
- @Override
- public void onSuccess(NativeMap<JsArray<CommentInfo>> result) {
- for (String k : result.keySet()) {
- result.put(k, filterForParent(result.get(k)));
- }
- publishedRevisionAll = result;
- publishedRevision = sort(result.get(path));
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- };
- }
-
- private JsArray<CommentInfo> filterForParent(JsArray<CommentInfo> list) {
- JsArray<CommentInfo> result = JsArray.createArray().cast();
- for (CommentInfo c : Natives.asList(list)) {
- if (c.side() == Side.REVISION) {
- result.push(c);
- } else if (base.isBaseOrAutoMerge() && !c.hasParent()) {
- result.push(c);
- } else if (base.isParent() && c.parent() == base.getParentNum()) {
- result.push(c);
- }
- }
- return result;
- }
-
- private AsyncCallback<NativeMap<JsArray<CommentInfo>>> draftsBase() {
- return new AsyncCallback<NativeMap<JsArray<CommentInfo>>>() {
- @Override
- public void onSuccess(NativeMap<JsArray<CommentInfo>> result) {
- draftsBase = sort(result.get(path));
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- };
- }
-
- private AsyncCallback<NativeMap<JsArray<CommentInfo>>> draftsRevision() {
- return new AsyncCallback<NativeMap<JsArray<CommentInfo>>>() {
- @Override
- public void onSuccess(NativeMap<JsArray<CommentInfo>> result) {
- for (String k : result.keySet()) {
- result.put(k, filterForParent(result.get(k)));
- }
- draftsRevision = sort(result.get(path));
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- };
- }
-
- private JsArray<CommentInfo> sort(JsArray<CommentInfo> in) {
- if (in != null) {
- for (CommentInfo c : Natives.asList(in)) {
- c.path(path);
- }
- Natives.asList(in).sort(comparing(CommentInfo::updated));
- }
- return in;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DiffApi.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DiffApi.java
deleted file mode 100644
index 1815920..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DiffApi.java
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import static com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace.IGNORE_ALL;
-
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.client.info.FileInfo;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.extensions.client.DiffPreferencesInfo;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-public class DiffApi {
- public static void list(
- @Nullable String project,
- int id,
- String revision,
- RevisionInfo base,
- AsyncCallback<NativeMap<FileInfo>> cb) {
- RestApi api = ChangeApi.revision(project, id, revision).view("files");
- if (base != null) {
- if (base._number() < 0) {
- api.addParameter("parent", -base._number());
- } else {
- api.addParameter("base", base.name());
- }
- }
- api.get(NativeMap.copyKeysIntoChildren("path", cb));
- }
-
- public static void list(
- @Nullable String project,
- PatchSet.Id id,
- PatchSet.Id base,
- AsyncCallback<NativeMap<FileInfo>> cb) {
- RestApi api = ChangeApi.revision(project, id).view("files");
- if (base != null) {
- if (base.get() < 0) {
- api.addParameter("parent", -base.get());
- } else {
- api.addParameter("base", base.get());
- }
- }
- api.get(NativeMap.copyKeysIntoChildren("path", cb));
- }
-
- public static DiffApi diff(@Nullable String project, PatchSet.Id id, String path) {
- return new DiffApi(ChangeApi.revision(project, id).view("files").id(path).view("diff"));
- }
-
- private final RestApi call;
-
- private DiffApi(RestApi call) {
- this.call = call;
- }
-
- public DiffApi base(PatchSet.Id id) {
- if (id != null) {
- if (id.get() < 0) {
- call.addParameter("parent", -id.get());
- } else {
- call.addParameter("base", id.get());
- }
- }
- return this;
- }
-
- public DiffApi webLinksOnly() {
- call.addParameterTrue("weblinks-only");
- return this;
- }
-
- public DiffApi ignoreWhitespace(DiffPreferencesInfo.Whitespace w) {
- if (w != null && w != IGNORE_ALL) {
- call.addParameter("whitespace", w);
- }
- return this;
- }
-
- public DiffApi intraline(boolean intraline) {
- if (intraline) {
- call.addParameterTrue("intraline");
- }
- return this;
- }
-
- public DiffApi wholeFile() {
- call.addParameter("context", "ALL");
- return this;
- }
-
- public DiffApi context(int lines) {
- call.addParameter("context", lines);
- return this;
- }
-
- public void get(AsyncCallback<DiffInfo> cb) {
- call.get(cb);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DiffChunkInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DiffChunkInfo.java
deleted file mode 100644
index 3b1b346..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DiffChunkInfo.java
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-/** Object recording the position of a diff chunk and whether it's an edit */
-class DiffChunkInfo {
- private DisplaySide side;
- private int start;
- private int end;
- private boolean edit;
-
- DiffChunkInfo(DisplaySide side, int start, int end, boolean edit) {
- this.side = side;
- this.start = start;
- this.end = end;
- this.edit = edit;
- }
-
- DisplaySide getSide() {
- return side;
- }
-
- int getStart() {
- return start;
- }
-
- int getEnd() {
- return end;
- }
-
- boolean isEdit() {
- return edit;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DiffInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DiffInfo.java
deleted file mode 100644
index d942c2e..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DiffInfo.java
+++ /dev/null
@@ -1,193 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gerrit.client.DiffWebLinkInfo;
-import com.google.gerrit.client.info.WebLinkInfo;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.extensions.client.GeneralPreferencesInfo.DiffView;
-import com.google.gerrit.reviewdb.client.Patch.ChangeType;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.JsArrayString;
-import java.util.ArrayList;
-import java.util.List;
-
-public class DiffInfo extends JavaScriptObject {
- public final native FileMeta metaA() /*-{ return this.meta_a; }-*/;
-
- public final native FileMeta metaB() /*-{ return this.meta_b; }-*/;
-
- public final native JsArrayString diffHeader() /*-{ return this.diff_header; }-*/;
-
- public final native JsArray<Region> content() /*-{ return this.content; }-*/;
-
- public final native JsArray<DiffWebLinkInfo> webLinks() /*-{ return this.web_links; }-*/;
-
- public final native boolean binary() /*-{ return this.binary || false; }-*/;
-
- public final List<WebLinkInfo> sideBySideWebLinks() {
- return filterWebLinks(DiffView.SIDE_BY_SIDE);
- }
-
- public final List<WebLinkInfo> unifiedWebLinks() {
- return filterWebLinks(DiffView.UNIFIED_DIFF);
- }
-
- private List<WebLinkInfo> filterWebLinks(DiffView diffView) {
- List<WebLinkInfo> filteredDiffWebLinks = new ArrayList<>();
- List<DiffWebLinkInfo> allDiffWebLinks = Natives.asList(webLinks());
- if (allDiffWebLinks != null) {
- for (DiffWebLinkInfo webLink : allDiffWebLinks) {
- if (diffView == DiffView.SIDE_BY_SIDE && webLink.showOnSideBySideDiffView()) {
- filteredDiffWebLinks.add(webLink);
- }
- if (diffView == DiffView.UNIFIED_DIFF && webLink.showOnUnifiedDiffView()) {
- filteredDiffWebLinks.add(webLink);
- }
- }
- }
- return filteredDiffWebLinks;
- }
-
- public final ChangeType changeType() {
- return ChangeType.valueOf(changeTypeRaw());
- }
-
- private native String changeTypeRaw() /*-{ return this.change_type }-*/;
-
- public final IntraLineStatus intralineStatus() {
- String s = intralineStatusRaw();
- return s != null ? IntraLineStatus.valueOf(s) : IntraLineStatus.OFF;
- }
-
- private native String intralineStatusRaw() /*-{ return this.intraline_status }-*/;
-
- public final boolean hasSkip() {
- JsArray<Region> c = content();
- for (int i = 0; i < c.length(); i++) {
- if (c.get(i).skip() != 0) {
- return true;
- }
- }
- return false;
- }
-
- public final String textA() {
- StringBuilder s = new StringBuilder();
- JsArray<Region> c = content();
- for (int i = 0; i < c.length(); i++) {
- Region r = c.get(i);
- if (r.ab() != null) {
- append(s, r.ab());
- } else if (r.a() != null) {
- append(s, r.a());
- }
- // TODO skip may need to be handled
- }
- return s.toString();
- }
-
- public final String textB() {
- StringBuilder s = new StringBuilder();
- JsArray<Region> c = content();
- for (int i = 0; i < c.length(); i++) {
- Region r = c.get(i);
- if (r.ab() != null) {
- append(s, r.ab());
- } else if (r.b() != null) {
- append(s, r.b());
- }
- // TODO skip may need to be handled
- }
- return s.toString();
- }
-
- public final String textUnified() {
- StringBuilder s = new StringBuilder();
- JsArray<Region> c = content();
- for (int i = 0; i < c.length(); i++) {
- Region r = c.get(i);
- if (r.ab() != null) {
- append(s, r.ab());
- } else {
- if (r.a() != null) {
- append(s, r.a());
- }
- if (r.b() != null) {
- append(s, r.b());
- }
- }
- // TODO skip may need to be handled
- }
- return s.toString();
- }
-
- private static void append(StringBuilder s, JsArrayString lines) {
- for (int i = 0; i < lines.length(); i++) {
- if (s.length() > 0) {
- s.append('\n');
- }
- s.append(lines.get(i));
- }
- }
-
- protected DiffInfo() {}
-
- public enum IntraLineStatus {
- OFF,
- OK,
- TIMEOUT,
- FAILURE
- }
-
- public static class FileMeta extends JavaScriptObject {
- public final native String name() /*-{ return this.name; }-*/;
-
- public final native String contentType() /*-{ return this.content_type; }-*/;
-
- public final native int lines() /*-{ return this.lines || 0 }-*/;
-
- public final native JsArray<WebLinkInfo> webLinks() /*-{ return this.web_links; }-*/;
-
- protected FileMeta() {}
- }
-
- public static class Region extends JavaScriptObject {
- public final native JsArrayString ab() /*-{ return this.ab; }-*/;
-
- public final native JsArrayString a() /*-{ return this.a; }-*/;
-
- public final native JsArrayString b() /*-{ return this.b; }-*/;
-
- public final native int skip() /*-{ return this.skip || 0; }-*/;
-
- public final native boolean common() /*-{ return this.common || false; }-*/;
-
- public final native JsArray<Span> editA() /*-{ return this.edit_a }-*/;
-
- public final native JsArray<Span> editB() /*-{ return this.edit_b }-*/;
-
- protected Region() {}
- }
-
- public static class Span extends JavaScriptObject {
- public final native int skip() /*-{ return this[0]; }-*/;
-
- public final native int mark() /*-{ return this[1]; }-*/;
-
- protected Span() {}
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DiffScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DiffScreen.java
deleted file mode 100644
index b4221ca..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DiffScreen.java
+++ /dev/null
@@ -1,931 +0,0 @@
-// Copyright (C) 2013 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 impl ied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package com.google.gerrit.client.diff;
-
-import static com.google.gerrit.extensions.client.DiffPreferencesInfo.WHOLE_FILE_CONTEXT;
-import static java.lang.Double.POSITIVE_INFINITY;
-
-import com.google.gerrit.client.DiffObject;
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.account.DiffPreferences;
-import com.google.gerrit.client.change.ChangeScreen;
-import com.google.gerrit.client.change.FileTable;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.ChangeList;
-import com.google.gerrit.client.diff.DiffInfo.FileMeta;
-import com.google.gerrit.client.diff.LineMapper.LineOnOtherInfo;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.ChangeInfo.CommitInfo;
-import com.google.gerrit.client.info.ChangeInfo.EditInfo;
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.client.info.FileInfo;
-import com.google.gerrit.client.patches.PatchUtil;
-import com.google.gerrit.client.projects.ConfigInfoCache;
-import com.google.gerrit.client.rpc.CallbackGroup;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.client.rpc.ScreenLoadCallback;
-import com.google.gerrit.client.ui.Screen;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.extensions.client.GeneralPreferencesInfo.DiffView;
-import com.google.gerrit.extensions.client.ListChangesOption;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Patch;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.core.client.Scheduler.RepeatingCommand;
-import com.google.gwt.core.client.Scheduler.ScheduledCommand;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.NativeEvent;
-import com.google.gwt.event.dom.client.FocusHandler;
-import com.google.gwt.event.dom.client.KeyCodes;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.event.logical.shared.ResizeEvent;
-import com.google.gwt.event.logical.shared.ResizeHandler;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.globalkey.client.KeyCommand;
-import com.google.gwtexpui.globalkey.client.KeyCommandSet;
-import com.google.gwtexpui.globalkey.client.ShowHelpCommand;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.List;
-import net.codemirror.lib.CodeMirror;
-import net.codemirror.lib.CodeMirror.BeforeSelectionChangeHandler;
-import net.codemirror.lib.CodeMirror.GutterClickHandler;
-import net.codemirror.lib.CodeMirror.LineHandle;
-import net.codemirror.lib.KeyMap;
-import net.codemirror.lib.Pos;
-import net.codemirror.mode.ModeInfo;
-import net.codemirror.mode.ModeInjector;
-import net.codemirror.theme.ThemeLoader;
-
-/** Base class for SideBySide and Unified */
-abstract class DiffScreen extends Screen {
- private static final KeyMap RENDER_ENTIRE_FILE_KEYMAP =
- KeyMap.create().propagate("Ctrl-F").propagate("Ctrl-G").propagate("Shift-Ctrl-G");
-
- enum FileSize {
- SMALL(0),
- LARGE(500),
- HUGE(4000);
-
- final int lines;
-
- FileSize(int n) {
- this.lines = n;
- }
- }
-
- @Nullable private Project.NameKey project;
- private final Change.Id changeId;
- final DiffObject base;
- final PatchSet.Id revision;
- final String path;
- final DiffPreferences prefs;
- final SkipManager skipManager;
-
- private DisplaySide startSide;
- private int startLine;
- private Change.Status changeStatus;
-
- private HandlerRegistration resizeHandler;
- private DiffInfo diff;
- private FileSize fileSize;
- private EditInfo edit;
-
- private KeyCommandSet keysNavigation;
- private KeyCommandSet keysAction;
- private KeyCommandSet keysComment;
- private List<HandlerRegistration> handlers;
- private PreferencesAction prefsAction;
- private int reloadVersionId;
- private int parents;
-
- @UiField(provided = true)
- Header header;
-
- DiffScreen(
- @Nullable Project.NameKey project,
- DiffObject base,
- DiffObject revision,
- String path,
- DisplaySide startSide,
- int startLine,
- DiffView diffScreenType) {
- this.project = project;
- this.base = base;
- this.revision = revision.asPatchSetId();
- this.changeId = revision.asPatchSetId().getParentKey();
- this.path = path;
- this.startSide = startSide;
- this.startLine = startLine;
-
- prefs = DiffPreferences.create(Gerrit.getDiffPreferences());
- handlers = new ArrayList<>(6);
- keysNavigation = new KeyCommandSet(Gerrit.C.sectionNavigation());
- header = new Header(keysNavigation, project, base, revision, path, diffScreenType, prefs);
- skipManager = new SkipManager(this);
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- setHeaderVisible(false);
- setWindowTitle(FileInfo.getFileName(path));
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
-
- CallbackGroup group1 = new CallbackGroup();
- final CallbackGroup group2 = new CallbackGroup();
-
- CodeMirror.initLibrary(
- group1.add(
- new AsyncCallback<Void>() {
- final AsyncCallback<Void> themeCallback = group2.addEmpty();
-
- @Override
- public void onSuccess(Void result) {
- // Load theme after CM library to ensure theme can override CSS.
- ThemeLoader.loadTheme(prefs.theme(), themeCallback);
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- }));
-
- DiffApi.diff(Project.NameKey.asStringOrNull(project), revision, path)
- .base(base.asPatchSetId())
- .wholeFile()
- .intraline(prefs.intralineDifference())
- .ignoreWhitespace(prefs.ignoreWhitespace())
- .get(
- group1.addFinal(
- new GerritCallback<DiffInfo>() {
- final AsyncCallback<Void> modeInjectorCb = group2.addEmpty();
-
- @Override
- public void onSuccess(DiffInfo diffInfo) {
- diff = diffInfo;
- fileSize = bucketFileSize(diffInfo);
-
- if (prefs.syntaxHighlighting()) {
- if (fileSize.compareTo(FileSize.SMALL) > 0) {
- modeInjectorCb.onSuccess(null);
- } else {
- injectMode(diffInfo, modeInjectorCb);
- }
- } else {
- modeInjectorCb.onSuccess(null);
- }
- }
- }));
-
- if (Gerrit.isSignedIn()) {
- ChangeApi.edit(
- Project.NameKey.asStringOrNull(project),
- changeId.get(),
- group2.add(
- new AsyncCallback<EditInfo>() {
- @Override
- public void onSuccess(EditInfo result) {
- edit = result;
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- }));
- }
-
- final CommentsCollections comments = new CommentsCollections(project, base, revision, path);
- comments.load(group2);
-
- countParents(group2);
-
- RestApi call = ChangeApi.detail(Project.NameKey.asStringOrNull(project), changeId.get());
- ChangeList.addOptions(call, EnumSet.of(ListChangesOption.ALL_REVISIONS));
- call.get(
- group2.add(
- new AsyncCallback<ChangeInfo>() {
- @Override
- public void onSuccess(ChangeInfo info) {
- changeStatus = info.status();
- project = info.projectNameKey();
- info.revisions().copyKeysIntoChildren("name");
- if (edit != null) {
- edit.setName(edit.commit().commit());
- info.setEdit(edit);
- info.revisions().put(edit.name(), RevisionInfo.fromEdit(edit));
- }
- String currentRevision = info.currentRevision();
- boolean current =
- currentRevision != null
- && revision.get() == info.revision(currentRevision)._number();
- JsArray<RevisionInfo> list = info.revisions().values();
- RevisionInfo.sortRevisionInfoByNumber(list);
- getDiffTable()
- .set(
- prefs,
- list,
- parents,
- diff,
- edit != null,
- current,
- changeStatus.isOpen(),
- diff.binary());
- header.setChangeInfo(info);
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- }));
-
- ConfigInfoCache.get(changeId, group2.addFinal(getScreenLoadCallback(comments)));
- }
-
- private void countParents(CallbackGroup cbg) {
- ChangeApi.revision(Project.NameKey.asStringOrNull(project), changeId.get(), revision.getId())
- .view("commit")
- .get(
- cbg.add(
- new AsyncCallback<CommitInfo>() {
- @Override
- public void onSuccess(CommitInfo info) {
- parents = info.parents().length();
- }
-
- @Override
- public void onFailure(Throwable caught) {
- parents = 0;
- }
- }));
- }
-
- @Override
- public void onShowView() {
- super.onShowView();
-
- Window.enableScrolling(false);
- if (prefs.hideTopMenu()) {
- Gerrit.setHeaderVisible(false);
- }
- resizeHandler =
- Window.addResizeHandler(
- new ResizeHandler() {
- @Override
- public void onResize(ResizeEvent event) {
- resizeCodeMirror();
- }
- });
- }
-
- KeyCommandSet getKeysNavigation() {
- return keysNavigation;
- }
-
- KeyCommandSet getKeysAction() {
- return keysAction;
- }
-
- @Override
- protected void onUnload() {
- super.onUnload();
-
- removeKeyHandlerRegistrations();
- if (getCommentManager() != null) {
- CallbackGroup group = new CallbackGroup();
- getCommentManager().saveAllDrafts(group);
- group.done();
- }
- if (resizeHandler != null) {
- resizeHandler.removeHandler();
- resizeHandler = null;
- }
- for (CodeMirror cm : getCms()) {
- if (cm != null) {
- cm.getWrapperElement().removeFromParent();
- }
- }
- if (prefsAction != null) {
- prefsAction.hide();
- }
-
- Window.enableScrolling(true);
- Gerrit.setHeaderVisible(true);
- }
-
- private void removeKeyHandlerRegistrations() {
- for (HandlerRegistration h : handlers) {
- h.removeHandler();
- }
- handlers.clear();
- }
-
- void registerCmEvents(CodeMirror cm) {
- cm.on("cursorActivity", updateActiveLine(cm));
- cm.on("focus", updateActiveLine(cm));
- KeyMap keyMap =
- KeyMap.create()
- .on("A", upToChange(true))
- .on("U", upToChange(false))
- .on("'['", header.navigate(Direction.PREV))
- .on("']'", header.navigate(Direction.NEXT))
- .on("R", header.toggleReviewed())
- .on("O", getCommentManager().toggleOpenBox(cm))
- .on("N", maybeNextVimSearch(cm))
- .on("Ctrl-Alt-E", openEditScreen(cm))
- .on("P", getChunkManager().diffChunkNav(cm, Direction.PREV))
- .on("Shift-M", header.reviewedAndNext())
- .on("Shift-N", maybePrevVimSearch(cm))
- .on("Shift-P", getCommentManager().commentNav(cm, Direction.PREV))
- .on("Shift-O", getCommentManager().openCloseAll(cm))
- .on(
- "I",
- () -> {
- switch (getIntraLineStatus()) {
- case OFF:
- case OK:
- toggleShowIntraline();
- break;
- case FAILURE:
- case TIMEOUT:
- default:
- break;
- }
- })
- .on("','", prefsAction::show)
- .on("Shift-/", () -> new ShowHelpCommand().onKeyPress(null))
- .on("Space", () -> cm.vim().handleKey("<C-d>"))
- .on("Shift-Space", () -> cm.vim().handleKey("<C-u>"))
- .on("Ctrl-F", () -> cm.execCommand("find"))
- .on("Ctrl-G", () -> cm.execCommand("findNext"))
- .on("Enter", maybeNextCmSearch(cm))
- .on("Shift-Ctrl-G", () -> cm.execCommand("findPrev"))
- .on("Shift-Enter", () -> cm.execCommand("findPrev"))
- .on(
- "Esc",
- () -> {
- cm.setCursor(cm.getCursor());
- cm.execCommand("clearSearch");
- cm.vim().handleEx("nohlsearch");
- })
- .on("Ctrl-A", () -> cm.execCommand("selectAll"))
- .on("G O", () -> Gerrit.display(PageLinks.toChangeQuery("status:open")))
- .on("G M", () -> Gerrit.display(PageLinks.toChangeQuery("status:merged")))
- .on("G A", () -> Gerrit.display(PageLinks.toChangeQuery("status:abandoned")));
- if (Gerrit.isSignedIn()) {
- keyMap
- .on("G I", () -> Gerrit.display(PageLinks.MINE))
- .on("G C", () -> Gerrit.display(PageLinks.toChangeQuery("has:draft")))
- .on("G W", () -> Gerrit.display(PageLinks.toChangeQuery("is:watched status:open")))
- .on("G S", () -> Gerrit.display(PageLinks.toChangeQuery("is:starred")));
- }
-
- if (revision.get() != 0) {
- cm.on("beforeSelectionChange", onSelectionChange(cm));
- cm.on("gutterClick", onGutterClick(cm));
- keyMap.on("C", getCommentManager().newDraftCallback(cm));
- }
- CodeMirror.normalizeKeyMap(keyMap); // Needed to for multi-stroke keymaps
- cm.addKeyMap(keyMap);
- }
-
- void maybeRegisterRenderEntireFileKeyMap(CodeMirror cm) {
- if (renderEntireFile()) {
- cm.addKeyMap(RENDER_ENTIRE_FILE_KEYMAP);
- }
- }
-
- private BeforeSelectionChangeHandler onSelectionChange(CodeMirror cm) {
- return new BeforeSelectionChangeHandler() {
- private InsertCommentBubble bubble;
-
- @Override
- public void handle(CodeMirror cm, Pos anchor, Pos head) {
- if (anchor.equals(head)) {
- if (bubble != null) {
- bubble.setVisible(false);
- }
- return;
- } else if (bubble == null) {
- init(anchor);
- } else {
- bubble.setVisible(true);
- }
- bubble.position(cm.charCoords(head, "local"));
- }
-
- private void init(Pos anchor) {
- bubble = new InsertCommentBubble(getCommentManager(), cm);
- add(bubble);
- cm.addWidget(anchor, bubble.getElement());
- }
- };
- }
-
- @Override
- public void registerKeys() {
- super.registerKeys();
-
- keysNavigation.add(new UpToChangeCommand(project, revision, 0, 'u'));
- keysNavigation.add(
- new NoOpKeyCommand(0, 'j', PatchUtil.C.lineNext()),
- new NoOpKeyCommand(0, 'k', PatchUtil.C.linePrev()));
- keysNavigation.add(
- new NoOpKeyCommand(0, 'n', PatchUtil.C.chunkNext()),
- new NoOpKeyCommand(0, 'p', PatchUtil.C.chunkPrev()));
- keysNavigation.add(
- new NoOpKeyCommand(KeyCommand.M_SHIFT, 'n', PatchUtil.C.commentNext()),
- new NoOpKeyCommand(KeyCommand.M_SHIFT, 'p', PatchUtil.C.commentPrev()));
- keysNavigation.add(new NoOpKeyCommand(KeyCommand.M_CTRL, 'f', Gerrit.C.keySearch()));
-
- keysAction = new KeyCommandSet(Gerrit.C.sectionActions());
- keysAction.add(new NoOpKeyCommand(0, KeyCodes.KEY_ENTER, PatchUtil.C.expandComment()));
- keysAction.add(new NoOpKeyCommand(0, 'o', PatchUtil.C.expandComment()));
- keysAction.add(
- new NoOpKeyCommand(KeyCommand.M_SHIFT, 'o', PatchUtil.C.expandAllCommentsOnCurrentLine()));
- if (Gerrit.isSignedIn()) {
- keysAction.add(
- new KeyCommand(0, 'r', PatchUtil.C.toggleReviewed()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- header.toggleReviewed().run();
- }
- });
- keysAction.add(
- new NoOpKeyCommand(KeyCommand.M_CTRL | KeyCommand.M_ALT, 'e', Gerrit.C.keyEditor()));
- }
- keysAction.add(
- new KeyCommand(KeyCommand.M_SHIFT, 'm', PatchUtil.C.markAsReviewedAndGoToNext()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- header.reviewedAndNext().run();
- }
- });
- keysAction.add(
- new KeyCommand(0, 'a', PatchUtil.C.openReply()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- upToChange(true).run();
- }
- });
- keysAction.add(
- new KeyCommand(0, ',', PatchUtil.C.showPreferences()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- prefsAction.show();
- }
- });
- if (getIntraLineStatus() == DiffInfo.IntraLineStatus.OFF
- || getIntraLineStatus() == DiffInfo.IntraLineStatus.OK) {
- keysAction.add(
- new KeyCommand(0, 'i', PatchUtil.C.toggleIntraline()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- toggleShowIntraline();
- }
- });
- }
-
- if (Gerrit.isSignedIn()) {
- keysAction.add(new NoOpKeyCommand(0, 'c', PatchUtil.C.commentInsert()));
- keysComment = new KeyCommandSet(PatchUtil.C.commentEditorSet());
- keysComment.add(new NoOpKeyCommand(KeyCommand.M_CTRL, 's', PatchUtil.C.commentSaveDraft()));
- keysComment.add(new NoOpKeyCommand(0, KeyCodes.KEY_ESCAPE, PatchUtil.C.commentCancelEdit()));
- } else {
- keysComment = null;
- }
- }
-
- @Nullable
- public Project.NameKey getProject() {
- return project;
- }
-
- void registerHandlers() {
- removeKeyHandlerRegistrations();
- handlers.add(GlobalKey.add(this, keysAction));
- handlers.add(GlobalKey.add(this, keysNavigation));
- if (keysComment != null) {
- handlers.add(GlobalKey.add(this, keysComment));
- }
- handlers.add(ShowHelpCommand.addFocusHandler(getFocusHandler()));
- }
-
- void setupSyntaxHighlighting() {
- if (prefs.syntaxHighlighting() && fileSize.compareTo(FileSize.SMALL) > 0) {
- Scheduler.get()
- .scheduleFixedDelay(
- new RepeatingCommand() {
- @Override
- public boolean execute() {
- if (prefs.syntaxHighlighting() && isAttached()) {
- setSyntaxHighlighting(prefs.syntaxHighlighting());
- }
- return false;
- }
- },
- 250);
- }
- }
-
- abstract CodeMirror newCm(DiffInfo.FileMeta meta, String contents, Element parent);
-
- void render(DiffInfo diff) {
- header.setNoDiff(diff);
- getChunkManager().render(diff);
- }
-
- void setShowLineNumbers(boolean b) {
- if (b) {
- getDiffTable().addStyleName(Resources.I.diffTableStyle().showLineNumbers());
- } else {
- getDiffTable().removeStyleName(Resources.I.diffTableStyle().showLineNumbers());
- }
- }
-
- void setShowIntraline(boolean b) {
- if (b && getIntraLineStatus() == DiffInfo.IntraLineStatus.OFF) {
- reloadDiffInfo();
- } else if (b) {
- getDiffTable().removeStyleName(Resources.I.diffTableStyle().noIntraline());
- } else {
- getDiffTable().addStyleName(Resources.I.diffTableStyle().noIntraline());
- }
- }
-
- private void toggleShowIntraline() {
- prefs.intralineDifference(!Boolean.valueOf(prefs.intralineDifference()));
- setShowIntraline(prefs.intralineDifference());
- prefsAction.update();
- }
-
- abstract void setSyntaxHighlighting(boolean b);
-
- void setContext(int context) {
- operation(
- () -> {
- skipManager.removeAll();
- skipManager.render(context, diff);
- updateRenderEntireFile();
- });
- }
-
- private int adjustCommitMessageLine(int line) {
- /* When commit messages are shown in the diff screen they include
- a header block that looks like this:
-
- 1 Parent: deadbeef (Parent commit title)
- 2 Author: A. U. Thor <author@example.com>
- 3 AuthorDate: 2015-02-27 19:20:52 +0900
- 4 Commit: A. U. Thor <author@example.com>
- 5 CommitDate: 2015-02-27 19:20:52 +0900
- 6 [blank line]
- 7 Commit message title
- 8
- 9 Commit message body
- 10 ...
- 11 ...
-
- If the commit is a merge commit, both parent commits are listed in the
- first two lines instead of a 'Parent' line:
-
- 1 Merge Of: deadbeef (Parent 1 commit title)
- 2 beefdead (Parent 2 commit title)
-
- */
-
- // Offset to compensate for header lines until the blank line
- // after 'CommitDate'
- int offset = 6;
-
- // Adjust for merge commits, which have two parent lines
- if (diff.textB().startsWith("Merge")) {
- offset += 1;
- }
-
- // If the cursor is inside the header line, reset to the first line of the
- // commit message. Otherwise if the cursor is on an actual line of the commit
- // message, adjust the line number to compensate for the header lines, so the
- // focus is on the correct line.
- if (line <= offset) {
- return 1;
- }
- return line - offset;
- }
-
- private Runnable openEditScreen(CodeMirror cm) {
- return () -> {
- LineHandle handle = cm.extras().activeLine();
- int line = cm.getLineNumber(handle) + 1;
- if (Patch.COMMIT_MSG.equals(path)) {
- line = adjustCommitMessageLine(line);
- }
- String token = Dispatcher.toEditScreen(project, revision, path, line);
- if (!Gerrit.isSignedIn()) {
- Gerrit.doSignIn(token);
- } else {
- Gerrit.display(token);
- }
- };
- }
-
- void updateRenderEntireFile() {
- boolean entireFile = renderEntireFile();
- for (CodeMirror cm : getCms()) {
- cm.removeKeyMap(RENDER_ENTIRE_FILE_KEYMAP);
- if (entireFile) {
- cm.addKeyMap(RENDER_ENTIRE_FILE_KEYMAP);
- }
- cm.setOption("viewportMargin", entireFile ? POSITIVE_INFINITY : 10);
- }
- }
-
- void resizeCodeMirror() {
- int height = header.getOffsetHeight() + getDiffTable().getHeaderHeight();
- for (CodeMirror cm : getCms()) {
- cm.adjustHeight(height);
- }
- }
-
- abstract ChunkManager getChunkManager();
-
- abstract CommentManager getCommentManager();
-
- Change.Status getChangeStatus() {
- return changeStatus;
- }
-
- int getStartLine() {
- return startLine;
- }
-
- void setStartLine(int startLine) {
- this.startLine = startLine;
- }
-
- DisplaySide getStartSide() {
- return startSide;
- }
-
- void setStartSide(DisplaySide startSide) {
- this.startSide = startSide;
- }
-
- DiffInfo getDiff() {
- return diff;
- }
-
- FileSize getFileSize() {
- return fileSize;
- }
-
- PreferencesAction getPrefsAction() {
- return prefsAction;
- }
-
- void setPrefsAction(PreferencesAction prefsAction) {
- this.prefsAction = prefsAction;
- }
-
- abstract void operation(Runnable apply);
-
- private Runnable upToChange(boolean openReplyBox) {
- return () -> {
- CallbackGroup group = new CallbackGroup();
- getCommentManager().saveAllDrafts(group);
- group.done();
- group.addListener(
- new GerritCallback<Void>() {
- @Override
- public void onSuccess(Void result) {
- String rev = String.valueOf(revision.get());
- Gerrit.display(
- PageLinks.toChange(project, changeId, base.asString(), rev),
- new ChangeScreen(
- project, changeId, base, rev, openReplyBox, FileTable.Mode.REVIEW));
- }
- });
- };
- }
-
- private Runnable maybePrevVimSearch(CodeMirror cm) {
- return () -> {
- if (cm.vim().hasSearchHighlight()) {
- cm.vim().handleKey("N");
- } else {
- getCommentManager().commentNav(cm, Direction.NEXT).run();
- }
- };
- }
-
- private Runnable maybeNextVimSearch(CodeMirror cm) {
- return () -> {
- if (cm.vim().hasSearchHighlight()) {
- cm.vim().handleKey("n");
- } else {
- getChunkManager().diffChunkNav(cm, Direction.NEXT).run();
- }
- };
- }
-
- Runnable maybeNextCmSearch(CodeMirror cm) {
- return () -> {
- if (cm.hasSearchHighlight()) {
- cm.execCommand("findNext");
- } else {
- cm.execCommand("clearSearch");
- getCommentManager().toggleOpenBox(cm).run();
- }
- };
- }
-
- boolean renderEntireFile() {
- return prefs.renderEntireFile() && canRenderEntireFile(prefs);
- }
-
- boolean canRenderEntireFile(DiffPreferences prefs) {
- // CodeMirror is too slow to layout an entire huge file.
- return fileSize.compareTo(FileSize.HUGE) < 0
- || (prefs.context() != WHOLE_FILE_CONTEXT && prefs.context() < 100);
- }
-
- DiffInfo.IntraLineStatus getIntraLineStatus() {
- return diff.intralineStatus();
- }
-
- void setThemeStyles(boolean d) {
- if (d) {
- getDiffTable().addStyleName(Resources.I.diffTableStyle().dark());
- } else {
- getDiffTable().removeStyleName(Resources.I.diffTableStyle().dark());
- }
- }
-
- void setShowTabs(boolean show) {
- for (CodeMirror cm : getCms()) {
- cm.extras().showTabs(show);
- }
- }
-
- void setLineLength(int columns) {
- for (CodeMirror cm : getCms()) {
- cm.extras().lineLength(columns);
- }
- }
-
- String getContentType(DiffInfo.FileMeta meta) {
- if (prefs.syntaxHighlighting() && meta != null && meta.contentType() != null) {
- ModeInfo m = ModeInfo.findMode(meta.contentType(), path);
- return m != null ? m.mime() : null;
- }
- return null;
- }
-
- String getContentType() {
- return getContentType(diff.metaB());
- }
-
- void injectMode(DiffInfo diffInfo, AsyncCallback<Void> cb) {
- new ModeInjector()
- .add(getContentType(diffInfo.metaA()))
- .add(getContentType(diffInfo.metaB()))
- .inject(cb);
- }
-
- abstract void setAutoHideDiffHeader(boolean hide);
-
- void prefetchNextFile() {
- String nextPath = header.getNextPath();
- if (nextPath != null) {
- DiffApi.diff(Project.NameKey.asStringOrNull(project), revision, nextPath)
- .base(base.asPatchSetId())
- .wholeFile()
- .intraline(prefs.intralineDifference())
- .ignoreWhitespace(prefs.ignoreWhitespace())
- .get(
- new AsyncCallback<DiffInfo>() {
- @Override
- public void onSuccess(DiffInfo info) {
- new ModeInjector()
- .add(getContentType(info.metaA()))
- .add(getContentType(info.metaB()))
- .inject(CallbackGroup.<Void>emptyCallback());
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- });
- }
- }
-
- void reloadDiffInfo() {
- int id = ++reloadVersionId;
- DiffApi.diff(Project.NameKey.asStringOrNull(project), revision, path)
- .base(base.asPatchSetId())
- .wholeFile()
- .intraline(prefs.intralineDifference())
- .ignoreWhitespace(prefs.ignoreWhitespace())
- .get(
- new GerritCallback<DiffInfo>() {
- @Override
- public void onSuccess(DiffInfo diffInfo) {
- if (id == reloadVersionId && isAttached()) {
- diff = diffInfo;
- operation(
- () -> {
- skipManager.removeAll();
- getChunkManager().reset();
- getDiffTable().scrollbar.removeDiffAnnotations();
- setShowIntraline(prefs.intralineDifference());
- render(diff);
- skipManager.render(prefs.context(), diff);
- });
- }
- }
- });
- }
-
- private static FileSize bucketFileSize(DiffInfo diff) {
- FileMeta a = diff.metaA();
- FileMeta b = diff.metaB();
- FileSize[] sizes = FileSize.values();
- for (int i = sizes.length - 1; 0 <= i; i--) {
- FileSize s = sizes[i];
- if ((a != null && s.lines <= a.lines()) || (b != null && s.lines <= b.lines())) {
- return s;
- }
- }
- return FileSize.SMALL;
- }
-
- abstract Runnable updateActiveLine(CodeMirror cm);
-
- private GutterClickHandler onGutterClick(CodeMirror cm) {
- return new GutterClickHandler() {
- @Override
- public void handle(
- CodeMirror instance, int line, String gutterClass, NativeEvent clickEvent) {
- if (Element.as(clickEvent.getEventTarget()).hasClassName(getLineNumberClassName())
- && clickEvent.getButton() == NativeEvent.BUTTON_LEFT
- && !clickEvent.getMetaKey()
- && !clickEvent.getAltKey()
- && !clickEvent.getCtrlKey()
- && !clickEvent.getShiftKey()) {
- cm.setCursor(Pos.create(line));
- Scheduler.get()
- .scheduleDeferred(
- new ScheduledCommand() {
- @Override
- public void execute() {
- getCommentManager().newDraftOnGutterClick(cm, gutterClass, line + 1);
- }
- });
- }
- }
- };
- }
-
- abstract FocusHandler getFocusHandler();
-
- abstract CodeMirror[] getCms();
-
- abstract CodeMirror getCmFromSide(DisplaySide side);
-
- abstract DiffTable getDiffTable();
-
- abstract int getCmLine(int line, DisplaySide side);
-
- abstract String getLineNumberClassName();
-
- LineOnOtherInfo lineOnOther(DisplaySide side, int line) {
- return getChunkManager().lineMapper.lineOnOther(side, line);
- }
-
- abstract ScreenLoadCallback<ConfigInfoCache.Entry> getScreenLoadCallback(
- CommentsCollections comments);
-
- abstract boolean isSideBySide();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DiffTable.css b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DiffTable.css
deleted file mode 100644
index 7569cf5..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DiffTable.css
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright (C) 2013 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.
- */
-.range {
- background-color: #ffd500 !important;
-}
-.rangeHighlight {
- background-color: #ffff00 !important;
-}
-
-.fullscreen {
- background-color: #f7f7f7;
- border-bottom: 1px solid #ddd;
-}
-
-@external .diffHeader;
-.diffHeader {
- font-size: 12px;
- font-weight: bold;
- color: #5252ad;
-}
-
-.diffHeader pre {
- margin: 0 0 3px 0;
-}
-
-@external .dark, .noIntraline, .showLineNumbers;
-.dark {}
-.noIntraline {}
-.showLineNumbers {}
\ No newline at end of file
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DiffTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DiffTable.java
deleted file mode 100644
index a91f8e6..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DiffTable.java
+++ /dev/null
@@ -1,184 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gerrit.client.DiffObject;
-import com.google.gerrit.client.account.DiffPreferences;
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.reviewdb.client.Patch.ChangeType;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwt.user.client.ui.Widget;
-import net.codemirror.lib.CodeMirror;
-
-/** Base class for SideBySideTable2 and UnifiedTable2 */
-abstract class DiffTable extends Composite {
- static {
- Resources.I.diffTableStyle().ensureInjected();
- }
-
- interface Style extends CssResource {
- String fullscreen();
-
- String dark();
-
- String noIntraline();
-
- String range();
-
- String rangeHighlight();
-
- String diffHeader();
-
- String showLineNumbers();
- }
-
- @UiField Element patchSetNavRow;
- @UiField Element patchSetNavCellA;
- @UiField Element patchSetNavCellB;
- @UiField Element diffHeaderRow;
- @UiField Element diffHeaderText;
- @UiField FlowPanel widgets;
-
- @UiField(provided = true)
- PatchSetSelectBox patchSetSelectBoxA;
-
- @UiField(provided = true)
- PatchSetSelectBox patchSetSelectBoxB;
-
- private boolean header;
- private ChangeType changeType;
- Scrollbar scrollbar;
-
- DiffTable(DiffScreen parent, DiffObject base, DiffObject revision, String path) {
- patchSetSelectBoxA =
- new PatchSetSelectBox(
- parent,
- DisplaySide.A,
- parent.getProject(),
- revision.asPatchSetId().getParentKey(),
- base,
- path);
- patchSetSelectBoxB =
- new PatchSetSelectBox(
- parent,
- DisplaySide.B,
- parent.getProject(),
- revision.asPatchSetId().getParentKey(),
- revision,
- path);
- PatchSetSelectBox.link(patchSetSelectBoxA, patchSetSelectBoxB);
-
- this.scrollbar = new Scrollbar(this);
- }
-
- abstract boolean isVisibleA();
-
- void setHeaderVisible(boolean show) {
- DiffScreen parent = getDiffScreen();
- if (show != UIObject.isVisible(patchSetNavRow)) {
- UIObject.setVisible(patchSetNavRow, show);
- UIObject.setVisible(diffHeaderRow, show && header);
- if (show) {
- parent.header.removeStyleName(Resources.I.diffTableStyle().fullscreen());
- } else {
- parent.header.addStyleName(Resources.I.diffTableStyle().fullscreen());
- }
- parent.resizeCodeMirror();
- }
- }
-
- abstract int getHeaderHeight();
-
- ChangeType getChangeType() {
- return changeType;
- }
-
- void setUpBlameIconA(CodeMirror cm, boolean isBase, PatchSet.Id rev, String path) {
- patchSetSelectBoxA.setUpBlame(cm, isBase, rev, path);
- }
-
- void setUpBlameIconB(CodeMirror cm, PatchSet.Id rev, String path) {
- patchSetSelectBoxB.setUpBlame(cm, false, rev, path);
- }
-
- void set(
- DiffPreferences prefs,
- JsArray<RevisionInfo> list,
- int parents,
- DiffInfo info,
- boolean editExists,
- boolean current,
- boolean open,
- boolean binary) {
- this.changeType = info.changeType();
- patchSetSelectBoxA.setUpPatchSetNav(
- list, parents, info.metaA(), editExists, current, open, binary);
- patchSetSelectBoxB.setUpPatchSetNav(
- list, parents, info.metaB(), editExists, current, open, binary);
-
- JsArrayString hdr = info.diffHeader();
- if (hdr != null) {
- StringBuilder b = new StringBuilder();
- for (int i = 1; i < hdr.length(); i++) {
- String s = hdr.get(i);
- if (!info.binary()
- && (s.startsWith("diff --git ")
- || s.startsWith("index ")
- || s.startsWith("+++ ")
- || s.startsWith("--- "))) {
- continue;
- }
- b.append(s).append('\n');
- }
-
- String hdrTxt = b.toString().trim();
- header = !hdrTxt.isEmpty();
- diffHeaderText.setInnerText(hdrTxt);
- UIObject.setVisible(diffHeaderRow, header);
- } else {
- header = false;
- UIObject.setVisible(diffHeaderRow, false);
- }
- setHideEmptyPane(prefs.hideEmptyPane());
- }
-
- abstract void setHideEmptyPane(boolean hide);
-
- void refresh() {
- if (header) {
- CodeMirror cm = getDiffScreen().getCmFromSide(DisplaySide.A);
- diffHeaderText.getStyle().setMarginLeft(cm.getGutterElement().getOffsetWidth(), Unit.PX);
- }
- }
-
- void add(Widget widget) {
- widgets.add(widget);
- }
-
- abstract DiffScreen getDiffScreen();
-
- boolean hasHeader() {
- return header;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Direction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Direction.java
deleted file mode 100644
index b1dd87e1..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Direction.java
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-/** Direction of traversal in an ordered list. */
-public enum Direction {
- PREV,
- NEXT
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DisplaySide.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DisplaySide.java
deleted file mode 100644
index 6cee174..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DisplaySide.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-/** Enum representing the side on a side-by-side view */
-public enum DisplaySide {
- A,
- B;
-
- DisplaySide otherSide() {
- return this == A ? B : A;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DraftBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DraftBox.java
deleted file mode 100644
index 33d1ac4..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DraftBox.java
+++ /dev/null
@@ -1,466 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gerrit.client.FormatUtil;
-import com.google.gerrit.client.change.LocalComments;
-import com.google.gerrit.client.changes.CommentApi;
-import com.google.gerrit.client.changes.CommentInfo;
-import com.google.gerrit.client.rpc.CallbackGroup;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.client.ui.CommentLinkProcessor;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.core.client.Scheduler.ScheduledCommand;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.event.dom.client.BlurEvent;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.dom.client.DoubleClickEvent;
-import com.google.gwt.event.dom.client.DoubleClickHandler;
-import com.google.gwt.event.dom.client.KeyCodes;
-import com.google.gwt.event.dom.client.KeyDownEvent;
-import com.google.gwt.event.dom.client.MouseMoveEvent;
-import com.google.gwt.event.dom.client.MouseMoveHandler;
-import com.google.gwt.event.dom.client.MouseUpEvent;
-import com.google.gwt.event.dom.client.MouseUpHandler;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.Timer;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.HTML;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.globalkey.client.NpTextArea;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-import net.codemirror.lib.CodeMirror;
-
-/** An HtmlPanel for displaying and editing a draft */
-class DraftBox extends CommentBox {
- interface Binder extends UiBinder<HTMLPanel, DraftBox> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- private static final int INITIAL_LINES = 5;
- private static final int MAX_LINES = 30;
-
- private final CommentLinkProcessor linkProcessor;
- private final PatchSet.Id psId;
- @Nullable private final Project.NameKey project;
- private final boolean expandAll;
- private CommentInfo comment;
- private PublishedBox replyToBox;
- private Timer expandTimer;
- private Timer resizeTimer;
- private int editAreaHeight;
- private boolean autoClosed;
- private CallbackGroup pendingGroup;
-
- @UiField Widget header;
- @UiField Element summary;
- @UiField Element date;
-
- @UiField Element p_view;
- @UiField HTML message;
- @UiField Button edit;
- @UiField Button discard1;
-
- @UiField Element p_edit;
- @UiField NpTextArea editArea;
- @UiField Button save;
- @UiField Button cancel;
- @UiField Button discard2;
-
- DraftBox(
- CommentGroup group,
- CommentLinkProcessor clp,
- @Nullable Project.NameKey pj,
- PatchSet.Id id,
- CommentInfo info,
- boolean expandAllComments) {
- super(group, info.range());
-
- linkProcessor = clp;
- psId = id;
- project = pj;
- expandAll = expandAllComments;
- initWidget(uiBinder.createAndBindUi(this));
-
- expandTimer =
- new Timer() {
- @Override
- public void run() {
- expandText();
- }
- };
- set(info);
-
- header.addDomHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- if (!isEdit()) {
- if (autoClosed && !isOpen()) {
- setOpen(true);
- setEdit(true);
- } else {
- setOpen(!isOpen());
- }
- }
- }
- },
- ClickEvent.getType());
-
- addDomHandler(
- new DoubleClickHandler() {
- @Override
- public void onDoubleClick(DoubleClickEvent event) {
- if (isEdit()) {
- editArea.setFocus(true);
- } else {
- setOpen(true);
- setEdit(true);
- }
- }
- },
- DoubleClickEvent.getType());
-
- initResizeHandler();
- }
-
- private void set(CommentInfo info) {
- autoClosed = !expandAll && info.message() != null && info.message().length() < 70;
- date.setInnerText(FormatUtil.shortFormatDayTime(info.updated()));
- if (info.message() != null) {
- String msg = info.message().trim();
- summary.setInnerText(msg);
- message.setHTML(linkProcessor.apply(new SafeHtmlBuilder().append(msg).wikify()));
- }
- comment = info;
- }
-
- @Override
- CommentInfo getCommentInfo() {
- return comment;
- }
-
- @Override
- boolean isOpen() {
- return UIObject.isVisible(p_view);
- }
-
- @Override
- void setOpen(boolean open) {
- UIObject.setVisible(summary, !open);
- UIObject.setVisible(p_view, open);
- super.setOpen(open);
- }
-
- private void expandText() {
- double cols = editArea.getCharacterWidth();
- int rows = 2;
- for (String line : editArea.getValue().split("\n")) {
- rows += Math.ceil((1.0 + line.length()) / cols);
- }
- rows = Math.max(INITIAL_LINES, Math.min(rows, MAX_LINES));
- if (editArea.getVisibleLines() != rows) {
- editArea.setVisibleLines(rows);
- }
- editAreaHeight = editArea.getOffsetHeight();
- getCommentGroup().resize();
- }
-
- boolean isEdit() {
- return UIObject.isVisible(p_edit);
- }
-
- void setEdit(boolean edit) {
- UIObject.setVisible(summary, false);
- UIObject.setVisible(p_view, !edit);
- UIObject.setVisible(p_edit, edit);
-
- setRangeHighlight(edit);
- if (edit) {
- String msg = comment.message() != null ? comment.message() : "";
- editArea.setValue(msg);
- cancel.setVisible(!isNew());
- expandText();
- editAreaHeight = editArea.getOffsetHeight();
-
- final int len = msg.length();
- Scheduler.get()
- .scheduleDeferred(
- new ScheduledCommand() {
- @Override
- public void execute() {
- editArea.setFocus(true);
- if (len > 0) {
- editArea.setCursorPos(len);
- }
- }
- });
- } else {
- expandTimer.cancel();
- resizeTimer.cancel();
- }
- getCommentManager().setUnsaved(this, edit);
- getCommentGroup().resize();
- }
-
- PublishedBox getReplyToBox() {
- return replyToBox;
- }
-
- void setReplyToBox(PublishedBox box) {
- replyToBox = box;
- }
-
- @Override
- protected void onUnload() {
- expandTimer.cancel();
- resizeTimer.cancel();
- super.onUnload();
- }
-
- private void removeUI() {
- if (replyToBox != null) {
- replyToBox.unregisterReplyBox();
- }
-
- getCommentManager().setUnsaved(this, false);
- setRangeHighlight(false);
- clearRange();
- getAnnotation().remove();
- getCommentGroup().remove(this);
- getCm().focus();
- }
-
- private void restoreSelection() {
- if (getFromTo() != null && comment.inReplyTo() == null) {
- getCm().setSelection(getFromTo().from(), getFromTo().to());
- }
- }
-
- @UiHandler("message")
- void onMessageClick(ClickEvent e) {
- e.stopPropagation();
- }
-
- @UiHandler("message")
- void onMessageDoubleClick(@SuppressWarnings("unused") DoubleClickEvent e) {
- setEdit(true);
- }
-
- @UiHandler("edit")
- void onEdit(ClickEvent e) {
- e.stopPropagation();
- setEdit(true);
- }
-
- @UiHandler("save")
- void onSave(ClickEvent e) {
- e.stopPropagation();
- CallbackGroup group = new CallbackGroup();
- save(group);
- group.done();
- }
-
- void save(CallbackGroup group) {
- if (pendingGroup != null) {
- pendingGroup.addListener(group);
- return;
- }
-
- String message = editArea.getValue().trim();
- if (message.length() == 0) {
- return;
- }
-
- CommentInfo input = CommentInfo.copy(comment);
- input.message(message);
- enableEdit(false);
-
- pendingGroup = group;
- final LocalComments lc = new LocalComments(project, psId);
- GerritCallback<CommentInfo> cb =
- new GerritCallback<CommentInfo>() {
- @Override
- public void onSuccess(CommentInfo result) {
- enableEdit(true);
- pendingGroup = null;
- set(result);
- setEdit(false);
- if (autoClosed) {
- setOpen(false);
- }
- getCommentManager().setUnsaved(DraftBox.this, false);
- }
-
- @Override
- public void onFailure(Throwable e) {
- enableEdit(true);
- pendingGroup = null;
- if (RestApi.isNotSignedIn(e)) {
- CommentInfo saved = CommentInfo.copy(comment);
- saved.message(editArea.getValue().trim());
- lc.setInlineComment(saved);
- }
- super.onFailure(e);
- }
- };
- if (input.id() == null) {
- CommentApi.createDraft(Project.NameKey.asStringOrNull(project), psId, input, group.add(cb));
- } else {
- CommentApi.updateDraft(
- Project.NameKey.asStringOrNull(project), psId, input.id(), input, group.add(cb));
- }
- CodeMirror cm = getCm();
- cm.vim().handleKey("<Esc>");
- cm.focus();
- }
-
- private void enableEdit(boolean on) {
- editArea.setEnabled(on);
- save.setEnabled(on);
- cancel.setEnabled(on);
- discard2.setEnabled(on);
- }
-
- @UiHandler("cancel")
- void onCancel(ClickEvent e) {
- e.stopPropagation();
- if (isNew() && !isDirty()) {
- removeUI();
- restoreSelection();
- } else {
- setEdit(false);
- if (autoClosed) {
- setOpen(false);
- }
- getCm().focus();
- }
- }
-
- @UiHandler({"discard1", "discard2"})
- void onDiscard(ClickEvent e) {
- e.stopPropagation();
- if (isNew()) {
- removeUI();
- restoreSelection();
- } else {
- setEdit(false);
- pendingGroup = new CallbackGroup();
- CommentApi.deleteDraft(
- Project.NameKey.asStringOrNull(project),
- psId,
- comment.id(),
- pendingGroup.addFinal(
- new GerritCallback<JavaScriptObject>() {
- @Override
- public void onSuccess(JavaScriptObject result) {
- pendingGroup = null;
- removeUI();
- }
- }));
- }
- }
-
- @UiHandler("editArea")
- void onKeyDown(KeyDownEvent e) {
- resizeTimer.cancel();
- if ((e.isControlKeyDown() || e.isMetaKeyDown()) && !e.isAltKeyDown() && !e.isShiftKeyDown()) {
- switch (e.getNativeKeyCode()) {
- case 's':
- case 'S':
- e.preventDefault();
- CallbackGroup group = new CallbackGroup();
- save(group);
- group.done();
- return;
- }
- } else if (e.getNativeKeyCode() == KeyCodes.KEY_ESCAPE && !isDirty()) {
- if (isNew()) {
- removeUI();
- restoreSelection();
- return;
- }
- setEdit(false);
- if (autoClosed) {
- setOpen(false);
- }
- getCm().focus();
- return;
- }
- expandTimer.schedule(250);
- }
-
- @UiHandler("editArea")
- void onBlur(@SuppressWarnings("unused") BlurEvent e) {
- resizeTimer.cancel();
- }
-
- private void initResizeHandler() {
- resizeTimer =
- new Timer() {
- @Override
- public void run() {
- getCommentGroup().resize();
- }
- };
-
- addDomHandler(
- new MouseMoveHandler() {
- @Override
- public void onMouseMove(MouseMoveEvent event) {
- int h = editArea.getOffsetHeight();
- if (isEdit() && h != editAreaHeight) {
- getCommentGroup().resize();
- resizeTimer.scheduleRepeating(50);
- editAreaHeight = h;
- }
- }
- },
- MouseMoveEvent.getType());
-
- addDomHandler(
- new MouseUpHandler() {
- @Override
- public void onMouseUp(MouseUpEvent event) {
- resizeTimer.cancel();
- getCommentGroup().resize();
- }
- },
- MouseUpEvent.getType());
- }
-
- private boolean isNew() {
- return comment.id() == null;
- }
-
- private boolean isDirty() {
- String msg = editArea.getValue().trim();
- if (isNew()) {
- return msg.length() > 0;
- }
- return !msg.equals(comment.message() != null ? comment.message().trim() : "");
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DraftBox.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DraftBox.ui.xml
deleted file mode 100644
index a363c06..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/DraftBox.ui.xml
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:c='urn:import:com.google.gerrit.client'
- xmlns:e='urn:import:com.google.gwtexpui.globalkey.client'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:with field='res' type='com.google.gerrit.client.diff.Resources'/>
- <ui:style gss='false'>
- .draft {
- width: 45px;
- text-align: center;
- color: #fff;
- background-color: #aaa;
- -webkit-border-radius: 2px;
- }
- .editArea { max-width: 637px; }
- button.button div {
- width: 35px;
- }
- button.discard {
- color: #d14836;
- background-color: #d14836;
- background-image: -webkit-linear-gradient(top, #d14836, #d14836);
- position: absolute;
- left: 150px;
- }
- </ui:style>
-
- <g:HTMLPanel styleName='{res.style.commentBox}'>
- <div class='{res.style.contents}'>
- <g:HTMLPanel ui:field='header' styleName='{res.style.header}'>
- <div class='{style.draft}'>Draft</div>
- <div ui:field='summary' class='{res.style.summary}'/>
- <div ui:field='date' class='{res.style.date}'/>
- </g:HTMLPanel>
- <div ui:field='p_view' aria-hidden='true' style='display: NONE'>
- <g:HTML ui:field='message' styleName='{res.style.message}'/>
- <div style='position: relative'>
- <g:Button ui:field='edit'
- title='Edit this draft comment'
- styleName='{style.button}'>
- <ui:attribute name='title'/>
- <div><ui:msg>Edit</ui:msg></div>
- </g:Button>
- <g:Button ui:field='discard1'
- title='Discard this draft comment'
- styleName='{style.button}'
- addStyleNames='{style.discard}'>
- <ui:attribute name='title'/>
- <div><ui:msg>Discard</ui:msg></div>
- </g:Button>
- </div>
- </div>
- <div ui:field='p_edit' aria-hidden='true' style='display: NONE'>
- <e:NpTextArea ui:field='editArea'
- characterWidth='60'
- visibleLines='5'
- spellCheck='true'
- styleName='{style.editArea}'/>
- <div style='position: relative'>
- <g:Button ui:field='save'
- title='Save this draft comment'
- styleName='{style.button}'>
- <ui:attribute name='title'/>
- <div><ui:msg>Save</ui:msg></div>
- </g:Button>
- <g:Button ui:field='cancel' styleName='{style.button}'>
- <div><ui:msg>Cancel</ui:msg></div>
- </g:Button>
- <g:Button ui:field='discard2'
- title='Discard this draft comment'
- styleName='{style.button}'
- addStyleNames='{style.discard}'>
- <ui:attribute name='title'/>
- <div><ui:msg>Discard</ui:msg></div>
- </g:Button>
- </div>
- </div>
- </div>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/EditIterator.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/EditIterator.java
deleted file mode 100644
index 4cf78c7..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/EditIterator.java
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gwt.core.client.JsArrayString;
-import net.codemirror.lib.Pos;
-
-/** An iterator for intraline edits */
-class EditIterator {
- private final JsArrayString lines;
- private final int startLine;
- private int line;
- private int pos;
-
- EditIterator(JsArrayString lineArray, int start) {
- lines = lineArray;
- startLine = start;
- }
-
- Pos advance(int numOfChar) {
- numOfChar = adjustForNegativeDelta(numOfChar);
-
- while (line < lines.length()) {
- int len = lines.get(line).length() - pos + 1; // + 1 for LF
- if (numOfChar < len) {
- Pos at = Pos.create(startLine + line, numOfChar + pos);
- pos += numOfChar;
- return at;
- }
-
- numOfChar -= len;
- line++;
- pos = 0;
-
- if (numOfChar == 0) {
- return Pos.create(startLine + line, 0);
- }
- }
-
- throw new IllegalStateException("EditIterator index out of bounds");
- }
-
- private int adjustForNegativeDelta(int n) {
- while (n < 0) {
- if (-n <= pos) {
- pos += n;
- return 0;
- }
-
- n += pos;
- line--;
- if (line < 0) {
- throw new IllegalStateException("EditIterator index out of bounds");
- }
- pos = lines.get(line).length() + 1;
- }
- return n;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Header.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Header.java
deleted file mode 100644
index 7a97df1..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Header.java
+++ /dev/null
@@ -1,367 +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.google.gerrit.client.diff;
-
-import com.google.gerrit.client.DiffObject;
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.account.DiffPreferences;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.ReviewInfo;
-import com.google.gerrit.client.changes.Util;
-import com.google.gerrit.client.diff.DiffInfo.Region;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.FileInfo;
-import com.google.gerrit.client.info.WebLinkInfo;
-import com.google.gerrit.client.patches.PatchUtil;
-import com.google.gerrit.client.rpc.CallbackGroup;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.client.ui.InlineHyperlink;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.extensions.client.GeneralPreferencesInfo.DiffView;
-import com.google.gerrit.reviewdb.client.Patch;
-import com.google.gerrit.reviewdb.client.Patch.ChangeType;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.Style.Visibility;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.event.logical.shared.ValueChangeEvent;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwtexpui.globalkey.client.KeyCommand;
-import com.google.gwtexpui.globalkey.client.KeyCommandSet;
-import com.google.gwtexpui.safehtml.client.SafeHtml;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-import java.util.List;
-
-public class Header extends Composite {
- interface Binder extends UiBinder<HTMLPanel, Header> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- static {
- Resources.I.style().ensureInjected();
- }
-
- private enum ReviewedState {
- AUTO_REVIEW,
- LOADED
- }
-
- @UiField CheckBox reviewed;
- @UiField Element project;
- @UiField Element filePath;
- @UiField Element fileNumber;
- @UiField Element fileCount;
-
- @UiField Element noDiff;
- @UiField FlowPanel linkPanel;
-
- @UiField InlineHyperlink prev;
- @UiField InlineHyperlink up;
- @UiField InlineHyperlink next;
- @UiField Image preferences;
-
- private final KeyCommandSet keys;
- @Nullable private final Project.NameKey projectKey;
- private final DiffObject base;
- private final PatchSet.Id patchSetId;
- private final String path;
- private final DiffView diffScreenType;
- private final DiffPreferences prefs;
- private boolean hasPrev;
- private boolean hasNext;
- private String nextPath;
- private JsArray<FileInfo> files;
- private PreferencesAction prefsAction;
- private ReviewedState reviewedState;
-
- Header(
- KeyCommandSet keys,
- @Nullable Project.NameKey project,
- DiffObject base,
- DiffObject patchSetId,
- String path,
- DiffView diffSreenType,
- DiffPreferences prefs) {
- initWidget(uiBinder.createAndBindUi(this));
- this.keys = keys;
- this.projectKey = project;
- this.base = base;
- this.patchSetId = patchSetId.asPatchSetId();
- this.path = path;
- this.diffScreenType = diffSreenType;
- this.prefs = prefs;
-
- if (!Gerrit.isSignedIn()) {
- reviewed.getElement().getStyle().setVisibility(Visibility.HIDDEN);
- }
- SafeHtml.setInnerHTML(filePath, formatPath(path));
- up.setTargetHistoryToken(
- PageLinks.toChange(
- project,
- patchSetId.asPatchSetId().getParentKey(),
- base.asString(),
- patchSetId.asPatchSetId().getId()));
- }
-
- public static SafeHtml formatPath(String path) {
- SafeHtmlBuilder b = new SafeHtmlBuilder();
- if (Patch.COMMIT_MSG.equals(path)) {
- return b.append(Util.C.commitMessage());
- } else if (Patch.MERGE_LIST.equals(path)) {
- return b.append(Util.C.mergeList());
- }
-
- int s = path.lastIndexOf('/') + 1;
- b.append(path.substring(0, s));
- b.openElement("b");
- b.append(path.substring(s));
- b.closeElement("b");
- return b;
- }
-
- private int findCurrentFileIndex(JsArray<FileInfo> files) {
- int currIndex = 0;
- for (int i = 0; i < files.length(); i++) {
- if (path.equals(files.get(i).path())) {
- currIndex = i;
- break;
- }
- }
- return currIndex;
- }
-
- @Override
- protected void onLoad() {
- DiffApi.list(
- Project.NameKey.asStringOrNull(projectKey),
- patchSetId,
- base.asPatchSetId(),
- new GerritCallback<NativeMap<FileInfo>>() {
- @Override
- public void onSuccess(NativeMap<FileInfo> result) {
- files = result.values();
- FileInfo.sortFileInfoByPath(files);
- fileNumber.setInnerText(
- Integer.toString(Natives.asList(files).indexOf(result.get(path)) + 1));
- fileCount.setInnerText(Integer.toString(files.length()));
- }
- });
-
- if (Gerrit.isSignedIn()) {
- ChangeApi.revision(Project.NameKey.asStringOrNull(projectKey), patchSetId)
- .view("files")
- .addParameterTrue("reviewed")
- .get(
- new AsyncCallback<JsArrayString>() {
- @Override
- public void onSuccess(JsArrayString result) {
- boolean b = Natives.asList(result).contains(path);
- reviewed.setValue(b, false);
- if (!b && reviewedState == ReviewedState.AUTO_REVIEW) {
- postAutoReviewed();
- }
- reviewedState = ReviewedState.LOADED;
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- });
- }
- }
-
- void autoReview() {
- if (reviewedState == ReviewedState.LOADED && !reviewed.getValue()) {
- postAutoReviewed();
- } else {
- reviewedState = ReviewedState.AUTO_REVIEW;
- }
- }
-
- void setChangeInfo(ChangeInfo info) {
- project.setInnerText(info.project());
- }
-
- void init(PreferencesAction pa, List<InlineHyperlink> links, List<WebLinkInfo> webLinks) {
- prefsAction = pa;
- prefsAction.setPartner(preferences);
-
- for (InlineHyperlink link : links) {
- linkPanel.add(link);
- }
- for (WebLinkInfo webLink : webLinks) {
- linkPanel.add(webLink.toAnchor());
- }
- }
-
- @UiHandler("reviewed")
- void onValueChange(ValueChangeEvent<Boolean> event) {
- if (event.getValue()) {
- reviewed().put(CallbackGroup.<ReviewInfo>emptyCallback());
- } else {
- reviewed().delete(CallbackGroup.<ReviewInfo>emptyCallback());
- }
- }
-
- private void postAutoReviewed() {
- reviewed()
- .background()
- .put(
- new AsyncCallback<ReviewInfo>() {
- @Override
- public void onSuccess(ReviewInfo result) {
- reviewed.setValue(true, false);
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- });
- }
-
- private RestApi reviewed() {
- return ChangeApi.revision(Project.NameKey.asStringOrNull(projectKey), patchSetId)
- .view("files")
- .id(path)
- .view("reviewed");
- }
-
- @UiHandler("preferences")
- void onPreferences(@SuppressWarnings("unused") ClickEvent e) {
- prefsAction.show();
- }
-
- private String url(FileInfo info) {
- return diffScreenType == DiffView.UNIFIED_DIFF
- ? Dispatcher.toUnified(projectKey, base, patchSetId, info.path())
- : Dispatcher.toSideBySide(projectKey, base, patchSetId, info.path());
- }
-
- private KeyCommand setupNav(InlineHyperlink link, char key, String help, FileInfo info) {
- if (info != null) {
- final String url = url(info);
- link.setTargetHistoryToken(url);
- link.setTitle(
- PatchUtil.M.fileNameWithShortcutKey(
- FileInfo.getFileName(info.path()), Character.toString(key)));
- KeyCommand k =
- new KeyCommand(0, key, help) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- Gerrit.display(url);
- }
- };
- keys.add(k);
- if (link == prev) {
- hasPrev = true;
- } else {
- hasNext = true;
- }
- return k;
- }
- link.getElement().getStyle().setVisibility(Visibility.HIDDEN);
- keys.add(new UpToChangeCommand(projectKey, patchSetId, 0, key));
- return null;
- }
-
- private boolean shouldSkipFile(FileInfo curr, CommentsCollections comments) {
- return prefs.skipDeleted() && ChangeType.DELETED.matches(curr.status())
- || prefs.skipUnchanged() && ChangeType.RENAMED.matches(curr.status())
- || prefs.skipUncommented() && !comments.hasCommentForPath(curr.path());
- }
-
- void setupPrevNextFiles(CommentsCollections comments) {
- FileInfo prevInfo = null;
- FileInfo nextInfo = null;
- int currIndex = findCurrentFileIndex(files);
- for (int i = currIndex - 1; i >= 0; i--) {
- FileInfo curr = files.get(i);
- if (shouldSkipFile(curr, comments)) {
- continue;
- }
- prevInfo = curr;
- break;
- }
- for (int i = currIndex + 1; i < files.length(); i++) {
- FileInfo curr = files.get(i);
- if (shouldSkipFile(curr, comments)) {
- continue;
- }
- nextInfo = curr;
- break;
- }
- KeyCommand p = setupNav(prev, '[', PatchUtil.C.previousFileHelp(), prevInfo);
- KeyCommand n = setupNav(next, ']', PatchUtil.C.nextFileHelp(), nextInfo);
- if (p != null && n != null) {
- keys.pair(p, n);
- }
- nextPath = nextInfo != null ? nextInfo.path() : null;
- }
-
- Runnable toggleReviewed() {
- return () -> reviewed.setValue(!reviewed.getValue(), true);
- }
-
- Runnable navigate(Direction dir) {
- switch (dir) {
- case PREV:
- return () -> (hasPrev ? prev : up).go();
- case NEXT:
- return () -> (hasNext ? next : up).go();
- default:
- return () -> {};
- }
- }
-
- Runnable reviewedAndNext() {
- return () -> {
- if (Gerrit.isSignedIn()) {
- reviewed.setValue(true, true);
- }
- navigate(Direction.NEXT).run();
- };
- }
-
- String getNextPath() {
- return nextPath;
- }
-
- void setNoDiff(DiffInfo diff) {
- if (diff.binary()) {
- UIObject.setVisible(noDiff, false); // Don't bother showing "No Differences"
- } else {
- JsArray<Region> regions = diff.content();
- boolean b = regions.length() == 0 || (regions.length() == 1 && regions.get(0).ab() != null);
- UIObject.setVisible(noDiff, b);
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Header.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Header.ui.xml
deleted file mode 100644
index 39eb6cb..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Header.ui.xml
+++ /dev/null
@@ -1,95 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:x='urn:import:com.google.gerrit.client.ui'>
- <ui:with field='ico' type='com.google.gerrit.client.GerritResources'/>
- <ui:with field='res' type='com.google.gerrit.client.diff.Resources'/>
- <ui:style gss='false'>
- .header {
- position: relative;
- height: 16px;
- line-height: 16px;
- }
- .reviewed input {
- margin: 0;
- padding: 0;
- vertical-align: middle;
- }
- .path {
- white-space: nowrap;
- }
- .fileCount {
- white-space: nowrap;
- position: relative;
- bottom: 4px;
- }
- .navigation {
- position: absolute;
- top: 0;
- right: 10px;
- height: 16px;
- line-height: 16px;
- }
- .nodiff {
- white-space: nowrap;
- color: #B00000;
- vertical-align: top;
- font-weight: bold;
- margin-right: 1em;
- float: left;
- }
- .linkPanel {
- float: left;
- }
- .linkPanel img {
- padding-right: 3px;
- }
- .preferences {
- cursor: pointer;
- }
- </ui:style>
- <g:HTMLPanel styleName='{style.header}'>
- <g:CheckBox ui:field='reviewed'
- styleName='{style.reviewed}'
- title='Mark file as reviewed (Shortcut: r)'>
- <ui:attribute name='title'/>
- </g:CheckBox>
- <span class='{style.path}'><span ui:field='project'/> / <span ui:field='filePath'/></span>
- <div class='{style.navigation}'>
- <span ui:field='noDiff' class='{style.nodiff}'><ui:msg>No Differences</ui:msg></span>
- <g:FlowPanel ui:field='linkPanel' styleName='{style.linkPanel}'/>
- <span class='{style.fileCount}'>
- <ui:msg>File <span ui:field='fileNumber'/> of <span ui:field='fileCount'/></ui:msg>
- </span>
- <x:InlineHyperlink ui:field='prev' styleName='{res.style.goPrev}'/>
- <x:InlineHyperlink ui:field='up'
- styleName='{res.style.goUp}'
- title='Up to change (Shortcut: u)'>
- <ui:attribute name='title'/>
- </x:InlineHyperlink>
- <x:InlineHyperlink ui:field='next' styleName='{res.style.goNext}'/>
- <g:Image ui:field='preferences'
- styleName='{style.preferences}'
- resource='{ico.gear}'
- title='Diff preferences (Shortcut: ,)'>
- <ui:attribute name='title'/>
- </g:Image>
- </div>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/InsertCommentBubble.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/InsertCommentBubble.java
deleted file mode 100644
index f8eab91..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/InsertCommentBubble.java
+++ /dev/null
@@ -1,62 +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.client.diff;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Style;
-import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.Image;
-import net.codemirror.lib.CodeMirror;
-import net.codemirror.lib.Rect;
-
-/** Bubble displayed near a selected region to create a comment. */
-class InsertCommentBubble extends Composite {
- interface Binder extends UiBinder<HTMLPanel, InsertCommentBubble> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- @UiField Image icon;
-
- InsertCommentBubble(CommentManager commentManager, CodeMirror cm) {
- initWidget(uiBinder.createAndBindUi(this));
- addDomHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- setVisible(false);
- commentManager.newDraftCallback(cm).run();
- }
- },
- ClickEvent.getType());
- }
-
- void position(Rect r) {
- Style s = getElement().getStyle();
- int top = (int) (r.top() - (getOffsetHeight() - 8));
- if (top < 0) {
- s.setTop(-3, Unit.PX);
- s.setLeft(r.right() + 2, Unit.PX);
- } else {
- s.setTop(top, Unit.PX);
- s.setLeft((int) (r.right() - 14), Unit.PX);
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/InsertCommentBubble.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/InsertCommentBubble.ui.xml
deleted file mode 100644
index 6a18c4d..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/InsertCommentBubble.ui.xml
+++ /dev/null
@@ -1,51 +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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:with field='res' type='com.google.gerrit.client.GerritResources'/>
- <ui:style gss='false'>
- .bubble {
- z-index: 150;
- white-space: nowrap;
- line-height: 16px;
- cursor: pointer;
- }
- .message {
- background: #fff1a8;
- padding-left: 5px;
- padding-right: 5px;
- border-radius: 5px;
- border: 1px solid #aaa;
- font-family: sans-serif;
- font-size: smaller;
- font-style: italic;
- vertical-align: top;
- }
- .message b {
- vertical-align: top;
- }
- </ui:style>
- <g:HTMLPanel styleName='{style.bubble}'>
- <g:Image ui:field='icon'
- styleName=''
- resource='{res.draftComments}'
- title='Create a new inline comment'>
- <ui:attribute name='title'/>
- </g:Image><span class='{style.message}'><ui:msg>press <b>c</b> to comment</ui:msg></span>
- </g:HTMLPanel>
-</ui:UiBinder>
\ No newline at end of file
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/LineMapper.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/LineMapper.java
deleted file mode 100644
index fc83a14..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/LineMapper.java
+++ /dev/null
@@ -1,225 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-
-/** Helper class to handle calculations involving line gaps. */
-class LineMapper {
- private int lineA;
- private int lineB;
- private List<LineGap> lineMapAtoB;
- private List<LineGap> lineMapBtoA;
-
- LineMapper() {
- reset();
- }
-
- void reset() {
- lineA = 0;
- lineB = 0;
- lineMapAtoB = new ArrayList<>();
- lineMapBtoA = new ArrayList<>();
- }
-
- int getLineA() {
- return lineA;
- }
-
- int getLineB() {
- return lineB;
- }
-
- void appendCommon(int numLines) {
- lineA += numLines;
- lineB += numLines;
- }
-
- void appendReplace(int aLen, int bLen) {
- appendCommon(Math.min(aLen, bLen));
- if (aLen < bLen) { // Edit with insertion
- appendInsert(bLen - aLen);
- } else if (aLen > bLen) { // Edit with deletion
- appendDelete(aLen - bLen);
- }
- }
-
- void appendInsert(int numLines) {
- int origLineB = lineB;
- lineB += numLines;
- int bAheadOfA = lineB - lineA;
- lineMapAtoB.add(new LineGap(lineA, -1, bAheadOfA));
- lineMapBtoA.add(new LineGap(origLineB, lineB - 1, -bAheadOfA));
- }
-
- void appendDelete(int numLines) {
- int origLineA = lineA;
- lineA += numLines;
- int aAheadOfB = lineA - lineB;
- lineMapAtoB.add(new LineGap(origLineA, lineA - 1, -aAheadOfB));
- lineMapBtoA.add(new LineGap(lineB, -1, aAheadOfB));
- }
-
- /**
- * Helper method to retrieve the line number on the other side.
- *
- * <p>Given a line number on one side, performs a binary search in the lineMap to find the
- * corresponding LineGap record.
- *
- * <p>A LineGap records gap information from the start of an actual gap up to the start of the
- * next gap. In the following example, lineMapAtoB will have LineGap: {start: 1, end: -1, delta:
- * 3} (end set to -1 to represent a dummy gap of length zero. The binary search only looks at
- * start so setting it to -1 has no effect here.) lineMapBtoA will have LineGap: {start: 1, end:
- * 3, delta: -3} These LineGaps control lines between 1 and 5.
- *
- * <p>The "delta" is computed as the number to add on our side to get the line number on the other
- * side given a line after the actual gap, so the result will be (line + delta). All lines within
- * the actual gap (1 to 3) are considered corresponding to the last line above the region on the
- * other side, which is 0 in this case. For these lines, we do (end + delta).
- *
- * <p>For example, to get the line number on the left corresponding to 1 on the right
- * (lineOnOther(REVISION, 1)), the method looks up in lineMapBtoA, finds the "delta" to be -3, and
- * returns 3 + (-3) = 0 since 1 falls in the actual gap. On the other hand, the line corresponding
- * to 5 on the right will be 5 + (-3) = 2, since 5 is in the region after the gap (but still
- * controlled by the current LineGap).
- *
- * <p>PARENT REVISION 0 | 0 - | 1 \ \ - | 2 | Actual insertion gap | - | 3 / | Region controlled
- * by one LineGap 1 | 4 <- delta = 4 - 1 = 3 | 2 | 5 / - | 6 ...
- */
- LineOnOtherInfo lineOnOther(DisplaySide mySide, int line) {
- List<LineGap> lineGaps = gapList(mySide);
- // Create a dummy LineGap for the search.
- int ret = Collections.binarySearch(lineGaps, new LineGap(line));
- if (ret == -1) {
- return new LineOnOtherInfo(line, true);
- }
- LineGap lookup = lineGaps.get(0 <= ret ? ret : -ret - 2);
- int start = lookup.start;
- int end = lookup.end;
- int delta = lookup.delta;
- if (start <= line && line <= end && end != -1) { // Line falls within gap
- return new LineOnOtherInfo(end + delta, false);
- }
- // Line after gap
- return new LineOnOtherInfo(line + delta, true);
- }
-
- AlignedPair align(DisplaySide mySide, int line) {
- List<LineGap> gaps = gapList(mySide);
- int idx = Collections.binarySearch(gaps, new LineGap(line));
- if (idx == -1) {
- return new AlignedPair(line, line);
- }
-
- LineGap g = gaps.get(0 <= idx ? idx : -idx - 2);
- if (g.start <= line && line <= g.end && g.end != -1) {
- if (0 < g.start) {
- // Line falls within this gap, use alignment before.
- return new AlignedPair(g.start - 1, g.end + g.delta);
- }
- return new AlignedPair(g.end, g.end + g.delta + 1);
- }
- return new AlignedPair(line, line + g.delta);
- }
-
- private List<LineGap> gapList(DisplaySide mySide) {
- return mySide == DisplaySide.A ? lineMapAtoB : lineMapBtoA;
- }
-
- static class AlignedPair {
- final int src;
- final int dst;
-
- AlignedPair(int s, int d) {
- src = s;
- dst = d;
- }
- }
-
- /**
- * @field line The line number on the other side.
- * @field aligned Whether the two lines are at the same height when displayed.
- */
- static class LineOnOtherInfo {
- private int line;
- private boolean aligned;
-
- LineOnOtherInfo(int line, boolean aligned) {
- this.line = line;
- this.aligned = aligned;
- }
-
- int getLine() {
- return line;
- }
-
- boolean isAligned() {
- return aligned;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj instanceof LineOnOtherInfo) {
- LineOnOtherInfo other = (LineOnOtherInfo) obj;
- return aligned == other.aligned && line == other.line;
- }
- return false;
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(line, aligned);
- }
-
- @Override
- public String toString() {
- return line + " " + aligned;
- }
- }
-
- /**
- * Helper class to record line gap info and assist in calculation of line number on the other
- * side.
- *
- * <p>For a mapping from A to B, where A is the side with an insertion:
- *
- * @field start The start line of the insertion in A.
- * @field end The exclusive end line of the insertion in A.
- * @field delta The offset added to A to get the line number in B calculated from end.
- */
- private static class LineGap implements Comparable<LineGap> {
- private final int start;
- private final int end;
- private final int delta;
-
- private LineGap(int start, int end, int delta) {
- this.start = start;
- this.end = end;
- this.delta = delta;
- }
-
- private LineGap(int line) {
- this(line, 0, 0);
- }
-
- @Override
- public int compareTo(LineGap o) {
- return start - o.start;
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/NoOpKeyCommand.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/NoOpKeyCommand.java
deleted file mode 100644
index 584232d..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/NoOpKeyCommand.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwtexpui.globalkey.client.KeyCommand;
-
-/** A KeyCommand that does nothing, used to display a help message */
-class NoOpKeyCommand extends KeyCommand {
- NoOpKeyCommand(int mask, int key, String help) {
- super(mask, key, help);
- }
-
- @Override
- public void onKeyPress(KeyPressEvent event) {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PatchSetSelectBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PatchSetSelectBox.java
deleted file mode 100644
index 292773c..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PatchSetSelectBox.java
+++ /dev/null
@@ -1,240 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gerrit.client.DiffObject;
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.blame.BlameInfo;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.Util;
-import com.google.gerrit.client.info.ChangeInfo.RevisionInfo;
-import com.google.gerrit.client.info.WebLinkInfo;
-import com.google.gerrit.client.patches.PatchUtil;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.InlineHyperlink;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Patch;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.ImageResourceRenderer;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtorm.client.KeyUtil;
-import java.util.List;
-import net.codemirror.lib.CodeMirror;
-
-/** HTMLPanel to select among patch sets */
-class PatchSetSelectBox extends Composite {
- interface Binder extends UiBinder<HTMLPanel, PatchSetSelectBox> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- interface BoxStyle extends CssResource {
- String selected();
- }
-
- @UiField Image icon;
- @UiField HTMLPanel linkPanel;
- @UiField BoxStyle style;
-
- @Nullable private final Project.NameKey project;
- private final Change.Id changeId;
-
- private DiffScreen parent;
- private DisplaySide side;
- private boolean sideA;
- private String path;
- private PatchSet.Id revision;
- private DiffObject idActive;
- private PatchSetSelectBox other;
-
- PatchSetSelectBox(
- DiffScreen parent,
- DisplaySide side,
- @Nullable Project.NameKey project,
- Change.Id changeId,
- DiffObject diffObject,
- String path) {
- initWidget(uiBinder.createAndBindUi(this));
- icon.setTitle(PatchUtil.C.addFileCommentToolTip());
- icon.addStyleName(Gerrit.RESOURCES.css().link());
-
- this.parent = parent;
- this.side = side;
- this.sideA = side == DisplaySide.A;
- this.project = project;
- this.changeId = changeId;
- this.revision = diffObject.asPatchSetId();
- this.idActive = diffObject;
- this.path = path;
- }
-
- void setUpPatchSetNav(
- JsArray<RevisionInfo> list,
- int parents,
- DiffInfo.FileMeta meta,
- boolean editExists,
- boolean current,
- boolean open,
- boolean binary) {
- InlineHyperlink selectedLink = null;
- if (sideA) {
- if (parents <= 1) {
- InlineHyperlink link = createLink(PatchUtil.C.patchBase(), DiffObject.base());
- linkPanel.add(link);
- selectedLink = link;
- } else {
- for (int i = parents; i > 0; i--) {
- PatchSet.Id id = new PatchSet.Id(changeId, -i);
- InlineHyperlink link = createLink(Util.M.diffBaseParent(i), DiffObject.patchSet(id));
- linkPanel.add(link);
- if (revision != null && id.equals(revision)) {
- selectedLink = link;
- }
- }
- InlineHyperlink link = createLink(Util.C.autoMerge(), DiffObject.autoMerge());
- linkPanel.add(link);
- if (selectedLink == null) {
- selectedLink = link;
- }
- }
- }
- for (int i = 0; i < list.length(); i++) {
- RevisionInfo r = list.get(i);
- InlineHyperlink link =
- createLink(r.id(), DiffObject.patchSet(new PatchSet.Id(changeId, r._number())));
- linkPanel.add(link);
- if (revision != null && r.id().equals(revision.getId())) {
- selectedLink = link;
- }
- }
- if (selectedLink != null) {
- selectedLink.setStyleName(style.selected());
- }
-
- if (meta == null) {
- return;
- }
- if (!Patch.isMagic(path)) {
- linkPanel.add(createDownloadLink());
- }
- if (!binary && open && !idActive.isBaseOrAutoMerge() && Gerrit.isSignedIn()) {
- if ((editExists && idActive.isEdit()) || (!editExists && current)) {
- linkPanel.add(createEditIcon());
- }
- }
- List<WebLinkInfo> webLinks = Natives.asList(meta.webLinks());
- if (webLinks != null) {
- for (WebLinkInfo webLink : webLinks) {
- linkPanel.add(webLink.toAnchor());
- }
- }
- }
-
- void setUpBlame(final CodeMirror cm, boolean isBase, PatchSet.Id rev, String path) {
- if (!Patch.isMagic(path) && Gerrit.isSignedIn() && Gerrit.info().change().allowBlame()) {
- Anchor blameIcon = createBlameIcon();
- blameIcon.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent clickEvent) {
- if (cm.extras().getBlameInfo() != null) {
- cm.extras().toggleAnnotation();
- } else {
- ChangeApi.blame(Project.NameKey.asStringOrNull(project), rev, path, isBase)
- .get(
- new GerritCallback<JsArray<BlameInfo>>() {
-
- @Override
- public void onSuccess(JsArray<BlameInfo> lines) {
- cm.extras().toggleAnnotation(lines);
- }
- });
- }
- }
- });
- linkPanel.add(blameIcon);
- }
- }
-
- private Widget createEditIcon() {
- PatchSet.Id id =
- idActive.isBaseOrAutoMerge() ? other.idActive.asPatchSetId() : idActive.asPatchSetId();
- Anchor anchor =
- new Anchor(
- new ImageResourceRenderer().render(Gerrit.RESOURCES.edit()),
- "#" + Dispatcher.toEditScreen(project, id, path));
- anchor.setTitle(PatchUtil.C.edit());
- return anchor;
- }
-
- private Anchor createBlameIcon() {
- Anchor anchor = new Anchor(new ImageResourceRenderer().render(Gerrit.RESOURCES.blame()));
- anchor.setTitle(PatchUtil.C.blame());
- return anchor;
- }
-
- static void link(PatchSetSelectBox a, PatchSetSelectBox b) {
- a.other = b;
- b.other = a;
- }
-
- private InlineHyperlink createLink(String label, DiffObject id) {
- assert other != null;
- if (sideA) {
- assert !other.idActive.isBaseOrAutoMerge();
- }
- DiffObject diffBase = sideA ? id : other.idActive;
- DiffObject revision = sideA ? other.idActive : id;
-
- return new InlineHyperlink(
- label,
- parent.isSideBySide()
- ? Dispatcher.toSideBySide(project, diffBase, revision.asPatchSetId(), path)
- : Dispatcher.toUnified(project, diffBase, revision.asPatchSetId(), path));
- }
-
- private Anchor createDownloadLink() {
- DiffObject diffObject = idActive.isBaseOrAutoMerge() ? other.idActive : idActive;
- String sideURL = idActive.isBaseOrAutoMerge() ? "1" : "0";
- String base = GWT.getHostPageBaseURL() + "cat/";
- Anchor anchor =
- new Anchor(
- new ImageResourceRenderer().render(Gerrit.RESOURCES.downloadIcon()),
- base + KeyUtil.encode(diffObject.asPatchSetId() + "," + path) + "^" + sideURL);
- anchor.setTitle(PatchUtil.C.download());
- return anchor;
- }
-
- @UiHandler("icon")
- void onIconClick(@SuppressWarnings("unused") ClickEvent e) {
- parent.getCmFromSide(side).scrollToY(0);
- parent.getCommentManager().insertNewDraft(side, 0);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PatchSetSelectBox.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PatchSetSelectBox.ui.xml
deleted file mode 100644
index 6e526ec..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PatchSetSelectBox.ui.xml
+++ /dev/null
@@ -1,74 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:with field='res' type='com.google.gerrit.client.GerritResources'/>
- <ui:with field='patchConstants'
- type='com.google.gerrit.client.patches.PatchConstants'/>
- <ui:style gss='false' type='com.google.gerrit.client.diff.PatchSetSelectBox.BoxStyle'>
- @eval selectionColor com.google.gerrit.client.Gerrit.getTheme().selectionColor;
- @eval trimColor com.google.gerrit.client.Gerrit.getTheme().trimColor;
- .table {
- width: 100%;
- }
- .linkCell {
- text-align: center;
- font-size: 12px;
- white-space: normal;
- font-family: sans-serif;
- font-weight: bold;
- }
- .linkCell div {
- padding-left: 3px;
- padding-right: 3px;
- vertical-align: middle;
- display: inline-block;
- }
- .linkCell a {
- padding-left: 3px;
- padding-right: 3px;
- text-decoration: none;
- vertical-align: middle;
- display: inline-block;
- }
- .selected {
- font-weight: bold;
- background-color: selectionColor;
- }
- .hidden {
- visibility: hidden;
- }
- .iconCell {
- width: 16px;
- }
- </ui:style>
- <g:HTMLPanel>
- <table class='{style.table}'>
- <td class='{style.iconCell}'>
- <g:Image ui:field='icon' resource='{res.addFileComment}'/>
- </td>
- <td class='{style.linkCell}'>
- <g:HTMLPanel ui:field='linkPanel'>
- <g:Label>
- <ui:text from='{patchConstants.patchSet}'/>
- </g:Label>
- </g:HTMLPanel>
- </td>
- </table>
- </g:HTMLPanel>
-</ui:UiBinder>
\ No newline at end of file
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PreferencesAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PreferencesAction.java
deleted file mode 100644
index 2d4a4c4..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PreferencesAction.java
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gerrit.client.account.DiffPreferences;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.PopupPanel.PositionCallback;
-import com.google.gwt.user.client.ui.Widget;
-
-class PreferencesAction {
- private final DiffScreen view;
- private final DiffPreferences prefs;
- private PopupPanel popup;
- private PreferencesBox current;
- private Widget partner;
-
- PreferencesAction(DiffScreen view, DiffPreferences prefs) {
- this.view = view;
- this.prefs = prefs;
- }
-
- void update() {
- if (current != null) {
- current.set(prefs);
- }
- }
-
- void show() {
- if (popup != null) {
- // Already open? Close the dialog.
- hide();
- return;
- }
-
- current = new PreferencesBox(view);
- current.set(prefs);
-
- popup = new PopupPanel(true, false);
- popup.setStyleName(current.style.dialog());
- popup.add(current);
- popup.addAutoHidePartner(partner.getElement());
- popup.addCloseHandler(
- new CloseHandler<PopupPanel>() {
- @Override
- public void onClose(CloseEvent<PopupPanel> event) {
- view.getCmFromSide(DisplaySide.B).focus();
- popup = null;
- current = null;
- }
- });
- popup.setPopupPositionAndShow(
- new PositionCallback() {
- @Override
- public void setPosition(int offsetWidth, int offsetHeight) {
- popup.setPopupPosition(300, 120);
- }
- });
- current.setFocus(true);
- }
-
- void hide() {
- if (popup != null) {
- popup.hide();
- popup = null;
- current = null;
- }
- }
-
- void setPartner(Widget w) {
- partner = w;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PreferencesBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PreferencesBox.java
deleted file mode 100644
index ed4ac25..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PreferencesBox.java
+++ /dev/null
@@ -1,644 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import static com.google.gerrit.extensions.client.DiffPreferencesInfo.DEFAULT_CONTEXT;
-import static com.google.gerrit.extensions.client.DiffPreferencesInfo.WHOLE_FILE_CONTEXT;
-import static com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace.IGNORE_ALL;
-import static com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace.IGNORE_LEADING_AND_TRAILING;
-import static com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace.IGNORE_NONE;
-import static com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace.IGNORE_TRAILING;
-import static com.google.gwt.event.dom.client.KeyCodes.KEY_ESCAPE;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.account.AccountApi;
-import com.google.gerrit.client.account.DiffPreferences;
-import com.google.gerrit.client.patches.PatchUtil;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.NpIntTextBox;
-import com.google.gerrit.extensions.client.DiffPreferencesInfo;
-import com.google.gerrit.extensions.client.DiffPreferencesInfo.Whitespace;
-import com.google.gerrit.extensions.client.Theme;
-import com.google.gerrit.reviewdb.client.Patch;
-import com.google.gerrit.reviewdb.client.Patch.ChangeType;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.Style.Visibility;
-import com.google.gwt.event.dom.client.ChangeEvent;
-import com.google.gwt.event.dom.client.ClickEvent;
-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.logical.shared.ValueChangeEvent;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.Timer;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.ListBox;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.ToggleButton;
-import com.google.gwt.user.client.ui.UIObject;
-import java.util.Objects;
-import net.codemirror.lib.CodeMirror;
-import net.codemirror.mode.ModeInfo;
-import net.codemirror.mode.ModeInjector;
-import net.codemirror.theme.ThemeLoader;
-
-/** Displays current diff preferences. */
-public class PreferencesBox extends Composite {
- interface Binder extends UiBinder<HTMLPanel, PreferencesBox> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- public interface Style extends CssResource {
- String dialog();
- }
-
- private final DiffScreen view;
- private DiffPreferences prefs;
- private int contextLastValue;
- private Timer updateContextTimer;
-
- @UiField Style style;
- @UiField Element header;
- @UiField Anchor close;
- @UiField ListBox ignoreWhitespace;
- @UiField NpIntTextBox tabWidth;
- @UiField NpIntTextBox lineLength;
- @UiField NpIntTextBox context;
- @UiField NpIntTextBox cursorBlinkRate;
- @UiField CheckBox contextEntireFile;
- @UiField ToggleButton intralineDifference;
- @UiField ToggleButton syntaxHighlighting;
- @UiField ToggleButton whitespaceErrors;
- @UiField ToggleButton showTabs;
- @UiField ToggleButton lineNumbers;
- @UiField Element leftSideLabel;
- @UiField ToggleButton leftSide;
- @UiField ToggleButton emptyPane;
- @UiField ToggleButton topMenu;
- @UiField ToggleButton autoHideDiffTableHeader;
- @UiField ToggleButton manualReview;
- @UiField ToggleButton expandAllComments;
- @UiField ToggleButton renderEntireFile;
- @UiField ToggleButton matchBrackets;
- @UiField ToggleButton lineWrapping;
- @UiField ToggleButton skipDeleted;
- @UiField ToggleButton skipUnchanged;
- @UiField ToggleButton skipUncommented;
- @UiField ListBox theme;
- @UiField Element modeLabel;
- @UiField ListBox mode;
- @UiField Button apply;
- @UiField Button save;
-
- public PreferencesBox(DiffScreen view) {
- this.view = view;
-
- initWidget(uiBinder.createAndBindUi(this));
- initIgnoreWhitespace();
- initTheme();
-
- if (view != null) {
- initMode();
- } else {
- UIObject.setVisible(header, false);
- apply.getElement().getStyle().setVisibility(Visibility.HIDDEN);
- }
- }
-
- @Override
- public void onLoad() {
- super.onLoad();
-
- save.setVisible(Gerrit.isSignedIn());
-
- if (view != null) {
- addDomHandler(
- new KeyDownHandler() {
- @Override
- public void onKeyDown(KeyDownEvent event) {
- if (event.getNativeKeyCode() == KEY_ESCAPE || event.getNativeKeyCode() == ',') {
- close();
- }
- }
- },
- KeyDownEvent.getType());
-
- updateContextTimer =
- new Timer() {
- @Override
- public void run() {
- if (prefs.context() == WHOLE_FILE_CONTEXT) {
- contextEntireFile.setValue(true);
- }
- if (view.canRenderEntireFile(prefs)) {
- renderEntireFile.setEnabled(true);
- renderEntireFile.setValue(prefs.renderEntireFile());
- } else {
- renderEntireFile.setValue(false);
- renderEntireFile.setEnabled(false);
- }
- view.setContext(prefs.context());
- }
- };
- }
- }
-
- public Style getStyle() {
- return style;
- }
-
- public void set(DiffPreferences prefs) {
- this.prefs = prefs;
-
- setIgnoreWhitespace(prefs.ignoreWhitespace());
- tabWidth.setIntValue(prefs.tabSize());
- if (view != null && Patch.COMMIT_MSG.equals(view.path)) {
- lineLength.setEnabled(false);
- lineLength.setIntValue(72);
- } else {
- lineLength.setEnabled(true);
- lineLength.setIntValue(prefs.lineLength());
- }
- cursorBlinkRate.setIntValue(prefs.cursorBlinkRate());
- syntaxHighlighting.setValue(prefs.syntaxHighlighting());
- whitespaceErrors.setValue(prefs.showWhitespaceErrors());
- showTabs.setValue(prefs.showTabs());
- lineNumbers.setValue(prefs.showLineNumbers());
- emptyPane.setValue(!prefs.hideEmptyPane());
- if (view != null) {
- leftSide.setValue(view.getDiffTable().isVisibleA());
- leftSide.setEnabled(
- !(prefs.hideEmptyPane() && view.getDiffTable().getChangeType() == ChangeType.ADDED));
- } else {
- UIObject.setVisible(leftSideLabel, false);
- leftSide.setVisible(false);
- }
- topMenu.setValue(!prefs.hideTopMenu());
- autoHideDiffTableHeader.setValue(!prefs.autoHideDiffTableHeader());
- manualReview.setValue(prefs.manualReview());
- expandAllComments.setValue(prefs.expandAllComments());
- matchBrackets.setValue(prefs.matchBrackets());
- lineWrapping.setValue(prefs.lineWrapping());
- skipDeleted.setValue(!prefs.skipDeleted());
- skipUnchanged.setValue(!prefs.skipUnchanged());
- skipUncommented.setValue(!prefs.skipUncommented());
- setTheme(prefs.theme());
-
- if (view == null || view.canRenderEntireFile(prefs)) {
- renderEntireFile.setValue(prefs.renderEntireFile());
- renderEntireFile.setEnabled(true);
- } else {
- renderEntireFile.setValue(false);
- renderEntireFile.setEnabled(false);
- }
-
- if (view != null) {
- mode.setEnabled(prefs.syntaxHighlighting());
- if (prefs.syntaxHighlighting()) {
- setMode(view.getCmFromSide(DisplaySide.B).getStringOption("mode"));
- }
- } else {
- UIObject.setVisible(modeLabel, false);
- mode.setVisible(false);
- }
-
- if (view != null) {
- switch (view.getIntraLineStatus()) {
- case OFF:
- case OK:
- intralineDifference.setValue(prefs.intralineDifference());
- break;
-
- case TIMEOUT:
- case FAILURE:
- intralineDifference.setValue(false);
- intralineDifference.setEnabled(false);
- break;
- }
- } else {
- intralineDifference.setValue(prefs.intralineDifference());
- }
-
- if (prefs.context() == WHOLE_FILE_CONTEXT) {
- contextLastValue = DEFAULT_CONTEXT;
- context.setText("");
- contextEntireFile.setValue(true);
- } else {
- context.setIntValue(prefs.context());
- contextEntireFile.setValue(false);
- }
- }
-
- @UiHandler("ignoreWhitespace")
- void onIgnoreWhitespace(@SuppressWarnings("unused") ChangeEvent e) {
- prefs.ignoreWhitespace(
- Whitespace.valueOf(ignoreWhitespace.getValue(ignoreWhitespace.getSelectedIndex())));
- if (view != null) {
- view.reloadDiffInfo();
- }
- }
-
- @UiHandler("intralineDifference")
- void onIntralineDifference(ValueChangeEvent<Boolean> e) {
- prefs.intralineDifference(Boolean.valueOf(e.getValue()));
- if (view != null) {
- view.setShowIntraline(prefs.intralineDifference());
- }
- }
-
- @UiHandler("context")
- void onContextKey(KeyPressEvent e) {
- if (contextEntireFile.getValue()) {
- char c = e.getCharCode();
- if ('0' <= c && c <= '9') {
- contextEntireFile.setValue(false);
- }
- }
- }
-
- @UiHandler("context")
- void onContext(ValueChangeEvent<String> e) {
- String v = e.getValue();
- int c;
- if (v != null && v.length() > 0) {
- c = Math.min(Math.max(0, Integer.parseInt(v)), 32767);
- contextEntireFile.setValue(false);
- } else if (v == null || v.isEmpty()) {
- c = WHOLE_FILE_CONTEXT;
- } else {
- return;
- }
- prefs.context(c);
- if (view != null) {
- updateContextTimer.schedule(200);
- }
- }
-
- @UiHandler("contextEntireFile")
- void onContextEntireFile(ValueChangeEvent<Boolean> e) {
- // If a click arrives too fast after onContext applied an update
- // the user committed the context line update by clicking on the
- // whole file checkmark. Drop this event, but transfer focus.
- if (e.getValue()) {
- contextLastValue = context.getIntValue();
- context.setText("");
- prefs.context(WHOLE_FILE_CONTEXT);
- } else {
- prefs.context(contextLastValue > 0 ? contextLastValue : DEFAULT_CONTEXT);
- context.setIntValue(prefs.context());
- context.setFocus(true);
- context.setSelectionRange(0, context.getText().length());
- }
- if (view != null) {
- updateContextTimer.schedule(200);
- }
- }
-
- @UiHandler("tabWidth")
- void onTabWidth(ValueChangeEvent<String> e) {
- String v = e.getValue();
- if (v != null && v.length() > 0) {
- prefs.tabSize(Math.max(1, Integer.parseInt(v)));
- if (view != null) {
- view.operation(
- () -> {
- int size = prefs.tabSize();
- for (CodeMirror cm : view.getCms()) {
- cm.setOption("tabSize", size);
- }
- });
- }
- }
- }
-
- @UiHandler("lineLength")
- void onLineLength(ValueChangeEvent<String> e) {
- String v = e.getValue();
- if (v != null && v.length() > 0) {
- prefs.lineLength(Math.max(1, Integer.parseInt(v)));
- if (view != null) {
- view.operation(() -> view.setLineLength(prefs.lineLength()));
- }
- }
- }
-
- @UiHandler("expandAllComments")
- void onExpandAllComments(ValueChangeEvent<Boolean> e) {
- prefs.expandAllComments(e.getValue());
- if (view != null) {
- view.getCommentManager().setExpandAllComments(prefs.expandAllComments());
- }
- }
-
- @UiHandler("cursorBlinkRate")
- void onCursoBlinkRate(ValueChangeEvent<String> e) {
- String v = e.getValue();
- if (v != null && v.length() > 0) {
- // A negative value hides the cursor entirely:
- // don't let user shoot himself in the foot.
- prefs.cursorBlinkRate(Math.max(0, Integer.parseInt(v)));
- view.getCmFromSide(DisplaySide.A).setOption("cursorBlinkRate", prefs.cursorBlinkRate());
- view.getCmFromSide(DisplaySide.B).setOption("cursorBlinkRate", prefs.cursorBlinkRate());
- }
- }
-
- @UiHandler("showTabs")
- void onShowTabs(ValueChangeEvent<Boolean> e) {
- prefs.showTabs(e.getValue());
- if (view != null) {
- view.setShowTabs(prefs.showTabs());
- }
- }
-
- @UiHandler("lineNumbers")
- void onLineNumbers(ValueChangeEvent<Boolean> e) {
- prefs.showLineNumbers(e.getValue());
- if (view != null) {
- view.setShowLineNumbers(prefs.showLineNumbers());
- }
- }
-
- @UiHandler("leftSide")
- void onLeftSide(ValueChangeEvent<Boolean> e) {
- if (view.getDiffTable() instanceof SideBySideTable) {
- ((SideBySideTable) view.getDiffTable()).setVisibleA(e.getValue());
- }
- }
-
- @UiHandler("emptyPane")
- void onHideEmptyPane(ValueChangeEvent<Boolean> e) {
- prefs.hideEmptyPane(!e.getValue());
- if (view != null) {
- view.getDiffTable().setHideEmptyPane(prefs.hideEmptyPane());
- if (prefs.hideEmptyPane()) {
- if (view.getDiffTable().getChangeType() == ChangeType.ADDED) {
- leftSide.setValue(false);
- leftSide.setEnabled(false);
- }
- } else {
- leftSide.setValue(view.getDiffTable().isVisibleA());
- leftSide.setEnabled(true);
- }
- }
- }
-
- @UiHandler("topMenu")
- void onTopMenu(ValueChangeEvent<Boolean> e) {
- prefs.hideTopMenu(!e.getValue());
- if (view != null) {
- Gerrit.setHeaderVisible(!prefs.hideTopMenu());
- view.resizeCodeMirror();
- }
- }
-
- @UiHandler("autoHideDiffTableHeader")
- void onAutoHideDiffTableHeader(ValueChangeEvent<Boolean> e) {
- prefs.autoHideDiffTableHeader(!e.getValue());
- if (view != null) {
- view.setAutoHideDiffHeader(!e.getValue());
- }
- }
-
- @UiHandler("manualReview")
- void onManualReview(ValueChangeEvent<Boolean> e) {
- prefs.manualReview(e.getValue());
- }
-
- @UiHandler("syntaxHighlighting")
- void onSyntaxHighlighting(ValueChangeEvent<Boolean> e) {
- prefs.syntaxHighlighting(e.getValue());
- if (view != null) {
- mode.setEnabled(prefs.syntaxHighlighting());
- if (prefs.syntaxHighlighting()) {
- setMode(view.getContentType());
- }
- view.setSyntaxHighlighting(prefs.syntaxHighlighting());
- }
- }
-
- @UiHandler("mode")
- void onMode(@SuppressWarnings("unused") ChangeEvent e) {
- String mode = getSelectedMode();
- prefs.syntaxHighlighting(true);
- syntaxHighlighting.setValue(true, false);
- new ModeInjector()
- .add(mode)
- .inject(
- new GerritCallback<Void>() {
- @Override
- public void onSuccess(Void result) {
- if (prefs.syntaxHighlighting()
- && Objects.equals(mode, getSelectedMode())
- && view.isAttached()) {
- view.operation(
- () -> {
- view.getCmFromSide(DisplaySide.A).setOption("mode", mode);
- view.getCmFromSide(DisplaySide.B).setOption("mode", mode);
- });
- }
- }
- });
- }
-
- private String getSelectedMode() {
- String m = mode.getValue(mode.getSelectedIndex());
- return m != null && !m.isEmpty() ? m : null;
- }
-
- @UiHandler("whitespaceErrors")
- void onWhitespaceErrors(ValueChangeEvent<Boolean> e) {
- prefs.showWhitespaceErrors(e.getValue());
- if (view != null) {
- view.operation(
- () -> {
- boolean s = prefs.showWhitespaceErrors();
- for (CodeMirror cm : view.getCms()) {
- cm.setOption("showTrailingSpace", s);
- }
- });
- }
- }
-
- @UiHandler("renderEntireFile")
- void onRenderEntireFile(ValueChangeEvent<Boolean> e) {
- prefs.renderEntireFile(e.getValue());
- if (view != null) {
- view.updateRenderEntireFile();
- }
- }
-
- @UiHandler("matchBrackets")
- void onMatchBrackets(ValueChangeEvent<Boolean> e) {
- prefs.matchBrackets(e.getValue());
- view.getCmFromSide(DisplaySide.A).setOption("matchBrackets", prefs.matchBrackets());
- view.getCmFromSide(DisplaySide.B).setOption("matchBrackets", prefs.matchBrackets());
- }
-
- @UiHandler("lineWrapping")
- void onLineWrapping(ValueChangeEvent<Boolean> e) {
- prefs.lineWrapping(e.getValue());
- view.getCmFromSide(DisplaySide.A).setOption("lineWrapping", prefs.lineWrapping());
- view.getCmFromSide(DisplaySide.B).setOption("lineWrapping", prefs.lineWrapping());
- }
-
- @UiHandler("skipDeleted")
- void onSkipDeleted(ValueChangeEvent<Boolean> e) {
- prefs.skipDeleted(!e.getValue());
- // TODO: Update the navigation links on the current DiffScreen
- }
-
- @UiHandler("skipUnchanged")
- void onSkipUnchanged(ValueChangeEvent<Boolean> e) {
- prefs.skipUnchanged(!e.getValue());
- // TODO: Update the navigation links on the current DiffScreen
- }
-
- @UiHandler("skipUncommented")
- void onSkipUncommented(ValueChangeEvent<Boolean> e) {
- prefs.skipUncommented(!e.getValue());
- // TODO: Update the navigation links on the current DiffScreen
- }
-
- @UiHandler("theme")
- void onTheme(@SuppressWarnings("unused") ChangeEvent e) {
- Theme newTheme = getSelectedTheme();
- prefs.theme(newTheme);
- if (view != null) {
- ThemeLoader.loadTheme(
- newTheme,
- new GerritCallback<Void>() {
- @Override
- public void onSuccess(Void result) {
- view.operation(
- () -> {
- if (getSelectedTheme() == newTheme && isAttached()) {
- String t = newTheme.name().toLowerCase();
- view.getCmFromSide(DisplaySide.A).setOption("theme", t);
- view.getCmFromSide(DisplaySide.B).setOption("theme", t);
- view.setThemeStyles(newTheme.isDark());
- }
- });
- }
- });
- }
- }
-
- private Theme getSelectedTheme() {
- return Theme.valueOf(theme.getValue(theme.getSelectedIndex()));
- }
-
- @UiHandler("apply")
- void onApply(@SuppressWarnings("unused") ClickEvent e) {
- close();
- }
-
- @UiHandler("save")
- void onSave(@SuppressWarnings("unused") ClickEvent e) {
- AccountApi.putDiffPreferences(
- prefs,
- new GerritCallback<DiffPreferences>() {
- @Override
- public void onSuccess(DiffPreferences result) {
- DiffPreferencesInfo p = new DiffPreferencesInfo();
- result.copyTo(p);
- Gerrit.setDiffPreferences(p);
- }
- });
- if (view != null) {
- close();
- }
- }
-
- @UiHandler("close")
- void onClose(ClickEvent e) {
- e.preventDefault();
- close();
- }
-
- void setFocus(boolean focus) {
- ignoreWhitespace.setFocus(focus);
- }
-
- private void close() {
- ((PopupPanel) getParent()).hide();
- }
-
- private void setIgnoreWhitespace(Whitespace v) {
- String name = v != null ? v.name() : IGNORE_NONE.name();
- for (int i = 0; i < ignoreWhitespace.getItemCount(); i++) {
- if (ignoreWhitespace.getValue(i).equals(name)) {
- ignoreWhitespace.setSelectedIndex(i);
- return;
- }
- }
- ignoreWhitespace.setSelectedIndex(0);
- }
-
- private void initIgnoreWhitespace() {
- ignoreWhitespace.addItem(PatchUtil.C.whitespaceIGNORE_NONE(), IGNORE_NONE.name());
- ignoreWhitespace.addItem(PatchUtil.C.whitespaceIGNORE_TRAILING(), IGNORE_TRAILING.name());
- ignoreWhitespace.addItem(
- PatchUtil.C.whitespaceIGNORE_LEADING_AND_TRAILING(), IGNORE_LEADING_AND_TRAILING.name());
- ignoreWhitespace.addItem(PatchUtil.C.whitespaceIGNORE_ALL(), IGNORE_ALL.name());
- }
-
- private void initMode() {
- mode.addItem("", "");
- for (ModeInfo m : Natives.asList(ModeInfo.all())) {
- mode.addItem(m.name(), m.mime());
- }
- }
-
- private void setMode(String modeType) {
- if (modeType != null && !modeType.isEmpty()) {
- ModeInfo m = ModeInfo.findModeByMIME(modeType);
- if (m != null) {
- for (int i = 0; i < mode.getItemCount(); i++) {
- if (mode.getValue(i).equals(m.mime())) {
- mode.setSelectedIndex(i);
- return;
- }
- }
- }
- }
- mode.setSelectedIndex(0);
- }
-
- private void setTheme(Theme v) {
- String name = v != null ? v.name() : Theme.DEFAULT.name();
- for (int i = 0; i < theme.getItemCount(); i++) {
- if (theme.getValue(i).equals(name)) {
- theme.setSelectedIndex(i);
- return;
- }
- }
- theme.setSelectedIndex(0);
- }
-
- private void initTheme() {
- for (Theme t : Theme.values()) {
- theme.addItem(t.name().toLowerCase(), t.name());
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PreferencesBox.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PreferencesBox.ui.xml
deleted file mode 100644
index 4465d63..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PreferencesBox.ui.xml
+++ /dev/null
@@ -1,341 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:x='urn:import:com.google.gerrit.client.ui'>
- <ui:style gss='false' type='com.google.gerrit.client.diff.PreferencesBox.Style'>
- @external .gwt-TextBox;
- @external .gwt-ToggleButton .html-face;
- @external .gwt-ToggleButton-up;
- @external .gwt-ToggleButton-up-hovering;
- @external .gwt-ToggleButton-up-disabled;
- @external .gwt-ToggleButton-down;
- @external .gwt-ToggleButton-down-hovering;
- @external .gwt-ToggleButton-down-disabled;
-
- .dialog {
- background: rgba(0, 0, 0, 0.85) none repeat scroll 0 50%;
- color: #ffffff;
- font-family: arial,sans-serif;
- font-weight: bold;
- overflow: auto !important;
- bottom: 0;
- text-align: left;
- text-shadow: 1px 1px 7px #000000;
- min-width: 300px;
- z-index: 200;
- border-radius: 10px;
- }
-
- @if user.agent safari {
- .dialog {
- \-webkit-border-radius: 10px;
- }
- }
-
- @if user.agent gecko1_8 {
- .dialog {
- \-moz-border-radius: 10px;
- }
- }
-
- .box { margin: 10px; }
- .box .gwt-TextBox { padding: 0; }
- .context { vertical-align: bottom; }
-
- .table tr { min-height: 23px; }
- .table th,
- .table td {
- white-space: nowrap;
- color: #ffffff;
- }
- .table th {
- padding-right: 8px;
- text-align: right;
- }
-
- .box a,
- .box a:visited,
- .box a:hover {
- color: #dddd00;
- }
-
- .box input.gwt-TextBox:disabled {
- background-color: #cacaca;
- }
-
- .box .gwt-ToggleButton {
- position: relative;
- height: 19px;
- width: 140px;
- background: #fff;
- color: #000;
- text-shadow: none;
- }
- .box .gwt-ToggleButton .html-face {
- position: absolute;
- top: 0;
- width: 68px;
- height: 17px;
- line-height: 17px;
- text-align: center;
- border-width: 1px;
- }
-
- .box .gwt-ToggleButton-up,
- .box .gwt-ToggleButton-up-hovering,
- .box .gwt-ToggleButton-up-disabled,
- .box .gwt-ToggleButton-down,
- .box .gwt-ToggleButton-down-hovering,
- .box .gwt-ToggleButton-down-disabled {
- padding: 0;
- border: 0;
- }
- .box .gwt-ToggleButton-up .html-face,
- .box .gwt-ToggleButton-up-hovering .html-face {
- left: 0;
- background: #cacaca;
- border-style: outset;
- }
- .box .gwt-ToggleButton-down .html-face,
- .box .gwt-ToggleButton-down-hovering .html-face {
- right: 0;
- background: #bcf;
- border-style: inset;
- }
-
- .box button {
- margin: 6px 3px 0 0;
- border-color: rgba(0, 0, 0, 0.1);
- text-align: center;
- font-size: 8pt;
- font-weight: bold;
- border: 1px solid;
- cursor: pointer;
- color: #444;
- background-color: #f5f5f5;
- background-image: -webkit-linear-gradient(top, #f5f5f5, #f1f1f1);
- -webkit-border-radius: 2px;
- -webkit-box-sizing: content-box;
- }
- .box button div {
- color: #444;
- height: 10px;
- min-width: 54px;
- line-height: 10px;
- white-space: nowrap;
- }
-
- button.apply {
- background-color: #4d90fe;
- background-image: -webkit-linear-gradient(top, #4d90fe, #4d90fe);
- }
- button.apply div { color: #fff; }
-
- button.save {
- margin-left: 10px;
- color: #d14836;
- background-color: #d14836;
- background-image: -webkit-linear-gradient(top, #d14836, #d14836);
- }
- button.save div { color: #fff; }
- </ui:style>
-
- <g:HTMLPanel styleName='{style.box}'>
- <div ui:field='header'>
- <table style='width: 100%'>
- <tr>
- <td><ui:msg>Diff Preferences</ui:msg></td>
- <td style='text-align: right'>
- <g:Anchor ui:field='close' href='javascript:;'><ui:msg>Close</ui:msg></g:Anchor>
- </td>
- </tr>
- </table>
- <hr/>
- </div>
- <table class='{style.table}'>
- <tr>
- <th><ui:msg>Theme</ui:msg></th>
- <td><g:ListBox ui:field='theme'/></td>
- </tr>
- <tr>
- <th><ui:msg>Ignore Whitespace</ui:msg></th>
- <td><g:ListBox ui:field='ignoreWhitespace'/></td>
- </tr>
- <tr>
- <th><ui:msg>Tab Width</ui:msg></th>
- <td><x:NpIntTextBox ui:field='tabWidth'
- visibleLength='4'
- alignment='RIGHT'/></td>
- </tr>
- <tr>
- <th><ui:msg>Columns</ui:msg></th>
- <td><x:NpIntTextBox ui:field='lineLength'
- visibleLength='4'
- alignment='RIGHT'/></td>
- </tr>
- <tr>
- <th><ui:msg>Lines of Context</ui:msg></th>
- <td><ui:msg><x:NpIntTextBox ui:field='context'
- addStyleNames='{style.context}'
- visibleLength='4'
- alignment='RIGHT'/>
- or <g:CheckBox ui:field='contextEntireFile'>entire file</g:CheckBox></ui:msg></td>
- </tr>
- <tr>
- <th><ui:msg>Cursor Blink Rate</ui:msg></th>
- <td><x:NpIntTextBox ui:field='cursorBlinkRate'
- visibleLength='4'
- alignment='RIGHT'/></td>
- </tr>
- <tr>
- <th><ui:msg>Intraline Difference</ui:msg></th>
- <td><g:ToggleButton ui:field='intralineDifference'>
- <g:upFace><ui:msg>Hide</ui:msg></g:upFace>
- <g:downFace><ui:msg>Show</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Syntax Highlighting</ui:msg></th>
- <td><g:ToggleButton ui:field='syntaxHighlighting'>
- <g:upFace><ui:msg>Hide</ui:msg></g:upFace>
- <g:downFace><ui:msg>Show</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><div ui:field='modeLabel'><ui:msg>Language</ui:msg></div></th>
- <td><g:ListBox ui:field='mode'/></td>
- </tr>
- <tr>
- <th><ui:msg>Whitespace Errors</ui:msg></th>
- <td><g:ToggleButton ui:field='whitespaceErrors'>
- <g:upFace><ui:msg>Hide</ui:msg></g:upFace>
- <g:downFace><ui:msg>Show</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Show Tabs</ui:msg></th>
- <td><g:ToggleButton ui:field='showTabs'>
- <g:upFace><ui:msg>Hide</ui:msg></g:upFace>
- <g:downFace><ui:msg>Show</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Line Numbers</ui:msg></th>
- <td><g:ToggleButton ui:field='lineNumbers'>
- <g:upFace><ui:msg>Hide</ui:msg></g:upFace>
- <g:downFace><ui:msg>Show</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Empty Pane</ui:msg></th>
- <td><g:ToggleButton ui:field='emptyPane'>
- <g:upFace><ui:msg>Hide</ui:msg></g:upFace>
- <g:downFace><ui:msg>Show</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><div ui:field='leftSideLabel'><ui:msg>Left Side</ui:msg></div></th>
- <td><g:ToggleButton ui:field='leftSide'>
- <g:upFace><ui:msg>Hide</ui:msg></g:upFace>
- <g:downFace><ui:msg>Show</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Top Menu</ui:msg></th>
- <td><g:ToggleButton ui:field='topMenu'>
- <g:upFace><ui:msg>Hide</ui:msg></g:upFace>
- <g:downFace><ui:msg>Show</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Auto Hide Diff Table Header</ui:msg></th>
- <td><g:ToggleButton ui:field='autoHideDiffTableHeader'>
- <g:upFace><ui:msg>Yes</ui:msg></g:upFace>
- <g:downFace><ui:msg>No</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Mark Reviewed</ui:msg></th>
- <td><g:ToggleButton ui:field='manualReview'>
- <g:upFace><ui:msg>Automatic</ui:msg></g:upFace>
- <g:downFace><ui:msg>Manual</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Expand All Comments</ui:msg></th>
- <td><g:ToggleButton ui:field='expandAllComments'>
- <g:upFace><ui:msg>Collapse</ui:msg></g:upFace>
- <g:downFace><ui:msg>Expand</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Render</ui:msg></th>
- <td><g:ToggleButton ui:field='renderEntireFile'>
- <g:upFace><ui:msg>Fast</ui:msg></g:upFace>
- <g:downFace><ui:msg>Slow</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Match Brackets</ui:msg></th>
- <td><g:ToggleButton ui:field='matchBrackets'>
- <g:upFace><ui:msg>Off</ui:msg></g:upFace>
- <g:downFace><ui:msg>On</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Line Wrapping</ui:msg></th>
- <td><g:ToggleButton ui:field='lineWrapping'>
- <g:upFace><ui:msg>Off</ui:msg></g:upFace>
- <g:downFace><ui:msg>On</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Skip Deleted Files</ui:msg></th>
- <td><g:ToggleButton ui:field='skipDeleted'>
- <g:upFace><ui:msg>Yes</ui:msg></g:upFace>
- <g:downFace><ui:msg>No</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Skip Unchanged Files</ui:msg></th>
- <td><g:ToggleButton ui:field='skipUnchanged'>
- <g:upFace><ui:msg>Yes</ui:msg></g:upFace>
- <g:downFace><ui:msg>No</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Skip Uncommented Files</ui:msg></th>
- <td><g:ToggleButton ui:field='skipUncommented'>
- <g:upFace><ui:msg>Yes</ui:msg></g:upFace>
- <g:downFace><ui:msg>No</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <td></td>
- <td>
- <g:Button ui:field='apply' styleName='{style.apply}'>
- <div><ui:msg>Apply</ui:msg></div>
- </g:Button>
- <g:Button ui:field='save' styleName='{style.save}'>
- <div><ui:msg>Save</ui:msg></div>
- </g:Button>
- </td>
- </tr>
- </table>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PublishedBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PublishedBox.java
deleted file mode 100644
index 1ddf895..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PublishedBox.java
+++ /dev/null
@@ -1,239 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gerrit.client.AvatarImage;
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.FormatUtil;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.api.ApiGlue;
-import com.google.gerrit.client.change.ReplyBox;
-import com.google.gerrit.client.changes.CommentApi;
-import com.google.gerrit.client.changes.CommentInfo;
-import com.google.gerrit.client.changes.Util;
-import com.google.gerrit.client.patches.PatchUtil;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.ui.CommentLinkProcessor;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-
-/** An HtmlPanel for displaying a published comment */
-class PublishedBox extends CommentBox {
- interface Binder extends UiBinder<HTMLPanel, PublishedBox> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- interface Style extends CssResource {
- String closed();
- }
-
- private final PatchSet.Id psId;
- @Nullable private final Project.NameKey project;
- private final CommentInfo comment;
- private final DisplaySide displaySide;
- private DraftBox replyBox;
-
- @UiField Style style;
- @UiField Widget header;
- @UiField Element name;
- @UiField Element summary;
- @UiField Element date;
- @UiField Element message;
- @UiField Element buttons;
- @UiField Button reply;
- @UiField Button done;
- @UiField Button fix;
-
- @UiField(provided = true)
- AvatarImage avatar;
-
- PublishedBox(
- CommentGroup group,
- CommentLinkProcessor clp,
- @Nullable Project.NameKey project,
- PatchSet.Id psId,
- CommentInfo info,
- DisplaySide displaySide,
- boolean open) {
- super(group, info.range());
-
- this.psId = psId;
- this.project = project;
- this.comment = info;
- this.displaySide = displaySide;
-
- if (info.author() != null) {
- avatar = new AvatarImage(info.author());
- avatar.setSize("", "");
- } else {
- avatar = new AvatarImage();
- }
-
- initWidget(uiBinder.createAndBindUi(this));
- header.addDomHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- setOpen(!isOpen());
- }
- },
- ClickEvent.getType());
-
- name.setInnerText(authorName(info));
- date.setInnerText(FormatUtil.shortFormatDayTime(info.updated()));
- if (info.message() != null) {
- String msg = info.message().trim();
- summary.setInnerText(msg);
- message.setInnerSafeHtml(clp.apply(new SafeHtmlBuilder().append(msg).wikify()));
- ApiGlue.fireEvent("comment", message);
- }
-
- fix.setVisible(open);
- }
-
- @Override
- CommentInfo getCommentInfo() {
- return comment;
- }
-
- @Override
- boolean isOpen() {
- return UIObject.isVisible(message);
- }
-
- @Override
- void setOpen(boolean open) {
- UIObject.setVisible(summary, !open);
- UIObject.setVisible(message, open);
- UIObject.setVisible(buttons, open && replyBox == null);
- if (open) {
- removeStyleName(style.closed());
- } else {
- addStyleName(style.closed());
- }
- super.setOpen(open);
- }
-
- void setReplyBox(DraftBox box) {
- replyBox = box;
- UIObject.setVisible(buttons, false);
- box.setReplyToBox(this);
- }
-
- void unregisterReplyBox() {
- replyBox = null;
- UIObject.setVisible(buttons, isOpen());
- }
-
- private void openReplyBox() {
- replyBox.setOpen(true);
- replyBox.setEdit(true);
- }
-
- void addReplyBox(boolean quote) {
- CommentInfo commentReply = CommentInfo.createReply(comment);
- if (quote) {
- commentReply.message(ReplyBox.quote(comment.message()));
- }
- getCommentManager().addDraftBox(displaySide, commentReply).setEdit(true);
- }
-
- void doReply() {
- if (!Gerrit.isSignedIn()) {
- Gerrit.doSignIn(getCommentManager().host.getToken());
- } else if (replyBox == null) {
- addReplyBox(false);
- } else {
- openReplyBox();
- }
- }
-
- @UiHandler("reply")
- void onReply(ClickEvent e) {
- e.stopPropagation();
- doReply();
- }
-
- @UiHandler("quote")
- void onQuote(ClickEvent e) {
- e.stopPropagation();
- if (!Gerrit.isSignedIn()) {
- Gerrit.doSignIn(getCommentManager().host.getToken());
- }
- addReplyBox(true);
- }
-
- @UiHandler("done")
- void onReplyDone(ClickEvent e) {
- e.stopPropagation();
- if (!Gerrit.isSignedIn()) {
- Gerrit.doSignIn(getCommentManager().host.getToken());
- } else if (replyBox == null) {
- done.setEnabled(false);
- CommentInfo input = CommentInfo.createReply(comment);
- input.message(PatchUtil.C.cannedReplyDone());
- CommentApi.createDraft(
- Project.NameKey.asStringOrNull(project),
- psId,
- input,
- new GerritCallback<CommentInfo>() {
- @Override
- public void onSuccess(CommentInfo result) {
- done.setEnabled(true);
- setOpen(false);
- getCommentManager().addDraftBox(displaySide, result);
- }
- });
- } else {
- openReplyBox();
- setOpen(false);
- }
- }
-
- @UiHandler("fix")
- void onFix(ClickEvent e) {
- e.stopPropagation();
- String t = Dispatcher.toEditScreen(project, psId, comment.path(), comment.line());
- if (!Gerrit.isSignedIn()) {
- Gerrit.doSignIn(t);
- } else {
- Gerrit.display(t);
- }
- }
-
- private static String authorName(CommentInfo info) {
- if (info.author() != null) {
- if (info.author().name() != null) {
- return info.author().name();
- }
- return Gerrit.info().user().anonymousCowardName();
- }
- return Util.C.messageNoAuthor();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PublishedBox.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PublishedBox.ui.xml
deleted file mode 100644
index cbea847..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/PublishedBox.ui.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder
- xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:c='urn:import:com.google.gerrit.client'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:with field='res' type='com.google.gerrit.client.diff.Resources'/>
- <ui:style gss='false' type='com.google.gerrit.client.diff.PublishedBox.Style'>
- .avatar {
- position: absolute;
- width: 26px;
- height: 26px;
- }
- .closed .avatar {
- position: absolute;
- width: 16px;
- height: 16px;
- }
-
- .name {
- white-space: nowrap;
- font-weight: bold;
- }
- .closed .name {
- width: 120px;
- overflow: hidden;
- text-overflow: ellipsis;
- font-weight: normal;
- }
- </ui:style>
-
- <g:HTMLPanel
- styleName='{res.style.commentBox}'
- addStyleNames='{style.closed}'>
- <c:AvatarImage ui:field='avatar' styleName='{style.avatar}'/>
- <div class='{res.style.contents}'>
- <g:HTMLPanel ui:field='header' styleName='{res.style.header}'>
- <div ui:field='name' class='{style.name}'/>
- <div ui:field='summary' class='{res.style.summary}'/>
- <div ui:field='date' class='{res.style.date}'/>
- </g:HTMLPanel>
- <div ui:field='message' class='{res.style.message}'
- aria-hidden='true' style='display: NONE'/>
- <div ui:field='buttons' aria-hidden='true' style='display: NONE'>
- <g:Button ui:field='reply' styleName=''
- title='Reply to this comment'>
- <ui:attribute name='title'/>
- <div><ui:msg>Reply</ui:msg></div>
- </g:Button>
- <g:Button ui:field='quote' styleName=''
- title='Reply to this comment with quoting it'>
- <ui:attribute name='title'/>
- <div><ui:msg>Quote</ui:msg></div>
- </g:Button>
- <g:Button ui:field='done' styleName=''
- title='Reply "Done" to this comment'>
- <ui:attribute name='title'/>
- <div><ui:msg>Done</ui:msg></div>
- </g:Button>
- <g:Button ui:field='fix' styleName='' visible='false'
- title='Fix this comment in the inline editor'>
- <ui:attribute name='title'/>
- <div><ui:msg>Fix</ui:msg></div>
- </g:Button>
- </div>
- </div>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Resources.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Resources.java
deleted file mode 100644
index e590333..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Resources.java
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.resources.client.ClientBundle;
-import com.google.gwt.resources.client.ImageResource;
-
-/** Resources used by diff. */
-interface Resources extends ClientBundle {
- Resources I = GWT.create(Resources.class);
-
- @Source("CommentBox.css")
- CommentBox.Style style();
-
- @Source("Scrollbar.css")
- Scrollbar.Style scrollbarStyle();
-
- @Source("DiffTable.css")
- DiffTable.Style diffTableStyle();
-
- /** tango icon library (public domain): http://tango.freedesktop.org/Tango_Icon_Library */
- @Source("goPrev.png")
- ImageResource goPrev();
-
- @Source("goNext.png")
- ImageResource goNext();
-
- @Source("goUp.png")
- ImageResource goUp();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/ScrollSynchronizer.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/ScrollSynchronizer.java
deleted file mode 100644
index 35e3e7d..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/ScrollSynchronizer.java
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gwt.user.client.Timer;
-import net.codemirror.lib.CodeMirror;
-import net.codemirror.lib.ScrollInfo;
-
-class ScrollSynchronizer {
- private SideBySideTable diffTable;
- private LineMapper mapper;
- private ScrollCallback active;
- private ScrollCallback callbackA;
- private ScrollCallback callbackB;
- private CodeMirror cmB;
- private boolean autoHideDiffTableHeader;
-
- ScrollSynchronizer(SideBySideTable diffTable, CodeMirror cmA, CodeMirror cmB, LineMapper mapper) {
- this.diffTable = diffTable;
- this.mapper = mapper;
- this.cmB = cmB;
-
- callbackA = new ScrollCallback(cmA, cmB, DisplaySide.A);
- callbackB = new ScrollCallback(cmB, cmA, DisplaySide.B);
- cmA.on("scroll", callbackA);
- cmB.on("scroll", callbackB);
- }
-
- void setAutoHideDiffTableHeader(boolean autoHide) {
- if (autoHide) {
- updateDiffTableHeader(cmB.getScrollInfo());
- } else {
- diffTable.setHeaderVisible(true);
- }
- autoHideDiffTableHeader = autoHide;
- }
-
- void syncScroll(DisplaySide masterSide) {
- (masterSide == DisplaySide.A ? callbackA : callbackB).sync();
- }
-
- private void updateDiffTableHeader(ScrollInfo si) {
- if (si.top() == 0) {
- diffTable.setHeaderVisible(true);
- } else if (si.top() > 0.5 * si.clientHeight()) {
- diffTable.setHeaderVisible(false);
- }
- }
-
- class ScrollCallback implements Runnable {
- private final CodeMirror src;
- private final CodeMirror dst;
- private final DisplaySide srcSide;
- private final Timer fixup;
- private int state;
-
- ScrollCallback(CodeMirror src, CodeMirror dst, DisplaySide srcSide) {
- this.src = src;
- this.dst = dst;
- this.srcSide = srcSide;
- this.fixup =
- new Timer() {
- @Override
- public void run() {
- if (active == ScrollCallback.this) {
- fixup();
- }
- }
- };
- }
-
- void sync() {
- dst.scrollToY(align(src.getScrollInfo().top()));
- }
-
- @Override
- public void run() {
- if (active == null) {
- active = this;
- fixup.scheduleRepeating(20);
- }
- if (active == this) {
- ScrollInfo si = src.getScrollInfo();
- if (autoHideDiffTableHeader) {
- updateDiffTableHeader(si);
- }
- dst.scrollTo(si.left(), align(si.top()));
- state = 0;
- }
- }
-
- private void fixup() {
- switch (state) {
- case 0:
- state = 1;
- dst.scrollToY(align(src.getScrollInfo().top()));
- break;
- case 1:
- state = 2;
- break;
- case 2:
- active = null;
- fixup.cancel();
- break;
- }
- }
-
- private double align(double srcTop) {
- // Since CM doesn't always take the height of line widgets into
- // account when calculating scrollInfo when scrolling too fast (e.g.
- // throw scrolling), simply setting scrollTop to be the same doesn't
- // guarantee alignment.
-
- int line = src.lineAtHeight(srcTop, "local");
- if (line == 0) {
- // Padding for insert at start of file occurs above line 0,
- // and CM3 doesn't always compute heightAtLine correctly.
- return srcTop;
- }
-
- // Find a pair of lines that are aligned and near the top of
- // the viewport. Use that distance to correct the Y coordinate.
- LineMapper.AlignedPair p = mapper.align(srcSide, line);
- double sy = src.heightAtLine(p.src, "local");
- double dy = dst.heightAtLine(p.dst, "local");
- return Math.max(0, dy + (srcTop - sy));
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Scrollbar.css b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Scrollbar.css
deleted file mode 100644
index 26f8ff5..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Scrollbar.css
+++ /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.
- */
-
-.comment, .draft, .insert, .delete, .edit {
- min-height: 5px;
- position: absolute;
- right: 0;
- z-index: 7;
-}
-
-.comment, .draft {
- color: #0d0d0d;
- font-size: 9px;
-}
-
-.delete {
- background-color: #faa;
- min-width: 12px;
-}
-.insert {
- background-color: #9f9;
- min-width: 12px;
-}
-.edit {
- border-left: 6px solid #faa;
- width: 6px !important;
- background-color: #9f9;
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Scrollbar.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Scrollbar.java
deleted file mode 100644
index 83ada90..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Scrollbar.java
+++ /dev/null
@@ -1,101 +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.client.diff;
-
-import com.google.gwt.resources.client.CssResource;
-import java.util.ArrayList;
-import java.util.List;
-import net.codemirror.lib.CodeMirror;
-import net.codemirror.lib.Pos;
-
-/** Displays overview of all edits and comments in this file. */
-class Scrollbar {
- static {
- Resources.I.scrollbarStyle().ensureInjected();
- }
-
- interface Style extends CssResource {
- String comment();
-
- String draft();
-
- String insert();
-
- String delete();
-
- String edit();
- }
-
- private final List<ScrollbarAnnotation> diff = new ArrayList<>();
- private final DiffTable parent;
-
- Scrollbar(DiffTable d) {
- parent = d;
- }
-
- ScrollbarAnnotation comment(CodeMirror cm, int line) {
- ScrollbarAnnotation a = new ScrollbarAnnotation(cm);
- a.setStyleName(Resources.I.scrollbarStyle().comment());
- a.at(line);
- a.getElement().setInnerText("\u2736"); // Six pointed black star
- parent.add(a);
- return a;
- }
-
- ScrollbarAnnotation draft(CodeMirror cm, int line) {
- ScrollbarAnnotation a = new ScrollbarAnnotation(cm);
- a.setStyleName(Resources.I.scrollbarStyle().draft());
- a.at(line);
- a.getElement().setInnerText("\u270D"); // Writing hand
- parent.add(a);
- return a;
- }
-
- ScrollbarAnnotation insert(CodeMirror cm, int line, int len) {
- ScrollbarAnnotation a = diff(cm, line, len);
- a.setStyleName(Resources.I.scrollbarStyle().insert());
- parent.add(a);
- return a;
- }
-
- ScrollbarAnnotation delete(CodeMirror cmA, CodeMirror cmB, int line, int len) {
- ScrollbarAnnotation a = diff(cmA, line, len);
- a.setStyleName(Resources.I.scrollbarStyle().delete());
- a.renderOn(cmB);
- parent.add(a);
- return a;
- }
-
- ScrollbarAnnotation edit(CodeMirror cm, int line, int len) {
- ScrollbarAnnotation a = diff(cm, line, len);
- a.setStyleName(Resources.I.scrollbarStyle().edit());
- parent.add(a);
- return a;
- }
-
- private ScrollbarAnnotation diff(CodeMirror cm, int s, int n) {
- ScrollbarAnnotation a = new ScrollbarAnnotation(cm);
- a.at(Pos.create(s), Pos.create(s + n));
- diff.add(a);
- return a;
- }
-
- void removeDiffAnnotations() {
- for (ScrollbarAnnotation a : diff) {
- a.remove();
- }
- diff.clear();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/ScrollbarAnnotation.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/ScrollbarAnnotation.java
deleted file mode 100644
index ecdac46..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/ScrollbarAnnotation.java
+++ /dev/null
@@ -1,118 +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.client.diff;
-
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.Widget;
-import net.codemirror.lib.CodeMirror;
-import net.codemirror.lib.CodeMirror.RegisteredHandler;
-import net.codemirror.lib.Pos;
-
-/** Displayed on the vertical scrollbar to place a chunk or comment. */
-class ScrollbarAnnotation extends Widget implements ClickHandler {
- private final CodeMirror cm;
- private CodeMirror cmB;
- private RegisteredHandler refresh;
- private Pos from;
- private Pos to;
- private double scale;
-
- ScrollbarAnnotation(CodeMirror cm) {
- setElement((Element) DOM.createDiv());
- getElement().setAttribute("not-content", "true");
- addDomHandler(this, ClickEvent.getType());
- this.cm = cm;
- this.cmB = cm;
- }
-
- void remove() {
- removeFromParent();
- }
-
- void at(int line) {
- at(Pos.create(line), Pos.create(line + 1));
- }
-
- void at(Pos from, Pos to) {
- this.from = from;
- this.to = to;
- }
-
- void renderOn(CodeMirror cm) {
- this.cmB = cm;
- }
-
- @Override
- protected void onLoad() {
- cmB.getWrapperElement().appendChild(getElement());
- refresh =
- cmB.on(
- "refresh",
- () -> {
- if (updateScale()) {
- updatePosition();
- }
- });
- updateScale();
- updatePosition();
- }
-
- @Override
- protected void onUnload() {
- cmB.off("refresh", refresh);
- }
-
- private boolean updateScale() {
- double old = scale;
- double docHeight = cmB.getWrapperElement().getClientHeight();
- double lineHeight = cmB.heightAtLine(cmB.lastLine() + 1, "local");
- scale = (docHeight - cmB.barHeight()) / lineHeight;
- return old != scale;
- }
-
- private void updatePosition() {
- double top = cm.charCoords(from, "local").top() * scale;
- double bottom = cm.charCoords(to, "local").bottom() * scale;
-
- Element e = getElement();
- e.getStyle().setTop(top, Unit.PX);
- e.getStyle().setWidth(Math.max(2, cm.barWidth() - 1), Unit.PX);
- e.getStyle().setHeight(Math.max(3, bottom - top), Unit.PX);
- }
-
- @Override
- public void onClick(ClickEvent event) {
- event.stopPropagation();
-
- int line = from.line();
- int h = to.line() - line;
- if (h > 5) {
- // Map click inside of the annotation to the relative position
- // within the region covered by the annotation.
- double s = ((double) event.getY()) / getElement().getOffsetHeight();
- line += (int) (s * h);
- }
-
- double y = cm.heightAtLine(line, "local");
- double viewport = cm.getScrollInfo().clientHeight();
- cm.setCursor(from);
- cm.scrollTo(0, y - 0.5 * viewport);
- cm.focus();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide.java
deleted file mode 100644
index d052323..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide.java
+++ /dev/null
@@ -1,414 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import static java.lang.Double.POSITIVE_INFINITY;
-
-import com.google.gerrit.client.DiffObject;
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.diff.LineMapper.LineOnOtherInfo;
-import com.google.gerrit.client.patches.PatchUtil;
-import com.google.gerrit.client.projects.ConfigInfoCache;
-import com.google.gerrit.client.rpc.ScreenLoadCallback;
-import com.google.gerrit.client.ui.InlineHyperlink;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.extensions.client.GeneralPreferencesInfo.DiffView;
-import com.google.gerrit.reviewdb.client.Patch;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.core.client.Scheduler.ScheduledCommand;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.event.dom.client.FocusEvent;
-import com.google.gwt.event.dom.client.FocusHandler;
-import com.google.gwt.event.dom.client.KeyCodes;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.ImageResourceRenderer;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.globalkey.client.KeyCommand;
-import java.util.Collections;
-import java.util.List;
-import net.codemirror.lib.CodeMirror;
-import net.codemirror.lib.CodeMirror.LineHandle;
-import net.codemirror.lib.Configuration;
-import net.codemirror.lib.KeyMap;
-import net.codemirror.lib.Pos;
-
-public class SideBySide extends DiffScreen {
- interface Binder extends UiBinder<FlowPanel, SideBySide> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
- private static final String LINE_NUMBER_CLASSNAME = "CodeMirror-linenumber";
-
- @UiField(provided = true)
- SideBySideTable diffTable;
-
- private CodeMirror cmA;
- private CodeMirror cmB;
-
- private ScrollSynchronizer scrollSynchronizer;
-
- private SideBySideChunkManager chunkManager;
- private SideBySideCommentManager commentManager;
-
- public SideBySide(
- @Nullable Project.NameKey project,
- DiffObject base,
- DiffObject revision,
- String path,
- DisplaySide startSide,
- int startLine) {
- super(project, base, revision, path, startSide, startLine, DiffView.SIDE_BY_SIDE);
-
- diffTable = new SideBySideTable(this, base, revision, path);
- add(uiBinder.createAndBindUi(this));
- addDomHandler(GlobalKey.STOP_PROPAGATION, KeyPressEvent.getType());
- }
-
- @Override
- ScreenLoadCallback<ConfigInfoCache.Entry> getScreenLoadCallback(
- final CommentsCollections comments) {
- return new ScreenLoadCallback<ConfigInfoCache.Entry>(SideBySide.this) {
- @Override
- protected void preDisplay(ConfigInfoCache.Entry result) {
- commentManager =
- new SideBySideCommentManager(
- SideBySide.this,
- getProject(),
- base,
- revision,
- path,
- result.getCommentLinkProcessor(),
- getChangeStatus().isOpen());
- setTheme(result.getTheme());
- display(comments);
- header.setupPrevNextFiles(comments);
- }
- };
- }
-
- @Override
- public void onShowView() {
- super.onShowView();
-
- operation(
- () -> {
- resizeCodeMirror();
- chunkManager.adjustPadding();
- cmA.refresh();
- cmB.refresh();
- });
- setLineLength(Patch.COMMIT_MSG.equals(path) ? 72 : prefs.lineLength());
- diffTable.refresh();
-
- if (getStartLine() == 0) {
- DiffChunkInfo d = chunkManager.getFirst();
- if (d != null) {
- if (d.isEdit() && d.getSide() == DisplaySide.A) {
- setStartSide(DisplaySide.B);
- setStartLine(lineOnOther(d.getSide(), d.getStart()).getLine() + 1);
- } else {
- setStartSide(d.getSide());
- setStartLine(d.getStart() + 1);
- }
- }
- }
- if (getStartSide() != null && getStartLine() > 0) {
- CodeMirror cm = getCmFromSide(getStartSide());
- cm.scrollToLine(getStartLine() - 1);
- cm.focus();
- } else {
- cmA.setCursor(Pos.create(0));
- cmA.focus();
- }
- if (Gerrit.isSignedIn() && prefs.autoReview()) {
- header.autoReview();
- }
- prefetchNextFile();
- }
-
- @Override
- void registerCmEvents(CodeMirror cm) {
- super.registerCmEvents(cm);
-
- KeyMap keyMap =
- KeyMap.create()
- .on("Shift-A", diffTable.toggleA())
- .on("Shift-Left", moveCursorToSide(cm, DisplaySide.A))
- .on("Shift-Right", moveCursorToSide(cm, DisplaySide.B));
- cm.addKeyMap(keyMap);
- maybeRegisterRenderEntireFileKeyMap(cm);
- }
-
- @Override
- public void registerKeys() {
- super.registerKeys();
-
- getKeysNavigation()
- .add(
- new NoOpKeyCommand(KeyCommand.M_SHIFT, KeyCodes.KEY_LEFT, PatchUtil.C.focusSideA()),
- new NoOpKeyCommand(KeyCommand.M_SHIFT, KeyCodes.KEY_RIGHT, PatchUtil.C.focusSideB()));
- getKeysAction()
- .add(
- new KeyCommand(KeyCommand.M_SHIFT, 'a', PatchUtil.C.toggleSideA()) {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- diffTable.toggleA().run();
- }
- });
-
- registerHandlers();
- }
-
- @Override
- FocusHandler getFocusHandler() {
- return new FocusHandler() {
- @Override
- public void onFocus(FocusEvent event) {
- cmB.focus();
- }
- };
- }
-
- private void display(CommentsCollections comments) {
- DiffInfo diff = getDiff();
- setThemeStyles(prefs.theme().isDark());
- setShowIntraline(prefs.intralineDifference());
- if (prefs.showLineNumbers()) {
- diffTable.addStyleName(Resources.I.diffTableStyle().showLineNumbers());
- }
-
- cmA = newCm(diff.metaA(), diff.textA(), diffTable.cmA);
- cmB = newCm(diff.metaB(), diff.textB(), diffTable.cmB);
-
- getDiffTable()
- .setUpBlameIconA(
- cmA,
- base.isBaseOrAutoMerge(),
- base.isBaseOrAutoMerge() ? revision : base.asPatchSetId(),
- path);
- getDiffTable().setUpBlameIconB(cmB, revision, path);
-
- cmA.extras().side(DisplaySide.A);
- cmB.extras().side(DisplaySide.B);
- setShowTabs(prefs.showTabs());
-
- chunkManager = new SideBySideChunkManager(this, cmA, cmB, diffTable.scrollbar);
-
- operation(
- () -> {
- // Estimate initial CodeMirror height, fixed up in onShowView.
- int height = Window.getClientHeight() - (Gerrit.getHeaderFooterHeight() + 18);
- cmA.setHeight(height);
- cmB.setHeight(height);
-
- render(diff);
- commentManager.render(comments, prefs.expandAllComments());
- skipManager.render(prefs.context(), diff);
- });
-
- registerCmEvents(cmA);
- registerCmEvents(cmB);
- scrollSynchronizer = new ScrollSynchronizer(diffTable, cmA, cmB, chunkManager.lineMapper);
-
- setPrefsAction(new PreferencesAction(this, prefs));
- header.init(getPrefsAction(), getUnifiedDiffLink(), diff.sideBySideWebLinks());
- scrollSynchronizer.setAutoHideDiffTableHeader(prefs.autoHideDiffTableHeader());
-
- setupSyntaxHighlighting();
- }
-
- private List<InlineHyperlink> getUnifiedDiffLink() {
- InlineHyperlink toUnifiedDiffLink = new InlineHyperlink();
- toUnifiedDiffLink.setHTML(new ImageResourceRenderer().render(Gerrit.RESOURCES.unifiedDiff()));
- toUnifiedDiffLink.setTargetHistoryToken(
- Dispatcher.toUnified(getProject(), base, revision, path));
- toUnifiedDiffLink.setTitle(PatchUtil.C.unifiedDiff());
- return Collections.singletonList(toUnifiedDiffLink);
- }
-
- @Override
- CodeMirror newCm(DiffInfo.FileMeta meta, String contents, Element parent) {
- return CodeMirror.create(
- parent,
- Configuration.create()
- .set("cursorBlinkRate", prefs.cursorBlinkRate())
- .set("cursorHeight", 0.85)
- .set("inputStyle", "textarea")
- .set("keyMap", "vim_ro")
- .set("lineNumbers", prefs.showLineNumbers())
- .set("matchBrackets", prefs.matchBrackets())
- .set("lineWrapping", prefs.lineWrapping())
- .set("mode", getFileSize() == FileSize.SMALL ? getContentType(meta) : null)
- .set("readOnly", true)
- .set("scrollbarStyle", "overlay")
- .set("showTrailingSpace", prefs.showWhitespaceErrors())
- .set("styleSelectedText", true)
- .set("tabSize", prefs.tabSize())
- .set("theme", prefs.theme().name().toLowerCase())
- .set("value", meta != null ? contents : "")
- .set("viewportMargin", renderEntireFile() ? POSITIVE_INFINITY : 10));
- }
-
- @Override
- void setShowLineNumbers(boolean b) {
- super.setShowLineNumbers(b);
-
- cmA.setOption("lineNumbers", b);
- cmB.setOption("lineNumbers", b);
- }
-
- @Override
- void setSyntaxHighlighting(boolean b) {
- final DiffInfo diff = getDiff();
- if (b) {
- injectMode(
- diff,
- new AsyncCallback<Void>() {
- @Override
- public void onSuccess(Void result) {
- if (prefs.syntaxHighlighting()) {
- cmA.setOption("mode", getContentType(diff.metaA()));
- cmB.setOption("mode", getContentType(diff.metaB()));
- }
- }
-
- @Override
- public void onFailure(Throwable caught) {
- prefs.syntaxHighlighting(false);
- }
- });
- } else {
- cmA.setOption("mode", (String) null);
- cmB.setOption("mode", (String) null);
- }
- }
-
- @Override
- void setAutoHideDiffHeader(boolean hide) {
- scrollSynchronizer.setAutoHideDiffTableHeader(hide);
- }
-
- CodeMirror otherCm(CodeMirror me) {
- return me == cmA ? cmB : cmA;
- }
-
- @Override
- CodeMirror getCmFromSide(DisplaySide side) {
- return side == DisplaySide.A ? cmA : cmB;
- }
-
- @Override
- int getCmLine(int line, DisplaySide side) {
- return line;
- }
-
- @Override
- Runnable updateActiveLine(CodeMirror cm) {
- CodeMirror other = otherCm(cm);
- return () -> {
- // The rendering of active lines has to be deferred. Reflow
- // caused by adding and removing styles chokes Firefox when arrow
- // key (or j/k) is held down. Performance on Chrome is fine
- // without the deferral.
- //
- Scheduler.get()
- .scheduleDeferred(
- new ScheduledCommand() {
- @Override
- public void execute() {
- operation(
- () -> {
- LineHandle handle = cm.getLineHandleVisualStart(cm.getCursor("end").line());
- if (!cm.extras().activeLine(handle)) {
- return;
- }
-
- LineOnOtherInfo info = lineOnOther(cm.side(), cm.getLineNumber(handle));
- if (info.isAligned()) {
- other.extras().activeLine(other.getLineHandle(info.getLine()));
- } else {
- other.extras().clearActiveLine();
- }
- });
- }
- });
- };
- }
-
- private Runnable moveCursorToSide(CodeMirror cmSrc, DisplaySide sideDst) {
- CodeMirror cmDst = getCmFromSide(sideDst);
- if (cmDst == cmSrc) {
- return () -> {};
- }
-
- DisplaySide sideSrc = cmSrc.side();
- return () -> {
- if (cmSrc.extras().hasActiveLine()) {
- cmDst.setCursor(
- Pos.create(
- lineOnOther(sideSrc, cmSrc.getLineNumber(cmSrc.extras().activeLine())).getLine()));
- }
- cmDst.focus();
- };
- }
-
- void syncScroll(DisplaySide masterSide) {
- if (scrollSynchronizer != null) {
- scrollSynchronizer.syncScroll(masterSide);
- }
- }
-
- @Override
- void operation(Runnable apply) {
- cmA.operation(() -> cmB.operation(apply::run));
- }
-
- @Override
- CodeMirror[] getCms() {
- return new CodeMirror[] {cmA, cmB};
- }
-
- @Override
- SideBySideTable getDiffTable() {
- return diffTable;
- }
-
- @Override
- SideBySideChunkManager getChunkManager() {
- return chunkManager;
- }
-
- @Override
- SideBySideCommentManager getCommentManager() {
- return commentManager;
- }
-
- @Override
- boolean isSideBySide() {
- return true;
- }
-
- @Override
- String getLineNumberClassName() {
- return LINE_NUMBER_CLASSNAME;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide.ui.xml
deleted file mode 100644
index 55c9de0..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySide.ui.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:d='urn:import:com.google.gerrit.client.diff'>
- <ui:style gss='false'>
- .sbs {
- margin-left: -5px;
- margin-right: -5px;
- }
- </ui:style>
- <g:FlowPanel styleName='{style.sbs}'>
- <d:Header ui:field='header'/>
- <d:SideBySideTable ui:field='diffTable'/>
- </g:FlowPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySideChunkManager.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySideChunkManager.java
deleted file mode 100644
index 2877794..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySideChunkManager.java
+++ /dev/null
@@ -1,262 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import static com.google.gerrit.client.diff.DisplaySide.A;
-import static com.google.gerrit.client.diff.DisplaySide.B;
-
-import com.google.gerrit.client.diff.DiffInfo.Region;
-import com.google.gerrit.client.diff.DiffInfo.Span;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.NativeEvent;
-import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.EventListener;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import net.codemirror.lib.CodeMirror;
-import net.codemirror.lib.CodeMirror.LineClassWhere;
-import net.codemirror.lib.Configuration;
-import net.codemirror.lib.LineWidget;
-import net.codemirror.lib.Pos;
-
-/** Colors modified regions for {@link SideBySide}. */
-class SideBySideChunkManager extends ChunkManager {
- private static final String DATA_LINES = "_cs2h";
- private static double guessedLineHeightPx = 15;
- private static final JavaScriptObject focusA = initOnClick(A);
- private static final JavaScriptObject focusB = initOnClick(B);
-
- private static native JavaScriptObject initOnClick(DisplaySide s) /*-{
- return $entry(function(e){
- @com.google.gerrit.client.diff.SideBySideChunkManager::focus(
- Lcom/google/gwt/dom/client/NativeEvent;
- Lcom/google/gerrit/client/diff/DisplaySide;)(e,s)
- });
- }-*/;
-
- private static void focus(NativeEvent event, DisplaySide side) {
- Element e = Element.as(event.getEventTarget());
- for (e = DOM.getParent(e); e != null; e = DOM.getParent(e)) {
- EventListener l = DOM.getEventListener(e);
- if (l instanceof SideBySide) {
- ((SideBySide) l).getCmFromSide(side).focus();
- event.stopPropagation();
- }
- }
- }
-
- static void focusOnClick(Element e, DisplaySide side) {
- onClick(e, side == A ? focusA : focusB);
- }
-
- private final SideBySide host;
- private final CodeMirror cmA;
- private final CodeMirror cmB;
-
- private List<DiffChunkInfo> chunks;
- private List<LineWidget> padding;
- private List<Element> paddingDivs;
-
- SideBySideChunkManager(SideBySide host, CodeMirror cmA, CodeMirror cmB, Scrollbar scrollbar) {
- super(scrollbar);
-
- this.host = host;
- this.cmA = cmA;
- this.cmB = cmB;
- }
-
- @Override
- DiffChunkInfo getFirst() {
- return !chunks.isEmpty() ? chunks.get(0) : null;
- }
-
- @Override
- void reset() {
- super.reset();
-
- for (LineWidget w : padding) {
- w.clear();
- }
- }
-
- @Override
- void render(DiffInfo diff) {
- super.render();
-
- chunks = new ArrayList<>();
- padding = new ArrayList<>();
- paddingDivs = new ArrayList<>();
-
- String diffColor =
- diff.metaA() == null || diff.metaB() == null
- ? SideBySideTable.style.intralineBg()
- : SideBySideTable.style.diff();
-
- for (Region current : Natives.asList(diff.content())) {
- if (current.ab() != null) {
- lineMapper.appendCommon(current.ab().length());
- } else if (current.skip() > 0) {
- lineMapper.appendCommon(current.skip());
- } else if (current.common()) {
- lineMapper.appendCommon(current.b().length());
- } else {
- render(current, diffColor);
- }
- }
-
- if (paddingDivs.isEmpty()) {
- paddingDivs = null;
- }
- }
-
- void adjustPadding() {
- if (paddingDivs != null) {
- double h = cmB.extras().lineHeightPx();
- for (Element div : paddingDivs) {
- int lines = div.getPropertyInt(DATA_LINES);
- div.getStyle().setHeight(lines * h, Unit.PX);
- }
- for (LineWidget w : padding) {
- w.changed();
- }
- paddingDivs = null;
- guessedLineHeightPx = h;
- }
- }
-
- private void render(Region region, String diffColor) {
- int startA = lineMapper.getLineA();
- int startB = lineMapper.getLineB();
-
- JsArrayString a = region.a();
- JsArrayString b = region.b();
- int aLen = a != null ? a.length() : 0;
- int bLen = b != null ? b.length() : 0;
-
- String color = a == null || b == null ? diffColor : SideBySideTable.style.intralineBg();
-
- colorLines(cmA, color, startA, aLen);
- colorLines(cmB, color, startB, bLen);
- markEdit(cmA, startA, a, region.editA());
- markEdit(cmB, startB, b, region.editB());
- addPadding(cmA, startA + aLen - 1, bLen - aLen);
- addPadding(cmB, startB + bLen - 1, aLen - bLen);
- addGutterTag(region, startA, startB);
- lineMapper.appendReplace(aLen, bLen);
-
- int endA = lineMapper.getLineA() - 1;
- int endB = lineMapper.getLineB() - 1;
- if (aLen > 0) {
- addDiffChunk(cmB, endA, aLen, bLen > 0);
- }
- if (bLen > 0) {
- addDiffChunk(cmA, endB, bLen, aLen > 0);
- }
- }
-
- private void addGutterTag(Region region, int startA, int startB) {
- if (region.a() == null) {
- scrollbar.insert(cmB, startB, region.b().length());
- } else if (region.b() == null) {
- scrollbar.delete(cmA, cmB, startA, region.a().length());
- } else {
- scrollbar.edit(cmB, startB, region.b().length());
- }
- }
-
- private void markEdit(CodeMirror cm, int startLine, JsArrayString lines, JsArray<Span> edits) {
- if (lines == null || edits == null) {
- return;
- }
-
- EditIterator iter = new EditIterator(lines, startLine);
- Configuration bg =
- Configuration.create()
- .set("className", SideBySideTable.style.intralineBg())
- .set("readOnly", true);
-
- Configuration diff =
- Configuration.create().set("className", SideBySideTable.style.diff()).set("readOnly", true);
-
- Pos last = Pos.create(0, 0);
- for (Span span : Natives.asList(edits)) {
- Pos from = iter.advance(span.skip());
- Pos to = iter.advance(span.mark());
- if (from.line() == last.line()) {
- getMarkers().add(cm.markText(last, from, bg));
- } else {
- getMarkers().add(cm.markText(Pos.create(from.line(), 0), from, bg));
- }
- getMarkers().add(cm.markText(from, to, diff));
- last = to;
- colorLines(
- cm, LineClassWhere.BACKGROUND, SideBySideTable.style.diff(), from.line(), to.line());
- }
- }
-
- /**
- * Insert a new padding div below the given line.
- *
- * @param cm parent CodeMirror to add extra space into.
- * @param line line to put the padding below.
- * @param len number of lines to pad. Padding is inserted only if {@code len >= 1}.
- */
- private void addPadding(CodeMirror cm, int line, int len) {
- if (0 < len) {
- Element pad = DOM.createDiv();
- pad.setClassName(SideBySideTable.style.padding());
- pad.setPropertyInt(DATA_LINES, len);
- pad.getStyle().setHeight(guessedLineHeightPx * len, Unit.PX);
- focusOnClick(pad, cm.side());
- paddingDivs.add(pad);
- padding.add(
- cm.addLineWidget(
- line == -1 ? 0 : line,
- pad,
- Configuration.create()
- .set("coverGutter", true)
- .set("noHScroll", true)
- .set("above", line == -1)));
- }
- }
-
- private void addDiffChunk(CodeMirror cmToPad, int lineOnOther, int chunkSize, boolean edit) {
- chunks.add(
- new DiffChunkInfo(
- host.otherCm(cmToPad).side(), lineOnOther - chunkSize + 1, lineOnOther, edit));
- }
-
- @Override
- Runnable diffChunkNav(CodeMirror cm, Direction dir) {
- return () -> {
- int line = cm.extras().hasActiveLine() ? cm.getLineNumber(cm.extras().activeLine()) : 0;
- int res =
- Collections.binarySearch(
- chunks, new DiffChunkInfo(cm.side(), line, 0, false), getDiffChunkComparator());
- diffChunkNavHelper(chunks, host, res, dir);
- };
- }
-
- @Override
- int getCmLine(int line, DisplaySide side) {
- return line;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySideCommentGroup.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySideCommentGroup.java
deleted file mode 100644
index c728f6f..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySideCommentGroup.java
+++ /dev/null
@@ -1,159 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Timer;
-import java.util.PriorityQueue;
-import net.codemirror.lib.CodeMirror;
-
-/**
- * LineWidget attached to a CodeMirror container.
- *
- * <p>When a comment is placed on a line a CommentWidget is created on both sides. The group tracks
- * all comment boxes on that same line, and also includes an empty padding element to keep
- * subsequent lines vertically aligned.
- */
-class SideBySideCommentGroup extends CommentGroup implements Comparable<SideBySideCommentGroup> {
- static void pair(SideBySideCommentGroup a, SideBySideCommentGroup b) {
- a.peers.add(b);
- b.peers.add(a);
- }
-
- private final Element padding;
- private final PriorityQueue<SideBySideCommentGroup> peers;
-
- SideBySideCommentGroup(
- SideBySideCommentManager manager, CodeMirror cm, DisplaySide side, int line) {
- super(manager, cm, side, line);
-
- padding = DOM.createDiv();
- padding.setClassName(SideBySideTable.style.padding());
- SideBySideChunkManager.focusOnClick(padding, cm.side());
- getElement().appendChild(padding);
- peers = new PriorityQueue<>();
- }
-
- SideBySideCommentGroup getPeer() {
- return peers.peek();
- }
-
- @Override
- void remove(DraftBox box) {
- super.remove(box);
-
- if (getBoxCount() == 0 && peers.size() == 1 && peers.peek().peers.size() > 1) {
- SideBySideCommentGroup peer = peers.peek();
- peer.peers.remove(this);
- detach();
- if (peer.getBoxCount() == 0
- && peer.peers.size() == 1
- && peer.peers.peek().getBoxCount() == 0) {
- peer.detach();
- } else {
- peer.resize();
- }
- } else {
- resize();
- }
- }
-
- @Override
- void init(DiffTable parent) {
- if (getLineWidget() == null) {
- attach(parent);
- }
- for (CommentGroup peer : peers) {
- if (peer.getLineWidget() == null) {
- peer.attach(parent);
- }
- }
- }
-
- @Override
- void handleRedraw() {
- getLineWidget()
- .onRedraw(
- () -> {
- if (canComputeHeight() && peers.peek().canComputeHeight()) {
- if (getResizeTimer() != null) {
- getResizeTimer().cancel();
- setResizeTimer(null);
- }
- adjustPadding(SideBySideCommentGroup.this, peers.peek());
- } else if (getResizeTimer() == null) {
- setResizeTimer(
- new Timer() {
- @Override
- public void run() {
- if (canComputeHeight() && peers.peek().canComputeHeight()) {
- cancel();
- setResizeTimer(null);
- adjustPadding(SideBySideCommentGroup.this, peers.peek());
- }
- }
- });
- getResizeTimer().scheduleRepeating(5);
- }
- });
- }
-
- @Override
- void resize() {
- if (getLineWidget() != null) {
- adjustPadding(this, peers.peek());
- }
- }
-
- private int computeHeight() {
- if (getComments().isVisible()) {
- // Include margin-bottom: 5px from CSS class.
- return getComments().getOffsetHeight() + 5;
- }
- return 0;
- }
-
- private static void adjustPadding(SideBySideCommentGroup a, SideBySideCommentGroup b) {
- int apx = a.computeHeight();
- int bpx = b.computeHeight();
- for (SideBySideCommentGroup otherPeer : a.peers) {
- if (otherPeer != b) {
- bpx += otherPeer.computeHeight();
- }
- }
- for (SideBySideCommentGroup otherPeer : b.peers) {
- if (otherPeer != a) {
- apx += otherPeer.computeHeight();
- }
- }
- int h = Math.max(apx, bpx);
- a.padding.getStyle().setHeight(Math.max(0, h - apx), Unit.PX);
- b.padding.getStyle().setHeight(Math.max(0, h - bpx), Unit.PX);
- a.getLineWidget().changed();
- b.getLineWidget().changed();
- a.updateSelection();
- b.updateSelection();
- }
-
- @Override
- public int compareTo(SideBySideCommentGroup o) {
- if (side == o.side) {
- return line - o.line;
- }
- throw new IllegalStateException("Cannot compare SideBySideCommentGroup with different sides");
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySideCommentManager.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySideCommentManager.java
deleted file mode 100644
index 09c5b07..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySideCommentManager.java
+++ /dev/null
@@ -1,136 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gerrit.client.DiffObject;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.CommentInfo;
-import com.google.gerrit.client.ui.CommentLinkProcessor;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import java.util.Collection;
-import java.util.Map;
-import java.util.SortedMap;
-import net.codemirror.lib.CodeMirror;
-import net.codemirror.lib.TextMarker.FromTo;
-
-/** Tracks comment widgets for {@link SideBySide}. */
-class SideBySideCommentManager extends CommentManager {
- SideBySideCommentManager(
- SideBySide host,
- @Nullable Project.NameKey project,
- DiffObject base,
- PatchSet.Id revision,
- String path,
- CommentLinkProcessor clp,
- boolean open) {
- super(host, project, base, revision, path, clp, open);
- }
-
- @Override
- SortedMap<Integer, CommentGroup> getMapForNav(DisplaySide side) {
- return map(side);
- }
-
- @Override
- void clearLine(DisplaySide side, int line, CommentGroup group) {
- super.clearLine(side, line, group);
- }
-
- @Override
- void newDraftOnGutterClick(CodeMirror cm, String gutterClass, int line) {
- if (!Gerrit.isSignedIn()) {
- signInCallback(cm).run();
- } else {
- insertNewDraft(cm.side(), line);
- }
- }
-
- @Override
- CommentGroup getCommentGroupOnActiveLine(CodeMirror cm) {
- CommentGroup group = null;
- if (cm.extras().hasActiveLine()) {
- group = map(cm.side()).get(cm.getLineNumber(cm.extras().activeLine()) + 1);
- }
- return group;
- }
-
- @Override
- Collection<Integer> getLinesWithCommentGroups() {
- return sideB.tailMap(1).keySet();
- }
-
- @Override
- String getTokenSuffixForActiveLine(CodeMirror cm) {
- return (cm.side() == DisplaySide.A ? "a" : "")
- + (cm.getLineNumber(cm.extras().activeLine()) + 1);
- }
-
- @Override
- void newDraft(CodeMirror cm) {
- int line = cm.getLineNumber(cm.extras().activeLine()) + 1;
- if (cm.somethingSelected()) {
- FromTo fromTo = adjustSelection(cm);
- addDraftBox(
- cm.side(),
- CommentInfo.create(
- getPath(),
- getStoredSideFromDisplaySide(cm.side()),
- getParentNumFromDisplaySide(cm.side()),
- line,
- CommentRange.create(fromTo),
- false))
- .setEdit(true);
- cm.setCursor(fromTo.to());
- cm.setSelection(cm.getCursor());
- } else {
- insertNewDraft(cm.side(), line);
- }
- }
-
- @Override
- CommentGroup group(DisplaySide side, int line) {
- CommentGroup existing = map(side).get(line);
- if (existing != null) {
- return existing;
- }
-
- SideBySideCommentGroup newGroup = newGroup(side, line);
- Map<Integer, CommentGroup> map = side == DisplaySide.A ? sideA : sideB;
- Map<Integer, CommentGroup> otherMap = side == DisplaySide.A ? sideB : sideA;
- map.put(line, newGroup);
- int otherLine = host.lineOnOther(side, line - 1).getLine() + 1;
- existing = map(side.otherSide()).get(otherLine);
- CommentGroup otherGroup;
- if (existing != null) {
- otherGroup = existing;
- } else {
- otherGroup = newGroup(side.otherSide(), otherLine);
- otherMap.put(otherLine, otherGroup);
- }
- SideBySideCommentGroup.pair(newGroup, (SideBySideCommentGroup) otherGroup);
-
- if (isAttached()) {
- newGroup.init(host.getDiffTable());
- otherGroup.handleRedraw();
- }
- return newGroup;
- }
-
- private SideBySideCommentGroup newGroup(DisplaySide side, int line) {
- return new SideBySideCommentGroup(this, host.getCmFromSide(side), side, line);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySideTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySideTable.java
deleted file mode 100644
index c65dcf0..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySideTable.java
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gerrit.client.DiffObject;
-import com.google.gerrit.reviewdb.client.Patch.ChangeType;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.user.client.ui.HTMLPanel;
-
-/**
- * A table with one row and two columns to hold the two CodeMirrors displaying the files to be
- * compared.
- */
-class SideBySideTable extends DiffTable {
- interface Binder extends UiBinder<HTMLPanel, SideBySideTable> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- interface DiffTableStyle extends CssResource {
- String intralineBg();
-
- String diff();
-
- String hideA();
-
- String hideB();
-
- String padding();
- }
-
- private SideBySide parent;
- @UiField Element cmA;
- @UiField Element cmB;
- @UiField static DiffTableStyle style;
-
- private boolean visibleA;
-
- SideBySideTable(SideBySide parent, DiffObject base, DiffObject revision, String path) {
- super(parent, base, revision, path);
-
- initWidget(uiBinder.createAndBindUi(this));
- this.visibleA = true;
- this.parent = parent;
- }
-
- @Override
- boolean isVisibleA() {
- return visibleA;
- }
-
- void setVisibleA(boolean show) {
- visibleA = show;
- if (show) {
- removeStyleName(style.hideA());
- parent.syncScroll(DisplaySide.B); // match B's viewport
- } else {
- addStyleName(style.hideA());
- }
- }
-
- Runnable toggleA() {
- return () -> setVisibleA(!isVisibleA());
- }
-
- void setVisibleB(boolean show) {
- if (show) {
- removeStyleName(style.hideB());
- parent.syncScroll(DisplaySide.A); // match A's viewport
- } else {
- addStyleName(style.hideB());
- }
- }
-
- @Override
- void setHideEmptyPane(boolean hide) {
- if (getChangeType() == ChangeType.ADDED) {
- setVisibleA(!hide);
- } else if (getChangeType() == ChangeType.DELETED) {
- setVisibleB(!hide);
- }
- }
-
- @Override
- SideBySide getDiffScreen() {
- return parent;
- }
-
- @Override
- int getHeaderHeight() {
- int h = patchSetSelectBoxA.getOffsetHeight();
- if (hasHeader()) {
- h += diffHeaderRow.getOffsetHeight();
- }
- return h;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySideTable.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySideTable.ui.xml
deleted file mode 100644
index b2e3f43..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SideBySideTable.ui.xml
+++ /dev/null
@@ -1,147 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:d='urn:import:com.google.gerrit.client.diff'>
- <ui:with field='res' type='com.google.gerrit.client.diff.Resources'/>
- <ui:style gss='false' type='com.google.gerrit.client.diff.SideBySideTable.DiffTableStyle'>
- @external .CodeMirror, .CodeMirror-selectedtext;
- @external .CodeMirror-linenumber;
- @external .CodeMirror-overlayscroll-vertical, .CodeMirror-scroll;
- @external .CodeMirror-dialog-bottom;
- @external .CodeMirror-cursor;
-
- @external .dark, .noIntraline, .showLineNumbers;
-
- .difftable .patchSetNav,
- .difftable .CodeMirror {
- -webkit-touch-callout: none;
- -webkit-user-select: none;
- -khtml-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- }
-
- .difftable .CodeMirror pre {
- overflow: visible;
- border-right: 0;
- width: auto;
- }
-
- /* Preserve space for underscores. If this changes
- * see ChunkManager.addPadding() and adjust there.
- */
- .difftable .CodeMirror pre,
- .difftable .CodeMirror pre span {
- padding-bottom: 1px;
- }
-
- .hideA .psNavA,
- .hideA .a {
- display: none;
- }
-
- .hideB .psNavB,
- .hideB .b {
- display: none;
- }
-
- .table {
- width: 100%;
- table-layout: fixed;
- border-spacing: 0;
- }
- .table td { padding: 0 }
- .a, .b { width: 50% }
- .hideA .psNavB, .hideA .b { width: 100% }
- .hideB .psNavA, .hideB .a { width: 100% }
-
- /* Hide scrollbars on A, B controls both views. */
- .a .CodeMirror-scroll { margin-right: -36px; }
- .a .CodeMirror-overlayscroll-vertical { display: none !important; }
-
- .showLineNumbers .b { border-left: none; }
- .b { border-left: 1px solid #ddd; }
-
- .a .diff { background-color: #faa; }
- /* Set min-width for lineWrapping to make sure it gets enough width
- before lineWrapping and to make sure it dosent do a ugly line wrap */
- .b .diff { background-color: #9f9; min-width: 60em; }
- .a .intralineBg { background-color: #fee; }
- .b .intralineBg { background-color: #dfd; }
- .noIntraline .a .intralineBg { background-color: #faa; }
- .noIntraline .b .intralineBg { background-color: #9f9; }
-
- .dark .a .diff { background-color: #400; }
- .dark .b .diff { background-color: #444; }
-
- .dark .a .intralineBg { background-color: #888; }
- .dark .b .intralineBg { background-color: #bbb; }
- .dark .noIntraline .a .intralineBg { background-color: #400; }
- .dark .noIntraline .b .intralineBg { background-color: #444; }
-
- .patchSetNav, .diff_header {
- background-color: #f7f7f7;
- line-height: 1;
- }
-
- .difftable .CodeMirror-selectedtext {
- background-color: inherit !important;
- }
- .difftable .CodeMirror-linenumber {
- height: 1.11em;
- cursor: pointer;
- }
- .difftable .CodeMirror div.CodeMirror-cursor {
- border-left: 2px solid black;
- }
- .difftable .CodeMirror-dialog-bottom {
- border-top: 0;
- border-left: 1px solid #000;
- border-bottom: 1px solid #000;
- background-color: #f7f7f7;
- top: 0;
- right: 0;
- bottom: auto;
- left: auto;
- }
- .showLineNumbers .padding {
- margin-left: 21px;
- border-left: 2px solid #d64040;
- }
- </ui:style>
- <g:HTMLPanel styleName='{style.difftable}'>
- <table class='{style.table}'>
- <tr ui:field='patchSetNavRow' class='{style.patchSetNav}'>
- <td ui:field='patchSetNavCellA' class='{style.psNavA}'>
- <d:PatchSetSelectBox ui:field='patchSetSelectBoxA' />
- </td>
- <td ui:field='patchSetNavCellB' class='{style.psNavB}'>
- <d:PatchSetSelectBox ui:field='patchSetSelectBoxB' />
- </td>
- </tr>
- <tr ui:field='diffHeaderRow' class='{res.diffTableStyle.diffHeader}'>
- <td colspan='2'><pre ui:field='diffHeaderText' /></td>
- </tr>
- <tr>
- <td ui:field='cmA' class='{style.a}' />
- <td ui:field='cmB' class='{style.b}' />
- </tr>
- </table>
- <g:FlowPanel ui:field='widgets' visible='false'/>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SkipBar.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SkipBar.java
deleted file mode 100644
index c138f37..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SkipBar.java
+++ /dev/null
@@ -1,217 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gerrit.client.patches.PatchUtil;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import net.codemirror.lib.CodeMirror;
-import net.codemirror.lib.Configuration;
-import net.codemirror.lib.LineWidget;
-import net.codemirror.lib.Pos;
-import net.codemirror.lib.TextMarker;
-import net.codemirror.lib.TextMarker.FromTo;
-
-class SkipBar extends Composite {
- interface Binder extends UiBinder<HTMLPanel, SkipBar> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
- private static final int NUM_ROWS_TO_EXPAND = 10;
- private static final int UP_DOWN_THRESHOLD = 30;
-
- interface SkipBarStyle extends CssResource {
- String noExpand();
- }
-
- @UiField(provided = true)
- Anchor skipNum;
-
- @UiField(provided = true)
- Anchor upArrow;
-
- @UiField(provided = true)
- Anchor downArrow;
-
- @UiField SkipBarStyle style;
-
- private final SkipManager manager;
- private final CodeMirror cm;
-
- private LineWidget lineWidget;
- private TextMarker textMarker;
- private SkipBar otherBar;
-
- SkipBar(SkipManager manager, CodeMirror cm) {
- this.manager = manager;
- this.cm = cm;
-
- skipNum = new Anchor(true);
- upArrow = new Anchor(true);
- downArrow = new Anchor(true);
- initWidget(uiBinder.createAndBindUi(this));
- addDomHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- cm.focus();
- }
- },
- ClickEvent.getType());
- }
-
- void collapse(int start, int end, boolean attach) {
- if (attach) {
- boolean isNew = lineWidget == null;
- Configuration cfg = Configuration.create().set("coverGutter", true).set("noHScroll", true);
- if (start == 0) { // First line workaround
- lineWidget = cm.addLineWidget(end + 1, getElement(), cfg.set("above", true));
- } else {
- lineWidget = cm.addLineWidget(start - 1, getElement(), cfg);
- }
- if (isNew) {
- lineWidget.onFirstRedraw(
- () -> {
- int w = cm.getGutterElement().getOffsetWidth();
- getElement().getStyle().setPaddingLeft(w, Unit.PX);
- });
- }
- }
-
- textMarker =
- cm.markText(
- Pos.create(start, 0),
- Pos.create(end),
- Configuration.create()
- .set("collapsed", true)
- .set("inclusiveLeft", true)
- .set("inclusiveRight", true));
-
- textMarker.on("beforeCursorEnter", this::expandAll);
-
- int skipped = end - start + 1;
- if (skipped <= UP_DOWN_THRESHOLD) {
- addStyleName(style.noExpand());
- } else {
- upArrow.setHTML(PatchUtil.M.expandBefore(NUM_ROWS_TO_EXPAND));
- downArrow.setHTML(PatchUtil.M.expandAfter(NUM_ROWS_TO_EXPAND));
- }
- skipNum.setText(PatchUtil.M.patchSkipRegion(Integer.toString(skipped)));
- }
-
- static void link(SkipBar barA, SkipBar barB) {
- barA.otherBar = barB;
- barB.otherBar = barA;
- }
-
- private void clearMarkerAndWidget() {
- textMarker.clear();
- lineWidget.clear();
- }
-
- void expandBefore(int cnt) {
- expandSideBefore(cnt);
-
- if (otherBar != null) {
- otherBar.expandSideBefore(cnt);
- }
- }
-
- private void expandSideBefore(int cnt) {
- FromTo range = textMarker.find();
- int oldStart = range.from().line();
- int newStart = oldStart + cnt;
- int end = range.to().line();
- clearMarkerAndWidget();
- collapse(newStart, end, true);
- updateSelection();
- }
-
- void expandSideAll() {
- clearMarkerAndWidget();
- removeFromParent();
- }
-
- private void expandAfter() {
- FromTo range = textMarker.find();
- int start = range.from().line();
- int oldEnd = range.to().line();
- int newEnd = oldEnd - NUM_ROWS_TO_EXPAND;
- boolean attach = start == 0;
- if (attach) {
- clearMarkerAndWidget();
- } else {
- textMarker.clear();
- }
- collapse(start, newEnd, attach);
- updateSelection();
- }
-
- private void updateSelection() {
- if (cm.somethingSelected()) {
- FromTo sel = cm.getSelectedRange();
- cm.setSelection(sel.from(), sel.to());
- }
- }
-
- @UiHandler("skipNum")
- void onExpandAll(@SuppressWarnings("unused") ClickEvent e) {
- expandAll();
- updateSelection();
- if (otherBar != null) {
- otherBar.expandAll();
- otherBar.updateSelection();
- }
- cm.refresh();
- cm.focus();
- }
-
- private void expandAll() {
- expandSideAll();
- if (otherBar != null) {
- otherBar.expandSideAll();
- }
- manager.remove(this, otherBar);
- }
-
- @UiHandler("upArrow")
- void onExpandBefore(@SuppressWarnings("unused") ClickEvent e) {
- expandBefore(NUM_ROWS_TO_EXPAND);
- if (otherBar != null) {
- otherBar.expandBefore(NUM_ROWS_TO_EXPAND);
- }
- cm.refresh();
- cm.focus();
- }
-
- @UiHandler("downArrow")
- void onExpandAfter(@SuppressWarnings("unused") ClickEvent e) {
- expandAfter();
-
- if (otherBar != null) {
- otherBar.expandAfter();
- }
- cm.refresh();
- cm.focus();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SkipBar.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SkipBar.ui.xml
deleted file mode 100644
index bf3c425..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SkipBar.ui.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:style gss='false' type='com.google.gerrit.client.diff.SkipBar.SkipBarStyle'>
- .skipBar {
- background-color: #def;
- height: 1.3em;
- overflow: hidden;
- }
- .text {
- display: table;
- margin: 0 auto;
- color: #777;
- font-style: italic;
- overflow: hidden;
- }
- .anchor {
- color: inherit;
- text-decoration: none;
- }
- .noExpand .arrow {
- display: none;
- }
- .arrow {
- font-family: Arial Unicode MS, sans-serif;
- }
- </ui:style>
- <g:HTMLPanel addStyleNames='{style.skipBar}'>
- <div class='{style.text}'>
- <ui:msg>
- <g:Anchor ui:field='upArrow' addStyleNames='{style.arrow} {style.anchor}' />
- <g:Anchor ui:field='skipNum' addStyleNames='{style.anchor}' />
- <g:Anchor ui:field='downArrow' addStyleNames=' {style.arrow} {style.anchor}' />
- </ui:msg>
- </div>
- </g:HTMLPanel>
-</ui:UiBinder>
\ No newline at end of file
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SkipManager.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SkipManager.java
deleted file mode 100644
index 533ba1f..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/SkipManager.java
+++ /dev/null
@@ -1,149 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gerrit.client.diff.DiffInfo.Region;
-import com.google.gerrit.client.patches.SkippedLine;
-import com.google.gerrit.extensions.client.DiffPreferencesInfo;
-import com.google.gwt.core.client.JsArray;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import net.codemirror.lib.CodeMirror;
-
-/** Collapses common regions with {@link SkipBar} for {@link SideBySide} and {@link Unified}. */
-class SkipManager {
- private final Set<SkipBar> skipBars;
- private final DiffScreen host;
- private SkipBar line0;
-
- SkipManager(DiffScreen host) {
- this.host = host;
- this.skipBars = new HashSet<>();
- }
-
- void render(int context, DiffInfo diff) {
- if (context == DiffPreferencesInfo.WHOLE_FILE_CONTEXT) {
- return;
- }
-
- List<SkippedLine> skips = new ArrayList<>();
- int lineA = 0;
- int lineB = 0;
- JsArray<Region> regions = diff.content();
- for (int i = 0; i < regions.length(); i++) {
- Region current = regions.get(i);
- if (current.ab() != null || current.common() || current.skip() > 0) {
- int len =
- current.skip() > 0
- ? current.skip()
- : (current.ab() != null ? current.ab() : current.b()).length();
- if (i == 0 && len > context + 1) {
- skips.add(new SkippedLine(0, 0, len - context));
- } else if (i == regions.length() - 1 && len > context + 1) {
- skips.add(new SkippedLine(lineA + context, lineB + context, len - context));
- } else if (len > 2 * context + 1) {
- skips.add(new SkippedLine(lineA + context, lineB + context, len - 2 * context));
- }
- lineA += len;
- lineB += len;
- } else {
- lineA += current.a() != null ? current.a().length() : 0;
- lineB += current.b() != null ? current.b().length() : 0;
- }
- }
- skips = host.getCommentManager().splitSkips(context, skips);
- renderSkips(skips, lineA, lineB);
- }
-
- private void renderSkips(List<SkippedLine> skips, int lineA, int lineB) {
- if (!skips.isEmpty()) {
- boolean isSideBySide = host.isSideBySide();
- CodeMirror cmA = null;
- if (isSideBySide) {
- cmA = host.getCmFromSide(DisplaySide.A);
- }
- CodeMirror cmB = host.getCmFromSide(DisplaySide.B);
-
- for (SkippedLine skip : skips) {
- SkipBar barA = null;
- SkipBar barB = newSkipBar(cmB, DisplaySide.B, skip);
- skipBars.add(barB);
- if (isSideBySide) {
- barA = newSkipBar(cmA, DisplaySide.A, skip);
- SkipBar.link(barA, barB);
- skipBars.add(barA);
- }
-
- if (skip.getStartA() == 0 || skip.getStartB() == 0) {
- if (isSideBySide) {
- barA.upArrow.setVisible(false);
- }
- barB.upArrow.setVisible(false);
- setLine0(barB);
- } else if (skip.getStartA() + skip.getSize() == lineA
- || skip.getStartB() + skip.getSize() == lineB) {
- if (isSideBySide) {
- barA.downArrow.setVisible(false);
- }
- barB.downArrow.setVisible(false);
- }
- }
- }
- }
-
- private SkipBar newSkipBar(CodeMirror cm, DisplaySide side, SkippedLine skip) {
- int start = host.getCmLine(side == DisplaySide.A ? skip.getStartA() : skip.getStartB(), side);
- int end = start + skip.getSize() - 1;
-
- SkipBar bar = new SkipBar(this, cm);
- host.getDiffTable().add(bar);
- bar.collapse(start, end, true);
- return bar;
- }
-
- void ensureFirstLineIsVisible() {
- if (line0 != null) {
- line0.expandBefore(1);
- line0 = null;
- }
- }
-
- void removeAll() {
- if (!skipBars.isEmpty()) {
- for (SkipBar bar : skipBars) {
- bar.expandSideAll();
- }
- line0 = null;
- }
- }
-
- void remove(SkipBar a, SkipBar b) {
- skipBars.remove(a);
- skipBars.remove(b);
- if (getLine0() == a || getLine0() == b) {
- setLine0(null);
- }
- }
-
- SkipBar getLine0() {
- return line0;
- }
-
- void setLine0(SkipBar bar) {
- line0 = bar;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Unified.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Unified.java
deleted file mode 100644
index 7bd9804..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Unified.java
+++ /dev/null
@@ -1,383 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import static java.lang.Double.POSITIVE_INFINITY;
-
-import com.google.gerrit.client.DiffObject;
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.diff.UnifiedChunkManager.LineRegionInfo;
-import com.google.gerrit.client.patches.PatchUtil;
-import com.google.gerrit.client.projects.ConfigInfoCache;
-import com.google.gerrit.client.rpc.ScreenLoadCallback;
-import com.google.gerrit.client.ui.InlineHyperlink;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.extensions.client.GeneralPreferencesInfo.DiffView;
-import com.google.gerrit.reviewdb.client.Patch;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.event.dom.client.FocusEvent;
-import com.google.gwt.event.dom.client.FocusHandler;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.ImageResourceRenderer;
-import com.google.gwt.user.client.ui.InlineHTML;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.safehtml.client.SafeHtml;
-import java.util.Collections;
-import java.util.List;
-import net.codemirror.lib.CodeMirror;
-import net.codemirror.lib.CodeMirror.LineHandle;
-import net.codemirror.lib.Configuration;
-import net.codemirror.lib.Pos;
-import net.codemirror.lib.ScrollInfo;
-
-public class Unified extends DiffScreen {
- interface Binder extends UiBinder<FlowPanel, Unified> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- @UiField(provided = true)
- UnifiedTable diffTable;
-
- private CodeMirror cm;
-
- private UnifiedChunkManager chunkManager;
- private UnifiedCommentManager commentManager;
-
- private boolean autoHideDiffTableHeader;
-
- public Unified(
- @Nullable Project.NameKey project,
- DiffObject base,
- DiffObject revision,
- String path,
- DisplaySide startSide,
- int startLine) {
- super(project, base, revision, path, startSide, startLine, DiffView.UNIFIED_DIFF);
-
- diffTable = new UnifiedTable(this, base, revision, path);
- add(uiBinder.createAndBindUi(this));
- addDomHandler(GlobalKey.STOP_PROPAGATION, KeyPressEvent.getType());
- }
-
- @Override
- ScreenLoadCallback<ConfigInfoCache.Entry> getScreenLoadCallback(
- final CommentsCollections comments) {
- return new ScreenLoadCallback<ConfigInfoCache.Entry>(Unified.this) {
- @Override
- protected void preDisplay(ConfigInfoCache.Entry result) {
- commentManager =
- new UnifiedCommentManager(
- Unified.this,
- getProject(),
- base,
- revision,
- path,
- result.getCommentLinkProcessor(),
- getChangeStatus().isOpen());
- setTheme(result.getTheme());
- display(comments);
- header.setupPrevNextFiles(comments);
- }
- };
- }
-
- @Override
- public void onShowView() {
- super.onShowView();
-
- operation(
- () -> {
- resizeCodeMirror();
- cm.refresh();
- });
- setLineLength(Patch.COMMIT_MSG.equals(path) ? 72 : prefs.lineLength());
- diffTable.refresh();
-
- if (getStartLine() == 0) {
- DiffChunkInfo d = chunkManager.getFirst();
- if (d != null) {
- if (d.isEdit() && d.getSide() == DisplaySide.A) {
- setStartSide(DisplaySide.B);
- } else {
- setStartSide(d.getSide());
- }
- setStartLine(chunkManager.getCmLine(d.getStart(), d.getSide()) + 1);
- }
- }
- if (getStartSide() != null && getStartLine() > 0) {
- cm.scrollToLine(chunkManager.getCmLine(getStartLine() - 1, getStartSide()));
- cm.focus();
- } else {
- cm.setCursor(Pos.create(0));
- cm.focus();
- }
- if (Gerrit.isSignedIn() && prefs.autoReview()) {
- header.autoReview();
- }
- prefetchNextFile();
- }
-
- @Override
- void registerCmEvents(CodeMirror cm) {
- super.registerCmEvents(cm);
-
- cm.on(
- "scroll",
- () -> {
- ScrollInfo si = cm.getScrollInfo();
- if (autoHideDiffTableHeader) {
- updateDiffTableHeader(si);
- }
- });
- maybeRegisterRenderEntireFileKeyMap(cm);
- }
-
- @Override
- public void registerKeys() {
- super.registerKeys();
-
- registerHandlers();
- }
-
- @Override
- FocusHandler getFocusHandler() {
- return new FocusHandler() {
- @Override
- public void onFocus(FocusEvent event) {
- cm.focus();
- }
- };
- }
-
- private void display(CommentsCollections comments) {
- DiffInfo diff = getDiff();
- setThemeStyles(prefs.theme().isDark());
- setShowIntraline(prefs.intralineDifference());
- if (prefs.showLineNumbers()) {
- diffTable.addStyleName(Resources.I.diffTableStyle().showLineNumbers());
- }
-
- cm =
- newCm(diff.metaA() == null ? diff.metaB() : diff.metaA(), diff.textUnified(), diffTable.cm);
- setShowTabs(prefs.showTabs());
-
- chunkManager = new UnifiedChunkManager(this, cm, diffTable.scrollbar);
-
- operation(
- () -> {
- // Estimate initial CodeMirror height, fixed up in onShowView.
- int height = Window.getClientHeight() - (Gerrit.getHeaderFooterHeight() + 18);
- cm.setHeight(height);
-
- render(diff);
- commentManager.render(comments, prefs.expandAllComments());
- skipManager.render(prefs.context(), diff);
- });
-
- registerCmEvents(cm);
-
- setPrefsAction(new PreferencesAction(this, prefs));
- header.init(getPrefsAction(), getSideBySideDiffLink(), diff.unifiedWebLinks());
- setAutoHideDiffHeader(prefs.autoHideDiffTableHeader());
-
- setupSyntaxHighlighting();
- }
-
- private List<InlineHyperlink> getSideBySideDiffLink() {
- InlineHyperlink toSideBySideDiffLink = new InlineHyperlink();
- toSideBySideDiffLink.setHTML(
- new ImageResourceRenderer().render(Gerrit.RESOURCES.sideBySideDiff()));
- toSideBySideDiffLink.setTargetHistoryToken(
- Dispatcher.toSideBySide(getProject(), base, revision, path));
- toSideBySideDiffLink.setTitle(PatchUtil.C.sideBySideDiff());
- return Collections.singletonList(toSideBySideDiffLink);
- }
-
- @Override
- CodeMirror newCm(DiffInfo.FileMeta meta, String contents, Element parent) {
- JsArrayString gutters = JavaScriptObject.createArray().cast();
- gutters.push(UnifiedTable.style.lineNumbersLeft());
- gutters.push(UnifiedTable.style.lineNumbersRight());
-
- return CodeMirror.create(
- parent,
- Configuration.create()
- .set("cursorBlinkRate", prefs.cursorBlinkRate())
- .set("cursorHeight", 0.85)
- .set("gutters", gutters)
- .set("inputStyle", "textarea")
- .set("keyMap", "vim_ro")
- .set("lineNumbers", false)
- .set("lineWrapping", prefs.lineWrapping())
- .set("matchBrackets", prefs.matchBrackets())
- .set("mode", getFileSize() == FileSize.SMALL ? getContentType(meta) : null)
- .set("readOnly", true)
- .set("scrollbarStyle", "overlay")
- .set("styleSelectedText", true)
- .set("showTrailingSpace", prefs.showWhitespaceErrors())
- .set("tabSize", prefs.tabSize())
- .set("theme", prefs.theme().name().toLowerCase())
- .set("value", meta != null ? contents : "")
- .set("viewportMargin", renderEntireFile() ? POSITIVE_INFINITY : 10));
- }
-
- @Override
- void setShowLineNumbers(boolean b) {
- super.setShowLineNumbers(b);
-
- cm.refresh();
- }
-
- private void setLineNumber(DisplaySide side, int cmLine, Integer line, String styleName) {
- SafeHtml html = SafeHtml.asis(line != null ? line.toString() : " ");
- InlineHTML gutter = new InlineHTML(html);
- diffTable.add(gutter);
- gutter.setStyleName(styleName);
- cm.setGutterMarker(
- cmLine,
- side == DisplaySide.A
- ? UnifiedTable.style.lineNumbersLeft()
- : UnifiedTable.style.lineNumbersRight(),
- gutter.getElement());
- }
-
- void setLineNumber(DisplaySide side, int cmLine, int line) {
- setLineNumber(side, cmLine, line, UnifiedTable.style.unifiedLineNumber());
- }
-
- void setLineNumberEmpty(DisplaySide side, int cmLine) {
- setLineNumber(side, cmLine, null, UnifiedTable.style.unifiedLineNumberEmpty());
- }
-
- @Override
- void setSyntaxHighlighting(boolean b) {
- final DiffInfo diff = getDiff();
- if (b) {
- injectMode(
- diff,
- new AsyncCallback<Void>() {
- @Override
- public void onSuccess(Void result) {
- if (prefs.syntaxHighlighting()) {
- cm.setOption(
- "mode", getContentType(diff.metaA() == null ? diff.metaB() : diff.metaA()));
- }
- }
-
- @Override
- public void onFailure(Throwable caught) {
- prefs.syntaxHighlighting(false);
- }
- });
- } else {
- cm.setOption("mode", (String) null);
- }
- }
-
- @Override
- void setAutoHideDiffHeader(boolean autoHide) {
- if (autoHide) {
- updateDiffTableHeader(cm.getScrollInfo());
- } else {
- diffTable.setHeaderVisible(true);
- }
- autoHideDiffTableHeader = autoHide;
- }
-
- private void updateDiffTableHeader(ScrollInfo si) {
- if (si.top() == 0) {
- diffTable.setHeaderVisible(true);
- } else if (si.top() > 0.5 * si.clientHeight()) {
- diffTable.setHeaderVisible(false);
- }
- }
-
- @Override
- Runnable updateActiveLine(CodeMirror cm) {
- return () -> {
- // The rendering of active lines has to be deferred. Reflow
- // caused by adding and removing styles chokes Firefox when arrow
- // key (or j/k) is held down. Performance on Chrome is fine
- // without the deferral.
- //
- Scheduler.get()
- .scheduleDeferred(
- () -> {
- LineHandle handle = cm.getLineHandleVisualStart(cm.getCursor("end").line());
- cm.extras().activeLine(handle);
- });
- };
- }
-
- @Override
- CodeMirror getCmFromSide(DisplaySide side) {
- return cm;
- }
-
- @Override
- int getCmLine(int line, DisplaySide side) {
- return chunkManager.getCmLine(line, side);
- }
-
- LineRegionInfo getLineRegionInfoFromCmLine(int cmLine) {
- return chunkManager.getLineRegionInfoFromCmLine(cmLine);
- }
-
- @Override
- void operation(Runnable apply) {
- cm.operation(apply::run);
- }
-
- @Override
- CodeMirror[] getCms() {
- return new CodeMirror[] {cm};
- }
-
- @Override
- UnifiedTable getDiffTable() {
- return diffTable;
- }
-
- @Override
- UnifiedChunkManager getChunkManager() {
- return chunkManager;
- }
-
- @Override
- UnifiedCommentManager getCommentManager() {
- return commentManager;
- }
-
- @Override
- boolean isSideBySide() {
- return false;
- }
-
- @Override
- String getLineNumberClassName() {
- return UnifiedTable.style.unifiedLineNumber();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Unified.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Unified.ui.xml
deleted file mode 100644
index 85f46a6..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/Unified.ui.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:d='urn:import:com.google.gerrit.client.diff'>
- <ui:style>
- .unified {
- margin-left: -5px;
- margin-right: -5px;
- }
- </ui:style>
- <g:FlowPanel styleName='{style.unified}'>
- <d:Header ui:field='header'/>
- <d:UnifiedTable ui:field='diffTable'/>
- </g:FlowPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UnifiedChunkManager.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UnifiedChunkManager.java
deleted file mode 100644
index 98ad023..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UnifiedChunkManager.java
+++ /dev/null
@@ -1,330 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import static java.util.Comparator.comparing;
-
-import com.google.gerrit.client.diff.DiffInfo.Region;
-import com.google.gerrit.client.diff.DiffInfo.Span;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.NativeEvent;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.EventListener;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.List;
-import net.codemirror.lib.CodeMirror;
-import net.codemirror.lib.CodeMirror.LineClassWhere;
-import net.codemirror.lib.Configuration;
-import net.codemirror.lib.Pos;
-
-/** Colors modified regions for {@link Unified}. */
-class UnifiedChunkManager extends ChunkManager {
- private static final JavaScriptObject focus = initOnClick();
-
- private static native JavaScriptObject initOnClick() /*-{
- return $entry(function(e){
- @com.google.gerrit.client.diff.UnifiedChunkManager::focus(
- Lcom/google/gwt/dom/client/NativeEvent;)(e)
- });
- }-*/;
-
- private List<UnifiedDiffChunkInfo> chunks;
-
- @Override
- DiffChunkInfo getFirst() {
- return !chunks.isEmpty() ? chunks.get(0) : null;
- }
-
- private static void focus(NativeEvent event) {
- Element e = Element.as(event.getEventTarget());
- for (e = DOM.getParent(e); e != null; e = DOM.getParent(e)) {
- EventListener l = DOM.getEventListener(e);
- if (l instanceof Unified) {
- ((Unified) l).getCmFromSide(DisplaySide.A).focus();
- event.stopPropagation();
- }
- }
- }
-
- static void focusOnClick(Element e) {
- onClick(e, focus);
- }
-
- private final Unified host;
- private final CodeMirror cm;
-
- UnifiedChunkManager(Unified host, CodeMirror cm, Scrollbar scrollbar) {
- super(scrollbar);
-
- this.host = host;
- this.cm = cm;
- }
-
- @Override
- void render(DiffInfo diff) {
- super.render();
-
- chunks = new ArrayList<>();
-
- int cmLine = 0;
- boolean useIntralineBg = diff.metaA() == null || diff.metaB() == null;
-
- for (Region current : Natives.asList(diff.content())) {
- int origLineA = lineMapper.getLineA();
- int origLineB = lineMapper.getLineB();
- if (current.ab() != null) {
- int length = current.ab().length();
- lineMapper.appendCommon(length);
- for (int i = 0; i < length; i++) {
- host.setLineNumber(DisplaySide.A, cmLine + i, origLineA + i + 1);
- host.setLineNumber(DisplaySide.B, cmLine + i, origLineB + i + 1);
- }
- cmLine += length;
- } else if (current.skip() > 0) {
- lineMapper.appendCommon(current.skip());
- cmLine += current.skip(); // Maybe current.ab().length();
- } else if (current.common()) {
- lineMapper.appendCommon(current.b().length());
- cmLine += current.b().length();
- } else {
- cmLine += render(current, cmLine, useIntralineBg);
- }
- }
- host.setLineNumber(DisplaySide.A, cmLine, lineMapper.getLineA() + 1);
- host.setLineNumber(DisplaySide.B, cmLine, lineMapper.getLineB() + 1);
- }
-
- private int render(Region region, int cmLine, boolean useIntralineBg) {
- int startA = lineMapper.getLineA();
- int startB = lineMapper.getLineB();
-
- JsArrayString a = region.a();
- JsArrayString b = region.b();
- int aLen = a != null ? a.length() : 0;
- int bLen = b != null ? b.length() : 0;
- boolean insertOrDelete = a == null || b == null;
-
- colorLines(
- cm,
- insertOrDelete && !useIntralineBg
- ? UnifiedTable.style.diffDelete()
- : UnifiedTable.style.intralineDelete(),
- cmLine,
- aLen);
- colorLines(
- cm,
- insertOrDelete && !useIntralineBg
- ? UnifiedTable.style.diffInsert()
- : UnifiedTable.style.intralineInsert(),
- cmLine + aLen,
- bLen);
- markEdit(DisplaySide.A, cmLine, a, region.editA());
- markEdit(DisplaySide.B, cmLine + aLen, b, region.editB());
- addGutterTag(region, cmLine); // TODO: verify addGutterTag
- lineMapper.appendReplace(aLen, bLen);
-
- int endA = lineMapper.getLineA() - 1;
- int endB = lineMapper.getLineB() - 1;
- if (aLen > 0) {
- addDiffChunk(DisplaySide.A, endA, aLen, cmLine, bLen > 0);
- for (int j = 0; j < aLen; j++) {
- host.setLineNumber(DisplaySide.A, cmLine + j, startA + j + 1);
- host.setLineNumberEmpty(DisplaySide.B, cmLine + j);
- }
- }
- if (bLen > 0) {
- addDiffChunk(DisplaySide.B, endB, bLen, cmLine + aLen, aLen > 0);
- for (int j = 0; j < bLen; j++) {
- host.setLineNumberEmpty(DisplaySide.A, cmLine + aLen + j);
- host.setLineNumber(DisplaySide.B, cmLine + aLen + j, startB + j + 1);
- }
- }
- return aLen + bLen;
- }
-
- private void addGutterTag(Region region, int cmLine) {
- if (region.a() == null) {
- scrollbar.insert(cm, cmLine, region.b().length());
- } else if (region.b() == null) {
- scrollbar.delete(cm, cm, cmLine, region.a().length());
- } else {
- scrollbar.edit(cm, cmLine, region.b().length());
- }
- }
-
- private void markEdit(DisplaySide side, int startLine, JsArrayString lines, JsArray<Span> edits) {
- if (lines == null || edits == null) {
- return;
- }
-
- EditIterator iter = new EditIterator(lines, startLine);
- Configuration bg =
- Configuration.create().set("className", getIntralineBgFromSide(side)).set("readOnly", true);
-
- Configuration diff =
- Configuration.create().set("className", getDiffColorFromSide(side)).set("readOnly", true);
-
- Pos last = Pos.create(0, 0);
- for (Span span : Natives.asList(edits)) {
- Pos from = iter.advance(span.skip());
- Pos to = iter.advance(span.mark());
- if (from.line() == last.line()) {
- getMarkers().add(cm.markText(last, from, bg));
- } else {
- getMarkers().add(cm.markText(Pos.create(from.line(), 0), from, bg));
- }
- getMarkers().add(cm.markText(from, to, diff));
- last = to;
- colorLines(cm, LineClassWhere.BACKGROUND, getDiffColorFromSide(side), from.line(), to.line());
- }
- }
-
- private String getIntralineBgFromSide(DisplaySide side) {
- return side == DisplaySide.A
- ? UnifiedTable.style.intralineDelete()
- : UnifiedTable.style.intralineInsert();
- }
-
- private String getDiffColorFromSide(DisplaySide side) {
- return side == DisplaySide.A
- ? UnifiedTable.style.diffDelete()
- : UnifiedTable.style.diffInsert();
- }
-
- private void addDiffChunk(
- DisplaySide side, int chunkEnd, int chunkSize, int cmLine, boolean edit) {
- chunks.add(new UnifiedDiffChunkInfo(side, chunkEnd - chunkSize + 1, chunkEnd, cmLine, edit));
- }
-
- @Override
- Runnable diffChunkNav(CodeMirror cm, Direction dir) {
- return () -> {
- int line = cm.extras().hasActiveLine() ? cm.getLineNumber(cm.extras().activeLine()) : 0;
- int res =
- Collections.binarySearch(
- chunks,
- new UnifiedDiffChunkInfo(cm.side(), 0, 0, line, false),
- getDiffChunkComparatorCmLine());
- diffChunkNavHelper(chunks, host, res, dir);
- };
- }
-
- /** Diff chunks are ordered by their starting lines in CodeMirror */
- private Comparator<UnifiedDiffChunkInfo> getDiffChunkComparatorCmLine() {
- return comparing(UnifiedDiffChunkInfo::getCmLine);
- }
-
- @Override
- int getCmLine(int line, DisplaySide side) {
- int res =
- Collections.binarySearch(
- chunks,
- new UnifiedDiffChunkInfo(side, line, 0, 0, false), // Dummy DiffChunkInfo
- getDiffChunkComparator());
- if (res >= 0) {
- return chunks.get(res).getCmLine();
- }
- // The line might be within a DiffChunk
- res = -res - 1;
- if (res > 0) {
- UnifiedDiffChunkInfo info = chunks.get(res - 1);
- if (side == DisplaySide.A && info.isEdit() && info.getSide() == DisplaySide.B) {
- // Need to use the start and cmLine of the deletion chunk
- UnifiedDiffChunkInfo delete = chunks.get(res - 2);
- if (line <= delete.getEnd()) {
- return delete.getCmLine() + line - delete.getStart();
- }
- // Need to add the length of the insertion chunk
- return delete.getCmLine() + line - delete.getStart() + info.getEnd() - info.getStart() + 1;
- } else if (side == info.getSide()) {
- return info.getCmLine() + line - info.getStart();
- } else {
- return info.getCmLine() + lineMapper.lineOnOther(side, line).getLine() - info.getStart();
- }
- }
- return line;
- }
-
- LineRegionInfo getLineRegionInfoFromCmLine(int cmLine) {
- int res =
- Collections.binarySearch(
- chunks,
- new UnifiedDiffChunkInfo(DisplaySide.A, 0, 0, cmLine, false), // Dummy DiffChunkInfo
- getDiffChunkComparatorCmLine());
- if (res >= 0) { // The line is right at the start of a diff chunk.
- UnifiedDiffChunkInfo info = chunks.get(res);
- return new LineRegionInfo(info.getStart(), displaySideToRegionType(info.getSide()));
- }
- // The line might be within or after a diff chunk.
- res = -res - 1;
- if (res > 0) {
- UnifiedDiffChunkInfo info = chunks.get(res - 1);
- int lineOnInfoSide = info.getStart() + cmLine - info.getCmLine();
- if (lineOnInfoSide > info.getEnd()) { // After a diff chunk
- if (info.getSide() == DisplaySide.A) {
- // For the common region after a deletion chunk, associate the line
- // on side B with a common region.
- return new LineRegionInfo(
- lineMapper.lineOnOther(DisplaySide.A, lineOnInfoSide).getLine(), RegionType.COMMON);
- }
- return new LineRegionInfo(lineOnInfoSide, RegionType.COMMON);
- }
- // Within a diff chunk
- return new LineRegionInfo(lineOnInfoSide, displaySideToRegionType(info.getSide()));
- }
- // The line is before any diff chunk, so it always equals cmLine and
- // belongs to a common region.
- return new LineRegionInfo(cmLine, RegionType.COMMON);
- }
-
- enum RegionType {
- INSERT,
- DELETE,
- COMMON,
- }
-
- private static RegionType displaySideToRegionType(DisplaySide side) {
- return side == DisplaySide.A ? RegionType.DELETE : RegionType.INSERT;
- }
-
- /**
- * Helper class to associate a line in the original file with the type of the region it belongs
- * to.
- *
- * @field line The 0-based line number in the original file. Note that this might be different
- * from the line number shown in CodeMirror.
- * @field type The type of the region the line belongs to. Can be INSERT, DELETE or COMMON.
- */
- static class LineRegionInfo {
- final int line;
- final RegionType type;
-
- LineRegionInfo(int line, RegionType type) {
- this.line = line;
- this.type = type;
- }
-
- DisplaySide getSide() {
- // Always return DisplaySide.B for INSERT or COMMON
- return type == RegionType.DELETE ? DisplaySide.A : DisplaySide.B;
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UnifiedCommentGroup.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UnifiedCommentGroup.java
deleted file mode 100644
index 6d5fba3..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UnifiedCommentGroup.java
+++ /dev/null
@@ -1,88 +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.client.diff;
-
-import com.google.gwt.user.client.Timer;
-import net.codemirror.lib.CodeMirror;
-
-/**
- * LineWidget attached to a CodeMirror container.
- *
- * <p>When a comment is placed on a line a CommentWidget is created. The group tracks all comment
- * boxes on a line in unified diff view.
- */
-class UnifiedCommentGroup extends CommentGroup {
- UnifiedCommentGroup(UnifiedCommentManager manager, CodeMirror cm, DisplaySide side, int line) {
- super(manager, cm, side, line);
- }
-
- @Override
- void remove(DraftBox box) {
- super.remove(box);
-
- if (0 < getBoxCount()) {
- resize();
- } else {
- detach();
- }
- }
-
- @Override
- void init(DiffTable parent) {
- if (getLineWidget() == null) {
- attach(parent);
- }
- }
-
- @Override
- void handleRedraw() {
- getLineWidget()
- .onRedraw(
- () -> {
- if (canComputeHeight()) {
- if (getResizeTimer() != null) {
- getResizeTimer().cancel();
- setResizeTimer(null);
- }
- reportHeightChange();
- } else if (getResizeTimer() == null) {
- setResizeTimer(
- new Timer() {
- @Override
- public void run() {
- if (canComputeHeight()) {
- cancel();
- setResizeTimer(null);
- reportHeightChange();
- }
- }
- });
- getResizeTimer().scheduleRepeating(5);
- }
- });
- }
-
- @Override
- void resize() {
- if (getLineWidget() != null) {
- reportHeightChange();
- }
- }
-
- private void reportHeightChange() {
- getLineWidget().changed();
- updateSelection();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UnifiedCommentManager.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UnifiedCommentManager.java
deleted file mode 100644
index c92075f..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UnifiedCommentManager.java
+++ /dev/null
@@ -1,203 +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.client.diff;
-
-import com.google.gerrit.client.DiffObject;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.CommentInfo;
-import com.google.gerrit.client.diff.LineMapper.LineOnOtherInfo;
-import com.google.gerrit.client.diff.UnifiedChunkManager.LineRegionInfo;
-import com.google.gerrit.client.diff.UnifiedChunkManager.RegionType;
-import com.google.gerrit.client.ui.CommentLinkProcessor;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.SortedMap;
-import java.util.TreeMap;
-import net.codemirror.lib.CodeMirror;
-import net.codemirror.lib.Pos;
-import net.codemirror.lib.TextMarker.FromTo;
-
-/** Tracks comment widgets for {@link Unified}. */
-class UnifiedCommentManager extends CommentManager {
-
- private final SortedMap<Integer, CommentGroup> mergedMap;
-
- // In Unified, a CodeMirror line can have up to two CommentGroups - one for
- // the base side and one for the revision, so we need to keep track of the
- // duplicates and replace the entries in mergedMap on draft removal.
- private final Map<Integer, CommentGroup> duplicates;
-
- UnifiedCommentManager(
- Unified host,
- @Nullable Project.NameKey project,
- DiffObject base,
- PatchSet.Id revision,
- String path,
- CommentLinkProcessor clp,
- boolean open) {
- super(host, project, base, revision, path, clp, open);
- mergedMap = new TreeMap<>();
- duplicates = new HashMap<>();
- }
-
- @Override
- SortedMap<Integer, CommentGroup> getMapForNav(DisplaySide side) {
- return mergedMap;
- }
-
- @Override
- void clearLine(DisplaySide side, int line, CommentGroup group) {
- super.clearLine(side, line, group);
-
- if (mergedMap.get(line) == group) {
- mergedMap.remove(line);
- if (duplicates.containsKey(line)) {
- mergedMap.put(line, duplicates.remove(line));
- }
- }
- }
-
- @Override
- void newDraftOnGutterClick(CodeMirror cm, String gutterClass, int cmLinePlusOne) {
- if (!Gerrit.isSignedIn()) {
- signInCallback(cm).run();
- } else {
- LineRegionInfo info = ((Unified) host).getLineRegionInfoFromCmLine(cmLinePlusOne - 1);
- DisplaySide side =
- gutterClass.equals(UnifiedTable.style.lineNumbersLeft()) ? DisplaySide.A : DisplaySide.B;
- int line = info.line;
- if (info.getSide() != side) {
- line = host.lineOnOther(info.getSide(), line).getLine();
- }
- insertNewDraft(side, line + 1);
- }
- }
-
- @Override
- CommentGroup getCommentGroupOnActiveLine(CodeMirror cm) {
- CommentGroup group = null;
- if (cm.extras().hasActiveLine()) {
- int cmLinePlusOne = cm.getLineNumber(cm.extras().activeLine()) + 1;
- LineRegionInfo info = ((Unified) host).getLineRegionInfoFromCmLine(cmLinePlusOne - 1);
- CommentGroup forSide = map(info.getSide()).get(cmLinePlusOne);
- group = forSide == null ? map(info.getSide().otherSide()).get(cmLinePlusOne) : forSide;
- }
- return group;
- }
-
- @Override
- Collection<Integer> getLinesWithCommentGroups() {
- return mergedMap.tailMap(1).keySet();
- }
-
- @Override
- String getTokenSuffixForActiveLine(CodeMirror cm) {
- int cmLinePlusOne = cm.getLineNumber(cm.extras().activeLine()) + 1;
- LineRegionInfo info = ((Unified) host).getLineRegionInfoFromCmLine(cmLinePlusOne - 1);
- return (info.getSide() == DisplaySide.A ? "a" : "") + cmLinePlusOne;
- }
-
- @Override
- void newDraft(CodeMirror cm) {
- if (cm.somethingSelected()) {
- FromTo fromTo = adjustSelection(cm);
- Pos from = fromTo.from();
- Pos to = fromTo.to();
- Unified unified = (Unified) host;
- UnifiedChunkManager manager = unified.getChunkManager();
- LineRegionInfo fromInfo = unified.getLineRegionInfoFromCmLine(from.line());
- LineRegionInfo toInfo = unified.getLineRegionInfoFromCmLine(to.line());
- DisplaySide side = toInfo.getSide();
-
- // Handle special cases in selections that span multiple regions. Force
- // start line to be on the same side as the end line.
- if ((fromInfo.type == RegionType.INSERT || fromInfo.type == RegionType.COMMON)
- && toInfo.type == RegionType.DELETE) {
- LineOnOtherInfo infoOnSideA = manager.lineMapper.lineOnOther(DisplaySide.B, fromInfo.line);
- int startLineOnSideA = infoOnSideA.getLine();
- if (infoOnSideA.isAligned()) {
- from.line(startLineOnSideA);
- } else {
- from.line(startLineOnSideA + 1);
- }
- from.ch(0);
- to.line(toInfo.line);
- } else if (fromInfo.type == RegionType.DELETE && toInfo.type == RegionType.INSERT) {
- LineOnOtherInfo infoOnSideB = manager.lineMapper.lineOnOther(DisplaySide.A, fromInfo.line);
- int startLineOnSideB = infoOnSideB.getLine();
- if (infoOnSideB.isAligned()) {
- from.line(startLineOnSideB);
- } else {
- from.line(startLineOnSideB + 1);
- }
- from.ch(0);
- to.line(toInfo.line);
- } else if (fromInfo.type == RegionType.DELETE && toInfo.type == RegionType.COMMON) {
- int toLineOnSideA = manager.lineMapper.lineOnOther(DisplaySide.B, toInfo.line).getLine();
- from.line(fromInfo.line);
- // Force the end line to be on the same side as the start line.
- to.line(toLineOnSideA);
- side = DisplaySide.A;
- } else { // Common case
- from.line(fromInfo.line);
- to.line(toInfo.line);
- }
-
- addDraftBox(
- side,
- CommentInfo.create(
- getPath(),
- getStoredSideFromDisplaySide(side),
- to.line() + 1,
- CommentRange.create(fromTo),
- false))
- .setEdit(true);
- cm.setCursor(Pos.create(host.getCmLine(to.line(), side), to.ch()));
- cm.setSelection(cm.getCursor());
- } else {
- int cmLine = cm.getLineNumber(cm.extras().activeLine());
- LineRegionInfo info = ((Unified) host).getLineRegionInfoFromCmLine(cmLine);
- insertNewDraft(info.getSide(), cmLine + 1);
- }
- }
-
- @Override
- CommentGroup group(DisplaySide side, int cmLinePlusOne) {
- Map<Integer, CommentGroup> map = map(side);
- CommentGroup existing = map.get(cmLinePlusOne);
- if (existing != null) {
- return existing;
- }
-
- UnifiedCommentGroup g =
- new UnifiedCommentGroup(this, host.getCmFromSide(side), side, cmLinePlusOne);
- map.put(cmLinePlusOne, g);
- if (mergedMap.containsKey(cmLinePlusOne)) {
- duplicates.put(cmLinePlusOne, mergedMap.remove(cmLinePlusOne));
- }
- mergedMap.put(cmLinePlusOne, g);
-
- if (isAttached()) {
- g.init(host.getDiffTable());
- g.handleRedraw();
- }
-
- return g;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UnifiedDiffChunkInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UnifiedDiffChunkInfo.java
deleted file mode 100644
index dc827cb..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UnifiedDiffChunkInfo.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-public class UnifiedDiffChunkInfo extends DiffChunkInfo {
-
- private int cmLine;
-
- UnifiedDiffChunkInfo(DisplaySide side, int start, int end, int cmLine, boolean edit) {
- super(side, start, end, edit);
- this.cmLine = cmLine;
- }
-
- int getCmLine() {
- return cmLine;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UnifiedTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UnifiedTable.java
deleted file mode 100644
index 2d5df63..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UnifiedTable.java
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gerrit.client.DiffObject;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.user.client.ui.HTMLPanel;
-
-/**
- * A table with one row and one column to hold a unified CodeMirror displaying the files to be
- * compared.
- */
-class UnifiedTable extends DiffTable {
- interface Binder extends UiBinder<HTMLPanel, UnifiedTable> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- interface DiffTableStyle extends CssResource {
- String intralineInsert();
-
- String intralineDelete();
-
- String diffInsert();
-
- String diffDelete();
-
- String unifiedLineNumber();
-
- String unifiedLineNumberEmpty();
-
- String lineNumbersLeft();
-
- String lineNumbersRight();
- }
-
- private Unified parent;
- @UiField Element cm;
- @UiField static DiffTableStyle style;
-
- UnifiedTable(Unified parent, DiffObject base, DiffObject revision, String path) {
- super(parent, base, revision, path);
-
- initWidget(uiBinder.createAndBindUi(this));
- this.parent = parent;
- }
-
- @Override
- void setHideEmptyPane(boolean hide) {}
-
- @Override
- boolean isVisibleA() {
- return true;
- }
-
- @Override
- Unified getDiffScreen() {
- return parent;
- }
-
- @Override
- int getHeaderHeight() {
- int h = patchSetSelectBoxA.getOffsetHeight() + patchSetSelectBoxB.getOffsetHeight();
- if (hasHeader()) {
- h += diffHeaderRow.getOffsetHeight();
- }
- return h;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UnifiedTable.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UnifiedTable.ui.xml
deleted file mode 100644
index c2cefe4..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UnifiedTable.ui.xml
+++ /dev/null
@@ -1,152 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-Copyright (C) 2013 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.
--->
-<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:d='urn:import:com.google.gerrit.client.diff'>
- <ui:with field='res' type='com.google.gerrit.client.diff.Resources'/>
- <ui:style gss='false' type='com.google.gerrit.client.diff.UnifiedTable.DiffTableStyle'>
- @external .CodeMirror, .CodeMirror-selectedtext;
- @external .CodeMirror-vscrollbar .CodeMirror-scroll;
- @external .CodeMirror-dialog-bottom;
- @external .CodeMirror-cursor;
-
- @external .dark, .unifiedLineNumber, .noIntraline, .showLineNumbers;
-
- .difftable .patchSetNav,
- .difftable .CodeMirror {
- -webkit-touch-callout: none;
- -webkit-user-select: none;
- -khtml-user-select: none;
- -moz-user-select: none;
- -ms-user-select: none;
- }
-
- .difftable .CodeMirror pre {
- overflow: visible;
- border-right: 0;
- width: auto;
- }
-
- /* Preserve space for underscores. If this changes
- * see ChunkManager.addPadding() and adjust there.
- */
- .difftable .CodeMirror pre,
- .difftable .CodeMirror pre span {
- padding-bottom: 1px;
- }
- .table {
- width: 100%;
- table-layout: fixed;
- border-spacing: 0;
- }
- .table td { padding: 0 }
-
- /* Hide scrollbars. */
- .difftable .CodeMirror-scroll { padding-right: 0; }
- .difftable .CodeMirror-vscrollbar { display: none !important; }
-
- .diffDelete { background-color: #faa; }
- .diffInsert { background-color: #9f9; }
- .intralineDelete { background-color: #fee; }
- .intralineInsert { background-color: #dfd; }
- .noIntraline .intralineDelete { background-color: #faa; }
- .noIntraline .intralineInsert { background-color: #9f9; }
-
- .dark .diffDelete { background-color: #400; }
- .dark .diffInsert { background-color: #444; }
- .dark .intralineDelete { background-color: #888; }
- .dark .intralineInsert { background-color: #bbb; }
- .dark .noIntraline .intralineDelete { background-color: #400; }
- .dark .noIntraline .intralineInsert { background-color: #444; }
-
- .patchSetNav, .diff_header {
- background-color: #f7f7f7;
- line-height: 1;
- }
-
- .difftable .CodeMirror-selectedtext {
- background-color: inherit !important;
- }
- .difftable .CodeMirror div.CodeMirror-cursor {
- border-left: 2px solid black;
- }
- .difftable .CodeMirror-dialog-bottom {
- border-top: 0;
- border-left: 1px solid #000;
- border-bottom: 1px solid #000;
- background-color: #f7f7f7;
- top: 0;
- right: 0;
- bottom: auto;
- left: auto;
- }
- .showLineNumbers .lineNumbersLeft, .showLineNumbers .lineNumbersRight {
- min-width: 20px;
- width: 3em; /* TODO: This needs to be set based on number of lines */
- }
- .showLineNumbers .lineNumbersLeft {
- border-right: 1px solid #ddd;
- }
- .unifiedLineNumber {
- display: none;
- }
- .showLineNumbers .unifiedLineNumber {
- display: block;
- cursor: pointer;
- padding: 0 3px 0 5px;
- min-width: 20px;
- text-align: right;
- color: #999;
- }
- .unifiedLineNumberEmpty {
- display: none;
- }
- .showLineNumbers .unifiedLineNumberEmpty {
- display: block;
- margin-left: 28px;
- border-left: 2px solid #d64040;
- padding-bottom: 1px;
- }
- </ui:style>
- <g:HTMLPanel styleName='{style.difftable}'>
- <table class='{style.table}'>
- <tr ui:field='patchSetNavRow' class='{style.patchSetNav}'>
- <td>
- <table class='{style.table}'>
- <tr>
- <td ui:field='patchSetNavCellA'>
- <d:PatchSetSelectBox ui:field='patchSetSelectBoxA' />
- </td>
- </tr>
- <tr>
- <td ui:field='patchSetNavCellB'>
- <d:PatchSetSelectBox ui:field='patchSetSelectBoxB' />
- </td>
- </tr>
- </table>
- </td>
- </tr>
- <tr ui:field='diffHeaderRow' class='{res.diffTableStyle.diffHeader}'>
- <td><pre ui:field='diffHeaderText' /></td>
- </tr>
- <tr>
- <td ui:field='cm'/>
- </tr>
- </table>
- <g:FlowPanel ui:field='widgets' visible='false'/>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UpToChangeCommand.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UpToChangeCommand.java
deleted file mode 100644
index 50ef0d7..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/UpToChangeCommand.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (C) 2013 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.client.diff;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.patches.PatchUtil;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwtexpui.globalkey.client.KeyCommand;
-
-class UpToChangeCommand extends KeyCommand {
- private final PatchSet.Id revision;
- @Nullable private final Project.NameKey project;
-
- UpToChangeCommand(@Nullable Project.NameKey project, PatchSet.Id revision, int mask, int key) {
- super(mask, key, PatchUtil.C.upToChange());
- this.revision = revision;
- this.project = project;
- }
-
- @Override
- public void onKeyPress(KeyPressEvent event) {
- Gerrit.display(PageLinks.toChange(project, revision.getParentKey(), revision.getId()));
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/goNext.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/goNext.png
deleted file mode 100644
index 872c197..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/goNext.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/goPrev.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/goPrev.png
deleted file mode 100644
index d68f29b..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/goPrev.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/goUp.png b/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/goUp.png
deleted file mode 100644
index f75bed4..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/diff/goUp.png
+++ /dev/null
Binary files differ
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocConstants.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocConstants.java
deleted file mode 100644
index 2958783..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocConstants.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) 2013 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.client.documentation;
-
-import com.google.gwt.i18n.client.Constants;
-
-public interface DocConstants extends Constants {
- String keyReloadSearch();
-
- String docItemHelp();
-
- String docTableColumnTitle();
-
- String docTableNone();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocConstants.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocConstants.properties
deleted file mode 100644
index b48c507..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocConstants.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-keyReloadSearch = Reload documentation list
-
-docItemHelp = documentation
-docTableColumnTitle = Title
-docTableNone = (None)
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocInfo.java
deleted file mode 100644
index 5fcb6b0..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocInfo.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (C) 2013 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.client.documentation;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class DocInfo extends JavaScriptObject {
-
- public final native String title() /*-{ return this.title; }-*/;
-
- public final native String url() /*-{ return this.url; }-*/;
-
- public static DocInfo create() {
- return (DocInfo) createObject();
- }
-
- protected DocInfo() {}
-
- public final String getFullUrl() {
- return GWT.getHostPageBaseURL() + url();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocMessages.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocMessages.java
deleted file mode 100644
index 7d76f7b..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocMessages.java
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (C) 2013 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.client.documentation;
-
-import com.google.gwt.i18n.client.Messages;
-
-public interface DocMessages extends Messages {
- String docQueryWindowTitle(String query);
-
- String docQueryPageTitle(String query);
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocMessages.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocMessages.properties
deleted file mode 100644
index 8810a4a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocMessages.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-docQueryWindowTitle = {0}
-docQueryPageTitle = Search for {0} in documentation
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocScreen.java
deleted file mode 100644
index 0a87d29..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocScreen.java
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (C) 2013 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.client.documentation;
-
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.client.ui.Screen;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwtorm.client.KeyUtil;
-
-public class DocScreen extends Screen {
- private static final String URI = "/Documentation/";
-
- private DocTable table;
- private final String query;
-
- public DocScreen(String query) {
- this.query = KeyUtil.decode(query);
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
-
- table = new DocTable();
- table.setSavePointerId(query);
- add(table);
-
- setWindowTitle(Util.M.docQueryWindowTitle(query));
- setPageTitle(Util.M.docQueryPageTitle(query));
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- doQuery();
- }
-
- @Override
- public void registerKeys() {
- super.registerKeys();
- table.setRegisterKeys(true);
- }
-
- private AsyncCallback<JsArray<DocInfo>> loadCallback() {
- return new GerritCallback<JsArray<DocInfo>>() {
- @Override
- public void onSuccess(JsArray<DocInfo> result) {
- displayResults(result);
- display();
- }
- };
- }
-
- private void displayResults(JsArray<DocInfo> result) {
- table.display(result);
- table.finishDisplay();
- }
-
- private void doQuery() {
- RestApi call = new RestApi(URI);
- call.addParameterRaw("q", KeyUtil.encode(query));
- call.get(loadCallback());
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocTable.java
deleted file mode 100644
index 677c2bf..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/DocTable.java
+++ /dev/null
@@ -1,126 +0,0 @@
-// Copyright (C) 2013 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.client.documentation;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.ui.NavigationTable;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
-import com.google.gwt.user.client.ui.HTMLTable.Cell;
-import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
-
-class DocTable extends NavigationTable<DocInfo> {
- private static final int C_TITLE = 1;
-
- private int rows;
- private int dataBeginRow;
-
- DocTable() {
- super(Util.C.docItemHelp());
-
- table.setText(0, C_TITLE, Util.C.docTableColumnTitle());
-
- FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(0, C_TITLE, Gerrit.RESOURCES.css().dataHeader());
-
- table.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- Cell cell = table.getCellForEvent(event);
- if (cell == null) {
- return;
- }
- if (getRowItem(cell.getRowIndex()) != null) {
- movePointerTo(cell.getRowIndex());
- }
- }
- });
- }
-
- @Override
- protected Object getRowItemKey(DocInfo item) {
- return item.url();
- }
-
- @Override
- protected void onOpenRow(int row) {
- DocInfo d = getRowItem(row);
- Window.Location.assign(d.getFullUrl());
- }
-
- private void insertNoneRow(int row) {
- table.insertRow(row);
- table.setText(row, 0, Util.C.docTableNone());
- FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.setStyleName(row, 0, Gerrit.RESOURCES.css().emptySection());
- }
-
- private void insertDocRow(int row) {
- table.insertRow(row);
- applyDataRowStyle(row);
- }
-
- @Override
- protected void applyDataRowStyle(int row) {
- super.applyDataRowStyle(row);
- CellFormatter fmt = table.getCellFormatter();
- fmt.addStyleName(row, C_TITLE, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, C_TITLE, Gerrit.RESOURCES.css().cSUBJECT());
- }
-
- private void populateDocRow(int row, DocInfo d) {
- table.setWidget(row, C_TITLE, new DocLink(d));
- setRowItem(row, d);
- }
-
- public void display(JsArray<DocInfo> docList) {
- int sz = docList != null ? docList.length() : 0;
- boolean hadData = rows > 0;
-
- if (hadData) {
- while (sz < rows) {
- table.removeRow(dataBeginRow);
- rows--;
- }
- } else {
- table.removeRow(dataBeginRow);
- }
-
- if (sz == 0) {
- insertNoneRow(dataBeginRow);
- return;
- }
-
- while (rows < sz) {
- insertDocRow(dataBeginRow + rows);
- rows++;
- }
- for (int i = 0; i < sz; i++) {
- populateDocRow(dataBeginRow + i, docList.get(i));
- }
- }
-
- public static class DocLink extends Anchor {
- DocLink(DocInfo d) {
- super(com.google.gerrit.client.changes.Util.cropSubject(d.title()));
- setHref(d.getFullUrl());
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/Util.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/Util.java
deleted file mode 100644
index 273ead8..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/documentation/Util.java
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (C) 2013 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.client.documentation;
-
-import com.google.gwt.core.client.GWT;
-
-public class Util {
- public static final DocConstants C = GWT.create(DocConstants.class);
- public static final DocMessages M = GWT.create(DocMessages.class);
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadCommandLink.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadCommandLink.java
deleted file mode 100644
index 2b09175..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadCommandLink.java
+++ /dev/null
@@ -1,60 +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.google.gerrit.client.download;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.info.DownloadInfo.DownloadCommandInfo;
-import com.google.gwt.aria.client.Roles;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.clippy.client.CopyableLabel;
-
-public class DownloadCommandLink extends Anchor implements ClickHandler {
- private final CopyableLabel copyLabel;
- private final String command;
-
- public DownloadCommandLink(CopyableLabel copyLabel, DownloadCommandInfo commandInfo) {
- super(commandInfo.name());
- this.copyLabel = copyLabel;
- this.command = commandInfo.command();
-
- setStyleName(Gerrit.RESOURCES.css().downloadLink());
- Roles.getTabRole().set(getElement());
- addClickHandler(this);
- }
-
- @Override
- public void onClick(ClickEvent event) {
- event.preventDefault();
- event.stopPropagation();
-
- select();
- }
-
- void select() {
- copyLabel.setText(command);
-
- DownloadCommandPanel parent = (DownloadCommandPanel) getParent();
- for (Widget w : parent) {
- if (w != this && w instanceof DownloadCommandLink) {
- w.removeStyleName(Gerrit.RESOURCES.css().downloadLink_Active());
- }
- }
- parent.setCurrentCommand(this);
- addStyleName(Gerrit.RESOURCES.css().downloadLink_Active());
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadCommandPanel.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadCommandPanel.java
deleted file mode 100644
index 20cf3f3..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadCommandPanel.java
+++ /dev/null
@@ -1,60 +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.google.gerrit.client.download;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gwt.aria.client.Roles;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Widget;
-
-public class DownloadCommandPanel extends FlowPanel {
- private DownloadCommandLink currentCommand;
-
- public DownloadCommandPanel() {
- setStyleName(Gerrit.RESOURCES.css().downloadLinkList());
- Roles.getTablistRole().set(getElement());
- }
-
- public boolean isEmpty() {
- return getWidgetCount() == 0;
- }
-
- public void select() {
- DownloadCommandLink first = null;
-
- for (Widget w : this) {
- if (w instanceof DownloadCommandLink) {
- DownloadCommandLink d = (DownloadCommandLink) w;
- if (currentCommand != null && d.getText().equals(currentCommand.getText())) {
- d.select();
- return;
- }
- if (first == null) {
- first = d;
- }
- }
- }
-
- // If none matched the requested type, select the first in the
- // group as that will at least give us an initial baseline.
- if (first != null) {
- first.select();
- }
- }
-
- void setCurrentCommand(DownloadCommandLink cmd) {
- currentCommand = cmd;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadPanel.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadPanel.java
deleted file mode 100644
index b881505..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadPanel.java
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright (C) 2008 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.client.download;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.info.DownloadInfo.DownloadCommandInfo;
-import com.google.gerrit.client.info.DownloadInfo.DownloadSchemeInfo;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.InlineLabel;
-import com.google.gwtexpui.clippy.client.CopyableLabel;
-import java.util.List;
-
-public abstract class DownloadPanel extends FlowPanel {
- protected final String project;
-
- private final DownloadCommandPanel commands = new DownloadCommandPanel();
- private final DownloadUrlPanel urls = new DownloadUrlPanel();
- private final CopyableLabel copyLabel = new CopyableLabel("");
-
- public DownloadPanel(String project, boolean allowAnonymous) {
- this.project = project;
- copyLabel.setStyleName(Gerrit.RESOURCES.css().downloadLinkCopyLabel());
- urls.add(DownloadUrlLink.createDownloadUrlLinks(allowAnonymous, this));
-
- setupWidgets();
- }
-
- private void setupWidgets() {
- if (!urls.isEmpty()) {
- urls.select(Gerrit.getUserPreferences().downloadScheme());
-
- FlowPanel p = new FlowPanel();
- p.setStyleName(Gerrit.RESOURCES.css().downloadLinkHeader());
- p.add(commands);
- final InlineLabel glue = new InlineLabel();
- glue.setStyleName(Gerrit.RESOURCES.css().downloadLinkHeaderGap());
- p.add(glue);
- p.add(urls);
-
- add(p);
- add(copyLabel);
- }
- }
-
- void populateDownloadCommandLinks(DownloadSchemeInfo schemeInfo) {
- commands.clear();
- for (DownloadCommandInfo cmd : getCommands(schemeInfo)) {
- commands.add(new DownloadCommandLink(copyLabel, cmd));
- }
- commands.select();
- }
-
- protected abstract List<DownloadCommandInfo> getCommands(DownloadSchemeInfo schemeInfo);
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadUrlLink.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadUrlLink.java
deleted file mode 100644
index 76e7d7c..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadUrlLink.java
+++ /dev/null
@@ -1,102 +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.google.gerrit.client.download;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.account.AccountApi;
-import com.google.gerrit.client.info.DownloadInfo.DownloadSchemeInfo;
-import com.google.gerrit.client.info.GeneralPreferences;
-import com.google.gwt.aria.client.Roles;
-import com.google.gwt.core.client.JavaScriptObject;
-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.Anchor;
-import com.google.gwt.user.client.ui.Widget;
-import java.util.ArrayList;
-import java.util.List;
-
-public class DownloadUrlLink extends Anchor implements ClickHandler {
- public static List<DownloadUrlLink> createDownloadUrlLinks(
- boolean allowAnonymous, DownloadPanel downloadPanel) {
- List<DownloadUrlLink> urls = new ArrayList<>();
- for (String s : Gerrit.info().download().schemes()) {
- DownloadSchemeInfo scheme = Gerrit.info().download().scheme(s);
- if (scheme.isAuthRequired() && !allowAnonymous) {
- continue;
- }
- urls.add(new DownloadUrlLink(downloadPanel, scheme, s));
- }
- return urls;
- }
-
- private final DownloadPanel downloadPanel;
- private final DownloadSchemeInfo schemeInfo;
- private final String schemeName;
-
- public DownloadUrlLink(
- DownloadPanel downloadPanel, DownloadSchemeInfo schemeInfo, String schemeName) {
- super(schemeName);
- setStyleName(Gerrit.RESOURCES.css().downloadLink());
- Roles.getTabRole().set(getElement());
- addClickHandler(this);
-
- this.downloadPanel = downloadPanel;
- this.schemeInfo = schemeInfo;
- this.schemeName = schemeName;
- }
-
- public String getSchemeName() {
- return schemeName;
- }
-
- @Override
- public void onClick(ClickEvent event) {
- event.preventDefault();
- event.stopPropagation();
-
- select();
-
- GeneralPreferences prefs = Gerrit.getUserPreferences();
- if (Gerrit.isSignedIn() && !schemeName.equals(prefs.downloadScheme())) {
- prefs.downloadScheme(schemeName);
- GeneralPreferences in = GeneralPreferences.create();
- in.downloadScheme(schemeName);
- AccountApi.self()
- .view("preferences")
- .put(
- in,
- new AsyncCallback<JavaScriptObject>() {
- @Override
- public void onSuccess(JavaScriptObject result) {}
-
- @Override
- public void onFailure(Throwable caught) {}
- });
- }
- }
-
- void select() {
- downloadPanel.populateDownloadCommandLinks(schemeInfo);
-
- DownloadUrlPanel parent = (DownloadUrlPanel) getParent();
- for (Widget w : parent) {
- if (w != this && w instanceof DownloadUrlLink) {
- w.removeStyleName(Gerrit.RESOURCES.css().downloadLink_Active());
- }
- }
- addStyleName(Gerrit.RESOURCES.css().downloadLink_Active());
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadUrlPanel.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadUrlPanel.java
deleted file mode 100644
index 6a5fbe4..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/download/DownloadUrlPanel.java
+++ /dev/null
@@ -1,62 +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.google.gerrit.client.download;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gwt.aria.client.Roles;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Widget;
-import java.util.Collection;
-
-public class DownloadUrlPanel extends FlowPanel {
-
- public DownloadUrlPanel() {
- setStyleName(Gerrit.RESOURCES.css().downloadLinkList());
- Roles.getTablistRole().set(getElement());
- }
-
- public boolean isEmpty() {
- return getWidgetCount() == 0;
- }
-
- public void select(String schemeName) {
- DownloadUrlLink first = null;
-
- for (Widget w : this) {
- if (w instanceof DownloadUrlLink) {
- final DownloadUrlLink d = (DownloadUrlLink) w;
- if (first == null) {
- first = d;
- }
- if (d.getSchemeName().equals(schemeName)) {
- d.select();
- return;
- }
- }
- }
-
- // If none matched the requested type, select the first in the
- // group as that will at least give us an initial baseline.
- if (first != null) {
- first.select();
- }
- }
-
- public void add(Collection<DownloadUrlLink> links) {
- for (Widget link : links) {
- add(link);
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditConstants.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditConstants.java
deleted file mode 100644
index b70c209..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditConstants.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (C) 2015 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.client.editor;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.i18n.client.Constants;
-
-interface EditConstants extends Constants {
- EditConstants I = GWT.create(EditConstants.class);
-
- String closeUnsavedChanges();
-
- String cancelUnsavedChanges();
-
- String gotoLineNumber();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditConstants.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditConstants.properties
deleted file mode 100644
index 2e8a087..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditConstants.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-closeUnsavedChanges = Unsaved changes were made to this file.
-
-cancelUnsavedChanges = Unsaved changes were made to this file.\n\
- \n\
- Discard unsaved changes?
-
-gotoLineNumber = Go to Line:
\ No newline at end of file
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditFileInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditFileInfo.java
deleted file mode 100644
index 3f9d732..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditFileInfo.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (C) 2015 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.client.editor;
-
-import com.google.gerrit.client.DiffWebLinkInfo;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-
-public class EditFileInfo extends JavaScriptObject {
- public final native JsArray<DiffWebLinkInfo> webLinks() /*-{ return this.web_links; }-*/;
-
- protected EditFileInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditPreferencesAction.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditPreferencesAction.java
deleted file mode 100644
index e11ded0..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditPreferencesAction.java
+++ /dev/null
@@ -1,71 +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.client.editor;
-
-import com.google.gerrit.client.account.EditPreferences;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.PopupPanel.PositionCallback;
-
-class EditPreferencesAction {
- private final EditScreen view;
- private final EditPreferences prefs;
- private PopupPanel popup;
- private EditPreferencesBox current;
-
- EditPreferencesAction(EditScreen view, EditPreferences prefs) {
- this.view = view;
- this.prefs = prefs;
- }
-
- void show() {
- if (popup != null) {
- hide();
- return;
- }
-
- current = new EditPreferencesBox(view);
- current.set(prefs);
-
- popup = new PopupPanel(true, false);
- popup.setStyleName(current.style.dialog());
- popup.add(current);
- popup.addCloseHandler(
- new CloseHandler<PopupPanel>() {
- @Override
- public void onClose(CloseEvent<PopupPanel> event) {
- view.getEditor().focus();
- popup = null;
- current = null;
- }
- });
- popup.setPopupPositionAndShow(
- new PositionCallback() {
- @Override
- public void setPosition(int offsetWidth, int offsetHeight) {
- popup.setPopupPosition(300, 120);
- }
- });
- }
-
- void hide() {
- if (popup != null) {
- popup.hide();
- popup = null;
- current = null;
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditPreferencesBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditPreferencesBox.java
deleted file mode 100644
index 5157123..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditPreferencesBox.java
+++ /dev/null
@@ -1,333 +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.client.editor;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.account.AccountApi;
-import com.google.gerrit.client.account.EditPreferences;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.ui.NpIntTextBox;
-import com.google.gerrit.extensions.client.EditPreferencesInfo;
-import com.google.gerrit.extensions.client.KeyMapType;
-import com.google.gerrit.extensions.client.Theme;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.Style.Visibility;
-import com.google.gwt.event.dom.client.ChangeEvent;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.logical.shared.ValueChangeEvent;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.ListBox;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.ToggleButton;
-import com.google.gwt.user.client.ui.UIObject;
-import net.codemirror.theme.ThemeLoader;
-
-/** Displays current edit preferences. */
-public class EditPreferencesBox extends Composite {
- interface Binder extends UiBinder<HTMLPanel, EditPreferencesBox> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- public interface Style extends CssResource {
- String dialog();
- }
-
- private final EditScreen view;
- private EditPreferences prefs;
-
- @UiField Style style;
- @UiField Element header;
- @UiField Anchor close;
- @UiField NpIntTextBox tabWidth;
- @UiField NpIntTextBox lineLength;
- @UiField NpIntTextBox indentUnit;
- @UiField NpIntTextBox cursorBlinkRate;
- @UiField ToggleButton topMenu;
- @UiField ToggleButton syntaxHighlighting;
- @UiField ToggleButton showTabs;
- @UiField ToggleButton whitespaceErrors;
- @UiField ToggleButton lineNumbers;
- @UiField ToggleButton matchBrackets;
- @UiField ToggleButton lineWrapping;
- @UiField ToggleButton indentWithTabs;
- @UiField ToggleButton autoCloseBrackets;
- @UiField ToggleButton showBase;
- @UiField ListBox theme;
- @UiField ListBox keyMap;
- @UiField Button apply;
- @UiField Button save;
-
- public EditPreferencesBox(EditScreen view) {
- this.view = view;
- initWidget(uiBinder.createAndBindUi(this));
- initTheme();
- initKeyMapType();
-
- if (view == null) {
- UIObject.setVisible(header, false);
- apply.getElement().getStyle().setVisibility(Visibility.HIDDEN);
- }
- }
-
- public Style getStyle() {
- return style;
- }
-
- public void set(EditPreferences prefs) {
- this.prefs = prefs;
-
- tabWidth.setIntValue(prefs.tabSize());
- lineLength.setIntValue(prefs.lineLength());
- indentUnit.setIntValue(prefs.indentUnit());
- cursorBlinkRate.setIntValue(prefs.cursorBlinkRate());
- topMenu.setValue(!prefs.hideTopMenu());
- syntaxHighlighting.setValue(prefs.syntaxHighlighting());
- showTabs.setValue(prefs.showTabs());
- whitespaceErrors.setValue(prefs.showWhitespaceErrors());
- lineNumbers.setValue(prefs.hideLineNumbers());
- matchBrackets.setValue(prefs.matchBrackets());
- lineWrapping.setValue(prefs.lineWrapping());
- indentWithTabs.setValue(prefs.indentWithTabs());
- autoCloseBrackets.setValue(prefs.autoCloseBrackets());
- showBase.setValue(prefs.showBase());
- setTheme(prefs.theme());
- setKeyMapType(prefs.keyMapType());
- }
-
- @UiHandler("tabWidth")
- void onTabWidth(ValueChangeEvent<String> e) {
- String v = e.getValue();
- if (v != null && v.length() > 0) {
- prefs.tabSize(Math.max(1, Integer.parseInt(v)));
- if (view != null) {
- view.setOption("tabSize", v);
- }
- }
- }
-
- @UiHandler("lineLength")
- void onLineLength(ValueChangeEvent<String> e) {
- String v = e.getValue();
- if (v != null && v.length() > 0) {
- prefs.lineLength(Math.max(1, Integer.parseInt(v)));
- if (view != null) {
- view.setLineLength(prefs.lineLength());
- }
- }
- }
-
- @UiHandler("indentUnit")
- void onIndentUnit(ValueChangeEvent<String> e) {
- String v = e.getValue();
- if (v != null && v.length() > 0) {
- prefs.indentUnit(Math.max(0, Integer.parseInt(v)));
- if (view != null) {
- view.setIndentUnit(prefs.indentUnit());
- }
- }
- }
-
- @UiHandler("cursorBlinkRate")
- void onCursoBlinkRate(ValueChangeEvent<String> e) {
- String v = e.getValue();
- if (v != null && v.length() > 0) {
- // A negative value hides the cursor entirely:
- // don't let user shoot himself in the foot.
- prefs.cursorBlinkRate(Math.max(0, Integer.parseInt(v)));
- if (view != null) {
- view.setOption("cursorBlinkRate", prefs.cursorBlinkRate());
- }
- }
- }
-
- @UiHandler("topMenu")
- void onTopMenu(ValueChangeEvent<Boolean> e) {
- prefs.hideTopMenu(!e.getValue());
- if (view != null) {
- Gerrit.setHeaderVisible(!prefs.hideTopMenu());
- view.adjustHeight();
- }
- }
-
- @UiHandler("showTabs")
- void onShowTabs(ValueChangeEvent<Boolean> e) {
- prefs.showTabs(e.getValue());
- if (view != null) {
- view.setShowTabs(prefs.showTabs());
- }
- }
-
- @UiHandler("whitespaceErrors")
- void onshowTrailingSpace(ValueChangeEvent<Boolean> e) {
- prefs.showWhitespaceErrors(e.getValue());
- if (view != null) {
- view.setShowWhitespaceErrors(prefs.showWhitespaceErrors());
- }
- }
-
- @UiHandler("lineNumbers")
- void onLineNumbers(ValueChangeEvent<Boolean> e) {
- prefs.hideLineNumbers(e.getValue());
- if (view != null) {
- view.setShowLineNumbers(prefs.hideLineNumbers());
- }
- }
-
- @UiHandler("syntaxHighlighting")
- void onSyntaxHighlighting(ValueChangeEvent<Boolean> e) {
- prefs.syntaxHighlighting(e.getValue());
- if (view != null) {
- view.setSyntaxHighlighting(prefs.syntaxHighlighting());
- }
- }
-
- @UiHandler("matchBrackets")
- void onMatchBrackets(ValueChangeEvent<Boolean> e) {
- prefs.matchBrackets(e.getValue());
- if (view != null) {
- view.setOption("matchBrackets", prefs.matchBrackets());
- }
- }
-
- @UiHandler("lineWrapping")
- void onLineWrapping(ValueChangeEvent<Boolean> e) {
- prefs.lineWrapping(e.getValue());
- if (view != null) {
- view.getEditor().setOption("lineWrapping", prefs.lineWrapping());
- }
- }
-
- @UiHandler("indentWithTabs")
- void onIndentWithTabs(ValueChangeEvent<Boolean> e) {
- prefs.indentWithTabs(e.getValue());
- if (view != null) {
- view.getEditor().setOption("indentWithTabs", prefs.indentWithTabs());
- }
- }
-
- @UiHandler("autoCloseBrackets")
- void onCloseBrackets(ValueChangeEvent<Boolean> e) {
- prefs.autoCloseBrackets(e.getValue());
- if (view != null) {
- view.getEditor().setOption("autoCloseBrackets", prefs.autoCloseBrackets());
- }
- }
-
- @UiHandler("showBase")
- void onShowBase(ValueChangeEvent<Boolean> e) {
- Boolean value = e.getValue();
- prefs.showBase(value);
- if (view != null) {
- view.showBase.setValue(value, true);
- }
- }
-
- @UiHandler("theme")
- void onTheme(@SuppressWarnings("unused") ChangeEvent e) {
- final Theme newTheme = Theme.valueOf(theme.getValue(theme.getSelectedIndex()));
- prefs.theme(newTheme);
- if (view != null) {
- ThemeLoader.loadTheme(
- newTheme,
- new GerritCallback<Void>() {
- @Override
- public void onSuccess(Void result) {
- view.setTheme(newTheme);
- }
- });
- }
- }
-
- @UiHandler("keyMap")
- void onKeyMap(@SuppressWarnings("unused") ChangeEvent e) {
- KeyMapType keyMapType = KeyMapType.valueOf(keyMap.getValue(keyMap.getSelectedIndex()));
- prefs.keyMapType(keyMapType);
- if (view != null) {
- view.setOption("keyMap", keyMapType.name().toLowerCase());
- }
- }
-
- @UiHandler("apply")
- void onApply(@SuppressWarnings("unused") ClickEvent e) {
- close();
- }
-
- @UiHandler("save")
- void onSave(@SuppressWarnings("unused") ClickEvent e) {
- AccountApi.putEditPreferences(
- prefs,
- new GerritCallback<EditPreferences>() {
- @Override
- public void onSuccess(EditPreferences p) {
- Gerrit.setEditPreferences(p.copyTo(new EditPreferencesInfo()));
- }
- });
- if (view != null) {
- close();
- }
- }
-
- @UiHandler("close")
- void onClose(ClickEvent e) {
- e.preventDefault();
- close();
- }
-
- private void close() {
- ((PopupPanel) getParent()).hide();
- }
-
- private void setTheme(Theme v) {
- String name = v != null ? v.name() : Theme.DEFAULT.name();
- for (int i = 0; i < theme.getItemCount(); i++) {
- if (theme.getValue(i).equals(name)) {
- theme.setSelectedIndex(i);
- return;
- }
- }
- theme.setSelectedIndex(0);
- }
-
- private void initTheme() {
- for (Theme t : Theme.values()) {
- theme.addItem(t.name().toLowerCase(), t.name());
- }
- }
-
- private void setKeyMapType(KeyMapType v) {
- String name = v != null ? v.name() : KeyMapType.DEFAULT.name();
- for (int i = 0; i < keyMap.getItemCount(); i++) {
- if (keyMap.getValue(i).equals(name)) {
- keyMap.setSelectedIndex(i);
- return;
- }
- }
- keyMap.setSelectedIndex(0);
- }
-
- private void initKeyMapType() {
- for (KeyMapType t : KeyMapType.values()) {
- keyMap.addItem(t.name().toLowerCase(), t.name());
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditPreferencesBox.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditPreferencesBox.ui.xml
deleted file mode 100644
index f5ec71e..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditPreferencesBox.ui.xml
+++ /dev/null
@@ -1,282 +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.
--->
-<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'
- xmlns:x='urn:import:com.google.gerrit.client.ui'>
- <ui:style type='com.google.gerrit.client.editor.EditPreferencesBox.Style'>
- @external .gwt-TextBox;
- @external .gwt-ToggleButton .html-face;
- @external .gwt-ToggleButton-up;
- @external .gwt-ToggleButton-up-hovering;
- @external .gwt-ToggleButton-up-disabled;
- @external .gwt-ToggleButton-down;
- @external .gwt-ToggleButton-down-hovering;
- @external .gwt-ToggleButton-down-disabled;
-
- .dialog {
- background: rgba(0, 0, 0, 0.85) none repeat scroll 0 50%;
- color: #ffffff;
- font-family: arial,sans-serif;
- font-weight: bold;
- overflow: auto !important;
- bottom: 0;
- text-align: left;
- text-shadow: 1px 1px 7px #000000;
- min-width: 300px;
- z-index: 200;
- border-radius: 10px;
- }
-
- @if user.agent safari {
- .dialog {
- \-webkit-border-radius: 10px;
- }
- }
-
- @if user.agent gecko1_8 {
- .dialog {
- \-moz-border-radius: 10px;
- }
- }
-
- .box { margin: 10px; }
- .box .gwt-TextBox { padding: 0; }
- .context { vertical-align: bottom; }
-
- .table tr { min-height: 23px; }
- .table th,
- .table td {
- white-space: nowrap;
- color: #ffffff;
- }
- .table th {
- padding-right: 8px;
- text-align: right;
- }
-
- .box a,
- .box a:visited,
- .box a:hover {
- color: #dddd00;
- }
-
- .box .gwt-ToggleButton {
- position: relative;
- height: 19px;
- width: 140px;
- background: #fff;
- color: #000;
- text-shadow: none;
- }
- .box .gwt-ToggleButton .html-face {
- position: absolute;
- top: 0;
- width: 68px;
- height: 17px;
- line-height: 17px;
- text-align: center;
- border-width: 1px;
- }
-
- .box .gwt-ToggleButton-up,
- .box .gwt-ToggleButton-up-hovering,
- .box .gwt-ToggleButton-up-disabled,
- .box .gwt-ToggleButton-down,
- .box .gwt-ToggleButton-down-hovering,
- .box .gwt-ToggleButton-down-disabled {
- padding: 0;
- border: 0;
- }
- .box .gwt-ToggleButton-up .html-face,
- .box .gwt-ToggleButton-up-hovering .html-face {
- left: 0;
- background: #cacaca;
- border-style: outset;
- }
- .box .gwt-ToggleButton-down .html-face,
- .box .gwt-ToggleButton-down-hovering .html-face {
- right: 0;
- background: #bcf;
- border-style: inset;
- }
-
- .box button {
- margin: 6px 3px 0 0;
- border-color: rgba(0, 0, 0, 0.1);
- text-align: center;
- font-size: 8pt;
- font-weight: bold;
- border: 1px solid;
- cursor: pointer;
- color: #444;
- background-color: #f5f5f5;
- background-image: -webkit-linear-gradient(top, #f5f5f5, #f1f1f1);
- -webkit-border-radius: 2px;
- -webkit-box-sizing: content-box;
- }
- .box button div {
- color: #444;
- height: 10px;
- min-width: 54px;
- line-height: 10px;
- white-space: nowrap;
- }
-
- button.apply {
- background-color: #4d90fe;
- background-image: -webkit-linear-gradient(top, #4d90fe, #4d90fe);
- }
- button.apply div { color: #fff; }
-
- button.save {
- margin-left: 10px;
- color: #d14836;
- background-color: #d14836;
- background-image: -webkit-linear-gradient(top, #d14836, #d14836);
- }
- button.save div { color: #fff; }
- </ui:style>
-
- <g:HTMLPanel styleName='{style.box}'>
- <div ui:field='header'>
- <table style='width: 100%'>
- <tr>
- <td><ui:msg>Edit Preferences</ui:msg></td>
- <td style='text-align: right'>
- <g:Anchor ui:field='close' href='javascript:;'><ui:msg>Close</ui:msg></g:Anchor>
- </td>
- </tr>
- </table>
- <hr/>
- </div>
- <table class='{style.table}'>
- <tr>
- <th><ui:msg>Theme</ui:msg></th>
- <td><g:ListBox ui:field='theme'/></td>
- </tr>
- <tr>
- <th><ui:msg>Key Map</ui:msg></th>
- <td><g:ListBox ui:field='keyMap'/></td>
- </tr>
- <tr>
- <th><ui:msg>Tab Width</ui:msg></th>
- <td><x:NpIntTextBox ui:field='tabWidth'
- visibleLength='4'
- alignment='RIGHT'/></td>
- </tr>
- <tr>
- <th><ui:msg>Columns</ui:msg></th>
- <td><x:NpIntTextBox ui:field='lineLength'
- visibleLength='4'
- alignment='RIGHT'/></td>
- </tr>
- <tr>
- <th><ui:msg>Indent Unit</ui:msg></th>
- <td><x:NpIntTextBox ui:field='indentUnit'
- visibleLength='4'
- alignment='RIGHT'/></td>
- </tr>
- <tr>
- <th><ui:msg>Cursor Blink Rate</ui:msg></th>
- <td><x:NpIntTextBox ui:field='cursorBlinkRate'
- visibleLength='4'
- alignment='RIGHT'/></td>
- </tr>
- <tr>
- <th><ui:msg>Top Menu</ui:msg></th>
- <td><g:ToggleButton ui:field='topMenu'>
- <g:upFace><ui:msg>Hide</ui:msg></g:upFace>
- <g:downFace><ui:msg>Show</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Syntax Highlighting</ui:msg></th>
- <td><g:ToggleButton ui:field='syntaxHighlighting'>
- <g:upFace><ui:msg>Hide</ui:msg></g:upFace>
- <g:downFace><ui:msg>Show</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Show Tabs</ui:msg></th>
- <td><g:ToggleButton ui:field='showTabs'>
- <g:upFace><ui:msg>Hide</ui:msg></g:upFace>
- <g:downFace><ui:msg>Show</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Whitespace Errors</ui:msg></th>
- <td><g:ToggleButton ui:field='whitespaceErrors'>
- <g:upFace><ui:msg>Hide</ui:msg></g:upFace>
- <g:downFace><ui:msg>Show</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Line Numbers</ui:msg></th>
- <td><g:ToggleButton ui:field='lineNumbers'>
- <g:upFace><ui:msg>Hide</ui:msg></g:upFace>
- <g:downFace><ui:msg>Show</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Match Brackets</ui:msg></th>
- <td><g:ToggleButton ui:field='matchBrackets'>
- <g:upFace><ui:msg>Off</ui:msg></g:upFace>
- <g:downFace><ui:msg>On</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Line Wrapping</ui:msg></th>
- <td><g:ToggleButton ui:field='lineWrapping'>
- <g:upFace><ui:msg>Off</ui:msg></g:upFace>
- <g:downFace><ui:msg>On</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Indent With Tabs</ui:msg></th>
- <td><g:ToggleButton ui:field='indentWithTabs'>
- <g:upFace><ui:msg>Off</ui:msg></g:upFace>
- <g:downFace><ui:msg>On</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Auto Close Brackets</ui:msg></th>
- <td><g:ToggleButton ui:field='autoCloseBrackets'>
- <g:upFace><ui:msg>Off</ui:msg></g:upFace>
- <g:downFace><ui:msg>On</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <th><ui:msg>Show Base Version</ui:msg></th>
- <td><g:ToggleButton ui:field='showBase'>
- <g:upFace><ui:msg>Hide</ui:msg></g:upFace>
- <g:downFace><ui:msg>Show</ui:msg></g:downFace>
- </g:ToggleButton></td>
- </tr>
- <tr>
- <td></td>
- <td>
- <g:Button ui:field='apply' styleName='{style.apply}'>
- <div><ui:msg>Apply</ui:msg></div>
- </g:Button>
- <g:Button ui:field='save' styleName='{style.save}'>
- <div><ui:msg>Save</ui:msg></div>
- </g:Button>
- </td>
- </tr>
- </table>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditScreen.java
deleted file mode 100644
index cbf12a3..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditScreen.java
+++ /dev/null
@@ -1,699 +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.client.editor;
-
-import static com.google.gwt.dom.client.Style.Visibility.HIDDEN;
-import static com.google.gwt.dom.client.Style.Visibility.VISIBLE;
-
-import com.google.gerrit.client.DiffWebLinkInfo;
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.JumpKeys;
-import com.google.gerrit.client.VoidResult;
-import com.google.gerrit.client.account.EditPreferences;
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.changes.ChangeEditApi;
-import com.google.gerrit.client.diff.DiffApi;
-import com.google.gerrit.client.diff.DiffInfo;
-import com.google.gerrit.client.diff.Header;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.info.FileInfo;
-import com.google.gerrit.client.patches.PatchUtil;
-import com.google.gerrit.client.rpc.CallbackGroup;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.HttpCallback;
-import com.google.gerrit.client.rpc.HttpResponse;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.client.rpc.ScreenLoadCallback;
-import com.google.gerrit.client.ui.InlineHyperlink;
-import com.google.gerrit.client.ui.Screen;
-import com.google.gerrit.common.Nullable;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.extensions.client.KeyMapType;
-import com.google.gerrit.extensions.client.Theme;
-import com.google.gerrit.reviewdb.client.Patch;
-import com.google.gerrit.reviewdb.client.PatchSet;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.dom.client.Style.Unit;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.event.logical.shared.ResizeEvent;
-import com.google.gwt.event.logical.shared.ResizeHandler;
-import com.google.gwt.event.logical.shared.ValueChangeEvent;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.resources.client.CssResource;
-import com.google.gwt.uibinder.client.UiBinder;
-import com.google.gwt.uibinder.client.UiField;
-import com.google.gwt.uibinder.client.UiHandler;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.Window.ClosingEvent;
-import com.google.gwt.user.client.Window.ClosingHandler;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HTMLPanel;
-import com.google.gwt.user.client.ui.ImageResourceRenderer;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.safehtml.client.SafeHtml;
-import java.util.List;
-import net.codemirror.addon.AddonInjector;
-import net.codemirror.addon.Addons;
-import net.codemirror.lib.CodeMirror;
-import net.codemirror.lib.CodeMirror.ChangesHandler;
-import net.codemirror.lib.CodeMirror.CommandRunner;
-import net.codemirror.lib.Configuration;
-import net.codemirror.lib.KeyMap;
-import net.codemirror.lib.MergeView;
-import net.codemirror.lib.Pos;
-import net.codemirror.mode.ModeInfo;
-import net.codemirror.mode.ModeInjector;
-import net.codemirror.theme.ThemeLoader;
-
-public class EditScreen extends Screen {
- interface Binder extends UiBinder<HTMLPanel, EditScreen> {}
-
- private static final Binder uiBinder = GWT.create(Binder.class);
-
- interface Style extends CssResource {
- String fullWidth();
-
- String base();
-
- String hideBase();
- }
-
- @Nullable private Project.NameKey projectKey;
- private final PatchSet.Id revision;
- private final String path;
- private final int startLine;
- private EditPreferences prefs;
- private EditPreferencesAction editPrefsAction;
- private MergeView mv;
- private CodeMirror cmBase;
- private CodeMirror cmEdit;
- private HttpResponse<NativeString> content;
- private HttpResponse<NativeString> baseContent;
- private EditFileInfo editFileInfo;
- private JsArray<DiffWebLinkInfo> diffLinks;
-
- @UiField Element header;
- @UiField Element project;
- @UiField Element filePath;
- @UiField FlowPanel linkPanel;
- @UiField Element cursLine;
- @UiField Element cursCol;
- @UiField Element dirty;
- @UiField CheckBox showBase;
- @UiField Button close;
- @UiField Button save;
- @UiField Element editor;
- @UiField Style style;
-
- private HandlerRegistration resizeHandler;
- private HandlerRegistration closeHandler;
- private int generation;
-
- public EditScreen(@Nullable Project.NameKey projectKey, Patch.Key patch, int startLine) {
- this.projectKey = projectKey;
- this.revision = patch.getParentKey();
- this.path = patch.get();
- this.startLine = startLine - 1;
- setRequiresSignIn(true);
- add(uiBinder.createAndBindUi(this));
- addDomHandler(GlobalKey.STOP_PROPAGATION, KeyPressEvent.getType());
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
- setHeaderVisible(false);
- setWindowTitle(FileInfo.getFileName(path));
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
-
- prefs = EditPreferences.create(Gerrit.getEditPreferences());
-
- CallbackGroup group1 = new CallbackGroup();
- final CallbackGroup group2 = new CallbackGroup();
- final CallbackGroup group3 = new CallbackGroup();
-
- CodeMirror.initLibrary(
- group1.add(
- new AsyncCallback<Void>() {
- final AsyncCallback<Void> themeCallback = group3.addEmpty();
-
- @Override
- public void onSuccess(Void result) {
- // Load theme after CM library to ensure theme can override CSS.
- ThemeLoader.loadTheme(prefs.theme(), themeCallback);
- group2.done();
-
- new AddonInjector()
- .add(Addons.I.merge_bundled().getName())
- .inject(
- new AsyncCallback<Void>() {
- @Override
- public void onFailure(Throwable caught) {}
-
- @Override
- public void onSuccess(Void result) {
- if (!prefs.showBase() || revision.get() > 0) {
- group3.done();
- }
- }
- });
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- }));
-
- ChangeApi.detail(
- Project.NameKey.asStringOrNull(projectKey),
- revision.getParentKey().get(),
- group1.add(
- new AsyncCallback<ChangeInfo>() {
- @Override
- public void onSuccess(ChangeInfo c) {
- projectKey = c.projectNameKey();
- project.setInnerText(c.project());
- SafeHtml.setInnerHTML(filePath, Header.formatPath(path));
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- }));
-
- if (revision.get() == 0) {
- ChangeEditApi.getMeta(
- Project.NameKey.asStringOrNull(projectKey),
- revision,
- path,
- group1.add(
- new AsyncCallback<EditFileInfo>() {
- @Override
- public void onSuccess(EditFileInfo editInfo) {
- editFileInfo = editInfo;
- }
-
- @Override
- public void onFailure(Throwable e) {}
- }));
-
- if (prefs.showBase()) {
- ChangeEditApi.get(
- projectKey,
- revision,
- path,
- true /* base */,
- group1.addFinal(
- new HttpCallback<NativeString>() {
- @Override
- public void onSuccess(HttpResponse<NativeString> fc) {
- baseContent = fc;
- group3.done();
- }
-
- @Override
- public void onFailure(Throwable e) {}
- }));
- } else {
- group1.done();
- }
- } else {
- // TODO(davido): We probably want to create dedicated GET EditScreenMeta
- // REST endpoint. Abuse GET diff for now, as it retrieves links we need.
- DiffApi.diff(Project.NameKey.asStringOrNull(projectKey), revision, path)
- .webLinksOnly()
- .get(
- group1.addFinal(
- new AsyncCallback<DiffInfo>() {
- @Override
- public void onSuccess(DiffInfo diffInfo) {
- diffLinks = diffInfo.webLinks();
- }
-
- @Override
- public void onFailure(Throwable e) {}
- }));
- }
-
- ChangeEditApi.get(
- projectKey,
- revision,
- path,
- group2.add(
- new HttpCallback<NativeString>() {
- final AsyncCallback<Void> modeCallback = group3.addEmpty();
-
- @Override
- public void onSuccess(HttpResponse<NativeString> fc) {
- content = fc;
- if (revision.get() > 0) {
- baseContent = fc;
- }
-
- if (prefs.syntaxHighlighting()) {
- injectMode(fc.getContentType(), modeCallback);
- } else {
- modeCallback.onSuccess(null);
- }
- }
-
- @Override
- public void onFailure(Throwable e) {
- // "Not Found" means it's a new file.
- if (RestApi.isNotFound(e)) {
- content = null;
- modeCallback.onSuccess(null);
- } else {
- GerritCallback.showFailure(e);
- }
- }
- }));
-
- group3.addListener(
- new ScreenLoadCallback<Void>(this) {
- @Override
- protected void preDisplay(Void result) {
- initEditor();
-
- renderLinks(editFileInfo, diffLinks);
- editFileInfo = null;
- diffLinks = null;
-
- showBase.setValue(prefs.showBase(), true);
- cmBase.refresh();
- }
- });
- }
-
- @Override
- public void registerKeys() {
- super.registerKeys();
- KeyMap localKeyMap = KeyMap.create();
- localKeyMap.on("Ctrl-L", gotoLine()).on("Cmd-L", gotoLine()).on("Cmd-S", save());
-
- // TODO(davido): Find a better way to prevent key maps collisions
- if (prefs.keyMapType() != KeyMapType.EMACS) {
- localKeyMap.on("Ctrl-S", save());
- }
-
- cmBase.addKeyMap(localKeyMap);
- cmEdit.addKeyMap(localKeyMap);
- }
-
- private Runnable gotoLine() {
- return () -> cmEdit.execCommand("jumpToLine");
- }
-
- @Override
- public void onShowView() {
- super.onShowView();
- Window.enableScrolling(false);
- JumpKeys.enable(false);
- if (prefs.hideTopMenu()) {
- Gerrit.setHeaderVisible(false);
- }
- resizeHandler =
- Window.addResizeHandler(
- new ResizeHandler() {
- @Override
- public void onResize(ResizeEvent event) {
- adjustHeight();
- }
- });
- closeHandler =
- Window.addWindowClosingHandler(
- new ClosingHandler() {
- @Override
- public void onWindowClosing(ClosingEvent event) {
- if (!cmEdit.isClean(generation)) {
- event.setMessage(EditConstants.I.closeUnsavedChanges());
- }
- }
- });
-
- generation = cmEdit.changeGeneration(true);
- setClean(true);
- cmEdit.on(
- new ChangesHandler() {
- @Override
- public void handle(CodeMirror cm) {
- setClean(cm.isClean(generation));
- }
- });
-
- adjustHeight();
- cmEdit.on("cursorActivity", updateCursorPosition());
- setShowTabs(prefs.showTabs());
- setLineLength(prefs.lineLength());
- cmEdit.refresh();
- cmEdit.focus();
-
- if (startLine > 0) {
- cmEdit.scrollToLine(startLine);
- }
- updateActiveLine();
- editPrefsAction = new EditPreferencesAction(this, prefs);
- }
-
- @Override
- protected void onUnload() {
- super.onUnload();
- if (cmBase != null) {
- cmBase.getWrapperElement().removeFromParent();
- }
- if (cmEdit != null) {
- cmEdit.getWrapperElement().removeFromParent();
- }
- if (resizeHandler != null) {
- resizeHandler.removeHandler();
- }
- if (closeHandler != null) {
- closeHandler.removeHandler();
- }
- Window.enableScrolling(true);
- Gerrit.setHeaderVisible(true);
- JumpKeys.enable(true);
- }
-
- CodeMirror getEditor() {
- return cmEdit;
- }
-
- @UiHandler("editSettings")
- void onEditSetting(@SuppressWarnings("unused") ClickEvent e) {
- editPrefsAction.show();
- }
-
- @UiHandler("save")
- void onSave(@SuppressWarnings("unused") ClickEvent e) {
- save().run();
- }
-
- @UiHandler("close")
- void onClose(@SuppressWarnings("unused") ClickEvent e) {
- if (cmEdit.isClean(generation) || Window.confirm(EditConstants.I.cancelUnsavedChanges())) {
- upToChange();
- }
- }
-
- private void displayBase() {
- cmBase.getWrapperElement().getParentElement().removeClassName(style.hideBase());
- cmEdit.getWrapperElement().getParentElement().removeClassName(style.fullWidth());
- mv.getGapElement().removeClassName(style.hideBase());
- setCmBaseValue();
- setLineLength(prefs.lineLength());
- cmBase.refresh();
- }
-
- @UiHandler("showBase")
- void onShowBase(ValueChangeEvent<Boolean> e) {
- boolean shouldShow = e.getValue();
- if (shouldShow) {
- if (baseContent == null) {
- ChangeEditApi.get(
- projectKey,
- revision,
- path,
- true /* base */,
- new HttpCallback<NativeString>() {
- @Override
- public void onSuccess(HttpResponse<NativeString> fc) {
- baseContent = fc;
- displayBase();
- }
-
- @Override
- public void onFailure(Throwable e) {}
- });
- } else {
- displayBase();
- }
- } else {
- cmBase.getWrapperElement().getParentElement().addClassName(style.hideBase());
- cmEdit.getWrapperElement().getParentElement().addClassName(style.fullWidth());
- mv.getGapElement().addClassName(style.hideBase());
- }
- mv.setShowDifferences(shouldShow);
- }
-
- void setOption(String option, String value) {
- cmBase.setOption(option, value);
- cmEdit.setOption(option, value);
- }
-
- void setOption(String option, boolean value) {
- cmBase.setOption(option, value);
- cmEdit.setOption(option, value);
- }
-
- void setOption(String option, double value) {
- cmBase.setOption(option, value);
- cmEdit.setOption(option, value);
- }
-
- void setTheme(Theme newTheme) {
- cmBase.operation(() -> cmBase.setOption("theme", newTheme.name().toLowerCase()));
- cmEdit.operation(() -> cmEdit.setOption("theme", newTheme.name().toLowerCase()));
- }
-
- void setLineLength(int length) {
- int adjustedLength = Patch.COMMIT_MSG.equals(path) ? 72 : length;
- cmBase.extras().lineLength(adjustedLength);
- cmEdit.extras().lineLength(adjustedLength);
- }
-
- void setIndentUnit(int indent) {
- cmEdit.setOption("indentUnit", Patch.COMMIT_MSG.equals(path) ? 2 : indent);
- }
-
- void setShowLineNumbers(boolean show) {
- cmBase.setOption("lineNumbers", show);
- cmEdit.setOption("lineNumbers", show);
- }
-
- void setShowWhitespaceErrors(boolean show) {
- cmBase.operation(() -> cmBase.setOption("showTrailingSpace", show));
- cmEdit.operation(() -> cmEdit.setOption("showTrailingSpace", show));
- }
-
- void setShowTabs(boolean show) {
- cmBase.extras().showTabs(show);
- cmEdit.extras().showTabs(show);
- }
-
- void adjustHeight() {
- int height = header.getOffsetHeight();
- int rest = Gerrit.getHeaderFooterHeight() + height + 5; // Estimate
- mv.getGapElement().getStyle().setHeight(Window.getClientHeight() - rest, Unit.PX);
- cmBase.adjustHeight(height);
- cmEdit.adjustHeight(height);
- }
-
- void setSyntaxHighlighting(boolean b) {
- ModeInfo modeInfo = ModeInfo.findMode(content.getContentType(), path);
- final String mode = modeInfo != null ? modeInfo.mime() : null;
- if (b && mode != null && !mode.isEmpty()) {
- injectMode(
- mode,
- new AsyncCallback<Void>() {
- @Override
- public void onSuccess(Void result) {
- cmBase.setOption("mode", mode);
- cmEdit.setOption("mode", mode);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- prefs.syntaxHighlighting(false);
- }
- });
- } else {
- cmBase.setOption("mode", (String) null);
- cmEdit.setOption("mode", (String) null);
- }
- }
-
- private void upToChange() {
- Gerrit.display(PageLinks.toChangeInEditMode(projectKey, revision.getParentKey()));
- }
-
- private void initEditor() {
- ModeInfo mode = null;
- String editContent = "";
- if (content != null && content.getResult() != null) {
- editContent = content.getResult().asString();
- if (prefs.syntaxHighlighting()) {
- mode = ModeInfo.findMode(content.getContentType(), path);
- }
- }
-
- Configuration cfg =
- Configuration.create()
- .set("autoCloseBrackets", prefs.autoCloseBrackets())
- .set("cursorBlinkRate", prefs.cursorBlinkRate())
- .set("cursorHeight", 0.85)
- .set("indentUnit", prefs.indentUnit())
- .set("keyMap", prefs.keyMapType().name().toLowerCase())
- .set("lineNumbers", prefs.hideLineNumbers())
- .set("lineWrapping", prefs.lineWrapping())
- .set("indentWithTabs", prefs.indentWithTabs())
- .set("matchBrackets", prefs.matchBrackets())
- .set("mode", mode != null ? mode.mime() : null)
- .set("origLeft", editContent)
- .set("scrollbarStyle", "overlay")
- .set("showTrailingSpace", prefs.showWhitespaceErrors())
- .set("styleSelectedText", true)
- .set("tabSize", prefs.tabSize())
- .set("theme", prefs.theme().name().toLowerCase())
- .set("value", "");
-
- if (editContent.contains("\r\n")) {
- cfg.set("lineSeparator", "\r\n");
- }
-
- mv = MergeView.create(editor, cfg);
-
- cmBase = mv.leftOriginal();
- cmBase.getWrapperElement().addClassName(style.base());
- cmEdit = mv.editor();
- setCmBaseValue();
- cmEdit.setValue(editContent);
-
- CodeMirror.addCommand(
- "save",
- new CommandRunner() {
- @Override
- public void run(CodeMirror instance) {
- save().run();
- }
- });
- }
-
- private void renderLinks(EditFileInfo editInfo, JsArray<DiffWebLinkInfo> diffLinks) {
- renderLinksToDiff();
-
- if (editInfo != null) {
- renderLinks(Natives.asList(editInfo.webLinks()));
- } else if (diffLinks != null) {
- renderLinks(Natives.asList(diffLinks));
- }
- }
-
- private void renderLinks(List<DiffWebLinkInfo> links) {
- if (links != null) {
- for (DiffWebLinkInfo webLink : links) {
- linkPanel.add(webLink.toAnchor());
- }
- }
- }
-
- private void renderLinksToDiff() {
- InlineHyperlink sbs = new InlineHyperlink();
- sbs.setHTML(new ImageResourceRenderer().render(Gerrit.RESOURCES.sideBySideDiff()));
- sbs.setTargetHistoryToken(
- Dispatcher.toPatch(projectKey, "sidebyside", null, new Patch.Key(revision, path)));
- sbs.setTitle(PatchUtil.C.sideBySideDiff());
- linkPanel.add(sbs);
-
- InlineHyperlink unified = new InlineHyperlink();
- unified.setHTML(new ImageResourceRenderer().render(Gerrit.RESOURCES.unifiedDiff()));
- unified.setTargetHistoryToken(
- Dispatcher.toPatch(projectKey, "unified", null, new Patch.Key(revision, path)));
- unified.setTitle(PatchUtil.C.unifiedDiff());
- linkPanel.add(unified);
- }
-
- private Runnable updateCursorPosition() {
- return () -> {
- // The rendering of active lines has to be deferred. Reflow
- // caused by adding and removing styles chokes Firefox when arrow
- // key (or j/k) is held down. Performance on Chrome is fine
- // without the deferral.
- //
- Scheduler.get().scheduleDeferred(() -> cmEdit.operation(this::updateActiveLine));
- };
- }
-
- private void updateActiveLine() {
- Pos p = cmEdit.getCursor("end");
- cursLine.setInnerText(Integer.toString(p.line() + 1));
- cursCol.setInnerText(Integer.toString(p.ch() + 1));
- cmEdit.extras().activeLine(cmEdit.getLineHandleVisualStart(p.line()));
- }
-
- private void setClean(boolean clean) {
- save.setEnabled(!clean);
- close.setEnabled(true);
- dirty.getStyle().setVisibility(!clean ? VISIBLE : HIDDEN);
- }
-
- private Runnable save() {
- return () -> {
- if (!cmEdit.isClean(generation)) {
- close.setEnabled(false);
- String text = cmEdit.getValue();
- if (Patch.COMMIT_MSG.equals(path)) {
- String trimmed = text.trim() + "\r";
- if (!trimmed.equals(text)) {
- text = trimmed;
- cmEdit.setValue(text);
- }
- }
- final int g = cmEdit.changeGeneration(false);
- ChangeEditApi.put(
- Project.NameKey.asStringOrNull(projectKey),
- revision.getParentKey().get(),
- path,
- text,
- new GerritCallback<VoidResult>() {
- @Override
- public void onSuccess(VoidResult result) {
- generation = g;
- setClean(cmEdit.isClean(g));
- }
-
- @Override
- public void onFailure(Throwable caught) {
- close.setEnabled(true);
- }
- });
- }
- };
- }
-
- private void injectMode(String type, AsyncCallback<Void> cb) {
- new ModeInjector().add(type).inject(cb);
- }
-
- private void setCmBaseValue() {
- cmBase.setValue(
- baseContent != null && baseContent.getResult() != null
- ? baseContent.getResult().asString()
- : "");
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditScreen.ui.xml b/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditScreen.ui.xml
deleted file mode 100644
index 34282c8..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/editor/EditScreen.ui.xml
+++ /dev/null
@@ -1,185 +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.
--->
-<ui:UiBinder xmlns:ui='urn:ui:com.google.gwt.uibinder'
- xmlns:g='urn:import:com.google.gwt.user.client.ui'>
- <ui:with field='ico' type='com.google.gerrit.client.GerritResources'/>
- <ui:style gss='false' type='com.google.gerrit.client.editor.EditScreen.Style'>
- @external .CodeMirror, .CodeMirror-cursor;
- @external .CodeMirror-merge-2pane, .CodeMirror-merge-pane;
- @external .CodeMirror-merge-gap;
- @external .CodeMirror-scroll, .CodeMirror-overlayscroll-vertical;
-
- .header {
- position: relative;
- height: 16px;
- line-height: 16px;
- }
-
- .header .CodeMirror div.CodeMirror-cursor {
- border-left: 2px solid black;
- }
-
- .headerLine {
- background-color: #f7f7f7;
- border-bottom: 1px solid #ddd;
- padding-left: 30px;
- }
-
- .headerButtons {
- display: inline-block;
- padding-right: 5px;
- border-right: 1px inset #ddd;
- margin-right: 5px;
- }
-
- .headerButtons button:disabled {
- background-color: #ddd;
- font-weight: normal;
- cursor: default;
- }
-
- .headerButtons button {
- margin: 2px 0 2px 0;
- text-align: center;
- font-size: 8pt;
- cursor: pointer;
- border: 1px solid;
- color: rgba(0, 0, 0, 0.15);
- background-color: #f5f5f5;
- -webkit-border-radius: 1px;
- -webkit-box-sizing: content-box;
- }
-
- .headerButtons button div {
- color: #444;
- min-width: 54px;
- white-space: nowrap;
- line-height: 8pt;
- }
-
- .save {
- font-weight: bold;
- }
-
- .path {
- white-space: nowrap;
- }
-
- .statusLine {
- position: fixed;
- bottom: 0;
- left: 0;
- width: 175px;
- height: 19px;
- background-color: #f7f7f7;
- border-top: 1px solid #ddd;
- border-right: 1px solid #ddd;
- }
- .statusLine div {
- height: inherit;
- }
-
- .cursorPosition {
- display: inline-block;
- margin: 0 5px 0 35px;
- white-space: nowrap;
- }
-
- .dirty {
- display: inline-block;
- margin: 0 5px 0 5px;
- padding: 0 0 0 5px;
- border-left: 1px solid #ddd;
- font-weight: bold;
- }
-
- .navigation {
- position: absolute;
- top: 0;
- right: 10px;
- }
- .linkPanel {
- float: left;
- }
- .linkPanel img {
- padding-top: 2px;
- padding-right: 3px;
- }
-
- .preferences {
- position: relative;
- top: 2px;
- cursor: pointer;
- outline: none;
- }
-
- .hideBase.CodeMirror-merge-pane {
- display: none;
- }
-
- .hideBase.CodeMirror-merge-gap {
- display: none;
- }
-
- .CodeMirror-merge-2pane .fullWidth.CodeMirror-merge-pane {
- width: 100%;
- }
-
- /* Hide the vertical scrollbar on the base side. The edit side controls
- both views */
- .base .CodeMirror-scroll { margin-right: -42px; }
- .base .CodeMirror-overlayscroll-vertical { display: none !important; }
- </ui:style>
- <g:HTMLPanel styleName='{style.header}'>
- <div class='{style.headerLine}' ui:field='header'>
- <div class='{style.headerButtons}'>
- <g:Button ui:field='close'
- title='Close file and return to change'>
- <ui:attribute name='title'/>
- <div><ui:msg>Close</ui:msg></div>
- </g:Button>
- <g:Button ui:field='save'
- styleName='{style.save}'
- title='Save'>
- <ui:attribute name='title'/>
- <div><ui:msg>Save</ui:msg></div>
- </g:Button>
- </div>
- <span class='{style.path}'><span ui:field='project'/> / <span ui:field='filePath'/></span>
- <div class='{style.navigation}'>
- <g:Label text='Show Base' styleName='{style.linkPanel}'></g:Label>
- <g:CheckBox ui:field='showBase' checked='true' styleName='{style.linkPanel}'
- title='Show Base Version'>
- <ui:attribute name='title'/>
- </g:CheckBox>
- <g:FlowPanel ui:field='linkPanel' styleName='{style.linkPanel}'/>
- <g:Image
- ui:field='editSettings'
- styleName='{style.preferences}'
- resource='{ico.gear}'
- title='Edit screen preferences'>
- <ui:attribute name='title'/>
- </g:Image>
- </div>
- </div>
- <div ui:field='editor' />
- <div class='{style.statusLine}'>
- <div class='{style.cursorPosition}'><span ui:field='cursLine'/> : <span ui:field='cursCol'/></div>
- <div class='{style.dirty}' ui:field='dirty'>Unsaved</div>
- </div>
- </g:HTMLPanel>
-</ui:UiBinder>
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/gerrit.css b/gerrit-gwtui/src/main/java/com/google/gerrit/client/gerrit.css
deleted file mode 100644
index 4076296..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/gerrit.css
+++ /dev/null
@@ -1,1060 +0,0 @@
-/* Copyright (C) 2009 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.
- */
-
-/**
- * Make every single class external so users can rely on their names
- */
-@external .*;
-
-@def black #000000;
-@def white #ffffff;
-@def norm-font sans-serif;
-@def mono-font monospace;
-
-@eval backgroundColor com.google.gerrit.client.Gerrit.getTheme().backgroundColor;
-@eval topMenuColor com.google.gerrit.client.Gerrit.getTheme().topMenuColor;
-@eval textColor com.google.gerrit.client.Gerrit.getTheme().textColor;
-@eval trimColor com.google.gerrit.client.Gerrit.getTheme().trimColor;
-@eval selectionColor com.google.gerrit.client.Gerrit.getTheme().selectionColor;
-@eval changeTableOutdatedColor com.google.gerrit.client.Gerrit.getTheme().changeTableOutdatedColor;
-@eval tableOddRowColor com.google.gerrit.client.Gerrit.getTheme().tableOddRowColor;
-@eval tableEvenRowColor com.google.gerrit.client.Gerrit.getTheme().tableEvenRowColor;
-
-@sprite .greenCheckClass {
- gwt-image: "greenCheck";
-}
-
-/** Override various GWT defaults */
-.gerritTopMenu {
- font-size: 9pt;
- padding-left: 5px;
- padding-right: 5px;
- background: transparent;
-}
-
-body, table td, select {
- font-family: norm-font;
-}
-
-button {
- padding: 1px 6px;
-}
-
-.gerritBody {
- font-size: small;
- padding-left: 5px;
- padding-right: 5px;
-}
-
-a,
-a:visited {
- color: #0654ac;
- text-decoration: none;
-}
-
-a:hover {
- color: #0654ac;
- text-decoration: underline;
-}
-
-#gerrit_btmmenu {
- clear: both;
- color: #a0adcc;
- text-align: right;
- padding-right: 10px;
-}
-
-.version a,
-.version a:visited,
-.version a:hover {
- color: #2a5db0;
-}
-
-
-/** Widgets **/
-.gwt-Button {
- color: black;
-}
-
-.accountLinkPanel {
- display: inline;
-}
-
-.accountLinkPanel img {
- margin-right: 0.2em;
- position: relative;
- top: 2px;
- height: 16px !important;
- width: 16px;
-}
-
-.accountLinkPanel a {
- position: relative;
- top: -1px;
-}
-
-.inputFieldTypeHint {
- color: grey;
-}
-
-.smallHeading {
- margin-top: 5px;
- font-weight: bold;
-}
-
-.link {
- cursor: pointer;
-}
-
-.extensionPanel {
- padding-top: 10px;
-}
-
-/** MenuScreen **/
-.menuScreenMenuBar {
- background: topMenuColor;
- padding-top: 0.5em;
- padding-bottom: 10em;
- padding-left: 0.5em;
- padding-right: 0.5em;
- border-right: 1px solid black;
- margin-right: 0.5em;
-}
-
-.menuScreenMenuBar .menuItem {
- white-space: nowrap;
- display: block;
- border-right: none;
- padding: 0.2em;
-}
-
-.menuScreenMenuBar .menuItem.activeRow {
- background: selectionColor;
-}
-
-.menuItem.activeRow {
- background: selectionColor;
-}
-
-/** Menu **/
-.linkMenuBar {
- font-size: 9pt;
- display: inline;
- white-space: nowrap;
- padding-left: 6px;
-}
-.menuItem {
- padding-left: 5px;
- padding-right: 5px;
-}
-.linkMenuItemNotLast {
- border-right: 1px solid black;
-}
-
-.topmenu {
- width: 100%;
-}
-.topmenuTDmenu {
- vertical-align: top;
-}
-.topmenuTDglue {
- width: 100%;
-}
-
-.topmenuMenuLeft {
- width: 300px;
- font-size: 9pt;
- padding-top: 5px;
- padding-left: 5px;
- padding-right: 5px;
- background: none;
- position: relative;
- top: 0;
-}
-.topmenuMenuLeft tbody tr td table {
- border: 0;
-}
-.topmenuMenuLeft tbody tr td table.gwt-TabBar {
- border-bottom: 1px solid #DDD;
-}
-.topmenuMenuLeft .gwt-TextBox {
- width: 250px;
-}
-.topmenuMenuLeft .gwt-Button {
- padding: 3px 6px;
-}
-.topmenuMenuLeft .gwt-TabBarFirst {
- display: none;
-}
-.topmenuMenuLeft .gwt-TabBarItem {
- margin: 0px;
- background: transparent;
- padding-top: 0px;
- padding-bottom: 1px;
- padding-left: 1em;
- padding-right: 1em;
-}
-.topmenuMenuLeft .gwt-TabBarRest {
- background: transparent;
- padding-top: 0px;
-}
-.topmenuMenuLeft .gwt-TabPanelBottom {
- background: transparent;
- border-top: none;
- border-left: none;
- border-right: none;
- border-bottom: none;
- padding: 1px;
-}
-.topmenuMenuLeft .menuItem {
- padding-left: 1em;
- padding-right: 1em;
- border-right: none;
-}
-
-.topmenuMenuRight {
- float: right;
- text-align: right;
-}
-.menuBarUserName {
- padding-left: 5px;
- padding-right: 5px;
- white-space: nowrap;
-}
-.menuBarUserNameAvatar {
- vertical-align: middle;
-}
-.menuBarUserNameFocusPanel {
- display: inline;
-}
-.menuBarUserNamePanel {
- display: inline;
- cursor: pointer;
- font-weight: bold;
-}
-.userInfoPopup {
- border: 1px solid black;
- background: white;
- box-shadow: 3px 3px 5px #888;
- z-index: 200;
-}
-.searchPanel {
- white-space: nowrap;
- display: inline;
-}
-.searchPanel .searchTextBox {
- font-size: 9pt;
- margin: 8.286px 3px 0 0;
-}
-.searchPanel .searchDropdown {
- font-size: 8pt;
- border: 2px solid;
- border-color: rgba(0, 0, 0, 0.15);
- height: 16px;
- border-radius: 2px;
- box-sizing: content-box;
-}
-.searchPanel .searchButton {
- text-align: center;
- font-size: 8pt;
- font-weight: bold;
- cursor: pointer;
- border: 2px solid;
- color: #FFF;
- border-color: rgba(0, 0, 0, 0.15);
- height: 14px;
- background-color: #53A93F;
- border-radius: 2px;
- box-sizing: content-box;
-}
-.suggestBoxPopup {
- z-index: 200;
-}
-
-/** RPC Status **/
-.rpcStatus {
- position: fixed;
- top: 6px;
- left: 50%;
- padding-top: 4px;
- padding-bottom: 4px;
- padding-left: 10px;
- padding-right: 10px;
- text-align: center;
- font-weight: bold;
- background: #FFF1A8;
- z-index: 200;
-}
-
-
-/** Error Dialog **/
-.errorDialog {
- background: none;
- border: none;
- padding: 10px;
- width: 600px;
- color: backgroundColor;
- font-size: 15px;
- font-family: verdana;
- z-index: 200;
-}
-.errorDialogGlass {
- opacity: 0.75;
- z-index: 200;
-}
-@if user.agent safari {
- .errorDialogGlass {
- opacity: 0.80;
- }
-}
-@if user.agent ie8 {
- /* IE just doesn't do opacity the way we want, make our dialog
- * stand out in a way that it can't be missed against the page
- */
- .errorDialog {
- color: black;
- background: darkgray;
- border: 10px groove lightgrey;
- }
-}
-.errorDialogTitle {
- font-size: 30px;
- font-weight: bold;
- margin-bottom: 15px;
-}
-.errorDialogErrorType {
- font-weight: bold;
- white-space: nowrap;
- margin-bottom: 15px;
-}
-.errorDialogButtons {
- width: 100%;
- margin-top: 15px;
-}
-.errorDialog a,
-.errorDialog a:visited,
-.errorDialog a:hover {
- color: white;
- font-weight: bold;
- font-size: 15px;
- font-family: verdana;
-}
-.loadingPluginsDialog {
- background: #fff;
- color: #000;
- width: auto;
-}
-
-
-/** Screen **/
-.screen {
-}
-
-.screenHeader {
- white-space: nowrap;
- font-size: 16pt;
- margin: 3px 0 8px;
- text-overflow: ellipsis;
- overflow: hidden;
-}
-
-/** ChangeTable **/
-.changeTable {
- border-collapse: separate;
- border-spacing: 0;
-}
-
-.changeTable tr:nth-child\(even\) {
- background: tableEvenRowColor;
-}
-
-.changeTable tr:nth-child\(odd\) {
- background: tableOddRowColor;
-}
-
-.changeTable .iconCell {
- width: 1px;
- padding: 0px;
- vertical-align: middle;
- border-bottom: 1px solid trimColor;
-}
-
-.changeTable .leftMostCell {
- border-left: 1px solid trimColor;
-}
-
-.changeTable .dataCell {
- padding-left: 5px;
- padding-right: 5px;
- border-right: 1px solid trimColor;
- border-bottom: 1px solid trimColor;
- vertical-align: middle;
- height: 20px;
-}
-
-.changeTable .dataCellHidden {
- display: none;
-}
-
-.changeTable a.gwt-InlineHyperlink,
-.changeTable a.gwt-Anchor {
- color: #222 !important;
-}
-
-.changeTable .changeSize {
- height: 10px;
- display: inline-block;
- opacity: 0.6;
-}
-
-.accountDashboard.changeTable tr {
- color: #444444;
-}
-.accountDashboard.changeTable tr a {
- color: #444444;
- text-decoration: none;
-}
-.accountDashboard.changeTable .needsReview,
-.accountDashboard.changeTable .needsReview a {
- font-weight: bold;
- color: textColor;
-}
-
-.changeTable .activeRow,
-.accountDashboard.changeTable .activeRow,
-.accountDashboard.changeTable .activeRow a {
- background: selectionColor !important;
-}
-
-.changeTable .cSIZE {
- width: 70px;
- text-align: right;
-}
-
-.changeTable .cSUBJECT div {
- text-overflow: ellipsis;
- overflow: hidden;
- white-space: nowrap;
-}
-
-.changeTable .cASSIGNEDTOME {
- background: #ffe9d6 !important;
-}
-
-.changeTable .cASSIGNEE,
-.changeTable .cOWNER,
-.changeTable .cSTATUS {
- white-space: nowrap;
-}
-
-.changeTable .cLastUpdate {
- white-space: nowrap;
- text-align: right;
- width: 1em;
-}
-
-.changeTable .groupName {
- white-space: nowrap;
-}
-
-.changeTable .cAPPROVAL {
- width: 0.5em;
- text-align: center;
-}
-.changeTable .dataCell.negscore {
- color: red;
-}
-.changeTable .dataCell.posscore {
- color: #08a400;
-}
-.changeTable .dataCell.singleLine {
- white-space: nowrap;
-}
-.changeTable .dataCell.labelNotApplicable {
- background: #F5F5F5;
-}
-.changeTable .iconHeader {
- border-top: 1px solid backgroundColor;
- border-bottom: 1px solid backgroundColor;
- background-color: trimColor;
-}
-
-.changeTable .dataHeader {
- border: 1px solid backgroundColor;
- padding: 2px 6px 1px;
- background-color: trimColor;
- font-style: italic;
- white-space: nowrap;
- color: textColor;
-}
-
-.changeTable .dataHeaderHidden {
- display: none;
-}
-
-.changeTable .sectionHeader {
- border-top: 8px solid backgroundColor;
- padding: 2px 6px 1px;
- background-color: trimColor;
- white-space: nowrap;
- font-weight: bold;
- color: textColor;
-}
-
-.changeTable .emptySection {
- border-left: 1px solid trimColor;
- border-right: 1px solid trimColor;
- border-bottom: 1px solid trimColor;
- font-style: italic;
- padding-left: 25px;
-}
-
-.changeTablePrevNextLinks {
- float: right;
- padding-right: 5px;
-}
-.changeTablePrevNextLinks td {
- width: 5em;
- text-align: right;
-}
-.changeTablePrevNextLinks .gwt-Hyperlink {
- font-size: 9pt;
- color: #2a5db0;
-}
-
-/** Change **/
-.avatarInfoPanel {
- margin-right: 10px;
-}
-.avatarInfoPanel td {
- text-align: center;
-}
-
-.infoBlock {
- border-collapse: collapse;
- border-spacing: 0;
-}
-
-.infoBlock td {
- padding: 2px 4px 2px 6px;
- border-right: 1px solid trimColor;
- border-bottom: 1px solid trimColor;
- text-align: left;
- white-space: nowrap;
-}
-
-.infoBlock td td {
- padding-left: 0px;
- border-right: 0px;
-}
-
-.infoBlock td.topmost {
- border-top: 1px solid trimColor;
-}
-
-.infoBlock td.header {
- background-color: trimColor;
- font-style: italic;
- text-align: right;
-}
-
-.infoBlock td.bottomheader {
- border-bottom: 1px solid trimColor;
-}
-
-
-.patchSetActions {
- margin-bottom: 10px;
-}
-.patchSetActions .gwt-Button {
- margin-right: 30px;
- font-size: 8pt;
-}
-
-.downloadBox {
- min-width: 580px;
- margin: 5px;
- margin-right: 15px;
-}
-.downloadBoxTable {
- border-spacing: 0;
- width: 100%;
-}
-.downloadBoxTableCommandColumn {
- text-align: left;
- font-weight: normal;
- white-space: nowrap;
- max-height: 18px;
- width: 80px;
- padding-right: 5px;
-}
-.downloadBoxSpacer {
- margin-left: 5px;
- margin-right: 5px;
-}
-.downloadBoxScheme {
- float: right;
-}
-.downloadBoxCopyLabel {
- font-size: smaller;
- font-family: monospace;
-}
-.downloadBoxCopyLabel span {
- width: 500px;
- white-space: nowrap;
- display: inline-block;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-.downloadBoxCopyLabel .gwt-TextBox {
- padding: 0;
- margin: 0;
- border: 0;
- max-height: 18px;
- width: 500px;
-}
-.downloadBoxCopyLabel div {
- float: right;
-}
-.downloadLinkHeader {
- background: trimColor;
- white-space: nowrap;
- border-bottom: 1px solid black;
-}
-.downloadLinkHeaderGap {
- margin-left: 5em;
-}
-.downloadLinkList {
- display: inline;
- white-space: nowrap;
-}
-.downloadLink {
- color: black;
- text-decoration: none;
- white-space: nowrap;
- background: trimColor;
- border-right: 1px solid black;
- padding-left: 0.5em;
- padding-right: 0.5em;
-}
-a:hover.downloadLink {
- color: black;
-}
-.downloadLink_Active {
- background: selectionColor;
-}
-.downloadLinkCopyLabel {
- white-space: pre;
- font-family: mono-font;
- font-size: 12px;
- margin-left: 0.5em;
- margin-right: 0.5em;
-}
-.downloadLinkCopyLabel .gwt-TextBox {
- width: 40em;
-}
-.downloadLinkCopyLabel span {
- width: 40em;
- white-space: nowrap;
- display: inline-block;
- overflow: hidden;
- text-overflow: ellipsis;
-}
-
-/** AccountSettings **/
-.usernameField {
- white-space: nowrap;
-}
-.accountUsername {
- font-family: mono-font;
- font-size: small;
-}
-.accountPassword {
- font-family: mono-font;
- font-size: small;
-}
-.sshKeyPanelEncodedKey {
- white-space: nowrap;
- text-overflow: ellipsis;
- overflow: hidden;
- font-family: mono-font;
- font-size: small;
-}
-.sshKeyPanelInvalid {
- white-space: nowrap;
- color: red;
- font-weight: bold;
-}
-.identityUntrustedExternalId {
- white-space: nowrap;
- color: red;
- font-weight: bold;
-}
-
-.accountInfoBlock {
- margin-bottom: 10px;
-}
-.accountInfoBlock .gwt-Button {
- margin-left: 10px;
-}
-
-.addWatchPanel {
- margin-top: 10px;
- padding: 5px 5px 5px 5px;
-}
-.watchedProjectFilter {
- margin-left: 1em;
- color: grey;
-}
-
-.addBranch {
- margin-top: 10px;
- background-color: trimColor;
- padding: 5px 5px 5px 5px;
-}
-
-.addSshKeyPanel {
- margin-top: 10px;
- background-color: trimColor;
- padding: 5px 5px 5px 5px;
-}
-
-.addSshKeyPanel ol {
- margin-top: 0px;
- margin-bottom: 5px;
-}
-
-.addSshKeyPanel td {
- width: 100%;
-}
-
-.sshKeyTable td.dataCell, .sshKeyTable td.iconCell {
- vertical-align: top;
-}
-
-.createProjectPanel {
- margin-bottom: 10px;
- background-color: trimColor;
- padding: 5px 5px 5px 5px;
-}
-
-.sshHostKeyPanel {
- margin-top: 10px;
- border: 1px solid trimColor;
- padding: 5px 5px 5px 5px;
-}
-.sshHostKeyPanelHeading {
- white-space: nowrap;
- margin-top: 5px;
- margin-left: 1em;
-}
-.sshHostKeyPanelFingerprintData {
- margin-left: 2em;
- white-space: nowrap;
- font-family: mono-font;
- font-size: small;
-}
-.sshHostKeyPanelKnownHostEntry {
- margin-left: 2em;
- white-space: nowrap;
- font-family: mono-font;
- font-size: small;
- width: 80em;
-}
-
-.contributorAgreementButton {
- font-weight: bold;
-}
-
-.contributorAgreementShortDescription {
- margin-left: 20px;
- margin-right: 20px;
- margin-bottom: 10px;
- padding: 5px 5px 5px 5px;
- border: 1px solid #b0bdcc;
-}
-
-.contributorAgreementAlreadySubmitted {
- margin-left: 20px;
- margin-right: 20px;
- padding: 5px 5px 5px 5px;
- color: red;
-}
-
-.contributorAgreementLegal {
- margin-left: 20px;
- margin-right: 20px;
- padding: 5px 5px 5px 5px;
- border: 1px solid #b0bdcc;
-}
-
-.registerScreenSection {
- margin-top: 2em;
-}
-.registerScreenExplain {
- margin-left: 10px;
- margin-top: 5px;
- margin-bottom: 5px;
- width: 45em;
-}
-.registerScreenNextLinks {
- margin-top: 2em;
-}
-.registerScreenNextLinks .gwt-InlineHyperlink {
- margin-left: 2em;
- white-space: nowrap;
-}
-.registerScreenSection .changeTable {
- width: 45em;
-}
-.registerScreenSection .addSshKeyPanel {
- background: none;
-}
-.registerScreenSection .sshHostKeyPanel {
- border: none;
-}
-.registerScreenSection .sshHostKeyPanel .sshHostKeyPanelKnownHostEntry {
- width: 45em;
-}
-
-.projectActions {
- margin-bottom: 10px;
-}
-
-.oauthInfoBlock {
- margin-bottom: 10px;
-}
-.oauthToken {
- font-family: monospace;
- font-size: small;
- width: 40em;
-}
-.oauthToken span {
- white-space: nowrap;
- display: inline-block;
- overflow: hidden;
- text-overflow: ellipsis;
- width: 38em;
-}
-.oauthExpires {
- font-family: monospace;
- font-size: small;
- width: 40em;
-}
-.oauthPanel {
- margin-top: 10px;
- border: 1px solid trimColor;
- padding: 5px 5px 5px 5px;
-}
-.oauthPanelNetRCHeading {
- margin-top: 5px;
- margin-left: 1em;
- white-space: nowrap;
-}
-.oauthPanelNetRCEntry {
- margin-top: 5px;
- margin-left: 2em;
- font-family: monospace;
- font-size: small;
- width: 80em;
-}
-.oauthPanelNetRCEntry span {
- white-space: nowrap;
- display: inline-block;
- overflow: hidden;
- text-overflow: ellipsis;
- width: 78em;
-}
-.oauthPanelCookieHeading {
- margin-top: 15px;
- margin-left: 1em;
- white-space: nowrap;
-}
-.oauthPanelCookieEntry {
- margin-top: 5px;
- margin-left: 2em;
- font-family: monospace;
- font-size: small;
- width: 80em;
-}
-.oauthPanelCookieEntry span {
- white-space: nowrap;
- display: inline-block;
- overflow: hidden;
- text-overflow: ellipsis;
- width: 78em;
-}
-
-
-/** CommentedActionDialog **/
-.commentedActionDialog .gwt-DisclosurePanel .header td {
- font-weight: bold;
- white-space: nowrap;
-}
-.commentedActionDialog .smallHeading {
- font-size: small;
- font-weight: bold;
- white-space: nowrap;
-}
-.commentedActionDialog .commentedActionMessage {
- margin-left: 10px;
- background: trimColor;
- padding: 5px 5px 5px 5px;
-}
-.commentedActionDialog .commentedActionMessage textarea {
- font-size: small;
-}
-.commentedActionDialog .gwt-Hyperlink {
- white-space: nowrap;
- font-size: small;
-}
-.commentedActionDialog .rebaseContentPanel {
- margin-left: 10px;
- background: trimColor;
- padding: 5px 5px 5px 5px;
- width: 300px;
-}
-.commentedActionDialog .rebaseContentPanel .rebaseSuggestBox {
- font-size: small;
- width: 100%;
-}
-
-/** AccountGroupInfoScreen **/
-.groupUUIDPanel {
- margin-bottom: 10px;
-}
-.groupDescriptionPanel {
- margin-bottom: 3px;
-}
-.groupNamePanel {
- margin-bottom: 3px;
-}
-.groupNameTextBox {
- margin-bottom: 2px;
-}
-.groupOptionsPanel {
- margin-bottom: 5px;
-}
-.groupOwnerPanel {
- margin-bottom: 3px;
-}
-.groupOwnerTextBox {
- margin-bottom: 2px;
-}
-
-
-/** AccountGroupMembersScreen **/
-.groupMembersTable {
- margin-bottom: 2px;
-}
-.groupIncludesTable {
- margin-bottom: 2px;
-}
-
-
-/** AddMemberBox **/
-.addMemberTextBox {
- margin-right: 2px;
- margin-bottom: 2px;
-}
-
-
-/** ProjectBranchesScreen **/
-.specialBranchIconCell {
- background: #ECECEC;
- border-bottom: 1px solid #FFFFFF;
- border-top: 1px solid #FFFFFF;
-}
-.specialBranchDataCell {
- background: #ECECEC;
- border: 1px solid white;
- font-style: italic;
- padding: 2px 6px 1px;
-}
-
-.editHeadButton {
- float: right;
- cursor: pointer;
-}
-
-.branchTableDeleteButton {
- margin-top: 5px;
-}
-
-.branchTablePrevNextLinks {
- position: relative;
-}
-.branchTablePrevNextLinks td {
- float: left;
- width: 5em;
- text-align: left;
- padding-right: 10px;
-}
-.branchTablePrevNextLinks .gwt-Hyperlink {
- font-size: 9pt;
- color: #2a5db0;
-}
-
-/** PluginListScreen **/
-.pluginsTable {
-}
-
-/** ProjectListScreen **/
-.projectFilterPanel {
- margin-bottom: 10px;
-}
-.projectFilterPanel input {
- width: 200px;
-}
-.projectFilterLabel {
- margin-right: 5px;
-}
-.projectNameColumn {
- min-width: 300px;
-}
-
-.queryIcon {
- position: relative;
- top: 2px;
- margin-right: 3px;
-}
-
-/** ProjectSettings */
-.maxObjectSizeLimitEffectiveLabel {
- padding-top: 5px;
- padding-left: 5px;
-}
-
-.pluginProjectConfigInheritedValue {
- padding-top: 5px;
- padding-left: 5px;
-}
-
-/* StringListPanel */
-.stringListPanelButtons {
- margin-left: 0.5em;
-}
-.stringListPanelButtons .gwt-Button {
- margin-right: 2em;
- font-size: 7pt;
- padding: 1px;
-}
-
-/* List Screens */
-.pagingLink {
- font-size: 18px;
- margin-top: 5px;
- margin-bottom: 15px;
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/groups/GroupApi.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/groups/GroupApi.java
deleted file mode 100644
index 01c4d26..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/groups/GroupApi.java
+++ /dev/null
@@ -1,270 +0,0 @@
-// Copyright (C) 2013 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.client.groups;
-
-import com.google.gerrit.client.VoidResult;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.info.GroupInfo;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.reviewdb.client.AccountGroup;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import java.util.Set;
-
-/** A collection of static methods which work on the Gerrit REST API for specific groups. */
-public class GroupApi {
- /** Create a new group */
- public static void createGroup(String groupName, AsyncCallback<GroupInfo> cb) {
- JavaScriptObject in = JavaScriptObject.createObject();
- new RestApi("/groups/").id(groupName).ifNoneMatch().put(in, cb);
- }
-
- public static void getGroupDetail(String group, AsyncCallback<GroupInfo> cb) {
- group(group).view("detail").get(cb);
- }
-
- /** Get the name of a group */
- public static void getGroupName(AccountGroup.UUID group, AsyncCallback<NativeString> cb) {
- group(group).view("name").get(cb);
- }
-
- /** Check if the current user is owner of a group */
- public static void isGroupOwner(String groupName, AsyncCallback<Boolean> cb) {
- GroupMap.myOwned(
- groupName,
- new AsyncCallback<GroupMap>() {
- @Override
- public void onSuccess(GroupMap result) {
- cb.onSuccess(!result.isEmpty());
- }
-
- @Override
- public void onFailure(Throwable caught) {
- cb.onFailure(caught);
- }
- });
- }
-
- /** Rename a group */
- public static void renameGroup(
- AccountGroup.UUID group, String newName, AsyncCallback<VoidResult> cb) {
- GroupInput in = GroupInput.create();
- in.name(newName);
- group(group).view("name").put(in, cb);
- }
-
- /** Set description for a group */
- public static void setGroupDescription(
- AccountGroup.UUID group, String description, AsyncCallback<VoidResult> cb) {
- RestApi call = group(group).view("description");
- if (description != null && !description.isEmpty()) {
- GroupInput in = GroupInput.create();
- in.description(description);
- call.put(in, cb);
- } else {
- call.delete(cb);
- }
- }
-
- /** Set owner for a group */
- public static void setGroupOwner(
- AccountGroup.UUID group, String owner, AsyncCallback<GroupInfo> cb) {
- GroupInput in = GroupInput.create();
- in.owner(owner);
- group(group).view("owner").put(in, cb);
- }
-
- /** Set the options for a group */
- public static void setGroupOptions(
- AccountGroup.UUID group, boolean isVisibleToAll, AsyncCallback<VoidResult> cb) {
- GroupOptionsInput in = GroupOptionsInput.create();
- in.visibleToAll(isVisibleToAll);
- group(group).view("options").put(in, cb);
- }
-
- /** Add member to a group. */
- public static void addMember(
- AccountGroup.UUID group, String member, AsyncCallback<AccountInfo> cb) {
- members(group).id(member).put(cb);
- }
-
- /** Add members to a group. */
- public static void addMembers(
- AccountGroup.UUID group, Set<String> members, AsyncCallback<JsArray<AccountInfo>> cb) {
- if (members.size() == 1) {
- addMember(
- group,
- members.iterator().next(),
- new AsyncCallback<AccountInfo>() {
- @Override
- public void onSuccess(AccountInfo result) {
- cb.onSuccess(Natives.arrayOf(result));
- }
-
- @Override
- public void onFailure(Throwable caught) {
- cb.onFailure(caught);
- }
- });
- } else {
- MemberInput input = MemberInput.create();
- for (String member : members) {
- input.addMember(member);
- }
- members(group).post(input, cb);
- }
- }
-
- /** Remove members from a group. */
- public static void removeMembers(
- AccountGroup.UUID group, Set<Integer> ids, AsyncCallback<VoidResult> cb) {
- if (ids.size() == 1) {
- members(group).id(ids.iterator().next().toString()).delete(cb);
- } else {
- MemberInput in = MemberInput.create();
- for (Integer id : ids) {
- in.addMember(id.toString());
- }
- group(group).view("members.delete").post(in, cb);
- }
- }
-
- /** Include a group into a group. */
- public static void addIncludedGroup(
- AccountGroup.UUID group, String include, AsyncCallback<GroupInfo> cb) {
- groups(group).id(include).put(cb);
- }
-
- /** Include groups into a group. */
- public static void addIncludedGroups(
- AccountGroup.UUID group,
- Set<String> includedGroups,
- final AsyncCallback<JsArray<GroupInfo>> cb) {
- if (includedGroups.size() == 1) {
- addIncludedGroup(
- group,
- includedGroups.iterator().next(),
- new AsyncCallback<GroupInfo>() {
- @Override
- public void onSuccess(GroupInfo result) {
- cb.onSuccess(Natives.arrayOf(result));
- }
-
- @Override
- public void onFailure(Throwable caught) {
- cb.onFailure(caught);
- }
- });
- } else {
- IncludedGroupInput input = IncludedGroupInput.create();
- for (String includedGroup : includedGroups) {
- input.addGroup(includedGroup);
- }
- groups(group).post(input, cb);
- }
- }
-
- /** Remove included groups from a group. */
- public static void removeIncludedGroups(
- AccountGroup.UUID group, Set<AccountGroup.UUID> ids, AsyncCallback<VoidResult> cb) {
- if (ids.size() == 1) {
- AccountGroup.UUID g = ids.iterator().next();
- groups(group).id(g.get()).delete(cb);
- } else {
- IncludedGroupInput in = IncludedGroupInput.create();
- for (AccountGroup.UUID g : ids) {
- in.addGroup(g.get());
- }
- group(group).view("groups.delete").post(in, cb);
- }
- }
-
- /** Get audit log of a group. */
- public static void getAuditLog(
- AccountGroup.UUID group, AsyncCallback<JsArray<GroupAuditEventInfo>> cb) {
- group(group).view("log.audit").get(cb);
- }
-
- private static RestApi members(AccountGroup.UUID group) {
- return group(group).view("members");
- }
-
- private static RestApi groups(AccountGroup.UUID group) {
- return group(group).view("groups");
- }
-
- private static RestApi group(AccountGroup.UUID group) {
- return group(group.get());
- }
-
- private static RestApi group(String group) {
- return new RestApi("/groups/").id(group);
- }
-
- private static class GroupInput extends JavaScriptObject {
- final native void description(String d) /*-{ if(d)this.description=d; }-*/;
-
- final native void name(String n) /*-{ if(n)this.name=n; }-*/;
-
- final native void owner(String o) /*-{ if(o)this.owner=o; }-*/;
-
- static GroupInput create() {
- return (GroupInput) createObject();
- }
-
- protected GroupInput() {}
- }
-
- private static class GroupOptionsInput extends JavaScriptObject {
- final native void visibleToAll(boolean v) /*-{ if(v)this.visible_to_all=v; }-*/;
-
- static GroupOptionsInput create() {
- return (GroupOptionsInput) createObject();
- }
-
- protected GroupOptionsInput() {}
- }
-
- private static class MemberInput extends JavaScriptObject {
- final native void init() /*-{ this.members = []; }-*/;
-
- final native void addMember(String n) /*-{ this.members.push(n); }-*/;
-
- static MemberInput create() {
- MemberInput m = (MemberInput) createObject();
- m.init();
- return m;
- }
-
- protected MemberInput() {}
- }
-
- private static class IncludedGroupInput extends JavaScriptObject {
- final native void init() /*-{ this.groups = []; }-*/;
-
- final native void addGroup(String n) /*-{ this.groups.push(n); }-*/;
-
- static IncludedGroupInput create() {
- IncludedGroupInput g = (IncludedGroupInput) createObject();
- g.init();
- return g;
- }
-
- protected IncludedGroupInput() {}
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/groups/GroupAuditEventInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/groups/GroupAuditEventInfo.java
deleted file mode 100644
index 255c6e8..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/groups/GroupAuditEventInfo.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (C) 2015 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.client.groups;
-
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.info.GroupInfo;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwtjsonrpc.client.impl.ser.JavaSqlTimestamp_JsonSerializer;
-import java.sql.Timestamp;
-
-public class GroupAuditEventInfo extends JavaScriptObject {
- public enum Type {
- ADD_USER,
- REMOVE_USER,
- ADD_GROUP,
- REMOVE_GROUP
- }
-
- public final Timestamp date() {
- return JavaSqlTimestamp_JsonSerializer.parseTimestamp(dateRaw());
- }
-
- public final Type type() {
- return Type.valueOf(typeRaw());
- }
-
- public final native AccountInfo user() /*-{ return this.user; }-*/;
-
- public final native AccountInfo memberAsUser() /*-{ return this.member; }-*/;
-
- public final native GroupInfo memberAsGroup() /*-{ return this.member; }-*/;
-
- private native String dateRaw() /*-{ return this.date; }-*/;
-
- private native String typeRaw() /*-{ return this.type; }-*/;
-
- protected GroupAuditEventInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/groups/GroupList.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/groups/GroupList.java
deleted file mode 100644
index db966b1..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/groups/GroupList.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (C) 2013 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.client.groups;
-
-import com.google.gerrit.client.info.GroupInfo;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.reviewdb.client.AccountGroup;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-/** Groups available from {@code /groups/} or {@code /accounts/[id]/groups}. */
-public class GroupList extends JsArray<GroupInfo> {
- public static void my(AsyncCallback<GroupList> callback) {
- new RestApi("/accounts/self/groups").get(callback);
- }
-
- public static void included(AccountGroup.UUID group, AsyncCallback<GroupList> callback) {
- new RestApi("/groups/").id(group.get()).view("groups").get(callback);
- }
-
- protected GroupList() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/groups/GroupMap.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/groups/GroupMap.java
deleted file mode 100644
index 73ac183..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/groups/GroupMap.java
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (C) 2013 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.client.groups;
-
-import com.google.gerrit.client.info.GroupInfo;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-/** Groups available from {@code /groups/}. */
-public class GroupMap extends NativeMap<GroupInfo> {
- public static void all(AsyncCallback<GroupMap> callback) {
- groups().get(NativeMap.copyKeysIntoChildren(callback));
- }
-
- public static void match(String match, int limit, int start, AsyncCallback<GroupMap> cb) {
- RestApi call = groups();
- if (match != null) {
- if (match.startsWith("^")) {
- call.addParameter("r", match);
- } else {
- call.addParameter("m", match);
- }
- }
- if (limit > 0) {
- call.addParameter("n", limit);
- }
- if (start > 0) {
- call.addParameter("S", start);
- }
- call.get(NativeMap.copyKeysIntoChildren(cb));
- }
-
- public static void suggestAccountGroupForProject(
- String project, String query, int limit, AsyncCallback<GroupMap> cb) {
- RestApi call = groups();
- if (project != null) {
- call.addParameter("p", project);
- }
- if (query != null) {
- call.addParameter("s", query);
- }
- if (limit > 0) {
- call.addParameter("n", limit);
- }
- call.get(NativeMap.copyKeysIntoChildren(cb));
- }
-
- public static void myOwned(AsyncCallback<GroupMap> cb) {
- myOwnedGroups().get(NativeMap.copyKeysIntoChildren(cb));
- }
-
- public static void myOwned(String groupName, AsyncCallback<GroupMap> cb) {
- myOwnedGroups().addParameter("g", groupName).get(NativeMap.copyKeysIntoChildren(cb));
- }
-
- private static RestApi myOwnedGroups() {
- return groups().addParameterTrue("owned");
- }
-
- private static RestApi groups() {
- return new RestApi("/groups/");
- }
-
- protected GroupMap() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/gwt_override.css b/gerrit-gwtui/src/main/java/com/google/gerrit/client/gwt_override.css
deleted file mode 100644
index c92117c..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/gwt_override.css
+++ /dev/null
@@ -1,88 +0,0 @@
-/* Copyright (C) 2009 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.
- */
-
-@external .gwt-Button;
-@external .gwt-DialogBox .dialogMiddleCenter;
-@external .gwt-TabBar;
-@external .gwt-TabBarFirst;
-@external .gwt-TabBarItem;
-@external .gwt-TabBarItem-selected;
-@external .gwt-TabBarRest;
-@external .gwt-TabPanel;
-@external .gwt-TabPanelBottom;
-
-@eval backgroundColor com.google.gerrit.client.Gerrit.getTheme().backgroundColor;
-@eval textColor com.google.gerrit.client.Gerrit.getTheme().textColor;
-@eval trimColor com.google.gerrit.client.Gerrit.getTheme().trimColor;
-@eval selectionColor com.google.gerrit.client.Gerrit.getTheme().selectionColor;
-
-body {
- background: backgroundColor;
- color: textColor;
-}
-
-.gwt-DialogBox .dialogMiddleCenter {
- background: backgroundColor;
- color: textColor;
-}
-
-.gwt-Button {
- white-space: nowrap;
-}
-
-.gwt-TabBar .gwt-TabBarItem,
-.gwt-TabBar .gwt-TabBarRest,
-.gwt-TabPanelBottom {
- background: transparent;
-}
-
-.gwt-TabBar {
- border-bottom: 1px solid black;
-}
-.gwt-TabBar .gwt-TabBarFirst {
- display: none;
-}
-.gwt-TabBar .gwt-TabBarItem {
- color: #353535;
- margin: 0;
- background: trimColor;
- padding-top: 0.5em;
- padding-bottom: 1px;
- padding-left: 1em;
- padding-right: 1em;
- border-bottom: 3px solid transparent;
- border-right: 0;
-}
-.gwt-TabBar .gwt-TabBarItem-selected {
- color: #990000;
- background: selectionColor;
- border-bottom-color: #990000;
-}
-.gwt-TabBar .gwt-TabBarRest {
- background: trimColor;
- padding-top: 0.5em;
- padding-bottom: 1px;
-}
-.gwt-TabBar .gwt-TabPanelBottom {
- background: trimColor;
- border-top: 1px solid black;
- border-left: none;
- border-right: none;
- border-bottom: none;
- padding: 1px;
-}
-.gwt-TabPanel .gwt-TabPanelBottom {
- border: none;
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchConstants.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchConstants.java
deleted file mode 100644
index 4c4c8da..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchConstants.java
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright (C) 2008 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.client.patches;
-
-import com.google.gwt.i18n.client.Constants;
-
-public interface PatchConstants extends Constants {
- String patchBase();
-
- String patchSet();
-
- String upToChange();
-
- String openReply();
-
- String linePrev();
-
- String lineNext();
-
- String chunkPrev();
-
- String chunkNext();
-
- String commentPrev();
-
- String commentNext();
-
- String focusSideA();
-
- String focusSideB();
-
- String expandComment();
-
- String expandAllCommentsOnCurrentLine();
-
- String toggleSideA();
-
- String toggleIntraline();
-
- String showPreferences();
-
- String toggleReviewed();
-
- String markAsReviewedAndGoToNext();
-
- String commentEditorSet();
-
- String commentInsert();
-
- String commentSaveDraft();
-
- String commentCancelEdit();
-
- String whitespaceIGNORE_NONE();
-
- String whitespaceIGNORE_TRAILING();
-
- String whitespaceIGNORE_LEADING_AND_TRAILING();
-
- String whitespaceIGNORE_ALL();
-
- String previousFileHelp();
-
- String nextFileHelp();
-
- String download();
-
- String edit();
-
- String blame();
-
- String addFileCommentToolTip();
-
- String cannedReplyDone();
-
- String sideBySideDiff();
-
- String unifiedDiff();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchConstants.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchConstants.properties
deleted file mode 100644
index 13f0afa..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchConstants.properties
+++ /dev/null
@@ -1,44 +0,0 @@
-cannedReplyDone = Done
-
-patchBase = Base
-patchSet = Patch Set
-
-upToChange = Up to change
-openReply = Reply and score
-linePrev = Previous line
-lineNext = Next line
-chunkPrev = Previous diff chunk
-chunkNext = Next diff chunk or search result
-commentPrev = Previous comment
-commentNext = Next comment
-focusSideA = Focus left side
-focusSideB = Focus right side
-expandComment = Expand or collapse comment
-expandAllCommentsOnCurrentLine = Expand or collapse all comments on current line
-toggleSideA = Toggle left side
-toggleIntraline = Toggle intraline difference
-showPreferences = Show diff preferences
-
-toggleReviewed = Toggle the reviewed flag
-markAsReviewedAndGoToNext = Mark patch as reviewed and go to next unreviewed patch
-
-commentEditorSet = Comment Editing
-commentInsert = Create a new inline comment
-commentSaveDraft = Save draft comment
-commentCancelEdit = Cancel comment edit
-
-whitespaceIGNORE_NONE=None
-whitespaceIGNORE_TRAILING=At Line End
-whitespaceIGNORE_LEADING_AND_TRAILING=Leading, At Line End
-whitespaceIGNORE_ALL=All
-
-previousFileHelp = Previous file
-nextFileHelp = Next file
-
-download = Download
-edit = Edit
-blame = Blame
-addFileCommentToolTip = Click to add file comment
-
-sideBySideDiff = Side-by-side diff
-unifiedDiff = Unified diff
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchMessages.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchMessages.java
deleted file mode 100644
index 358ccd3..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchMessages.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) 2008 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.client.patches;
-
-import com.google.gwt.i18n.client.Messages;
-
-public interface PatchMessages extends Messages {
- String expandBefore(int cnt);
-
- String expandAfter(int cnt);
-
- String patchSkipRegion(String lineNumber);
-
- String fileNameWithShortcutKey(String file, String key);
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchMessages.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchMessages.properties
deleted file mode 100644
index 8dcebdc..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchMessages.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-expandBefore = +{0}⇧
-expandAfter = +{0}⇩
-patchSkipRegion = ... skipped {0} common lines ...
-fileNameWithShortcutKey = {0} (Shortcut: {1})
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchMessages_en.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchMessages_en.properties
deleted file mode 100644
index 8dcebdc..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchMessages_en.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-expandBefore = +{0}⇧
-expandAfter = +{0}⇩
-patchSkipRegion = ... skipped {0} common lines ...
-fileNameWithShortcutKey = {0} (Shortcut: {1})
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchUtil.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchUtil.java
deleted file mode 100644
index d599756..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/PatchUtil.java
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (C) 2008 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.client.patches;
-
-import com.google.gwt.core.client.GWT;
-
-public class PatchUtil {
- public static final PatchConstants C = GWT.create(PatchConstants.class);
- public static final PatchMessages M = GWT.create(PatchMessages.class);
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/SkippedLine.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/SkippedLine.java
deleted file mode 100644
index 486e7b8..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/patches/SkippedLine.java
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (C) 2011 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.client.patches;
-
-public class SkippedLine {
-
- private int a;
- private int b;
- private int sz;
-
- public SkippedLine(int startA, int startB, int size) {
- a = startA;
- b = startB;
- sz = size;
- }
-
- public int getStartA() {
- return a;
- }
-
- public int getStartB() {
- return b;
- }
-
- public int getSize() {
- return sz;
- }
-
- public void incrementStart(int n) {
- a += n;
- b += n;
- reduceSize(n);
- }
-
- public void reduceSize(int n) {
- sz -= n;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/plugins/PluginInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/plugins/PluginInfo.java
deleted file mode 100644
index ac073de..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/plugins/PluginInfo.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) 2012 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.client.plugins;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class PluginInfo extends JavaScriptObject {
- public final native String name() /*-{ return this.name }-*/;
-
- public final native String version() /*-{ return this.version }-*/;
-
- public final native String indexUrl() /*-{ return this.index_url }-*/;
-
- public final native boolean disabled() /*-{ return this.disabled || false }-*/;
-
- protected PluginInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/plugins/PluginMap.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/plugins/PluginMap.java
deleted file mode 100644
index cea27b9..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/plugins/PluginMap.java
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright (C) 2012 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.client.plugins;
-
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-/** Plugins available from {@code /plugins/}. */
-public class PluginMap extends NativeMap<PluginInfo> {
- public static void all(AsyncCallback<PluginMap> callback) {
- new RestApi("/plugins/").addParameterTrue("all").get(NativeMap.copyKeysIntoChildren(callback));
- }
-
- protected PluginMap() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/BranchInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/BranchInfo.java
deleted file mode 100644
index 097f26a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/BranchInfo.java
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (C) 2013 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.client.projects;
-
-import com.google.gerrit.client.info.ActionInfo;
-import com.google.gerrit.client.info.WebLinkInfo;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gwt.core.client.JsArray;
-
-public class BranchInfo extends RefInfo {
- public final native boolean canDelete() /*-{ return this['can_delete'] ? true : false; }-*/;
-
- public final native NativeMap<ActionInfo> actions() /*-{ return this.actions }-*/;
-
- public final native JsArray<WebLinkInfo> webLinks() /*-{ return this.web_links; }-*/;
-
- protected BranchInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ConfigInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ConfigInfo.java
deleted file mode 100644
index 684f8e6..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ConfigInfo.java
+++ /dev/null
@@ -1,262 +0,0 @@
-// Copyright (C) 2013 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.client.projects;
-
-import com.google.gerrit.client.ErrorDialog;
-import com.google.gerrit.client.info.ActionInfo;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.extensions.client.InheritableBoolean;
-import com.google.gerrit.extensions.client.ProjectState;
-import com.google.gerrit.extensions.client.SubmitType;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.core.client.JsArrayString;
-import com.google.gwtexpui.safehtml.client.FindReplace;
-import com.google.gwtexpui.safehtml.client.LinkFindReplace;
-import com.google.gwtexpui.safehtml.client.RawFindReplace;
-import java.util.ArrayList;
-import java.util.List;
-
-public class ConfigInfo extends JavaScriptObject {
-
- public final native String description() /*-{ return this.description }-*/;
-
- public final native InheritedBooleanInfo requireChangeId()
- /*-{ return this.require_change_id; }-*/ ;
-
- public final native InheritedBooleanInfo useContentMerge()
- /*-{ return this.use_content_merge; }-*/ ;
-
- public final native InheritedBooleanInfo useContributorAgreements()
- /*-{ return this.use_contributor_agreements; }-*/ ;
-
- public final native InheritedBooleanInfo createNewChangeForAllNotInTarget()
- /*-{ return this.create_new_change_for_all_not_in_target; }-*/ ;
-
- public final native InheritedBooleanInfo useSignedOffBy()
- /*-{ return this.use_signed_off_by; }-*/ ;
-
- public final native InheritedBooleanInfo enableSignedPush()
- /*-{ return this.enable_signed_push; }-*/ ;
-
- public final native InheritedBooleanInfo requireSignedPush()
- /*-{ return this.require_signed_push; }-*/ ;
-
- public final native InheritedBooleanInfo rejectImplicitMerges()
- /*-{ return this.reject_implicit_merges; }-*/ ;
-
- public final native InheritedBooleanInfo privateByDefault()
- /*-{ return this.private_by_default; }-*/ ;
-
- public final native InheritedBooleanInfo workInProgressByDefault()
- /*-{ return this.work_in_progress_by_default; }-*/ ;
-
- public final native InheritedBooleanInfo enableReviewerByEmail()
- /*-{ return this.enable_reviewer_by_email; }-*/ ;
-
- public final native InheritedBooleanInfo matchAuthorToCommitterDate()
- /*-{ return this.match_author_to_committer_date; }-*/ ;
-
- public final SubmitType submitType() {
- return SubmitType.valueOf(submitTypeRaw());
- }
-
- public final native SubmitTypeInfo defaultSubmitType() /*-{ return this.default_submit_type; }-*/;
-
- public final native NativeMap<NativeMap<ConfigParameterInfo>> pluginConfig()
- /*-{ return this.plugin_config || {}; }-*/ ;
-
- public final native NativeMap<ConfigParameterInfo> pluginConfig(String p)
- /*-{ return this.plugin_config[p]; }-*/ ;
-
- public final native NativeMap<ActionInfo> actions() /*-{ return this.actions; }-*/;
-
- private native String submitTypeRaw() /*-{ return this.submit_type }-*/;
-
- public final ProjectState state() {
- if (stateRaw() == null) {
- return ProjectState.ACTIVE;
- }
- return ProjectState.valueOf(stateRaw());
- }
-
- private native String stateRaw() /*-{ return this.state }-*/;
-
- public final native MaxObjectSizeLimitInfo maxObjectSizeLimit()
- /*-{ return this.max_object_size_limit; }-*/ ;
-
- private native NativeMap<CommentLinkInfo> commentlinks0() /*-{ return this.commentlinks; }-*/;
-
- final List<FindReplace> commentlinks() {
- JsArray<CommentLinkInfo> cls = commentlinks0().values();
- List<FindReplace> commentLinks = new ArrayList<>(cls.length());
- for (int i = 0; i < cls.length(); i++) {
- CommentLinkInfo cl = cls.get(i);
- if (!cl.enabled()) {
- continue;
- }
- if (cl.link() != null) {
- commentLinks.add(new LinkFindReplace(cl.match(), cl.link()));
- } else {
- try {
- FindReplace fr = new RawFindReplace(cl.match(), cl.html());
- commentLinks.add(fr);
- } catch (RuntimeException e) {
- int index = e.getMessage().indexOf("at Object");
- new ErrorDialog(
- "Invalid commentlink configuration: "
- + (index == -1 ? e.getMessage() : e.getMessage().substring(0, index)))
- .center();
- }
- }
- }
- return commentLinks;
- }
-
- final native ThemeInfo theme() /*-{ return this.theme; }-*/;
-
- final native NativeMap<JsArrayString>
- extensionPanelNames() /*-{ return this.extension_panel_names; }-*/;
-
- protected ConfigInfo() {}
-
- static class CommentLinkInfo extends JavaScriptObject {
- final native String match() /*-{ return this.match; }-*/;
-
- final native String link() /*-{ return this.link; }-*/;
-
- final native String html() /*-{ return this.html; }-*/;
-
- final native boolean enabled() /*-{
- return !this.hasOwnProperty('enabled') || this.enabled;
- }-*/;
-
- protected CommentLinkInfo() {}
- }
-
- public static class InheritedBooleanInfo extends JavaScriptObject {
- public static InheritedBooleanInfo create() {
- return (InheritedBooleanInfo) createObject();
- }
-
- public final native boolean value() /*-{ return this.value ? true : false; }-*/;
-
- public final native boolean inheritedValue()
- /*-{ return this.inherited_value ? true : false; }-*/ ;
-
- public final InheritableBoolean configuredValue() {
- return InheritableBoolean.valueOf(configuredValueRaw());
- }
-
- private native String configuredValueRaw() /*-{ return this.configured_value }-*/;
-
- public final void setConfiguredValue(InheritableBoolean v) {
- setConfiguredValueRaw(v.name());
- }
-
- public final native void setConfiguredValueRaw(String v)
- /*-{ if(v)this.configured_value=v; }-*/ ;
-
- protected InheritedBooleanInfo() {}
- }
-
- public static class MaxObjectSizeLimitInfo extends JavaScriptObject {
- public final native String value() /*-{ return this.value; }-*/;
-
- public final native String configuredValue() /*-{ return this.configured_value }-*/;
-
- public final native String summary() /*-{ return this.summary; }-*/;
-
- protected MaxObjectSizeLimitInfo() {}
- }
-
- public static class ConfigParameterInfo extends JavaScriptObject {
- public final native String name() /*-{ return this.name; }-*/;
-
- public final native String displayName() /*-{ return this.display_name; }-*/;
-
- public final native String description() /*-{ return this.description; }-*/;
-
- public final native String warning() /*-{ return this.warning; }-*/;
-
- public final native String type() /*-{ return this.type; }-*/;
-
- public final native String value() /*-{ return this.value; }-*/;
-
- public final native boolean editable() /*-{ return this.editable ? true : false; }-*/;
-
- public final native boolean inheritable() /*-{ return this.inheritable ? true : false; }-*/;
-
- public final native String configuredValue() /*-{ return this.configured_value; }-*/;
-
- public final native String inheritedValue() /*-{ return this.inherited_value; }-*/;
-
- public final native JsArrayString permittedValues() /*-{ return this.permitted_values; }-*/;
-
- public final native JsArrayString values() /*-{ return this.values; }-*/;
-
- protected ConfigParameterInfo() {}
- }
-
- public static class ConfigParameterValue extends JavaScriptObject {
- final native void init() /*-{ this.values = []; }-*/;
-
- final native void addValue(String v) /*-{ this.values.push(v); }-*/;
-
- final native void setValue(String v) /*-{ if(v)this.value = v; }-*/;
-
- public static ConfigParameterValue create() {
- ConfigParameterValue v = createObject().cast();
- return v;
- }
-
- public final ConfigParameterValue values(String[] values) {
- init();
- for (String v : values) {
- addValue(v);
- }
- return this;
- }
-
- public final ConfigParameterValue value(String v) {
- setValue(v);
- return this;
- }
-
- protected ConfigParameterValue() {}
- }
-
- public static class SubmitTypeInfo extends JavaScriptObject {
- public final SubmitType value() {
- return SubmitType.valueOf(valueRaw());
- }
-
- public final SubmitType configuredValue() {
- return SubmitType.valueOf(configuredValueRaw());
- }
-
- public final SubmitType inheritedValue() {
- return SubmitType.valueOf(inheritedValueRaw());
- }
-
- private final native String valueRaw() /*-{ return this.value; }-*/;
-
- private final native String configuredValueRaw() /*-{ return this.configured_value; }-*/;
-
- private final native String inheritedValueRaw() /*-{ return this.inherited_value; }-*/;
-
- protected SubmitTypeInfo() {}
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ConfigInfoCache.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ConfigInfoCache.java
deleted file mode 100644
index 7262b3a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ConfigInfoCache.java
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright (C) 2013 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.client.projects;
-
-import com.google.gerrit.client.changes.ChangeApi;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.client.ui.CommentLinkProcessor;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-/** Cache of {@link ConfigInfo} objects by project name. */
-public class ConfigInfoCache {
- private static final int PROJECT_LIMIT = 25;
- private static final int CHANGE_LIMIT = 100;
- private static final ConfigInfoCache instance = GWT.create(ConfigInfoCache.class);
-
- public static class Entry {
- private final ConfigInfo info;
- private CommentLinkProcessor commentLinkProcessor;
-
- private Entry(ConfigInfo info) {
- this.info = info;
- }
-
- public CommentLinkProcessor getCommentLinkProcessor() {
- if (commentLinkProcessor == null) {
- commentLinkProcessor = new CommentLinkProcessor(info.commentlinks());
- }
- return commentLinkProcessor;
- }
-
- public ThemeInfo getTheme() {
- return info.theme();
- }
-
- public List<String> getExtensionPanelNames(String extensionPoint) {
- return Natives.asList(info.extensionPanelNames().get(extensionPoint));
- }
- }
-
- public static void get(Project.NameKey name, AsyncCallback<Entry> cb) {
- instance.getImpl(name.get(), cb);
- }
-
- public static void get(Change.Id changeId, AsyncCallback<Entry> cb) {
- instance.getImpl(changeId.get(), cb);
- }
-
- public static void add(ChangeInfo info) {
- instance.changeToProject.put(info.legacyId().get(), info.project());
- }
-
- private final LinkedHashMap<String, Entry> cache;
- private final LinkedHashMap<Integer, String> changeToProject;
-
- protected ConfigInfoCache() {
- cache =
- new LinkedHashMap<String, Entry>(PROJECT_LIMIT) {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected boolean removeEldestEntry(Map.Entry<String, ConfigInfoCache.Entry> e) {
- return size() > PROJECT_LIMIT;
- }
- };
-
- changeToProject =
- new LinkedHashMap<Integer, String>(CHANGE_LIMIT) {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected boolean removeEldestEntry(Map.Entry<Integer, String> e) {
- return size() > CHANGE_LIMIT;
- }
- };
- }
-
- private void getImpl(String name, AsyncCallback<Entry> cb) {
- Entry e = cache.get(name);
- if (e != null) {
- cb.onSuccess(e);
- return;
- }
- ProjectApi.getConfig(
- new Project.NameKey(name),
- new AsyncCallback<ConfigInfo>() {
- @Override
- public void onSuccess(ConfigInfo result) {
- Entry e = new Entry(result);
- cache.put(name, e);
- cb.onSuccess(e);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- cb.onFailure(caught);
- }
- });
- }
-
- private void getImpl(Integer id, AsyncCallback<Entry> cb) {
- String name = changeToProject.get(id);
- if (name != null) {
- getImpl(name, cb);
- return;
- }
- // TODO(hiesel) Make a preflight request to get project before we deprecate the numeric changeId
- ChangeApi.change(null, id)
- .get(
- new AsyncCallback<ChangeInfo>() {
- @Override
- public void onSuccess(ChangeInfo result) {
- changeToProject.put(id, result.project());
- getImpl(result.project(), cb);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- cb.onFailure(caught);
- }
- });
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ProjectApi.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ProjectApi.java
deleted file mode 100644
index 3be52e6..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ProjectApi.java
+++ /dev/null
@@ -1,461 +0,0 @@
-// Copyright (C) 2013 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.client.projects;
-
-import com.google.gerrit.client.VoidResult;
-import com.google.gerrit.client.projects.ConfigInfo.ConfigParameterValue;
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.NativeString;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gerrit.extensions.client.InheritableBoolean;
-import com.google.gerrit.extensions.client.ProjectState;
-import com.google.gerrit.extensions.client.SubmitType;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-public class ProjectApi {
- /** Create a new project */
- public static void createProject(
- String projectName,
- String parent,
- Boolean createEmptyCcommit,
- Boolean permissionsOnly,
- AsyncCallback<VoidResult> cb) {
- ProjectInput input = ProjectInput.create();
- input.setName(projectName);
- input.setParent(parent);
- input.setPermissionsOnly(permissionsOnly);
- input.setCreateEmptyCommit(createEmptyCcommit);
- new RestApi("/projects/").id(projectName).ifNoneMatch().put(input, cb);
- }
-
- private static RestApi getRestApi(
- Project.NameKey name, String viewName, int limit, int start, String match) {
- RestApi call = project(name).view(viewName);
- call.addParameter("n", limit);
- call.addParameter("S", start);
- if (match != null) {
- if (match.startsWith("^")) {
- call.addParameter("r", match);
- } else {
- call.addParameter("m", match);
- }
- }
- return call;
- }
-
- /** Create a new tag */
- public static void createTag(
- Project.NameKey name,
- String ref,
- String revision,
- String annotation,
- AsyncCallback<TagInfo> cb) {
- TagInput input = TagInput.create();
- input.setRevision(revision);
- input.setMessage(annotation);
- project(name).view("tags").id(ref).ifNoneMatch().put(input, cb);
- }
-
- /** Retrieve all visible tags of the project */
- public static void getTags(Project.NameKey name, AsyncCallback<JsArray<TagInfo>> cb) {
- project(name).view("tags").get(cb);
- }
-
- public static void getTags(
- Project.NameKey name,
- int limit,
- int start,
- String match,
- AsyncCallback<JsArray<TagInfo>> cb) {
- getRestApi(name, "tags", limit, start, match).get(cb);
- }
-
- /** Delete tags. One call is fired to the server to delete all the tags. */
- public static void deleteTags(
- Project.NameKey name, Set<String> refs, AsyncCallback<VoidResult> cb) {
- if (refs.size() == 1) {
- project(name).view("tags").id(refs.iterator().next()).delete(cb);
- } else {
- DeleteTagsInput d = DeleteTagsInput.create();
- for (String ref : refs) {
- d.addTag(ref);
- }
- project(name).view("tags:delete").post(d, cb);
- }
- }
-
- /** Create a new branch */
- public static void createBranch(
- Project.NameKey name, String ref, String revision, AsyncCallback<BranchInfo> cb) {
- BranchInput input = BranchInput.create();
- input.setRevision(revision);
- project(name).view("branches").id(ref).ifNoneMatch().put(input, cb);
- }
-
- /** Retrieve all visible branches of the project */
- public static void getBranches(Project.NameKey name, AsyncCallback<JsArray<BranchInfo>> cb) {
- project(name).view("branches").get(cb);
- }
-
- public static void getBranches(
- Project.NameKey name,
- int limit,
- int start,
- String match,
- AsyncCallback<JsArray<BranchInfo>> cb) {
- getRestApi(name, "branches", limit, start, match).get(cb);
- }
-
- /** Delete branches. One call is fired to the server to delete all the branches. */
- public static void deleteBranches(
- Project.NameKey name, Set<String> refs, AsyncCallback<VoidResult> cb) {
- if (refs.size() == 1) {
- project(name).view("branches").id(refs.iterator().next()).delete(cb);
- } else {
- DeleteBranchesInput d = DeleteBranchesInput.create();
- for (String ref : refs) {
- d.addBranch(ref);
- }
- project(name).view("branches:delete").post(d, cb);
- }
- }
-
- public static void getConfig(Project.NameKey name, AsyncCallback<ConfigInfo> cb) {
- project(name).view("config").get(cb);
- }
-
- public static void setConfig(
- Project.NameKey name,
- String description,
- InheritableBoolean useContributorAgreements,
- InheritableBoolean useContentMerge,
- InheritableBoolean useSignedOffBy,
- InheritableBoolean createNewChangeForAllNotInTarget,
- InheritableBoolean requireChangeId,
- InheritableBoolean enableSignedPush,
- InheritableBoolean requireSignedPush,
- InheritableBoolean rejectImplicitMerges,
- InheritableBoolean privateByDefault,
- InheritableBoolean workInProgressByDefault,
- InheritableBoolean enableReviewerByEmail,
- InheritableBoolean matchAuthorToCommitterDate,
- String maxObjectSizeLimit,
- SubmitType submitType,
- ProjectState state,
- Map<String, Map<String, ConfigParameterValue>> pluginConfigValues,
- AsyncCallback<ConfigInfo> cb) {
- ConfigInput in = ConfigInput.create();
- in.setDescription(description);
- in.setUseContributorAgreements(useContributorAgreements);
- in.setUseContentMerge(useContentMerge);
- in.setUseSignedOffBy(useSignedOffBy);
- in.setRequireChangeId(requireChangeId);
- in.setCreateNewChangeForAllNotInTarget(createNewChangeForAllNotInTarget);
- if (enableSignedPush != null) {
- in.setEnableSignedPush(enableSignedPush);
- }
- if (requireSignedPush != null) {
- in.setRequireSignedPush(requireSignedPush);
- }
- in.setRejectImplicitMerges(rejectImplicitMerges);
- in.setPrivateByDefault(privateByDefault);
- in.setWorkInProgressByDefault(workInProgressByDefault);
- in.setMaxObjectSizeLimit(maxObjectSizeLimit);
- if (submitType != null) {
- in.setSubmitType(submitType);
- }
- in.setState(state);
- in.setPluginConfigValues(pluginConfigValues);
- in.setEnableReviewerByEmail(enableReviewerByEmail);
- in.setMatchAuthorToCommitterDate(matchAuthorToCommitterDate);
-
- project(name).view("config").put(in, cb);
- }
-
- public static void getParent(Project.NameKey name, AsyncCallback<Project.NameKey> cb) {
- project(name)
- .view("parent")
- .get(
- new AsyncCallback<NativeString>() {
- @Override
- public void onSuccess(NativeString result) {
- cb.onSuccess(new Project.NameKey(result.asString()));
- }
-
- @Override
- public void onFailure(Throwable caught) {
- cb.onFailure(caught);
- }
- });
- }
-
- public static void getChildren(
- Project.NameKey name, boolean recursive, AsyncCallback<JsArray<ProjectInfo>> cb) {
- RestApi view = project(name).view("children");
- if (recursive) {
- view.addParameterTrue("recursive");
- }
- view.get(cb);
- }
-
- public static void getDescription(Project.NameKey name, AsyncCallback<NativeString> cb) {
- project(name).view("description").get(cb);
- }
-
- public static void setDescription(
- Project.NameKey name, String description, AsyncCallback<NativeString> cb) {
- RestApi call = project(name).view("description");
- if (description != null && !description.isEmpty()) {
- DescriptionInput input = DescriptionInput.create();
- input.setDescription(description);
- call.put(input, cb);
- } else {
- call.delete(cb);
- }
- }
-
- public static void setHead(Project.NameKey name, String ref, AsyncCallback<NativeString> cb) {
- RestApi call = project(name).view("HEAD");
- HeadInput input = HeadInput.create();
- input.setRef(ref);
- call.put(input, cb);
- }
-
- public static RestApi project(Project.NameKey name) {
- return new RestApi("/projects/").id(name.get());
- }
-
- private static class ProjectInput extends JavaScriptObject {
- static ProjectInput create() {
- return (ProjectInput) createObject();
- }
-
- protected ProjectInput() {}
-
- final native void setName(String n) /*-{ if(n)this.name=n; }-*/;
-
- final native void setParent(String p) /*-{ if(p)this.parent=p; }-*/;
-
- final native void setPermissionsOnly(boolean po) /*-{ if(po)this.permissions_only=po; }-*/;
-
- final native void setCreateEmptyCommit(boolean cc) /*-{ if(cc)this.create_empty_commit=cc; }-*/;
- }
-
- private static class ConfigInput extends JavaScriptObject {
- static ConfigInput create() {
- return (ConfigInput) createObject();
- }
-
- protected ConfigInput() {}
-
- final native void setDescription(String d) /*-{ if(d)this.description=d; }-*/;
-
- final void setUseContributorAgreements(InheritableBoolean v) {
- setUseContributorAgreementsRaw(v.name());
- }
-
- private native void setUseContributorAgreementsRaw(String v)
- /*-{ if(v)this.use_contributor_agreements=v; }-*/ ;
-
- final void setUseContentMerge(InheritableBoolean v) {
- setUseContentMergeRaw(v.name());
- }
-
- private native void setUseContentMergeRaw(String v) /*-{ if(v)this.use_content_merge=v; }-*/;
-
- final void setUseSignedOffBy(InheritableBoolean v) {
- setUseSignedOffByRaw(v.name());
- }
-
- private native void setUseSignedOffByRaw(String v) /*-{ if(v)this.use_signed_off_by=v; }-*/;
-
- final void setRequireChangeId(InheritableBoolean v) {
- setRequireChangeIdRaw(v.name());
- }
-
- private native void setRequireChangeIdRaw(String v) /*-{ if(v)this.require_change_id=v; }-*/;
-
- final void setCreateNewChangeForAllNotInTarget(InheritableBoolean v) {
- setCreateNewChangeForAllNotInTargetRaw(v.name());
- }
-
- private native void setCreateNewChangeForAllNotInTargetRaw(String v)
- /*-{ if(v)this.create_new_change_for_all_not_in_target=v; }-*/ ;
-
- final void setEnableSignedPush(InheritableBoolean v) {
- setEnableSignedPushRaw(v.name());
- }
-
- private native void setEnableSignedPushRaw(String v) /*-{ if(v)this.enable_signed_push=v; }-*/;
-
- final void setRequireSignedPush(InheritableBoolean v) {
- setRequireSignedPushRaw(v.name());
- }
-
- final void setPrivateByDefault(InheritableBoolean v) {
- setPrivateByDefault(v.name());
- }
-
- private native void setPrivateByDefault(String v) /*-{ if(v)this.private_by_default=v; }-*/;
-
- final void setWorkInProgressByDefault(InheritableBoolean v) {
- setWorkInProgressByDefault(v.name());
- }
-
- private native void setWorkInProgressByDefault(
- String v) /*-{ if(v)this.work_in_progress_by_default=v; }-*/;
-
- final void setEnableReviewerByEmail(InheritableBoolean v) {
- setEnableReviewerByEmailRaw(v.name());
- }
-
- final void setMatchAuthorToCommitterDate(InheritableBoolean v) {
- setMatchAuthorToCommitterDateRaw(v.name());
- }
-
- private native void setMatchAuthorToCommitterDateRaw(String v)
- /*-{ if(v)this.match_author_to_committer_date=v; }-*/ ;
-
- private native void setEnableReviewerByEmailRaw(String v)
- /*-{ if(v)this.enable_reviewer_by_email=v; }-*/ ;
-
- private native void setRequireSignedPushRaw(String v)
- /*-{ if(v)this.require_signed_push=v; }-*/ ;
-
- final void setRejectImplicitMerges(InheritableBoolean v) {
- setRejectImplicitMergesRaw(v.name());
- }
-
- private native void setRejectImplicitMergesRaw(String v)
- /*-{ if(v)this.reject_implicit_merges=v; }-*/ ;
-
- final native void setMaxObjectSizeLimit(String l) /*-{ if(l)this.max_object_size_limit=l; }-*/;
-
- final void setSubmitType(SubmitType t) {
- setSubmitTypeRaw(t.name());
- }
-
- private native void setSubmitTypeRaw(String t) /*-{ if(t)this.submit_type=t; }-*/;
-
- final void setState(ProjectState s) {
- setStateRaw(s.name());
- }
-
- private native void setStateRaw(String s) /*-{ if(s)this.state=s; }-*/;
-
- final void setPluginConfigValues(
- Map<String, Map<String, ConfigParameterValue>> pluginConfigValues) {
- if (!pluginConfigValues.isEmpty()) {
- NativeMap<ConfigParameterValueMap> configValues = NativeMap.create().cast();
- for (Entry<String, Map<String, ConfigParameterValue>> e : pluginConfigValues.entrySet()) {
- ConfigParameterValueMap values = ConfigParameterValueMap.create();
- configValues.put(e.getKey(), values);
- for (Entry<String, ConfigParameterValue> e2 : e.getValue().entrySet()) {
- values.put(e2.getKey(), e2.getValue());
- }
- }
- setPluginConfigValuesRaw(configValues);
- }
- }
-
- private native void setPluginConfigValuesRaw(NativeMap<ConfigParameterValueMap> v)
- /*-{ this.plugin_config_values=v; }-*/ ;
- }
-
- private static class ConfigParameterValueMap extends JavaScriptObject {
- static ConfigParameterValueMap create() {
- return createObject().cast();
- }
-
- protected ConfigParameterValueMap() {}
-
- public final native void put(String n, ConfigParameterValue v) /*-{ this[n] = v; }-*/;
- }
-
- private static class TagInput extends JavaScriptObject {
- static TagInput create() {
- return (TagInput) createObject();
- }
-
- protected TagInput() {}
-
- final native void setRevision(String r) /*-{ if(r)this.revision=r; }-*/;
-
- final native void setMessage(String m) /*-{ if(m)this.message=m; }-*/;
- }
-
- private static class BranchInput extends JavaScriptObject {
- static BranchInput create() {
- return (BranchInput) createObject();
- }
-
- protected BranchInput() {}
-
- final native void setRevision(String r) /*-{ if(r)this.revision=r; }-*/;
- }
-
- private static class DescriptionInput extends JavaScriptObject {
- static DescriptionInput create() {
- return (DescriptionInput) createObject();
- }
-
- protected DescriptionInput() {}
-
- final native void setDescription(String d) /*-{ if(d)this.description=d; }-*/;
- }
-
- private static class HeadInput extends JavaScriptObject {
- static HeadInput create() {
- return createObject().cast();
- }
-
- protected HeadInput() {}
-
- final native void setRef(String r) /*-{ if(r)this.ref=r; }-*/;
- }
-
- private static class DeleteTagsInput extends JavaScriptObject {
- static DeleteTagsInput create() {
- DeleteTagsInput d = createObject().cast();
- d.init();
- return d;
- }
-
- protected DeleteTagsInput() {}
-
- final native void init() /*-{ this.tags = []; }-*/;
-
- final native void addTag(String b) /*-{ this.tags.push(b); }-*/;
- }
-
- private static class DeleteBranchesInput extends JavaScriptObject {
- static DeleteBranchesInput create() {
- DeleteBranchesInput d = createObject().cast();
- d.init();
- return d;
- }
-
- protected DeleteBranchesInput() {}
-
- final native void init() /*-{ this.branches = []; }-*/;
-
- final native void addBranch(String b) /*-{ this.branches.push(b); }-*/;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ProjectInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ProjectInfo.java
deleted file mode 100644
index 1ff568f..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ProjectInfo.java
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright (C) 2012 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.client.projects;
-
-import com.google.gerrit.client.info.WebLinkInfo;
-import com.google.gerrit.extensions.client.ProjectState;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.ui.SuggestOracle;
-
-public class ProjectInfo extends JavaScriptObject implements SuggestOracle.Suggestion {
- public final Project.NameKey name_key() {
- return new Project.NameKey(name());
- }
-
- public final native String name() /*-{ return this.name; }-*/;
-
- public final native String description() /*-{ return this.description; }-*/;
-
- public final native JsArray<WebLinkInfo> webLinks() /*-{ return this.web_links; }-*/;
-
- public final ProjectState state() {
- return ProjectState.valueOf(getStringState());
- }
-
- private native String getStringState() /*-{ return this.state; }-*/;
-
- @Override
- public final String getDisplayString() {
- if (description() != null) {
- return name() + " (" + description() + ")";
- }
- return name();
- }
-
- @Override
- public final String getReplacementString() {
- return name();
- }
-
- protected ProjectInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ProjectMap.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ProjectMap.java
deleted file mode 100644
index 5ff300d..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ProjectMap.java
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright (C) 2012 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.client.projects;
-
-import com.google.gerrit.client.rpc.NativeMap;
-import com.google.gerrit.client.rpc.RestApi;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-
-/** Projects available from {@code /projects/}. */
-public class ProjectMap extends NativeMap<ProjectInfo> {
- public static void all(AsyncCallback<ProjectMap> callback) {
- new RestApi("/projects/")
- .addParameterRaw("type", "ALL")
- .addParameterTrue("all")
- .addParameterTrue("d") // description
- .get(NativeMap.copyKeysIntoChildren(callback));
- }
-
- public static void permissions(AsyncCallback<ProjectMap> callback) {
- new RestApi("/projects/")
- .addParameterRaw("type", "PERMISSIONS")
- .addParameterTrue("all")
- .addParameterTrue("d") // description
- .get(NativeMap.copyKeysIntoChildren(callback));
- }
-
- public static void parentCandidates(AsyncCallback<ProjectMap> callback) {
- new RestApi("/projects/")
- .addParameterRaw("type", "PARENT_CANDIDATES")
- .addParameterTrue("all")
- .addParameterTrue("d") // description
- .get(NativeMap.copyKeysIntoChildren(callback));
- }
-
- public static void suggest(String match, int limit, AsyncCallback<ProjectMap> cb) {
- new RestApi("/projects/")
- .addParameter("m", match)
- .addParameter("n", limit)
- .addParameterRaw("type", "ALL")
- .addParameterTrue("d") // description
- .background()
- .get(NativeMap.copyKeysIntoChildren(cb));
- }
-
- public static void match(String match, int limit, int start, AsyncCallback<ProjectMap> cb) {
- RestApi call = new RestApi("/projects/");
- if (match != null) {
- if (match.startsWith("^")) {
- call.addParameter("r", match);
- } else {
- call.addParameter("m", match);
- }
- }
- if (limit > 0) {
- call.addParameter("n", limit);
- }
- if (start > 0) {
- call.addParameter("S", start);
- }
- call.addParameterRaw("type", "ALL");
- call.addParameterTrue("d"); // description
- call.get(NativeMap.copyKeysIntoChildren(cb));
- }
-
- public static void match(String match, AsyncCallback<ProjectMap> cb) {
- match(match, 0, 0, cb);
- }
-
- protected ProjectMap() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/RefInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/RefInfo.java
deleted file mode 100644
index 90c862f..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/RefInfo.java
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (C) 2015 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.client.projects;
-
-import com.google.gerrit.reviewdb.client.RefNames;
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class RefInfo extends JavaScriptObject {
- public final String getShortName() {
- return RefNames.shortName(ref());
- }
-
- public final native String ref() /*-{ return this.ref; }-*/;
-
- public final native String revision() /*-{ return this.revision; }-*/;
-
- protected RefInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/TagInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/TagInfo.java
deleted file mode 100644
index fc13fe1..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/TagInfo.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) 2015 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.client.projects;
-
-import com.google.gerrit.client.info.WebLinkInfo;
-import com.google.gwt.core.client.JsArray;
-
-public class TagInfo extends RefInfo {
- public final native boolean canDelete() /*-{ return this['can_delete'] ? true : false; }-*/;
-
- public final native JsArray<WebLinkInfo> webLinks() /*-{ return this.web_links; }-*/;
-
- // TODO(dpursehouse) add extra tag-related fields (message, tagger, etc)
- protected TagInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ThemeInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ThemeInfo.java
deleted file mode 100644
index 7584e14..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ThemeInfo.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) 2013 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.client.projects;
-
-import com.google.gwt.core.client.JavaScriptObject;
-
-public class ThemeInfo extends JavaScriptObject {
- public final native String css() /*-{ return this.css; }-*/;
-
- public final native String header() /*-{ return this.header; }-*/;
-
- public final native String footer() /*-{ return this.footer; }-*/;
-
- protected ThemeInfo() {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/CallbackGroup.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/CallbackGroup.java
deleted file mode 100644
index af32d01..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/CallbackGroup.java
+++ /dev/null
@@ -1,260 +0,0 @@
-// Copyright (C) 2013 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.client.rpc;
-
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-/**
- * Class for grouping together callbacks and calling them in order.
- *
- * <p>Callbacks are added to the group with {@link #add(AsyncCallback)}, which returns a wrapped
- * callback suitable for passing to an asynchronous RPC call. The last callback must be added using
- * {@link #addFinal(AsyncCallback)} or {@link #done()} must be invoked.
- *
- * <p>The enclosing group buffers returned results and ensures that {@code onSuccess} is called
- * exactly once for each callback in the group, in the same order that callbacks were added. This
- * allows callers to, for example, use a {@link ScreenLoadCallback} as the last callback in the list
- * and only display the screen once all callbacks have succeeded.
- *
- * <p>In the event of a failure, the <em>first</em> caught exception is sent to <em>all</em>
- * callbacks' {@code onFailure} methods, in order; subsequent successes or failures are all ignored.
- * Note that this means {@code onFailure} may be called with an exception unrelated to the callback
- * processing it.
- */
-public class CallbackGroup {
- private final List<CallbackGlue> callbacks;
- private final Set<CallbackGlue> remaining;
- private boolean finalAdded;
-
- private boolean failed;
- private Throwable failedThrowable;
-
- public static <T> Callback<T> emptyCallback() {
- return new Callback<T>() {
- @Override
- public void onSuccess(T result) {}
-
- @Override
- public void onFailure(Throwable err) {}
- };
- }
-
- public CallbackGroup() {
- callbacks = new ArrayList<>();
- remaining = new HashSet<>();
- }
-
- public <T> Callback<T> addEmpty() {
- Callback<T> cb = emptyCallback();
- return add(cb);
- }
-
- public <T> Callback<T> add(AsyncCallback<T> cb) {
- checkFinalAdded();
- return handleAdd(cb);
- }
-
- public <T> HttpCallback<T> add(HttpCallback<T> cb) {
- checkFinalAdded();
- return handleAdd(cb);
- }
-
- public <T> Callback<T> addFinal(AsyncCallback<T> cb) {
- checkFinalAdded();
- finalAdded = true;
- return handleAdd(cb);
- }
-
- public <T> HttpCallback<T> addFinal(HttpCallback<T> cb) {
- checkFinalAdded();
- finalAdded = true;
- return handleAdd(cb);
- }
-
- public void done() {
- finalAdded = true;
- apply();
- }
-
- public void addListener(AsyncCallback<Void> cb) {
- if (!failed && finalAdded && remaining.isEmpty()) {
- cb.onSuccess(null);
- } else {
- handleAdd(cb).onSuccess(null);
- }
- }
-
- public void addListener(CallbackGroup group) {
- addListener(group.<Void>addEmpty());
- }
-
- private void success(CallbackGlue cb) {
- remaining.remove(cb);
- apply();
- }
-
- private <T> void failure(CallbackGlue w, Throwable caught) {
- if (!failed) {
- failed = true;
- failedThrowable = caught;
- }
- remaining.remove(w);
- apply();
- }
-
- private void apply() {
- if (finalAdded && remaining.isEmpty()) {
- if (failed) {
- for (CallbackGlue cb : callbacks) {
- cb.applyFailed();
- }
- } else {
- for (CallbackGlue cb : callbacks) {
- cb.applySuccess();
- }
- }
- callbacks.clear();
- }
- }
-
- private <T> Callback<T> handleAdd(AsyncCallback<T> cb) {
- if (failed) {
- cb.onFailure(failedThrowable);
- return emptyCallback();
- }
-
- CallbackImpl<T> wrapper = new CallbackImpl<>(cb);
- callbacks.add(wrapper);
- remaining.add(wrapper);
- return wrapper;
- }
-
- private <T> HttpCallback<T> handleAdd(HttpCallback<T> cb) {
- if (failed) {
- cb.onFailure(failedThrowable);
- return new HttpCallback<T>() {
- @Override
- public void onSuccess(HttpResponse<T> result) {}
-
- @Override
- public void onFailure(Throwable caught) {}
- };
- }
-
- HttpCallbackImpl<T> w = new HttpCallbackImpl<>(cb);
- callbacks.add(w);
- remaining.add(w);
- return w;
- }
-
- private void checkFinalAdded() {
- if (finalAdded) {
- throw new IllegalStateException("final callback already added");
- }
- }
-
- public interface Callback<T>
- extends AsyncCallback<T>, com.google.gwtjsonrpc.common.AsyncCallback<T> {}
-
- private interface CallbackGlue {
- void applySuccess();
-
- void applyFailed();
- }
-
- private class CallbackImpl<T> implements Callback<T>, CallbackGlue {
- AsyncCallback<T> delegate;
- T result;
-
- CallbackImpl(AsyncCallback<T> delegate) {
- this.delegate = delegate;
- }
-
- @Override
- public void onSuccess(T value) {
- this.result = value;
- success(this);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- failure(this, caught);
- }
-
- @Override
- public void applySuccess() {
- AsyncCallback<T> cb = delegate;
- if (cb != null) {
- delegate = null;
- cb.onSuccess(result);
- result = null;
- }
- }
-
- @Override
- public void applyFailed() {
- AsyncCallback<T> cb = delegate;
- if (cb != null) {
- delegate = null;
- result = null;
- cb.onFailure(failedThrowable);
- }
- }
- }
-
- private class HttpCallbackImpl<T> implements HttpCallback<T>, CallbackGlue {
- private HttpCallback<T> delegate;
- private HttpResponse<T> result;
-
- HttpCallbackImpl(HttpCallback<T> delegate) {
- this.delegate = delegate;
- }
-
- @Override
- public void onSuccess(HttpResponse<T> result) {
- this.result = result;
- success(this);
- }
-
- @Override
- public void onFailure(Throwable caught) {
- failure(this, caught);
- }
-
- @Override
- public void applySuccess() {
- HttpCallback<T> cb = delegate;
- if (cb != null) {
- delegate = null;
- cb.onSuccess(result);
- result = null;
- }
- }
-
- @Override
- public void applyFailed() {
- HttpCallback<T> cb = delegate;
- if (cb != null) {
- delegate = null;
- result = null;
- cb.onFailure(failedThrowable);
- }
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/GerritCallback.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/GerritCallback.java
deleted file mode 100644
index 2d6723a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/GerritCallback.java
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright (C) 2008 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.client.rpc;
-
-import com.google.gerrit.client.ErrorDialog;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.NotSignedInDialog;
-import com.google.gerrit.common.errors.NameAlreadyUsedException;
-import com.google.gerrit.common.errors.NoSuchAccountException;
-import com.google.gerrit.common.errors.NoSuchEntityException;
-import com.google.gerrit.common.errors.NoSuchGroupException;
-import com.google.gerrit.common.errors.NotSignedInException;
-import com.google.gwt.user.client.rpc.InvocationException;
-import com.google.gwtjsonrpc.client.RemoteJsonException;
-import com.google.gwtjsonrpc.client.ServerUnavailableException;
-import com.google.gwtjsonrpc.common.JsonConstants;
-
-/** Abstract callback handling generic error conditions automatically */
-public abstract class GerritCallback<T>
- implements com.google.gwtjsonrpc.common.AsyncCallback<T>,
- com.google.gwt.user.client.rpc.AsyncCallback<T> {
- @Override
- public void onFailure(Throwable caught) {
- showFailure(caught);
- }
-
- public static void showFailure(Throwable caught) {
- if (isSigninFailure(caught)) {
- new NotSignedInDialog().center();
- } else if (isNoSuchEntity(caught)) {
- new ErrorDialog(Gerrit.C.notFoundBody()).center();
- } else if (isNoSuchAccount(caught)) {
- final String msg = caught.getMessage();
- final String who = msg.substring(NoSuchAccountException.MESSAGE.length());
- final ErrorDialog d = new ErrorDialog(Gerrit.M.noSuchAccountMessage(who));
- d.setText(Gerrit.C.noSuchAccountTitle());
- d.center();
-
- } else if (isNameAlreadyUsed(caught)) {
- final String msg = caught.getMessage();
- final String alreadyUsedName = msg.substring(NameAlreadyUsedException.MESSAGE.length());
- new ErrorDialog(Gerrit.M.nameAlreadyUsedBody(alreadyUsedName)).center();
-
- } else if (isNoSuchGroup(caught)) {
- final String msg = caught.getMessage();
- final String group = msg.substring(NoSuchGroupException.MESSAGE.length());
- final ErrorDialog d = new ErrorDialog(Gerrit.M.noSuchGroupMessage(group));
- d.setText(Gerrit.C.noSuchGroupTitle());
- d.center();
-
- } else if (caught instanceof ServerUnavailableException) {
- new ErrorDialog(RpcConstants.C.errorServerUnavailable()).center();
-
- } else {
- new ErrorDialog(caught).center();
- }
- }
-
- public static boolean isSigninFailure(Throwable caught) {
- if (isNotSignedIn(caught)
- || isInvalidXSRF(caught)
- || (isNoSuchEntity(caught) && !Gerrit.isSignedIn())) {
- return true;
- }
- return false;
- }
-
- protected static boolean isInvalidXSRF(Throwable caught) {
- return caught instanceof InvocationException
- && caught.getMessage().equals(JsonConstants.ERROR_INVALID_XSRF);
- }
-
- protected static boolean isNotSignedIn(Throwable caught) {
- return RestApi.isNotSignedIn(caught)
- || (caught instanceof RemoteJsonException
- && caught.getMessage().equals(NotSignedInException.MESSAGE));
- }
-
- protected static boolean isNoSuchEntity(Throwable caught) {
- return RestApi.isNotFound(caught)
- || (caught instanceof RemoteJsonException
- && caught.getMessage().equals(NoSuchEntityException.MESSAGE));
- }
-
- protected static boolean isNoSuchAccount(Throwable caught) {
- return caught instanceof RemoteJsonException
- && caught.getMessage().startsWith(NoSuchAccountException.MESSAGE);
- }
-
- protected static boolean isNameAlreadyUsed(Throwable caught) {
- return caught instanceof RemoteJsonException
- && caught.getMessage().startsWith(NameAlreadyUsedException.MESSAGE);
- }
-
- protected static boolean isNoSuchGroup(Throwable caught) {
- return caught instanceof RemoteJsonException
- && caught.getMessage().startsWith(NoSuchGroupException.MESSAGE);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/HttpCallback.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/HttpCallback.java
deleted file mode 100644
index 2de2980..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/HttpCallback.java
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (C) 2015 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.client.rpc;
-
-/** AsyncCallback supplied with HTTP response headers. */
-public interface HttpCallback<T> {
- void onSuccess(HttpResponse<T> result);
-
- void onFailure(Throwable caught);
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/HttpResponse.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/HttpResponse.java
deleted file mode 100644
index 22d62fb..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/HttpResponse.java
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright (C) 2015 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.client.rpc;
-
-import com.google.gwt.http.client.Response;
-
-/** Wraps decoded server reply with HTTP headers. */
-public class HttpResponse<T> {
- private final Response httpResponse;
- private final String contentType;
- private final T result;
-
- HttpResponse(Response httpResponse, String contentType, T result) {
- this.httpResponse = httpResponse;
- this.contentType = contentType;
- this.result = result;
- }
-
- /** HTTP status code, always in the 2xx family. */
- public int getStatusCode() {
- return httpResponse.getStatusCode();
- }
-
- /**
- * Content type supplied by the server.
- *
- * <p>This helper simplifies the common {@code getHeader("Content-Type")} case.
- */
- public String getContentType() {
- return contentType;
- }
-
- /** Lookup an arbitrary reply header. */
- public String getHeader(String header) {
- if ("Content-Type".equals(header)) {
- return contentType;
- }
- return httpResponse.getHeader(header);
- }
-
- public T getResult() {
- return result;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/RestApi.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/RestApi.java
deleted file mode 100644
index e2a9ffb..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/RestApi.java
+++ /dev/null
@@ -1,519 +0,0 @@
-// Copyright (C) 2012 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.client.rpc;
-
-import static com.google.gwt.http.client.RequestBuilder.DELETE;
-import static com.google.gwt.http.client.RequestBuilder.GET;
-import static com.google.gwt.http.client.RequestBuilder.POST;
-import static com.google.gwt.http.client.RequestBuilder.PUT;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.RpcStatus;
-import com.google.gerrit.common.data.HostPageData;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.core.client.JavaScriptObject;
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.http.client.Request;
-import com.google.gwt.http.client.RequestBuilder;
-import com.google.gwt.http.client.RequestBuilder.Method;
-import com.google.gwt.http.client.RequestCallback;
-import com.google.gwt.http.client.RequestException;
-import com.google.gwt.http.client.Response;
-import com.google.gwt.http.client.URL;
-import com.google.gwt.json.client.JSONException;
-import com.google.gwt.json.client.JSONParser;
-import com.google.gwt.json.client.JSONValue;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.rpc.StatusCodeException;
-
-/** Makes a REST API call to the server. */
-public class RestApi {
- private static final int SC_UNAVAILABLE = 2;
- private static final int SC_BAD_TRANSPORT = 3;
- private static final int SC_BAD_RESPONSE = 4;
- private static final String JSON_TYPE = "application/json";
- private static final String JSON_UTF8 = JSON_TYPE + "; charset=utf-8";
- private static final String TEXT_TYPE = "text/plain";
- private static final String TEXT_UTF8 = TEXT_TYPE + "; charset=utf-8";
-
- /**
- * Expected JSON content body prefix that prevents XSSI.
- *
- * <p>The server always includes this line as the first line of the response content body when the
- * response body is formatted as JSON. It gets inserted by the server to prevent the resource from
- * being imported into another domain's page using a <script> tag. This line must be removed
- * before the JSON can be parsed.
- */
- private static final String JSON_MAGIC = ")]}'\n";
-
- /** True if err is a StatusCodeException reporting Not Found. */
- public static boolean isNotFound(Throwable err) {
- return isStatus(err, Response.SC_NOT_FOUND);
- }
-
- /** True if err is describing a user that is currently anonymous. */
- public static boolean isNotSignedIn(Throwable err) {
- if (err instanceof StatusCodeException) {
- StatusCodeException sce = (StatusCodeException) err;
- if (sce.getStatusCode() == Response.SC_UNAUTHORIZED) {
- return true;
- }
- return sce.getStatusCode() == Response.SC_FORBIDDEN
- && (sce.getEncodedResponse().equals("Authentication required")
- || sce.getEncodedResponse().startsWith("Must be signed-in")
- || sce.getEncodedResponse().startsWith("Invalid authentication"));
- }
- return false;
- }
-
- /** True if err is a StatusCodeException with a specific HTTP code. */
- public static boolean isStatus(Throwable err, int status) {
- return err instanceof StatusCodeException
- && ((StatusCodeException) err).getStatusCode() == status;
- }
-
- /** Is the Gerrit Code Review server likely to return this status? */
- public static boolean isExpected(int statusCode) {
- switch (statusCode) {
- case SC_UNAVAILABLE:
- case Response.SC_BAD_REQUEST:
- case Response.SC_UNAUTHORIZED:
- case Response.SC_FORBIDDEN:
- case Response.SC_NOT_FOUND:
- case Response.SC_METHOD_NOT_ALLOWED:
- case Response.SC_CONFLICT:
- case Response.SC_PRECONDITION_FAILED:
- case 422: // Unprocessable Entity
- case 429: // Too Many Requests (RFC 6585)
- return true;
-
- default:
- // Assume any other code is not expected. These may be
- // local proxy server errors outside of our control.
- return false;
- }
- }
-
- private static class HttpImpl<T extends JavaScriptObject> implements RequestCallback {
- private final boolean background;
- private final HttpCallback<T> cb;
-
- HttpImpl(boolean bg, HttpCallback<T> cb) {
- this.background = bg;
- this.cb = cb;
- }
-
- @Override
- public void onResponseReceived(Request req, Response res) {
- int status = res.getStatusCode();
- if (status == Response.SC_NO_CONTENT) {
- cb.onSuccess(new HttpResponse<T>(res, null, null));
- if (!background) {
- RpcStatus.INSTANCE.onRpcComplete();
- }
-
- } else if (200 <= status && status < 300) {
- long start = System.currentTimeMillis();
- final T data;
- final String type;
- if (isJsonBody(res)) {
- try {
- JSONValue val = parseJson(res);
- if (isJsonEncoded(res) && val.isString() != null) {
- data = NativeString.wrap(val.isString().stringValue()).cast();
- type = simpleType(res.getHeader("X-FYI-Content-Type"));
- } else {
- data = RestApi.<T>cast(val);
- type = JSON_TYPE;
- }
- } catch (JSONException e) {
- if (!background) {
- RpcStatus.INSTANCE.onRpcComplete();
- }
- cb.onFailure(
- new StatusCodeException(SC_BAD_RESPONSE, "Invalid JSON: " + e.getMessage()));
- return;
- }
- } else if (isTextBody(res)) {
- data = NativeString.wrap(res.getText()).cast();
- type = TEXT_TYPE;
- } else {
- if (!background) {
- RpcStatus.INSTANCE.onRpcComplete();
- }
- cb.onFailure(
- new StatusCodeException(
- SC_BAD_RESPONSE,
- "Expected "
- + JSON_TYPE
- + " or "
- + TEXT_TYPE
- + "; received Content-Type: "
- + res.getHeader("Content-Type")));
- return;
- }
-
- Scheduler.ScheduledCommand cmd =
- new Scheduler.ScheduledCommand() {
- @Override
- public void execute() {
- try {
- cb.onSuccess(new HttpResponse<>(res, type, data));
- } finally {
- if (!background) {
- RpcStatus.INSTANCE.onRpcComplete();
- }
- }
- }
- };
-
- // Defer handling the response if the create took a while.
- if ((System.currentTimeMillis() - start) > 75) {
- Scheduler.get().scheduleDeferred(cmd);
- } else {
- cmd.execute();
- }
- } else {
- String msg;
- if (isTextBody(res)) {
- msg = res.getText().trim();
- } else if (isJsonBody(res)) {
- JSONValue v;
- try {
- v = parseJson(res);
- } catch (JSONException e) {
- v = null;
- }
- if (v != null && v.isString() != null) {
- msg = v.isString().stringValue();
- } else {
- msg = trimJsonMagic(res.getText()).trim();
- }
- } else {
- msg = res.getStatusText();
- }
-
- if (!background) {
- RpcStatus.INSTANCE.onRpcComplete();
- }
- cb.onFailure(new StatusCodeException(status, msg));
- }
- }
-
- @Override
- public void onError(Request req, Throwable err) {
- if (!background) {
- RpcStatus.INSTANCE.onRpcComplete();
- }
- if (err.getMessage().contains("XmlHttpRequest.status")) {
- cb.onFailure(
- new StatusCodeException(SC_UNAVAILABLE, RpcConstants.C.errorServerUnavailable()));
- } else {
- cb.onFailure(new StatusCodeException(SC_BAD_TRANSPORT, err.getMessage()));
- }
- }
- }
-
- private StringBuilder url;
- private boolean hasQueryParams;
- private boolean background;
- private String ifNoneMatch;
-
- /**
- * Initialize a new API call.
- *
- * <p>By default the JSON format will be selected by including an HTTP Accept header in the
- * request.
- *
- * @param name URL of the REST resource to access, e.g. {@code "/projects/"} to list accessible
- * projects from the server.
- */
- public RestApi(String name) {
- if (name.startsWith("/")) {
- name = name.substring(1);
- }
-
- url = new StringBuilder();
- url.append(GWT.getHostPageBaseURL());
- url.append(name);
- }
-
- public RestApi view(String name) {
- return idRaw(name);
- }
-
- public RestApi id(String id) {
- return idRaw(URL.encodePathSegment(id));
- }
-
- public RestApi id(String project, int id) {
- return idRaw(URL.encodePathSegment(project) + "~" + id);
- }
-
- public RestApi id(int id) {
- return idRaw(Integer.toString(id));
- }
-
- public RestApi idRaw(String name) {
- if (hasQueryParams) {
- throw new IllegalStateException();
- }
- if (url.charAt(url.length() - 1) != '/') {
- url.append('/');
- }
- url.append(name);
- return this;
- }
-
- public RestApi addParameter(String name, String value) {
- return addParameterRaw(name, URL.encodeQueryString(value));
- }
-
- public RestApi addParameter(String name, String... value) {
- for (String val : value) {
- addParameter(name, val);
- }
- return this;
- }
-
- public RestApi addParameterTrue(String name) {
- return addParameterRaw(name, null);
- }
-
- public RestApi addParameter(String name, boolean value) {
- return addParameterRaw(name, value ? "t" : "f");
- }
-
- public RestApi addParameter(String name, int value) {
- return addParameterRaw(name, String.valueOf(value));
- }
-
- public RestApi addParameter(String name, Enum<?> value) {
- return addParameterRaw(name, value.name());
- }
-
- public RestApi addParameterRaw(String name, String value) {
- if (hasQueryParams) {
- url.append("&");
- } else {
- url.append("?");
- hasQueryParams = true;
- }
- url.append(name);
- if (value != null) {
- url.append("=").append(value);
- }
- return this;
- }
-
- public RestApi ifNoneMatch() {
- return ifNoneMatch("*");
- }
-
- public RestApi ifNoneMatch(String etag) {
- ifNoneMatch = etag;
- return this;
- }
-
- public RestApi background() {
- background = true;
- return this;
- }
-
- public String url() {
- return url.toString();
- }
-
- public <T extends JavaScriptObject> void get(AsyncCallback<T> cb) {
- get(wrap(cb));
- }
-
- public <T extends JavaScriptObject> void get(HttpCallback<T> cb) {
- send(GET, cb);
- }
-
- public <T extends JavaScriptObject> void delete(AsyncCallback<T> cb) {
- delete(wrap(cb));
- }
-
- public <T extends JavaScriptObject> void delete(HttpCallback<T> cb) {
- send(DELETE, cb);
- }
-
- private <T extends JavaScriptObject> void send(Method method, HttpCallback<T> cb) {
- HttpImpl<T> httpCallback = new HttpImpl<>(background, cb);
- try {
- if (!background) {
- RpcStatus.INSTANCE.onRpcStart();
- }
- request(method).sendRequest(null, httpCallback);
- } catch (RequestException e) {
- httpCallback.onError(null, e);
- }
- }
-
- public <T extends JavaScriptObject> void post(JavaScriptObject content, AsyncCallback<T> cb) {
- post(content, wrap(cb));
- }
-
- public <T extends JavaScriptObject> void post(JavaScriptObject content, HttpCallback<T> cb) {
- sendJSON(POST, content, cb);
- }
-
- public <T extends JavaScriptObject> void post(String content, AsyncCallback<T> cb) {
- post(content, wrap(cb));
- }
-
- public <T extends JavaScriptObject> void post(String content, HttpCallback<T> cb) {
- sendText(POST, content, cb);
- }
-
- public <T extends JavaScriptObject> void put(AsyncCallback<T> cb) {
- put(wrap(cb));
- }
-
- public <T extends JavaScriptObject> void put(HttpCallback<T> cb) {
- send(PUT, cb);
- }
-
- public <T extends JavaScriptObject> void put(String content, AsyncCallback<T> cb) {
- put(content, wrap(cb));
- }
-
- public <T extends JavaScriptObject> void put(String content, HttpCallback<T> cb) {
- sendText(PUT, content, cb);
- }
-
- public <T extends JavaScriptObject> void put(JavaScriptObject content, AsyncCallback<T> cb) {
- put(content, wrap(cb));
- }
-
- public <T extends JavaScriptObject> void put(JavaScriptObject content, HttpCallback<T> cb) {
- sendJSON(PUT, content, cb);
- }
-
- private <T extends JavaScriptObject> void sendJSON(
- Method method, JavaScriptObject content, HttpCallback<T> cb) {
- HttpImpl<T> httpCallback = new HttpImpl<>(background, cb);
- try {
- if (!background) {
- RpcStatus.INSTANCE.onRpcStart();
- }
- RequestBuilder req = request(method);
- req.setHeader("Content-Type", JSON_UTF8);
- req.sendRequest(str(content), httpCallback);
- } catch (RequestException e) {
- httpCallback.onError(null, e);
- }
- }
-
- private static native String str(JavaScriptObject jso) /*-{ return JSON.stringify(jso) }-*/;
-
- private <T extends JavaScriptObject> void sendText(
- Method method, String body, HttpCallback<T> cb) {
- HttpImpl<T> httpCallback = new HttpImpl<>(background, cb);
- try {
- if (!background) {
- RpcStatus.INSTANCE.onRpcStart();
- }
- RequestBuilder req = request(method);
- req.setHeader("Content-Type", TEXT_UTF8);
- req.sendRequest(body, httpCallback);
- } catch (RequestException e) {
- httpCallback.onError(null, e);
- }
- }
-
- private RequestBuilder request(Method method) {
- RequestBuilder req = new RequestBuilder(method, url());
- if (ifNoneMatch != null) {
- req.setHeader("If-None-Match", ifNoneMatch);
- }
- req.setHeader("Accept", JSON_TYPE);
- if (Gerrit.getXGerritAuth() != null) {
- req.setHeader(HostPageData.XSRF_HEADER_NAME, Gerrit.getXGerritAuth());
- }
- return req;
- }
-
- private static boolean isJsonBody(Response res) {
- return isContentType(res, JSON_TYPE);
- }
-
- private static boolean isTextBody(Response res) {
- return isContentType(res, TEXT_TYPE);
- }
-
- private static boolean isJsonEncoded(Response res) {
- return "json".equals(res.getHeader("X-FYI-Content-Encoding"));
- }
-
- private static boolean isContentType(Response res, String want) {
- String type = res.getHeader("Content-Type");
- return type != null && want.equals(simpleType(type));
- }
-
- private static String simpleType(String type) {
- int semi = type.indexOf(';');
- if (semi >= 0) {
- return type.substring(0, semi).trim();
- }
- return type;
- }
-
- private static JSONValue parseJson(Response res) throws JSONException {
- String json = trimJsonMagic(res.getText());
- if (json.isEmpty()) {
- throw new JSONException("response was empty");
- }
- return JSONParser.parseStrict(json);
- }
-
- private static String trimJsonMagic(String json) {
- if (json.startsWith(JSON_MAGIC)) {
- json = json.substring(JSON_MAGIC.length());
- }
- return json;
- }
-
- @SuppressWarnings("unchecked")
- private static <T extends JavaScriptObject> T cast(JSONValue val) {
- if (val.isObject() != null) {
- return (T) val.isObject().getJavaScriptObject();
- } else if (val.isArray() != null) {
- return (T) val.isArray().getJavaScriptObject();
- } else if (val.isString() != null) {
- return (T) NativeString.wrap(val.isString().stringValue());
- } else if (val.isNull() != null) {
- return null;
- } else {
- throw new JSONException("unsupported JSON type");
- }
- }
-
- private static <T extends JavaScriptObject> HttpCallback<T> wrap(AsyncCallback<T> cb) {
- return new HttpCallback<T>() {
- @Override
- public void onSuccess(HttpResponse<T> r) {
- cb.onSuccess(r.getResult());
- }
-
- @Override
- public void onFailure(Throwable e) {
- cb.onFailure(e);
- }
- };
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/RpcConstants.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/RpcConstants.java
deleted file mode 100644
index 56d536d..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/RpcConstants.java
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright (C) 2008 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.client.rpc;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.i18n.client.Constants;
-
-public interface RpcConstants extends Constants {
- RpcConstants C = GWT.create(RpcConstants.class);
-
- String errorServerUnavailable();
-
- String errorRemoteJsonException();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/RpcConstants.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/RpcConstants.properties
deleted file mode 100644
index e8695b1..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/RpcConstants.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-errorServerUnavailable = Server Unavailable
-errorRemoteJsonException = Server Error
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/ScreenLoadCallback.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/ScreenLoadCallback.java
deleted file mode 100644
index 3aae04a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/rpc/ScreenLoadCallback.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (C) 2008 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.client.rpc;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.NotFoundScreen;
-import com.google.gerrit.client.NotSignedInDialog;
-import com.google.gerrit.client.ui.Screen;
-import com.google.gerrit.common.errors.NoSuchEntityException;
-
-/** Callback switching {@link NoSuchEntityException} to {@link NotFoundScreen} */
-public abstract class ScreenLoadCallback<T> extends GerritCallback<T> {
- private final Screen screen;
-
- public ScreenLoadCallback(Screen s) {
- screen = s;
- }
-
- @Override
- public final void onSuccess(T result) {
- if (screen.isAttached()) {
- preDisplay(result);
- screen.display();
- postDisplay();
- }
- }
-
- protected abstract void preDisplay(T result);
-
- protected void postDisplay() {}
-
- @Override
- public void onFailure(Throwable caught) {
- if (isSigninFailure(caught)) {
- new NotSignedInDialog().center();
- } else if (isNoSuchEntity(caught)) {
- Gerrit.display(screen.getToken(), new NotFoundScreen());
- } else {
- super.onFailure(caught);
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountGroupSuggestOracle.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountGroupSuggestOracle.java
deleted file mode 100644
index bdebd68..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountGroupSuggestOracle.java
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (C) 2008 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.client.ui;
-
-import com.google.gerrit.client.groups.GroupMap;
-import com.google.gerrit.client.info.GroupInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.reviewdb.client.AccountGroup;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.user.client.ui.SuggestOracle;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-/** Suggestion Oracle for AccountGroup entities. */
-public class AccountGroupSuggestOracle extends SuggestAfterTypingNCharsOracle {
- private Map<String, AccountGroup.UUID> priorResults = new HashMap<>();
-
- private Project.NameKey projectName;
-
- @Override
- public void _onRequestSuggestions(Request req, Callback callback) {
- GroupMap.suggestAccountGroupForProject(
- projectName == null ? null : projectName.get(),
- req.getQuery(),
- req.getLimit(),
- new GerritCallback<GroupMap>() {
- @Override
- public void onSuccess(GroupMap result) {
- priorResults.clear();
- ArrayList<AccountGroupSuggestion> r = new ArrayList<>(result.size());
- for (GroupInfo group : Natives.asList(result.values())) {
- r.add(new AccountGroupSuggestion(group));
- priorResults.put(group.name(), group.getGroupUUID());
- }
- callback.onSuggestionsReady(req, new Response(r));
- }
- });
- }
-
- public void setProject(Project.NameKey projectName) {
- this.projectName = projectName;
- }
-
- private static class AccountGroupSuggestion implements SuggestOracle.Suggestion {
- private final GroupInfo info;
-
- AccountGroupSuggestion(GroupInfo k) {
- info = k;
- }
-
- @Override
- public String getDisplayString() {
- return info.name();
- }
-
- @Override
- public String getReplacementString() {
- return info.name();
- }
- }
-
- /** @return the group UUID, or null if it cannot be found. */
- public AccountGroup.UUID getUUID(String name) {
- return priorResults.get(name);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountLinkPanel.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountLinkPanel.java
deleted file mode 100644
index c44f357..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountLinkPanel.java
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright (C) 2012 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.client.ui;
-
-import com.google.gerrit.client.AvatarImage;
-import com.google.gerrit.client.FormatUtil;
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gwt.user.client.ui.FlowPanel;
-import java.util.function.Function;
-
-/** Link to any user's account dashboard. */
-public class AccountLinkPanel extends FlowPanel {
- public static AccountLinkPanel create(AccountInfo ai) {
- return withStatus(ai, Change.Status.NEW);
- }
-
- public static AccountLinkPanel withStatus(AccountInfo ai, Change.Status status) {
- return new AccountLinkPanel(ai, name -> PageLinks.toAccountQuery(name, status));
- }
-
- public static AccountLinkPanel forAssignee(AccountInfo ai) {
- return new AccountLinkPanel(ai, PageLinks::toAssigneeQuery);
- }
-
- private AccountLinkPanel(AccountInfo ai, Function<String, String> nameToQuery) {
- addStyleName(Gerrit.RESOURCES.css().accountLinkPanel());
-
- InlineHyperlink l =
- new InlineHyperlink(FormatUtil.name(ai), nameToQuery.apply(name(ai))) {
- @Override
- public void go() {
- Gerrit.display(getTargetHistoryToken());
- }
- };
- l.setTitle(FormatUtil.nameEmail(ai));
-
- add(new AvatarImage(ai));
- add(l);
- }
-
- private static String name(AccountInfo ai) {
- if (ai.email() != null) {
- return ai.email();
- } else if (ai.name() != null) {
- return ai.name();
- } else if (ai._accountId() != 0) {
- return "" + ai._accountId();
- } else {
- return "";
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountScreen.java
deleted file mode 100644
index 59ff9fe3..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountScreen.java
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright (C) 2008 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.client.ui;
-
-/** A screen that requires the user to be signed-into their account. */
-public abstract class AccountScreen extends Screen {
- protected AccountScreen() {
- setRequiresSignIn(true);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountSuggestOracle.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountSuggestOracle.java
deleted file mode 100644
index 5038ad9..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AccountSuggestOracle.java
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (C) 2008 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.client.ui;
-
-import com.google.gerrit.client.FormatUtil;
-import com.google.gerrit.client.account.AccountApi;
-import com.google.gerrit.client.info.AccountInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.ui.SuggestOracle;
-import java.util.ArrayList;
-import java.util.List;
-
-/** Suggestion Oracle for Account entities. */
-public class AccountSuggestOracle extends SuggestAfterTypingNCharsOracle {
- @Override
- public void _onRequestSuggestions(Request req, Callback cb) {
- AccountApi.suggest(
- req.getQuery(),
- req.getLimit(),
- new GerritCallback<JsArray<AccountInfo>>() {
- @Override
- public void onSuccess(JsArray<AccountInfo> in) {
- List<AccountSuggestion> r = new ArrayList<>(in.length());
- for (AccountInfo p : Natives.asList(in)) {
- r.add(new AccountSuggestion(p, req.getQuery()));
- }
- cb.onSuggestionsReady(req, new Response(r));
- }
- });
- }
-
- public static class AccountSuggestion implements SuggestOracle.Suggestion {
- private final String suggestion;
-
- public AccountSuggestion(AccountInfo info, String query) {
- this.suggestion = format(info, query);
- }
-
- @Override
- public String getDisplayString() {
- return suggestion;
- }
-
- @Override
- public String getReplacementString() {
- return suggestion;
- }
-
- public static String format(AccountInfo info, String query) {
- String s = FormatUtil.nameEmail(info);
- if (query != null && !containsQuery(s, query) && info.secondaryEmails() != null) {
- for (String email : Natives.asList(info.secondaryEmails())) {
- AccountInfo info2 =
- AccountInfo.create(info._accountId(), info.name(), email, info.username());
- String s2 = FormatUtil.nameEmail(info2);
- if (containsQuery(s2, query)) {
- s = s2;
- break;
- }
- }
- }
- return s;
- }
-
- private static boolean containsQuery(String s, String query) {
- for (String qterm : query.split("\\s+")) {
- if (!s.toLowerCase().contains(qterm.toLowerCase())) {
- return false;
- }
- }
- return true;
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AddMemberBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AddMemberBox.java
deleted file mode 100644
index a1d2229..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/AddMemberBox.java
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright (C) 2008 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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.logical.shared.SelectionEvent;
-import com.google.gwt.event.logical.shared.SelectionHandler;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.SuggestOracle;
-
-public class AddMemberBox extends Composite {
- private final FlowPanel addPanel;
- private final Button addMember;
- private final RemoteSuggestBox suggestBox;
-
- public AddMemberBox(final String buttonLabel, String hint, SuggestOracle suggestOracle) {
- addPanel = new FlowPanel();
- addMember = new Button(buttonLabel);
-
- suggestBox = new RemoteSuggestBox(suggestOracle);
- suggestBox.setStyleName(Gerrit.RESOURCES.css().addMemberTextBox());
- suggestBox.setVisibleLength(50);
- suggestBox.setHintText(hint);
- suggestBox.addSelectionHandler(
- new SelectionHandler<String>() {
- @Override
- public void onSelection(SelectionEvent<String> event) {
- addMember.fireEvent(new ClickEvent() {});
- }
- });
-
- addPanel.add(suggestBox);
- addPanel.add(addMember);
-
- initWidget(addPanel);
- }
-
- public void addClickHandler(ClickHandler handler) {
- addMember.addClickHandler(handler);
- }
-
- public String getText() {
- return suggestBox.getText();
- }
-
- public void setEnabled(boolean enabled) {
- addMember.setEnabled(enabled);
- suggestBox.setEnabled(enabled);
- }
-
- public void setText(String text) {
- suggestBox.setText(text);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/BranchLink.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/BranchLink.java
deleted file mode 100644
index 6e05f83..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/BranchLink.java
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (C) 2009 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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.QueryScreen;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gerrit.reviewdb.client.RefNames;
-
-/** Link to the open changes of a project. */
-public class BranchLink extends InlineHyperlink {
- private final String query;
-
- public BranchLink(Project.NameKey project, Change.Status status, String branch, String topic) {
- this(text(branch, topic), query(project, status, branch, topic));
- }
-
- public BranchLink(
- String text, Project.NameKey project, Change.Status status, String branch, String topic) {
- this(text, query(project, status, branch, topic));
- }
-
- private BranchLink(String text, String query) {
- super(text, PageLinks.toChangeQuery(query));
- this.query = query;
- }
-
- @Override
- public void go() {
- Gerrit.display(getTargetHistoryToken(), createScreen());
- }
-
- private Screen createScreen() {
- return QueryScreen.forQuery(query);
- }
-
- private static String text(String branch, String topic) {
- if (topic != null && !topic.isEmpty()) {
- return branch + " (" + topic + ")";
- }
- return branch;
- }
-
- public static String query(
- Project.NameKey project, Change.Status status, String branch, String topic) {
- String query = PageLinks.projectQuery(project, status);
-
- if (branch.startsWith(RefNames.REFS)) {
- if (branch.startsWith(RefNames.REFS_HEADS)) {
- query +=
- " "
- + PageLinks.op(
- "branch", //
- branch.substring(RefNames.REFS_HEADS.length()));
- } else {
- query += " " + PageLinks.op("ref", branch);
- }
- } else {
- // Assume it was clipped already by the caller. This
- // happens for example inside of the ChangeInfo object.
- //
- query += " " + PageLinks.op("branch", branch);
- }
-
- if (topic != null && !topic.isEmpty()) {
- query += " " + PageLinks.op("topic", topic);
- }
-
- return query;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ChangeLink.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ChangeLink.java
deleted file mode 100644
index b54d752..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ChangeLink.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (C) 2008 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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.GWT;
-
-public class ChangeLink extends InlineHyperlink {
- public static String permalink(Change.Id c) {
- return GWT.getHostPageBaseURL() + c.get();
- }
-
- protected Change.Id cid;
-
- public ChangeLink(Project.NameKey project, Change.Id c, String text) {
- super(text, PageLinks.toChange(project, c));
- getElement().setPropertyString("href", permalink(c));
- cid = c;
- }
-
- @Override
- public void go() {
- Gerrit.display(getTargetHistoryToken());
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CherryPickDialog.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CherryPickDialog.java
deleted file mode 100644
index 0a0c14a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CherryPickDialog.java
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (C) 2013 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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.Util;
-import com.google.gerrit.client.projects.BranchInfo;
-import com.google.gerrit.client.projects.ProjectApi;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.SuggestBox;
-import com.google.gwt.user.client.ui.SuggestOracle.Suggestion;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.safehtml.client.HighlightSuggestOracle;
-import java.util.ArrayList;
-import java.util.List;
-
-public abstract class CherryPickDialog extends TextAreaActionDialog {
- private SuggestBox newBranch;
- private List<BranchInfo> branches;
-
- public CherryPickDialog(Project.NameKey project) {
- super(Util.C.cherryPickTitle(), Util.C.cherryPickCommitMessage());
- ProjectApi.getBranches(
- project,
- new GerritCallback<JsArray<BranchInfo>>() {
- @Override
- public void onSuccess(JsArray<BranchInfo> result) {
- branches = Natives.asList(result);
- }
- });
-
- newBranch =
- new SuggestBox(
- new HighlightSuggestOracle() {
- @Override
- protected void onRequestSuggestions(Request request, Callback done) {
- List<BranchSuggestion> suggestions = new ArrayList<>();
- for (BranchInfo b : branches) {
- if (b.ref().contains(request.getQuery())) {
- suggestions.add(new BranchSuggestion(b));
- }
- }
- done.onSuggestionsReady(request, new Response(suggestions));
- }
- });
-
- newBranch.setWidth("100%");
- newBranch.getElement().getStyle().setProperty("boxSizing", "border-box");
- message.setCharacterWidth(70);
-
- final FlowPanel mwrap = new FlowPanel();
- mwrap.setStyleName(Gerrit.RESOURCES.css().commentedActionMessage());
- mwrap.add(newBranch);
-
- panel.insert(mwrap, 0);
- panel.insert(new SmallHeading(Util.C.headingCherryPickBranch()), 0);
- }
-
- @Override
- public void center() {
- super.center();
- GlobalKey.dialog(this);
- newBranch.setFocus(true);
- }
-
- public String getDestinationBranch() {
- return newBranch.getText();
- }
-
- static class BranchSuggestion implements Suggestion {
- private BranchInfo branch;
-
- BranchSuggestion(BranchInfo branch) {
- this.branch = branch;
- }
-
- @Override
- public String getDisplayString() {
- final String refsHeads = "refs/heads/";
- if (branch.ref().startsWith(refsHeads)) {
- return branch.ref().substring(refsHeads.length());
- }
- return branch.ref();
- }
-
- @Override
- public String getReplacementString() {
- return branch.getShortName();
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CommandMenuItem.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CommandMenuItem.java
deleted file mode 100644
index c5ee34f..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CommandMenuItem.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (C) 2009 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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gwt.aria.client.Roles;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.ui.Anchor;
-
-public class CommandMenuItem extends Anchor implements ClickHandler {
- private final Command command;
-
- public CommandMenuItem(String text, Command cmd) {
- super(text);
- setStyleName(Gerrit.RESOURCES.css().menuItem());
- Roles.getMenuitemRole().set(getElement());
- addClickHandler(this);
- command = cmd;
- }
-
- @Override
- public void onClick(ClickEvent event) {
- setFocus(false);
- command.execute();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CommentLinkProcessor.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CommentLinkProcessor.java
deleted file mode 100644
index 1753ade..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CommentLinkProcessor.java
+++ /dev/null
@@ -1,95 +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.google.gerrit.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gwtexpui.safehtml.client.FindReplace;
-import com.google.gwtexpui.safehtml.client.SafeHtml;
-import com.google.gwtjsonrpc.common.AsyncCallback;
-import com.google.gwtjsonrpc.common.VoidResult;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public class CommentLinkProcessor {
- private List<FindReplace> commentLinks;
-
- public CommentLinkProcessor(List<FindReplace> commentLinks) {
- this.commentLinks = commentLinks;
- }
-
- public SafeHtml apply(SafeHtml buf) {
- try {
- return buf.replaceAll(commentLinks);
- } catch (RuntimeException err) {
- // One or more of the patterns isn't valid on this browser.
- // Try to filter the list down and remove the invalid ones.
-
- List<FindReplace> safe = new ArrayList<>(commentLinks.size());
-
- List<PatternError> bad = new ArrayList<>();
- for (FindReplace r : commentLinks) {
- try {
- buf.replaceAll(Collections.singletonList(r));
- safe.add(r);
- } catch (RuntimeException why) {
- bad.add(new PatternError(r, why.getMessage()));
- }
- }
-
- if (!bad.isEmpty()) {
- StringBuilder msg = new StringBuilder();
- msg.append("Invalid commentlink pattern(s):");
- for (PatternError e : bad) {
- msg.append("\n");
- msg.append("\"");
- msg.append(e.pattern.pattern().getSource());
- msg.append("\": ");
- msg.append(e.errorMessage);
- }
- Gerrit.SYSTEM_SVC.clientError(
- msg.toString(),
- new AsyncCallback<VoidResult>() {
- @Override
- public void onFailure(Throwable caught) {}
-
- @Override
- public void onSuccess(VoidResult result) {}
- });
- }
-
- try {
- commentLinks = safe;
- return buf.replaceAll(safe);
- } catch (RuntimeException err2) {
- // To heck with it. The patterns passed individually above but
- // failed as a group? Just render without.
- //
- commentLinks = null;
- return buf;
- }
- }
- }
-
- private static class PatternError {
- FindReplace pattern;
- String errorMessage;
-
- PatternError(FindReplace r, String w) {
- pattern = r;
- errorMessage = w;
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CommentedActionDialog.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CommentedActionDialog.java
deleted file mode 100644
index b68f329..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CommentedActionDialog.java
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright (C) 2009 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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.FocusWidget;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.user.client.AutoCenterDialogBox;
-
-public abstract class CommentedActionDialog extends AutoCenterDialogBox
- implements CloseHandler<PopupPanel> {
- protected final FlowPanel panel;
- protected final Button sendButton;
- protected final Button cancelButton;
- protected final FlowPanel buttonPanel;
- protected final FlowPanel contentPanel;
- protected FocusWidget focusOn;
-
- protected boolean sent;
-
- public CommentedActionDialog(String title, String heading) {
- super(/* auto hide */ false, /* modal */ true);
- setGlassEnabled(true);
- setText(title);
-
- addStyleName(Gerrit.RESOURCES.css().commentedActionDialog());
-
- sendButton = new Button(Util.C.commentedActionButtonSend());
- sendButton.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- enableButtons(false);
- onSend();
- }
- });
-
- cancelButton = new Button(Util.C.commentedActionButtonCancel());
- cancelButton.getElement().getStyle().setProperty("float", "right");
- cancelButton.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- hide();
- }
- });
-
- contentPanel = new FlowPanel();
- contentPanel.setStyleName(Gerrit.RESOURCES.css().commentedActionMessage());
-
- buttonPanel = new FlowPanel();
- buttonPanel.add(sendButton);
- buttonPanel.add(cancelButton);
- buttonPanel.getElement().getStyle().setProperty("marginTop", "4px");
-
- panel = new FlowPanel();
- if (heading != null) {
- panel.add(new SmallHeading(heading));
- }
- panel.add(contentPanel);
- panel.add(buttonPanel);
- add(panel);
-
- addCloseHandler(this);
- }
-
- public void setFocusOn(FocusWidget focusWidget) {
- focusOn = focusWidget;
- }
-
- public void enableButtons(boolean enable) {
- sendButton.setEnabled(enable);
- cancelButton.setEnabled(enable);
- }
-
- @Override
- public void center() {
- super.center();
- GlobalKey.dialog(this);
- if (focusOn != null) {
- focusOn.setFocus(true);
- }
- }
-
- @Override
- public void onClose(CloseEvent<PopupPanel> event) {
- sent = false;
- }
-
- public abstract void onSend();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ComplexDisclosurePanel.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ComplexDisclosurePanel.java
deleted file mode 100644
index c0b662a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ComplexDisclosurePanel.java
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright (C) 2008 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.client.ui;
-
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.event.logical.shared.HasCloseHandlers;
-import com.google.gwt.event.logical.shared.HasOpenHandlers;
-import com.google.gwt.event.logical.shared.OpenHandler;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.ComplexPanel;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.DisclosurePanel;
-import com.google.gwt.user.client.ui.Panel;
-import com.google.gwt.user.client.ui.Widget;
-
-public class ComplexDisclosurePanel extends Composite
- implements HasOpenHandlers<DisclosurePanel>, HasCloseHandlers<DisclosurePanel> {
- private final DisclosurePanel main;
- private final Panel header;
-
- public ComplexDisclosurePanel(String text, boolean isOpen) {
- // Ick. GWT's DisclosurePanel won't let us subclass it, or do any
- // other modification of its header. We're stuck with injecting
- // into the DOM directly.
- //
- main = new DisclosurePanel(text);
- main.setOpen(isOpen);
- final Element headerParent;
- {
- final Element table = main.getElement();
- final Element tbody = DOM.getFirstChild(table);
- final Element tr1 = DOM.getChild(tbody, 0);
- final Element tr2 = DOM.getChild(tbody, 1);
-
- DOM.getChild(tr1, 0).setPropertyString("width", "20px");
- DOM.getChild(tr2, 0).setPropertyInt("colSpan", 2);
- headerParent = tr1;
- }
-
- header =
- new ComplexPanel() {
- {
- setElement((Element) (DOM.createTD()));
- getElement().setInnerHTML(" ");
- }
-
- @Override
- public void add(Widget w) {
- add(w, (Element) getElement());
- }
- };
-
- initWidget(
- new ComplexPanel() {
- {
- final DisclosurePanel main = ComplexDisclosurePanel.this.main;
- setElement((Element) (main.getElement()));
- getChildren().add(main);
- adopt(main);
-
- add(ComplexDisclosurePanel.this.header, headerParent);
- }
- });
- }
-
- public Panel getHeader() {
- return header;
- }
-
- public void setContent(Widget w) {
- main.setContent(w);
- }
-
- public Widget getContent() {
- return main.getContent();
- }
-
- @Override
- public HandlerRegistration addOpenHandler(OpenHandler<DisclosurePanel> h) {
- return main.addOpenHandler(h);
- }
-
- @Override
- public HandlerRegistration addCloseHandler(CloseHandler<DisclosurePanel> h) {
- return main.addCloseHandler(h);
- }
-
- /** @return true if the panel's content is visible. */
- public boolean isOpen() {
- return main.isOpen();
- }
-
- /**
- * Changes the visible state of this panel's content.
- *
- * @param isOpen {@code true} to open, {@code false} to close
- */
- public void setOpen(boolean isOpen) {
- main.setOpen(isOpen);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CreateChangeDialog.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CreateChangeDialog.java
deleted file mode 100644
index 2d00281..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/CreateChangeDialog.java
+++ /dev/null
@@ -1,116 +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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.projects.BranchInfo;
-import com.google.gerrit.client.projects.ProjectApi;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.SuggestBox;
-import com.google.gwt.user.client.ui.SuggestOracle.Suggestion;
-import com.google.gwt.user.client.ui.TextBox;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.safehtml.client.HighlightSuggestOracle;
-import java.util.ArrayList;
-import java.util.List;
-
-public abstract class CreateChangeDialog extends TextAreaActionDialog {
- private SuggestBox newChange;
- private List<BranchInfo> branches;
- private TextBox topic;
-
- public CreateChangeDialog(Project.NameKey project) {
- super(Util.C.dialogCreateChangeTitle(), Util.C.dialogCreateChangeHeading());
- ProjectApi.getBranches(
- project,
- new GerritCallback<JsArray<BranchInfo>>() {
- @Override
- public void onSuccess(JsArray<BranchInfo> result) {
- branches = Natives.asList(result);
- }
- });
-
- topic = new TextBox();
- topic.setWidth("100%");
- topic.getElement().getStyle().setProperty("boxSizing", "border-box");
- FlowPanel newTopicPanel = new FlowPanel();
- newTopicPanel.setStyleName(Gerrit.RESOURCES.css().commentedActionMessage());
- newTopicPanel.add(topic);
- panel.insert(newTopicPanel, 0);
- panel.insert(new SmallHeading(Util.C.newChangeTopicSuggestion()), 0);
-
- newChange =
- new SuggestBox(
- new HighlightSuggestOracle() {
- @Override
- protected void onRequestSuggestions(Request request, Callback done) {
- List<BranchSuggestion> suggestions = new ArrayList<>();
- for (BranchInfo b : branches) {
- if (b.ref().contains(request.getQuery())) {
- suggestions.add(new BranchSuggestion(b));
- }
- }
- done.onSuggestionsReady(request, new Response(suggestions));
- }
- });
-
- newChange.setWidth("100%");
- newChange.getElement().getStyle().setProperty("boxSizing", "border-box");
- FlowPanel newChangePanel = new FlowPanel();
- newChangePanel.setStyleName(Gerrit.RESOURCES.css().commentedActionMessage());
- newChangePanel.add(newChange);
- panel.insert(newChangePanel, 0);
- panel.insert(new SmallHeading(Util.C.newChangeBranchSuggestion()), 0);
-
- message.setCharacterWidth(70);
- }
-
- @Override
- public void center() {
- super.center();
- GlobalKey.dialog(this);
- newChange.setFocus(true);
- }
-
- public String getDestinationBranch() {
- return newChange.getText();
- }
-
- public String getDestinationTopic() {
- return topic.getText();
- }
-
- static class BranchSuggestion implements Suggestion {
- private BranchInfo branch;
-
- BranchSuggestion(BranchInfo branch) {
- this.branch = branch;
- }
-
- @Override
- public String getDisplayString() {
- return branch.getShortName();
- }
-
- @Override
- public String getReplacementString() {
- return branch.getShortName();
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/FancyFlexTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/FancyFlexTable.java
deleted file mode 100644
index 045e0ae..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/FancyFlexTable.java
+++ /dev/null
@@ -1,222 +0,0 @@
-// Copyright (C) 2008 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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.dom.client.Document;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlexTable;
-import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.safehtml.client.SafeHtml;
-import java.util.Comparator;
-import java.util.Iterator;
-
-public abstract class FancyFlexTable<RowItem> extends Composite {
- private static final FancyFlexTableImpl impl = GWT.create(FancyFlexTableImpl.class);
-
- protected static final int C_ARROW = 0;
-
- protected final MyFlexTable table;
-
- protected FancyFlexTable() {
- table = createFlexTable();
- table.addStyleName(Gerrit.RESOURCES.css().changeTable());
- table.setWidth("100%");
- initWidget(table);
-
- table.setText(0, C_ARROW, "");
- table.getCellFormatter().addStyleName(0, C_ARROW, Gerrit.RESOURCES.css().iconHeader());
- }
-
- protected MyFlexTable createFlexTable() {
- return new MyFlexTable();
- }
-
- protected RowItem getRowItem(int row) {
- return FancyFlexTable.<RowItem>getRowItem(table.getCellFormatter().getElement(row, 0));
- }
-
- protected void setRowItem(int row, RowItem item) {
- setRowItem(table.getCellFormatter().getElement(row, 0), item);
- }
-
- /**
- * Finds an item in the table.
- *
- * @param comparator comparator by which the items in the table are sorted
- * @param item the item that should be found
- * @return if the item is found the number of the row that contains the item; if the item is not
- * found {@code -1}
- */
- protected int findRowItem(Comparator<RowItem> comparator, RowItem item) {
- int row = lookupRowItem(comparator, item);
- if (row < table.getRowCount() && comparator.compare(item, getRowItem(row)) == 0) {
- return row;
- }
- return -1;
- }
-
- /**
- * Finds the number of the row where a new item should be inserted into the table.
- *
- * @param comparator comparator by which the items in the table are sorted
- * @param item the new item that should be inserted
- * @return if the item is not yet contained in the table, the number of the row where the new item
- * should be inserted; if the item is already contained in the table {@code -1}
- */
- protected int getInsertRow(Comparator<RowItem> comparator, RowItem item) {
- int row = lookupRowItem(comparator, item);
- if (row >= table.getRowCount() || comparator.compare(item, getRowItem(row)) != 0) {
- return row;
- }
- return -1;
- }
-
- /**
- * Makes a binary search for the given row item over the table.
- *
- * @param comparator comparator by which the items in the table are sorted
- * @param item the item that should be looked up
- * @return if the item is found the number of the row that contains the item; if the item is not
- * found the number of the row where the item should be inserted according to the given
- * comparator.
- */
- private int lookupRowItem(Comparator<RowItem> comparator, RowItem item) {
- int left = 1;
- int right = table.getRowCount() - 1;
- while (left <= right) {
- int middle = (left + right) >>> 1; // (left+right)/2
- RowItem i = getRowItem(middle);
- int cmp = comparator.compare(i, item);
-
- if (cmp < 0) {
- left = middle + 1;
- } else if (cmp > 0) {
- right = middle - 1;
- } else {
- // item is already contained in the table
- return middle;
- }
- }
- return left;
- }
-
- protected void resetHtml(SafeHtml body) {
- for (Iterator<Widget> i = table.iterator(); i.hasNext(); ) {
- i.next();
- i.remove();
- }
- impl.resetHtml(table, body);
- }
-
- protected void scrollIntoView(int topRow, int endRow) {
- final CellFormatter fmt = table.getCellFormatter();
- final Element top = fmt.getElement(topRow, C_ARROW).getParentElement();
- final Element end = fmt.getElement(endRow, C_ARROW).getParentElement();
-
- final int rTop = top.getAbsoluteTop();
- final int rEnd = end.getAbsoluteTop() + end.getOffsetHeight();
- final int rHeight = rEnd - rTop;
-
- final int sTop = Document.get().getScrollTop();
- final int sHeight = Document.get().getClientHeight();
- final int sEnd = sTop + sHeight;
-
- final int nTop;
- if (sHeight <= rHeight) {
- // The region is larger than the visible area, make the top
- // exactly the top of the region, its the most visible area.
- //
- nTop = rTop;
- } else if (sTop <= rTop && rTop <= sEnd) {
- // At least part of the region is already visible.
- //
- if (rEnd <= sEnd) {
- // ... actually its all visible. Don't scroll.
- //
- return;
- }
-
- // Move only enough to make the end visible.
- //
- nTop = sTop + (rHeight - (sEnd - rTop));
- } else {
- // None of the region is visible. Make it visible.
- //
- nTop = rTop;
- }
- Document.get().setScrollTop(nTop);
- }
-
- protected void applyDataRowStyle(int newRow) {
- table.getCellFormatter().addStyleName(newRow, C_ARROW, Gerrit.RESOURCES.css().iconCell());
- table.getCellFormatter().addStyleName(newRow, C_ARROW, Gerrit.RESOURCES.css().leftMostCell());
- }
-
- /**
- * Get the td element that contains another element.
- *
- * @param target the child element whose parent td is required.
- * @return the td containing element {@code target}; null if {@code target} is not a member of
- * this table.
- */
- protected Element getParentCell(Element target) {
- final Element body = FancyFlexTableImpl.getBodyElement(table);
- for (Element td = target; td != null && td != body; td = DOM.getParent(td)) {
- // If it's a TD, it might be the one we're looking for.
- if ("td".equalsIgnoreCase(td.getTagName())) {
- // Make sure it's directly a part of this table.
- Element tr = DOM.getParent(td);
- if (DOM.getParent(tr) == body) {
- return td;
- }
- }
- }
- return null;
- }
-
- /** @return the row of the child element; -1 if the child is not in the table. */
- protected int rowOf(Element target) {
- final Element td = getParentCell(target);
- if (td == null) {
- return -1;
- }
- final Element tr = DOM.getParent(td);
- final Element body = DOM.getParent(tr);
- return DOM.getChildIndex(body, tr);
- }
-
- /** @return the cell of the child element; -1 if the child is not in the table. */
- protected int columnOf(Element target) {
- final Element td = getParentCell(target);
- if (td == null) {
- return -1;
- }
- final Element tr = DOM.getParent(td);
- return DOM.getChildIndex(tr, td);
- }
-
- protected static class MyFlexTable extends FlexTable {}
-
- private static native <ItemType> void setRowItem(Element td, ItemType c)
- /*-{ td['__gerritRowItem'] = c; }-*/ ;
-
- private static native <ItemType> ItemType getRowItem(Element td)
- /*-{ return td['__gerritRowItem']; }-*/ ;
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/FancyFlexTableImpl.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/FancyFlexTableImpl.java
deleted file mode 100644
index a3a2a7a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/FancyFlexTableImpl.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) 2009 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.client.ui;
-
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.user.client.ui.FlexTable;
-import com.google.gwt.user.client.ui.HTMLTable;
-import com.google.gwtexpui.safehtml.client.SafeHtml;
-
-public class FancyFlexTableImpl {
- public void resetHtml(FlexTable myTable, SafeHtml body) {
- SafeHtml.setInnerHTML(getBodyElement(myTable), body);
- }
-
- protected static native Element getBodyElement(HTMLTable myTable)
- /*-{ return myTable.@com.google.gwt.user.client.ui.HTMLTable::bodyElem; }-*/ ;
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/FancyFlexTableImplIE8.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/FancyFlexTableImplIE8.java
deleted file mode 100644
index 3eae0f8..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/FancyFlexTableImplIE8.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (C) 2009 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.client.ui;
-
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.FlexTable;
-import com.google.gwt.user.client.ui.HTMLTable;
-import com.google.gwtexpui.safehtml.client.SafeHtml;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-
-public class FancyFlexTableImplIE8 extends FancyFlexTableImpl {
- @Override
- public void resetHtml(FlexTable myTable, SafeHtml bodyHtml) {
- final Element oldBody = getBodyElement(myTable);
- final Element newBody = parseBody(bodyHtml);
- assert newBody != null;
-
- final Element tableElem = DOM.getParent(oldBody);
- tableElem.removeChild(oldBody);
- setBodyElement(myTable, newBody);
- DOM.appendChild(tableElem, newBody);
- }
-
- private static Element parseBody(SafeHtml body) {
- final SafeHtmlBuilder b = new SafeHtmlBuilder();
- b.openElement("table");
- b.append(body);
- b.closeElement("table");
-
- final Element newTable = SafeHtml.parse(b);
- for (Element e = DOM.getFirstChild(newTable); e != null; e = DOM.getNextSibling(e)) {
- if ("tbody".equals(e.getTagName().toLowerCase())) {
- return e;
- }
- }
- return null;
- }
-
- private static native void setBodyElement(HTMLTable myTable, Element newBody)
- /*-{ myTable.@com.google.gwt.user.client.ui.HTMLTable::bodyElem = newBody; }-*/ ;
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/HighlightingInlineHyperlink.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/HighlightingInlineHyperlink.java
deleted file mode 100644
index f8e382a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/HighlightingInlineHyperlink.java
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright (C) 2012 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.client.ui;
-
-public class HighlightingInlineHyperlink extends InlineHyperlink {
-
- private String toHighlight;
-
- public HighlightingInlineHyperlink(final String text, String token, String toHighlight) {
- super(text, token);
- this.toHighlight = toHighlight;
- highlight(text, toHighlight);
- }
-
- @Override
- public void setText(String text) {
- super.setText(text);
- highlight(text, toHighlight);
- }
-
- private void highlight(String text, String toHighlight) {
- setHTML(Util.highlight(text, toHighlight));
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/HighlightingProjectsTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/HighlightingProjectsTable.java
deleted file mode 100644
index 1e3be3f..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/HighlightingProjectsTable.java
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright (C) 2012 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.client.ui;
-
-import com.google.gerrit.client.projects.ProjectInfo;
-import com.google.gerrit.client.projects.ProjectMap;
-import com.google.gwt.user.client.ui.InlineHTML;
-
-public class HighlightingProjectsTable extends ProjectsTable {
- private String toHighlight;
-
- public void display(ProjectMap projects, String toHighlight) {
- this.toHighlight = toHighlight;
- super.display(projects);
- }
-
- @Override
- protected void populate(int row, ProjectInfo k) {
- populateState(row, k);
- table.setWidget(
- row, ProjectsTable.C_NAME, new InlineHTML(Util.highlight(k.name(), toHighlight)));
- table.setText(row, ProjectsTable.C_DESCRIPTION, k.description());
-
- setRowItem(row, k);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/HintTextBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/HintTextBox.java
deleted file mode 100644
index 4ccfe9d..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/HintTextBox.java
+++ /dev/null
@@ -1,218 +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.google.gerrit.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gwt.event.dom.client.BlurEvent;
-import com.google.gwt.event.dom.client.BlurHandler;
-import com.google.gwt.event.dom.client.FocusEvent;
-import com.google.gwt.event.dom.client.FocusHandler;
-import com.google.gwt.event.dom.client.KeyCodes;
-import com.google.gwt.event.dom.client.KeyDownEvent;
-import com.google.gwt.event.dom.client.KeyDownHandler;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.user.client.ui.SuggestBox;
-import com.google.gwt.user.client.ui.SuggestBox.DefaultSuggestionDisplay;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.globalkey.client.NpTextBox;
-
-public class HintTextBox extends NpTextBox {
- private HandlerRegistration hintFocusHandler;
- private HandlerRegistration hintBlurHandler;
- private HandlerRegistration keyDownHandler;
-
- private String hintText;
- private String hintStyleName = Gerrit.RESOURCES.css().inputFieldTypeHint();
-
- private String prevText;
-
- private boolean hintOn;
- private boolean isFocused;
-
- @Override
- public String getText() {
- if (hintOn) {
- return "";
- }
- return super.getText();
- }
-
- @Override
- public void setText(String text) {
- focusHint();
-
- super.setText(text);
- prevText = text;
-
- if (!isFocused) {
- blurHint();
- }
- }
-
- public String getHintText() {
- return hintText;
- }
-
- public void setHintText(String text) {
- if (text == null) {
- if (hintText == null) { // was not set, still not set, no change.
- return;
- }
-
- // Clearing a previously set Hint
- hintFocusHandler.removeHandler();
- hintFocusHandler = null;
- hintBlurHandler.removeHandler();
- hintBlurHandler = null;
- keyDownHandler.removeHandler();
- keyDownHandler = null;
- hintText = null;
- focusHint();
-
- return;
- }
-
- // Setting Hints
-
- if (hintText == null) { // first time (was not already set)
- hintText = text;
-
- hintFocusHandler =
- addFocusHandler(
- new FocusHandler() {
- @Override
- public void onFocus(FocusEvent event) {
- focusHint();
- prevText = getText();
- isFocused = true;
- }
- });
-
- hintBlurHandler =
- addBlurHandler(
- new BlurHandler() {
- @Override
- public void onBlur(BlurEvent event) {
- blurHint();
- isFocused = false;
- }
- });
-
- /*
- * There seems to be a strange bug (at least on firefox 3.5.9 ubuntu) with
- * the textbox under the following circumstances:
- * 1) The field is not focused with BText in it.
- * 2) The field receives focus and a focus listener changes the text to FText
- * 3) The ESC key is pressed and the value of the field has not changed
- * (ever) from FText
- * 4) BUG: The text value gets reset to BText!
- *
- * A counter to this bug seems to be to force setFocus(false) on ESC.
- */
-
- /* Chrome does not create a KeyPressEvent on ESC, so use KeyDownEvents */
- keyDownHandler =
- addKeyDownHandler(
- new KeyDownHandler() {
- @Override
- public void onKeyDown(KeyDownEvent event) {
- onKey(event.getNativeKeyCode());
- }
- });
-
- } else { // Changing an already set Hint
-
- focusHint();
- hintText = text;
- }
-
- if (!isFocused) {
- blurHint();
- }
- }
-
- private void onKey(int key) {
- if (key == KeyCodes.KEY_ESCAPE) {
- setText(prevText);
-
- Widget p = getParent();
- if (p instanceof SuggestBox) {
- // Since the text was changed, ensure that the SuggestBox is
- // aware of this change so that it will refresh properly on
- // the next keystroke. Without this, if the first keystroke
- // recreates the same string as before ESC was pressed, the
- // SuggestBox will think that the string has not changed, and
- // it will not yet provide any Suggestions.
- ((SuggestBox) p).showSuggestionList();
-
- // The suggestion list lingers if we don't hide it.
- ((DefaultSuggestionDisplay) ((SuggestBox) p).getSuggestionDisplay()).hideSuggestions();
- }
-
- setFocus(false);
- }
- }
-
- public void setHintStyleName(String styleName) {
- if (hintStyleName != null && hintOn) {
- removeStyleName(hintStyleName);
- }
-
- hintStyleName = styleName;
-
- if (styleName != null && hintOn) {
- addStyleName(styleName);
- }
- }
-
- public String getHintStyleName() {
- return hintStyleName;
- }
-
- protected void blurHint() {
- if (!hintOn && getHintText() != null && "".equals(super.getText())) {
- hintOn = true;
- super.setText(getHintText());
- if (getHintStyleName() != null) {
- addStyleName(getHintStyleName());
- }
- }
- }
-
- protected void focusHint() {
- if (hintOn) {
- super.setText("");
- if (getHintStyleName() != null) {
- removeStyleName(getHintStyleName());
- }
- hintOn = false;
- }
- }
-
- @Override
- public void setFocus(boolean focus) {
- super.setFocus(focus);
-
- if (focus != isFocused) {
- if (focus) {
- focusHint();
- } else {
- blurHint();
- }
- }
-
- isFocused = focus;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Hyperlink.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Hyperlink.java
deleted file mode 100644
index c35d097..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Hyperlink.java
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright (C) 2008 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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gwt.core.client.GWT;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Event;
-import com.google.gwt.user.client.ui.Anchor;
-import com.google.gwt.user.client.ui.impl.HyperlinkImpl;
-
-/** Standard GWT hyperlink with late updating of the token. */
-public class Hyperlink extends com.google.gwt.user.client.ui.Hyperlink {
- public static final HyperlinkImpl impl = GWT.create(HyperlinkImpl.class);
-
- /** Initialize a default hyperlink with no target and no text. */
- public Hyperlink() {}
-
- /**
- * Creates a hyperlink with its text and target history token specified.
- *
- * @param text the hyperlink's text
- * @param token the history token to which it will link, which may not be null (use {@link Anchor}
- * instead if you don't need history processing)
- */
- public Hyperlink(String text, String token) {
- super(text, token);
- }
-
- /**
- * Creates a hyperlink with its text and target history token specified.
- *
- * @param text the hyperlink's text
- * @param asHTML {@code true} to treat the specified text as html
- * @param token the history token to which it will link
- * @see #setTargetHistoryToken
- */
- public Hyperlink(String text, boolean asHTML, String token) {
- super(text, asHTML, token);
- }
-
- @Override
- public void onBrowserEvent(Event event) {
- if (DOM.eventGetType(event) == Event.ONCLICK && impl.handleAsClick(event)) {
- event.preventDefault();
- go();
- } else {
- super.onBrowserEvent(event);
- }
- }
-
- /** Create the screen and start rendering, updating the browser history. */
- public void go() {
- Gerrit.display(getTargetHistoryToken());
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/InlineHyperlink.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/InlineHyperlink.java
deleted file mode 100644
index a4edb5b..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/InlineHyperlink.java
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright (C) 2008 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.client.ui;
-
-import static com.google.gerrit.client.ui.Hyperlink.impl;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Event;
-
-/** Standard GWT hyperlink with late updating of the token. */
-public class InlineHyperlink extends com.google.gwt.user.client.ui.InlineHyperlink {
- /**
- * Creates a link with its text and target history token specified.
- *
- * @param text the hyperlink's text
- * @param token the history token to which it will link
- */
- public InlineHyperlink(String text, String token) {
- super(text, token);
- }
-
- /** Creates an empty link. */
- public InlineHyperlink() {}
-
- @Override
- public void onBrowserEvent(Event event) {
- if (DOM.eventGetType(event) == Event.ONCLICK && impl.handleAsClick(event)) {
- event.preventDefault();
- go();
- } else {
- super.onBrowserEvent(event);
- }
- }
-
- /** Create the screen and start rendering, updating the browser history. */
- public void go() {
- Gerrit.display(getTargetHistoryToken());
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/LinkMenuBar.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/LinkMenuBar.java
deleted file mode 100644
index d3db098..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/LinkMenuBar.java
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright (C) 2008 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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gwt.aria.client.Roles;
-import com.google.gwt.user.client.Command;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Widget;
-
-public class LinkMenuBar extends Composite implements ScreenLoadHandler {
- private final FlowPanel body;
-
- public LinkMenuBar() {
- body = new FlowPanel();
- initWidget(body);
- setStyleName(Gerrit.RESOURCES.css().linkMenuBar());
- Roles.getMenubarRole().set(getElement());
- Gerrit.EVENT_BUS.addHandler(ScreenLoadEvent.TYPE, this);
- }
-
- public void addItem(String text, Command imp) {
- add(new CommandMenuItem(text, imp));
- }
-
- public void addItem(CommandMenuItem i) {
- add(i);
- }
-
- public void addItem(LinkMenuItem i) {
- i.setMenuBar(this);
- add(i);
- }
-
- public void insertItem(LinkMenuItem i, int beforeIndex) {
- i.setMenuBar(this);
- insert(i, beforeIndex);
- }
-
- public void clear() {
- body.clear();
- }
-
- public LinkMenuItem find(String targetToken) {
- for (Widget w : body) {
- if (w instanceof LinkMenuItem) {
- LinkMenuItem m = (LinkMenuItem) w;
- if (targetToken.equals(m.getTargetHistoryToken())) {
- return m;
- }
- }
- }
- return null;
- }
-
- public void add(Widget i) {
- if (body.getWidgetCount() > 0) {
- final Widget p = body.getWidget(body.getWidgetCount() - 1);
- p.addStyleName(Gerrit.RESOURCES.css().linkMenuItemNotLast());
- }
- body.add(i);
- }
-
- public void insert(Widget i, int beforeIndex) {
- if (body.getWidgetCount() == 0 || body.getWidgetCount() <= beforeIndex) {
- add(i);
- return;
- }
- body.insert(i, beforeIndex);
- }
-
- public int getWidgetIndex(Widget i) {
- return body.getWidgetIndex(i);
- }
-
- @Override
- public void onScreenLoad(ScreenLoadEvent event) {}
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/LinkMenuItem.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/LinkMenuItem.java
deleted file mode 100644
index 8a8ab25..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/LinkMenuItem.java
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright (C) 2008 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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gwt.aria.client.Roles;
-import com.google.gwt.dom.client.AnchorElement;
-
-public class LinkMenuItem extends InlineHyperlink implements ScreenLoadHandler {
- private LinkMenuBar bar;
-
- public LinkMenuItem(String text, String targetHistoryToken) {
- super(text, targetHistoryToken);
- setStyleName(Gerrit.RESOURCES.css().menuItem());
- Roles.getMenuitemRole().set(getElement());
- Gerrit.EVENT_BUS.addHandler(ScreenLoadEvent.TYPE, this);
- }
-
- @Override
- public void go() {
- super.go();
- AnchorElement.as(getElement()).blur();
- }
-
- public void setMenuBar(LinkMenuBar bar) {
- this.bar = bar;
- }
-
- @Override
- public void onScreenLoad(ScreenLoadEvent event) {
- if (match(event.getScreen().getToken())) {
- Gerrit.selectMenu(bar);
- addStyleName(Gerrit.RESOURCES.css().activeRow());
- } else {
- removeStyleName(Gerrit.RESOURCES.css().activeRow());
- }
- }
-
- protected boolean match(String token) {
- return token.equals(getTargetHistoryToken());
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/MenuScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/MenuScreen.java
deleted file mode 100644
index 0f28ddc..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/MenuScreen.java
+++ /dev/null
@@ -1,76 +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.google.gerrit.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Widget;
-
-public abstract class MenuScreen extends Screen {
- private final LinkMenuBar menu;
- private final FlowPanel body;
-
- public MenuScreen() {
- menu = new LinkMenuBar();
- menu.setStyleName(Gerrit.RESOURCES.css().menuScreenMenuBar());
- body = new FlowPanel();
- }
-
- @Override
- protected void onInitUI() {
- super.onInitUI();
-
- HorizontalPanel hp = new HorizontalPanel();
- hp.add(menu);
- hp.add(body);
- super.add(hp);
- }
-
- @Override
- public void setToken(String token) {
- LinkMenuItem self = menu.find(token);
- if (self != null) {
- self.addStyleName(Gerrit.RESOURCES.css().activeRow());
- }
- super.setToken(token);
- }
-
- @Override
- protected FlowPanel getBody() {
- return body;
- }
-
- @Override
- protected void add(Widget w) {
- body.add(w);
- }
-
- protected void link(String text, String target) {
- link(text, target, true);
- }
-
- protected void link(String text, String target, boolean visible) {
- final LinkMenuItem item = new LinkMenuItem(text, target);
- item.setStyleName(Gerrit.RESOURCES.css().menuItem());
- item.setVisible(visible);
- menu.add(item);
- }
-
- protected void setLinkVisible(String token, boolean visible) {
- final LinkMenuItem item = menu.find(token);
- item.setVisible(visible);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/MorphingTabPanel.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/MorphingTabPanel.java
deleted file mode 100644
index 7fd6432..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/MorphingTabPanel.java
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (C) 2011 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.client.ui;
-
-import com.google.gwt.event.logical.shared.SelectionEvent;
-import com.google.gwt.event.logical.shared.SelectionHandler;
-import com.google.gwt.user.client.ui.TabPanel;
-import com.google.gwt.user.client.ui.Widget;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * A TabPanel which allows entries to be hidden. This class is not yet designed to handle removes or
- * any other add methods than the one overridden here. It is also not designed to handle anything
- * other than text for the tab.
- */
-public class MorphingTabPanel extends TabPanel {
- // Keep track of the order the widgets/texts should be in when not hidden.
- private List<Widget> widgets = new ArrayList<>();
- private List<String> texts = new ArrayList<>();
-
- // currently visible widgets
- private List<Widget> visibles = new ArrayList<>();
-
- private int selection;
-
- public MorphingTabPanel() {
- addSelectionHandler(
- new SelectionHandler<Integer>() {
- @Override
- public void onSelection(SelectionEvent<Integer> ev) {
- selection = ev.getSelectedItem();
- }
- });
- }
-
- public int getSelectedIndex() {
- return selection;
- }
-
- public Widget getSelectedWidget() {
- return getWidget(getSelectedIndex());
- }
-
- @Override
- public void clear() {
- super.clear();
- widgets.clear();
- texts.clear();
- visibles.clear();
- }
-
- @Override
- public void add(Widget w, String tabText) {
- addInvisible(w, tabText);
- visibles.add(w);
- super.add(w, tabText);
- }
-
- public void addInvisible(Widget w, String tabText) {
- widgets.add(w);
- texts.add(tabText);
- }
-
- public void setVisible(Widget w, boolean visible) {
- if (visible) {
- if (!visibles.contains(w)) {
- int origPos = widgets.indexOf(w);
-
- /* Re-insert the widget right after the first visible widget found
- when scanning backwards from the current widget */
- for (int pos = origPos - 1; pos >= 0; pos--) {
- int visiblePos = visibles.indexOf(widgets.get(pos));
- if (visiblePos != -1) {
- visibles.add(visiblePos + 1, w);
- insert(w, texts.get(origPos), visiblePos + 1);
- break;
- }
- }
- }
- } else {
- int i = visibles.indexOf(w);
- if (i != -1) {
- visibles.remove(i);
- remove(i);
- }
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/MoveDialog.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/MoveDialog.java
deleted file mode 100644
index 3821e93..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/MoveDialog.java
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright (C) 2017 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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.Util;
-import com.google.gerrit.client.projects.BranchInfo;
-import com.google.gerrit.client.projects.ProjectApi;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.SuggestBox;
-import com.google.gwt.user.client.ui.SuggestOracle.Suggestion;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.safehtml.client.HighlightSuggestOracle;
-import java.util.ArrayList;
-import java.util.List;
-
-public abstract class MoveDialog extends TextAreaActionDialog {
- private SuggestBox newBranch;
- private List<BranchInfo> branches;
-
- public MoveDialog(Project.NameKey project) {
- super(Util.C.moveTitle(), Util.C.moveChangeMessage());
- ProjectApi.getBranches(
- project,
- new GerritCallback<JsArray<BranchInfo>>() {
- @Override
- public void onSuccess(JsArray<BranchInfo> result) {
- branches = Natives.asList(result);
- }
- });
-
- newBranch =
- new SuggestBox(
- new HighlightSuggestOracle() {
- @Override
- protected void onRequestSuggestions(Request request, Callback done) {
- List<BranchSuggestion> suggestions = new ArrayList<>();
- for (BranchInfo b : branches) {
- if (b.ref().contains(request.getQuery())) {
- suggestions.add(new BranchSuggestion(b));
- }
- }
- done.onSuggestionsReady(request, new Response(suggestions));
- }
- });
-
- newBranch.setWidth("100%");
- newBranch.getElement().getStyle().setProperty("boxSizing", "border-box");
- message.setCharacterWidth(70);
-
- FlowPanel mwrap = new FlowPanel();
- mwrap.setStyleName(Gerrit.RESOURCES.css().commentedActionMessage());
- mwrap.add(newBranch);
-
- panel.insert(mwrap, 0);
- panel.insert(new SmallHeading(Util.C.headingMoveBranch()), 0);
- }
-
- @Override
- public void center() {
- super.center();
- GlobalKey.dialog(this);
- newBranch.setFocus(true);
- }
-
- public String getDestinationBranch() {
- return newBranch.getText();
- }
-
- static class BranchSuggestion implements Suggestion {
- private BranchInfo branch;
-
- BranchSuggestion(BranchInfo branch) {
- this.branch = branch;
- }
-
- @Override
- public String getDisplayString() {
- String refsHeads = "refs/heads/";
- if (branch.ref().startsWith(refsHeads)) {
- return branch.ref().substring(refsHeads.length());
- }
- return branch.ref();
- }
-
- @Override
- public String getReplacementString() {
- return branch.getShortName();
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/NavigationTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/NavigationTable.java
deleted file mode 100644
index b2306a6..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/NavigationTable.java
+++ /dev/null
@@ -1,408 +0,0 @@
-// Copyright (C) 2009 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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gwt.dom.client.Document;
-import com.google.gwt.dom.client.Element;
-import com.google.gwt.event.dom.client.KeyCodes;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.Event;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.HTMLTable.CellFormatter;
-import com.google.gwt.user.client.ui.Image;
-import com.google.gwt.user.client.ui.ScrollPanel;
-import com.google.gwt.user.client.ui.UIObject;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.globalkey.client.KeyCommand;
-import com.google.gwtexpui.globalkey.client.KeyCommandSet;
-import com.google.gwtexpui.safehtml.client.SafeHtml;
-import java.util.LinkedHashMap;
-import java.util.Map.Entry;
-
-public abstract class NavigationTable<RowItem> extends FancyFlexTable<RowItem> {
- protected class MyFlexTable extends FancyFlexTable.MyFlexTable {
- public MyFlexTable() {
- sinkEvents(Event.ONDBLCLICK | Event.ONCLICK);
- }
-
- @Override
- public void onBrowserEvent(Event event) {
- switch (DOM.eventGetType(event)) {
- case Event.ONCLICK:
- {
- // Find out which cell was actually clicked.
- final Element td = getEventTargetCell(event);
- if (td == null) {
- break;
- }
- final int row = rowOf(td);
- if (getRowItem(row) != null) {
- onCellSingleClick(event, rowOf(td), columnOf(td));
- return;
- }
- break;
- }
- case Event.ONDBLCLICK:
- {
- // Find out which cell was actually clicked.
- Element td = getEventTargetCell(event);
- if (td == null) {
- return;
- }
- onCellDoubleClick(rowOf(td), columnOf(td));
- return;
- }
- }
- super.onBrowserEvent(event);
- }
- }
-
- private static final LinkedHashMap<String, Object> savedPositions =
- new LinkedHashMap<String, Object>(10, 0.75f, true) {
- private static final long serialVersionUID = 1L;
-
- @Override
- protected boolean removeEldestEntry(Entry<String, Object> eldest) {
- return size() >= 20;
- }
- };
-
- private final Image pointer;
- protected final KeyCommandSet keysNavigation;
- protected final KeyCommandSet keysAction;
- private HandlerRegistration regNavigation;
- private HandlerRegistration regAction;
- private int currentRow = -1;
- private String saveId;
-
- private boolean computedScrollType;
- private ScrollPanel parentScrollPanel;
-
- protected NavigationTable(String itemHelpName) {
- this();
- keysNavigation.add(
- new PrevKeyCommand(0, 'k', Util.M.helpListPrev(itemHelpName)),
- new NextKeyCommand(0, 'j', Util.M.helpListNext(itemHelpName)));
- keysNavigation.add(new OpenKeyCommand(0, 'o', Util.M.helpListOpen(itemHelpName)));
- keysNavigation.add(
- new OpenKeyCommand(0, KeyCodes.KEY_ENTER, Util.M.helpListOpen(itemHelpName)));
- }
-
- protected NavigationTable() {
- pointer = new Image(Gerrit.RESOURCES.arrowRight());
- keysNavigation = new KeyCommandSet(Gerrit.C.sectionNavigation());
- keysAction = new KeyCommandSet(Gerrit.C.sectionActions());
- }
-
- protected abstract void onOpenRow(int row);
-
- protected abstract Object getRowItemKey(RowItem item);
-
- private void onUp() {
- for (int row = currentRow - 1; row >= 0; row--) {
- if (getRowItem(row) != null) {
- movePointerTo(row);
- break;
- }
- }
- }
-
- private void onDown() {
- final int max = table.getRowCount();
- for (int row = currentRow + 1; row < max; row++) {
- if (getRowItem(row) != null) {
- movePointerTo(row);
- break;
- }
- }
- }
-
- private void onOpen() {
- if (0 <= currentRow && currentRow < table.getRowCount()) {
- if (getRowItem(currentRow) != null) {
- onOpenRow(currentRow);
- }
- }
- }
-
- /**
- * Invoked when the user double clicks on a table cell.
- *
- * @param row row number.
- * @param column column number.
- */
- protected void onCellDoubleClick(int row, int column) {
- onOpenRow(row);
- }
-
- /**
- * Invoked when the user clicks on a table cell.
- *
- * @param event click event.
- * @param row row number.
- * @param column column number.
- */
- protected void onCellSingleClick(Event event, int row, int column) {
- movePointerTo(row);
- }
-
- protected int getCurrentRow() {
- return currentRow;
- }
-
- protected void ensurePointerVisible() {
- final int max = table.getRowCount();
- int row = currentRow;
- final int init = row;
- if (row < 0) {
- row = 0;
- } else if (max <= row) {
- row = max - 1;
- }
-
- final CellFormatter fmt = table.getCellFormatter();
- final int sTop = Document.get().getScrollTop();
- final int sEnd = sTop + Document.get().getClientHeight();
-
- while (0 <= row && row < max) {
- final Element cur = fmt.getElement(row, C_ARROW).getParentElement();
- final int cTop = cur.getAbsoluteTop();
- final int cEnd = cTop + cur.getOffsetHeight();
-
- if (cEnd < sTop) {
- row++;
- } else if (sEnd < cTop) {
- row--;
- } else {
- break;
- }
- }
-
- if (init != row) {
- movePointerTo(row, false);
- }
- }
-
- protected void movePointerTo(int newRow) {
- movePointerTo(newRow, true);
- }
-
- protected void movePointerTo(int newRow, boolean scroll) {
- final CellFormatter fmt = table.getCellFormatter();
- final boolean clear = 0 <= currentRow && currentRow < table.getRowCount();
- if (clear) {
- final Element tr = fmt.getElement(currentRow, C_ARROW).getParentElement();
- UIObject.setStyleName(tr, Gerrit.RESOURCES.css().activeRow(), false);
- }
- if (0 <= newRow && newRow < table.getRowCount() && getRowItem(newRow) != null) {
- table.setWidget(newRow, C_ARROW, pointer);
- final Element tr = fmt.getElement(newRow, C_ARROW).getParentElement();
- UIObject.setStyleName(tr, Gerrit.RESOURCES.css().activeRow(), true);
- if (scroll && isAttached()) {
- scrollIntoView(tr);
- }
- } else if (clear) {
- table.setWidget(currentRow, C_ARROW, null);
- pointer.removeFromParent();
- }
- currentRow = newRow;
- }
-
- protected void scrollIntoView(Element tr) {
- if (!computedScrollType) {
- parentScrollPanel = null;
- Widget w = getParent();
- while (w != null) {
- if (w instanceof ScrollPanel) {
- parentScrollPanel = (ScrollPanel) w;
- break;
- }
- w = w.getParent();
- }
- computedScrollType = true;
- }
-
- if (parentScrollPanel != null) {
- parentScrollPanel.ensureVisible(
- new UIObject() {
- {
- setElement(tr);
- }
- });
- } else {
- int rt = tr.getAbsoluteTop();
- int rl = tr.getAbsoluteLeft();
- int rb = tr.getAbsoluteBottom();
-
- int wt = Window.getScrollTop();
- int wl = Window.getScrollLeft();
-
- int wh = Window.getClientHeight();
- int ww = Window.getClientWidth();
- int wb = wt + wh;
-
- // If the row is partially or fully obscured, scroll:
- //
- // rl < wl: Row left edge is off screen to left.
- // rt < wt: Row top is above top of window.
- // wb < rt: Row top is below bottom of window.
- // wb < rb: Row bottom is below bottom of window.
- if (rl < wl || rt < wt || wb < rt || wb < rb) {
- if (rl < wl) {
- // Left edge needs to move to make it visible.
- // If the row fully fits in the window, set 0.
- if (tr.getAbsoluteRight() < ww) {
- wl = 0;
- } else {
- wl = Math.max(tr.getAbsoluteLeft() - 5, 0);
- }
- }
-
- // Vertically center the row in the window.
- int h = (wh - (rb - rt)) / 2;
- Window.scrollTo(wl, Math.max(rt - h, 0));
- }
- }
- }
-
- protected void movePointerTo(Object oldId) {
- final int row = findRow(oldId);
- if (0 <= row) {
- movePointerTo(row);
- }
- }
-
- protected int findRow(Object oldId) {
- if (oldId != null) {
- final int max = table.getRowCount();
- for (int row = 0; row < max; row++) {
- final RowItem c = getRowItem(row);
- if (c != null && oldId.equals(getRowItemKey(c))) {
- return row;
- }
- }
- }
- return -1;
- }
-
- @Override
- public void resetHtml(SafeHtml body) {
- currentRow = -1;
- super.resetHtml(body);
- }
-
- public void finishDisplay() {
- if (currentRow >= table.getRowCount()) {
- currentRow = -1;
- }
- if (saveId != null) {
- movePointerTo(savedPositions.get(saveId));
- }
- if (currentRow < 0) {
- onDown();
- }
- }
-
- public void setSavePointerId(String id) {
- saveId = id;
- }
-
- public void setRegisterKeys(boolean on) {
- if (on && isAttached()) {
- if (regNavigation == null) {
- regNavigation = GlobalKey.add(this, keysNavigation);
- }
- if (regAction == null) {
- regAction = GlobalKey.add(this, keysAction);
- }
- } else {
- if (regNavigation != null) {
- regNavigation.removeHandler();
- regNavigation = null;
- }
- if (regAction != null) {
- regAction.removeHandler();
- regAction = null;
- }
- }
- }
-
- @Override
- protected void onLoad() {
- computedScrollType = false;
- parentScrollPanel = null;
- }
-
- @Override
- protected void onUnload() {
- setRegisterKeys(false);
-
- if (saveId != null && currentRow >= 0) {
- final RowItem c = getRowItem(currentRow);
- if (c != null) {
- savedPositions.put(saveId, getRowItemKey(c));
- }
- }
-
- computedScrollType = false;
- parentScrollPanel = null;
- super.onUnload();
- }
-
- @Override
- protected MyFlexTable createFlexTable() {
- return new MyFlexTable();
- }
-
- public class PrevKeyCommand extends KeyCommand {
- public PrevKeyCommand(int mask, char key, String help) {
- super(mask, key, help);
- }
-
- @Override
- public void onKeyPress(KeyPressEvent event) {
- ensurePointerVisible();
- onUp();
- }
- }
-
- public class NextKeyCommand extends KeyCommand {
- public NextKeyCommand(int mask, char key, String help) {
- super(mask, key, help);
- }
-
- @Override
- public void onKeyPress(KeyPressEvent event) {
- ensurePointerVisible();
- onDown();
- }
- }
-
- public class OpenKeyCommand extends KeyCommand {
- public OpenKeyCommand(int mask, int key, String help) {
- super(mask, key, help);
- }
-
- @Override
- public void onKeyPress(KeyPressEvent event) {
- ensurePointerVisible();
- onOpen();
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/NeedsSignInKeyCommand.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/NeedsSignInKeyCommand.java
deleted file mode 100644
index 4420762..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/NeedsSignInKeyCommand.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (C) 2009 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.client.ui;
-
-import com.google.gwtexpui.globalkey.client.KeyCommand;
-
-public abstract class NeedsSignInKeyCommand extends KeyCommand {
- public NeedsSignInKeyCommand(int mask, int key, String help) {
- super(mask, key, help);
- }
-
- public NeedsSignInKeyCommand(int mask, char key, String help) {
- super(mask, key, help);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/NpIntTextBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/NpIntTextBox.java
deleted file mode 100644
index 8be6647..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/NpIntTextBox.java
+++ /dev/null
@@ -1,96 +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.google.gerrit.client.ui;
-
-import com.google.gwt.event.dom.client.KeyCodes;
-import com.google.gwt.event.dom.client.KeyDownEvent;
-import com.google.gwt.event.dom.client.KeyDownHandler;
-import com.google.gwt.event.dom.client.KeyEvent;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.event.dom.client.KeyPressHandler;
-import com.google.gwtexpui.globalkey.client.NpTextBox;
-
-/** Text box that accepts only integer values. */
-public class NpIntTextBox extends NpTextBox {
- private int intValue;
-
- public NpIntTextBox() {
- init();
- }
-
- private void init() {
- addKeyDownHandler(
- new KeyDownHandler() {
- @Override
- public void onKeyDown(KeyDownEvent event) {
- int code = event.getNativeKeyCode();
- onKey(event, code, code);
- }
- });
- addKeyPressHandler(
- new KeyPressHandler() {
- @Override
- public void onKeyPress(KeyPressEvent event) {
- int charCode = event.getCharCode();
- int keyCode = event.getNativeEvent().getKeyCode();
- onKey(event, charCode, keyCode);
- }
- });
- }
-
- private void onKey(KeyEvent<?> event, int charCode, int keyCode) {
- if ('0' <= charCode && charCode <= '9') {
- if (event.isAnyModifierKeyDown()) {
- event.preventDefault();
- }
- } else {
- switch (keyCode) {
- case KeyCodes.KEY_BACKSPACE:
- case KeyCodes.KEY_LEFT:
- case KeyCodes.KEY_RIGHT:
- case KeyCodes.KEY_HOME:
- case KeyCodes.KEY_END:
- case KeyCodes.KEY_TAB:
- case KeyCodes.KEY_DELETE:
- break;
-
- default:
- // Allow copy and paste using ctl-c/ctrl-v,
- // or whatever the platform's convention is.
- if (!(event.isControlKeyDown() || event.isMetaKeyDown() || event.isAltKeyDown())) {
- event.preventDefault();
- }
- break;
- }
- }
- }
-
- public int getIntValue() {
- String txt = getText().trim();
- if (!txt.isEmpty()) {
- try {
- intValue = Integer.parseInt(getText());
- } catch (NumberFormatException e) {
- // Ignored
- }
- }
- return intValue;
- }
-
- public void setIntValue(int v) {
- intValue = v;
- setText(Integer.toString(v));
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/OnEditEnabler.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/OnEditEnabler.java
deleted file mode 100644
index 2c7fcd4..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/OnEditEnabler.java
+++ /dev/null
@@ -1,192 +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.google.gerrit.client.ui;
-
-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(FocusWidget w, TextBoxBase tb) {
- this(w);
- originalValue = tb.getValue().trim();
- listenTo(tb);
- }
-
- public OnEditEnabler(FocusWidget w, ListBox lb) {
- this(w);
- listenTo(lb);
- }
-
- public OnEditEnabler(FocusWidget w, CheckBox cb) {
- this(w);
- listenTo(cb);
- }
-
- public OnEditEnabler(FocusWidget w) {
- widget = w;
- }
-
- public void updateOriginalValue(TextBoxBase tb) {
- originalValue = tb.getValue().trim();
- }
-
- // Register input widgets to be listened to
-
- public void listenTo(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
- // occurred 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(ListBox lb) {
- lb.addChangeHandler(this);
- }
-
- @SuppressWarnings({"unchecked", "rawtypes"})
- public void listenTo(CheckBox cb) {
- cb.addValueChangeHandler((ValueChangeHandler) this);
- }
-
- // Handlers
-
- @Override
- public void onKeyPress(KeyPressEvent e) {
- on(e);
- }
-
- @Override
- public void onKeyDown(KeyDownEvent e) {
- on(e);
- }
-
- @Override
- public void onMouseUp(MouseUpEvent e) {
- on(e);
- }
-
- @Override
- public void onChange(ChangeEvent e) {
- on(e);
- }
-
- @SuppressWarnings("rawtypes")
- @Override
- public void onValueChange(ValueChangeEvent e) {
- on(e);
- }
-
- private void on(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(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/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/PagingHyperlink.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/PagingHyperlink.java
deleted file mode 100644
index 7f0ef68..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/PagingHyperlink.java
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (C) 2015 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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.admin.AdminConstants;
-
-public class PagingHyperlink extends Hyperlink {
-
- public static PagingHyperlink createPrev() {
- return new PagingHyperlink(AdminConstants.I.pagedListPrev());
- }
-
- public static PagingHyperlink createNext() {
- return new PagingHyperlink(AdminConstants.I.pagedListNext());
- }
-
- private PagingHyperlink(String text) {
- super(text, true, "");
- setStyleName(Gerrit.RESOURCES.css().pagingLink());
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ParentProjectBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ParentProjectBox.java
deleted file mode 100644
index 7c45a20..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ParentProjectBox.java
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright (C) 2013 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.client.ui;
-
-import com.google.gerrit.client.projects.ProjectApi;
-import com.google.gerrit.client.projects.ProjectInfo;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.core.client.JsArray;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import com.google.gwt.user.client.ui.Composite;
-import java.util.HashSet;
-import java.util.Set;
-
-public class ParentProjectBox extends Composite {
- private final RemoteSuggestBox suggestBox;
- private final ParentProjectNameSuggestOracle suggestOracle;
-
- public ParentProjectBox() {
- suggestOracle = new ParentProjectNameSuggestOracle();
- suggestBox = new RemoteSuggestBox(suggestOracle);
- initWidget(suggestBox);
- }
-
- public void setVisibleLength(int len) {
- suggestBox.setVisibleLength(len);
- }
-
- public void setProject(Project.NameKey project) {
- suggestOracle.setProject(project);
- }
-
- public void setParentProject(Project.NameKey parent) {
- suggestBox.setText(parent != null ? parent.get() : "");
- }
-
- public Project.NameKey getParentProjectName() {
- final String projectName = suggestBox.getText().trim();
- if (projectName.isEmpty()) {
- return null;
- }
- return new Project.NameKey(projectName);
- }
-
- private static class ParentProjectNameSuggestOracle extends ProjectNameSuggestOracle {
- private Set<String> exclude = new HashSet<>();
-
- public void setProject(Project.NameKey project) {
- exclude.clear();
- exclude.add(project.get());
- ProjectApi.getChildren(
- project,
- true,
- new AsyncCallback<JsArray<ProjectInfo>>() {
- @Override
- public void onSuccess(JsArray<ProjectInfo> result) {
- for (ProjectInfo p : Natives.asList(result)) {
- exclude.add(p.name());
- }
- }
-
- @Override
- public void onFailure(Throwable caught) {}
- });
- }
-
- @Override
- public void _onRequestSuggestions(Request req, Callback callback) {
- super._onRequestSuggestions(
- req,
- new Callback() {
- @Override
- public void onSuggestionsReady(Request request, Response response) {
- if (exclude.size() > 0) {
- Set<Suggestion> filteredSuggestions = new HashSet<>(response.getSuggestions());
- for (Suggestion s : response.getSuggestions()) {
- if (exclude.contains(s.getReplacementString())) {
- filteredSuggestions.remove(s);
- }
- }
- response.setSuggestions(filteredSuggestions);
- }
- callback.onSuggestionsReady(request, response);
- }
- });
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectLink.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectLink.java
deleted file mode 100644
index c5b609a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectLink.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) 2009 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.client.ui;
-
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Project;
-
-/** Link to the default dashboard of a project. */
-public class ProjectLink extends InlineHyperlink {
- public ProjectLink(Project.NameKey proj) {
- this(proj.get(), proj);
- }
-
- public ProjectLink(String text, Project.NameKey proj) {
- super(text, PageLinks.toProjectDefaultDashboard(proj));
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectLinkMenuItem.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectLinkMenuItem.java
deleted file mode 100644
index 114f794..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectLinkMenuItem.java
+++ /dev/null
@@ -1,51 +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.client.ui;
-
-import com.google.gerrit.client.Dispatcher;
-import com.google.gerrit.client.admin.ProjectScreen;
-import com.google.gerrit.reviewdb.client.Project;
-
-public class ProjectLinkMenuItem extends LinkMenuItem {
- protected final String panel;
-
- public ProjectLinkMenuItem(String text, String panel) {
- super(text, "");
- this.panel = panel;
- }
-
- @Override
- public void onScreenLoad(ScreenLoadEvent event) {
- Screen screen = event.getScreen();
- Project.NameKey projectKey;
- if (screen instanceof ProjectScreen) {
- projectKey = ((ProjectScreen) screen).getProjectKey();
- } else {
- projectKey = ProjectScreen.getSavedKey();
- }
-
- if (projectKey != null) {
- setVisible(true);
- onScreenLoad(projectKey);
- } else {
- setVisible(false);
- }
- super.onScreenLoad(event);
- }
-
- protected void onScreenLoad(Project.NameKey project) {
- setTargetHistoryToken(Dispatcher.toProjectAdmin(project, panel));
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectListPopup.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectListPopup.java
deleted file mode 100644
index 89bff71..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectListPopup.java
+++ /dev/null
@@ -1,233 +0,0 @@
-// Copyright (C) 2011 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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.account.Util;
-import com.google.gerrit.client.projects.ProjectMap;
-import com.google.gerrit.client.rpc.GerritCallback;
-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.KeyUpEvent;
-import com.google.gwt.event.dom.client.KeyUpHandler;
-import com.google.gwt.user.client.Window;
-import com.google.gwt.user.client.ui.Button;
-import com.google.gwt.user.client.ui.DialogBox;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.HorizontalPanel;
-import com.google.gwt.user.client.ui.Label;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwt.user.client.ui.ScrollPanel;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.globalkey.client.HidePopupPanelCommand;
-import com.google.gwtexpui.globalkey.client.NpTextBox;
-
-/** A popup containing all projects. */
-public class ProjectListPopup {
- private HighlightingProjectsTable projectsTab;
- private DialogBox popup;
- private NpTextBox filterTxt;
- private HorizontalPanel filterPanel;
- private String match;
- private Query query;
- private Button closeTop;
- private Button closeBottom;
- private ScrollPanel sp;
- private PopupPanel.PositionCallback popupPosition;
- private int preferredTop;
- private int preferredLeft;
- private boolean poppingUp;
- private boolean firstPopupLoad = true;
-
- public void initPopup(String popupText, String currentPageLink) {
- createWidgets(popupText, currentPageLink);
- final FlowPanel pfp = new FlowPanel();
- pfp.add(filterPanel);
- pfp.add(closeTop);
- sp = new ScrollPanel(projectsTab);
- sp.setSize("100%", "100%");
- pfp.add(sp);
- pfp.add(closeBottom);
- popup.setWidget(pfp);
- popup.setHeight("100%");
- popupPosition = getPositionCallback();
- }
-
- protected PopupPanel.PositionCallback getPositionCallback() {
- return new PopupPanel.PositionCallback() {
- @Override
- public void setPosition(int offsetWidth, int offsetHeight) {
- if (preferredTop + offsetHeight > Window.getClientWidth()) {
- preferredTop = Window.getClientWidth() - offsetHeight;
- }
- if (preferredLeft + offsetWidth > Window.getClientWidth()) {
- preferredLeft = Window.getClientWidth() - offsetWidth;
- }
-
- if (preferredTop < 0) {
- sp.setHeight((sp.getOffsetHeight() + preferredTop) + "px");
- preferredTop = 0;
- }
- if (preferredLeft < 0) {
- sp.setWidth((sp.getOffsetWidth() + preferredLeft) + "px");
- preferredLeft = 0;
- }
-
- popup.setPopupPosition(preferredLeft, preferredTop);
- }
- };
- }
-
- /**
- * Invoked after moving pointer to a project.
- *
- * @param projectName project name.
- */
- protected void onMovePointerTo(String projectName) {}
-
- /**
- * Invoked after opening a project row.
- *
- * @param projectName project name.
- */
- protected void openRow(String projectName) {}
-
- public boolean isPoppingUp() {
- return poppingUp;
- }
-
- private void createWidgets(String popupText, String currentPageLink) {
- filterPanel = new HorizontalPanel();
- filterPanel.setStyleName(Gerrit.RESOURCES.css().projectFilterPanel());
- final Label filterLabel =
- new Label(com.google.gerrit.client.admin.AdminConstants.I.projectFilter());
- filterLabel.setStyleName(Gerrit.RESOURCES.css().projectFilterLabel());
- filterPanel.add(filterLabel);
- filterTxt = new NpTextBox();
- filterTxt.addKeyUpHandler(
- new KeyUpHandler() {
- @Override
- public void onKeyUp(KeyUpEvent event) {
- Query q = new Query(filterTxt.getValue());
- if (!match.equals(q.qMatch)) {
- if (query == null) {
- q.run();
- }
- query = q;
- }
- }
- });
- filterPanel.add(filterTxt);
-
- projectsTab =
- new HighlightingProjectsTable() {
- @Override
- protected void movePointerTo(int row, boolean scroll) {
- super.movePointerTo(row, scroll);
- onMovePointerTo(getRowItem(row).name());
- }
-
- @Override
- protected void onOpenRow(int row) {
- super.onOpenRow(row);
- openRow(getRowItem(row).name());
- }
- };
- projectsTab.setSavePointerId(currentPageLink);
-
- closeTop = createCloseButton();
- closeBottom = createCloseButton();
-
- popup = new DialogBox();
- popup.setModal(false);
- popup.setText(popupText);
- }
-
- private Button createCloseButton() {
- Button close = new Button(Util.C.projectsClose());
- close.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- closePopup();
- }
- });
- return close;
- }
-
- public void displayPopup() {
- poppingUp = true;
- if (firstPopupLoad) { // For sizing/positioning, delay display until loaded
- match = "";
- query = new Query(match).run();
- } else {
- popup.setPopupPositionAndShow(popupPosition);
- GlobalKey.dialog(popup);
- GlobalKey.addApplication(popup, new HidePopupPanelCommand(0, KeyCodes.KEY_ESCAPE, popup));
- projectsTab.setRegisterKeys(true);
- projectsTab.finishDisplay();
- filterTxt.setFocus(true);
- poppingUp = false;
- }
- }
-
- public void closePopup() {
- popup.hide();
- }
-
- public void setPreferredCoordinates(int top, int left) {
- this.preferredTop = top;
- this.preferredLeft = left;
- }
-
- private class Query {
- private final String qMatch;
-
- Query(String match) {
- this.qMatch = match;
- }
-
- Query run() {
- ProjectMap.match(
- qMatch,
- new GerritCallback<ProjectMap>() {
- @Override
- public void onSuccess(ProjectMap result) {
- if (!firstPopupLoad && !popup.isShowing()) {
- query = null;
- } else if (query == Query.this) {
- query = null;
- showMap(result);
- } else {
- query.run();
- }
- }
- });
- return this;
- }
-
- private void showMap(ProjectMap result) {
- ProjectListPopup.this.match = qMatch;
- projectsTab.display(result, qMatch);
-
- if (firstPopupLoad) {
- // Display was delayed until table was loaded
- firstPopupLoad = false;
- displayPopup();
- }
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectNameSuggestOracle.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectNameSuggestOracle.java
deleted file mode 100644
index f2ebf81..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectNameSuggestOracle.java
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (C) 2008 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.client.ui;
-
-import com.google.gerrit.client.projects.ProjectMap;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-
-/** Suggestion Oracle for Project.NameKey entities. */
-public class ProjectNameSuggestOracle extends SuggestAfterTypingNCharsOracle {
- @Override
- public void _onRequestSuggestions(Request req, Callback callback) {
- ProjectMap.suggest(
- req.getQuery(),
- req.getLimit(),
- new GerritCallback<ProjectMap>() {
- @Override
- public void onSuccess(ProjectMap map) {
- callback.onSuggestionsReady(req, new Response(Natives.asList(map.values())));
- }
- });
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectSearchLink.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectSearchLink.java
deleted file mode 100644
index f0e06a0..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectSearchLink.java
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright (C) 2012 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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.admin.AdminConstants;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.user.client.DOM;
-import com.google.gwt.user.client.ui.Image;
-
-public class ProjectSearchLink extends InlineHyperlink {
-
- public ProjectSearchLink(Project.NameKey projectName) {
- super(" ", PageLinks.toProjectDefaultDashboard(projectName));
- setTitle(AdminConstants.I.projectListQueryLink());
- final Image image = new Image(Gerrit.RESOURCES.queryIcon());
- image.setStyleName(Gerrit.RESOURCES.css().queryIcon());
- DOM.insertBefore(getElement(), image.getElement(), DOM.getFirstChild(getElement()));
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectsTable.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectsTable.java
deleted file mode 100644
index 3576b12..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ProjectsTable.java
+++ /dev/null
@@ -1,121 +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.google.gerrit.client.ui;
-
-import static java.util.Comparator.comparing;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.projects.ProjectInfo;
-import com.google.gerrit.client.projects.ProjectMap;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
-import com.google.gwt.user.client.ui.Image;
-import java.util.List;
-
-public class ProjectsTable extends NavigationTable<ProjectInfo> {
- public static final int C_STATE = 1;
- public static final int C_NAME = 2;
- public static final int C_DESCRIPTION = 3;
- public static final int C_REPO_BROWSER = 4;
-
- public ProjectsTable() {
- super(Util.C.projectItemHelp());
- initColumnHeaders();
- }
-
- protected void initColumnHeaders() {
- table.setText(0, C_STATE, Util.C.projectStateAbbrev());
- table.getCellFormatter().getElement(0, C_STATE).setTitle(Util.C.projectStateHelp());
- table.setText(0, C_NAME, Util.C.projectName());
- table.setText(0, C_DESCRIPTION, Util.C.projectDescription());
-
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(0, C_STATE, Gerrit.RESOURCES.css().iconHeader());
- fmt.addStyleName(0, C_NAME, Gerrit.RESOURCES.css().dataHeader());
- fmt.addStyleName(0, C_DESCRIPTION, Gerrit.RESOURCES.css().dataHeader());
- }
-
- @Override
- protected Object getRowItemKey(ProjectInfo item) {
- return item.name();
- }
-
- @Override
- protected void onOpenRow(int row) {
- if (row > 0) {
- movePointerTo(row);
- }
- }
-
- public void display(ProjectMap projects) {
- displaySubset(projects, 0, projects.size());
- }
-
- public void displaySubset(ProjectMap projects, int fromIndex, int toIndex) {
- while (1 < table.getRowCount()) {
- table.removeRow(table.getRowCount() - 1);
- }
-
- List<ProjectInfo> list = Natives.asList(projects.values());
- list.sort(comparing(ProjectInfo::name));
- for (ProjectInfo p : list.subList(fromIndex, toIndex)) {
- insert(table.getRowCount(), p);
- }
-
- finishDisplay();
- }
-
- protected void insert(int row, ProjectInfo k) {
- table.insertRow(row);
-
- applyDataRowStyle(row);
-
- final FlexCellFormatter fmt = table.getFlexCellFormatter();
- fmt.addStyleName(row, C_STATE, Gerrit.RESOURCES.css().iconCell());
- fmt.addStyleName(row, C_NAME, Gerrit.RESOURCES.css().dataCell());
- fmt.addStyleName(row, C_NAME, Gerrit.RESOURCES.css().projectNameColumn());
- fmt.addStyleName(row, C_DESCRIPTION, Gerrit.RESOURCES.css().dataCell());
-
- populate(row, k);
- }
-
- protected void populate(int row, ProjectInfo k) {
- populateState(row, k);
- table.setText(row, C_NAME, k.name());
- table.setText(row, C_DESCRIPTION, k.description());
-
- setRowItem(row, k);
- }
-
- protected void populateState(int row, ProjectInfo k) {
- Image state = new Image();
- switch (k.state()) {
- case HIDDEN:
- state.setResource(Gerrit.RESOURCES.redNot());
- state.setTitle(com.google.gerrit.client.admin.Util.toLongString(k.state()));
- table.setWidget(row, ProjectsTable.C_STATE, state);
- break;
- case READ_ONLY:
- state.setResource(Gerrit.RESOURCES.readOnly());
- state.setTitle(com.google.gerrit.client.admin.Util.toLongString(k.state()));
- table.setWidget(row, ProjectsTable.C_STATE, state);
- break;
- case ACTIVE:
- default:
- // Intentionally left blank, do not show an icon when active.
- break;
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/RebaseDialog.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/RebaseDialog.java
deleted file mode 100644
index e03ac46..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/RebaseDialog.java
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright (C) 2015 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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.changes.ChangeList;
-import com.google.gerrit.client.changes.Util;
-import com.google.gerrit.client.info.ChangeInfo;
-import com.google.gerrit.client.rpc.GerritCallback;
-import com.google.gerrit.client.rpc.Natives;
-import com.google.gerrit.common.PageLinks;
-import com.google.gerrit.extensions.client.ListChangesOption;
-import com.google.gerrit.reviewdb.client.Change;
-import com.google.gerrit.reviewdb.client.Project;
-import com.google.gwt.event.dom.client.ClickEvent;
-import com.google.gwt.event.dom.client.ClickHandler;
-import com.google.gwt.user.client.ui.CheckBox;
-import com.google.gwt.user.client.ui.SuggestBox;
-import com.google.gwt.user.client.ui.SuggestOracle.Suggestion;
-import com.google.gwtexpui.globalkey.client.GlobalKey;
-import com.google.gwtexpui.safehtml.client.HighlightSuggestOracle;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-public abstract class RebaseDialog extends CommentedActionDialog {
- private final SuggestBox base;
- private final CheckBox changeParent;
- private List<ChangeInfo> candidateChanges;
- private final boolean sendEnabled;
-
- public RebaseDialog(
- final Project.NameKey project,
- final String branch,
- final Change.Id changeId,
- final boolean sendEnabled) {
- super(Util.C.rebaseTitle(), null);
- this.sendEnabled = sendEnabled;
- sendButton.setText(Util.C.buttonRebaseChangeSend());
-
- // Create the suggestion box to filter over a list of recent changes
- // open on the same branch. The list of candidates is primed by the
- // changeParent CheckBox (below) getting enabled by the user.
- base =
- new SuggestBox(
- new HighlightSuggestOracle() {
- @Override
- protected void onRequestSuggestions(Request request, Callback done) {
- String query = request.getQuery().toLowerCase();
- List<ChangeSuggestion> suggestions = new ArrayList<>();
- for (ChangeInfo ci : candidateChanges) {
- if (changeId.equals(ci.legacyId())) {
- continue; // do not suggest current change
- }
- String id = String.valueOf(ci.legacyId().get());
- if (id.contains(query) || ci.subject().toLowerCase().contains(query)) {
- suggestions.add(new ChangeSuggestion(ci));
- if (suggestions.size() >= 50) { // limit to 50 suggestions
- break;
- }
- }
- }
- done.onSuggestionsReady(request, new Response(suggestions));
- }
- });
- base.getElement().setAttribute("placeholder", Util.C.rebasePlaceholderMessage());
- base.setStyleName(Gerrit.RESOURCES.css().rebaseSuggestBox());
-
- // The changeParent checkbox must be clicked to load into browser memory
- // a list of open changes from the same project and same branch that this
- // change may rebase onto.
- changeParent = new CheckBox(Util.C.rebaseConfirmMessage());
- changeParent.addClickHandler(
- new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- if (changeParent.getValue()) {
- ChangeList.query(
- PageLinks.projectQuery(project)
- + " "
- + PageLinks.op("branch", branch)
- + " is:open -age:90d",
- Collections.<ListChangesOption>emptySet(),
- new GerritCallback<ChangeList>() {
- @Override
- public void onSuccess(ChangeList result) {
- candidateChanges = Natives.asList(result);
- updateControls(true);
- }
-
- @Override
- public void onFailure(Throwable err) {
- updateControls(false);
- changeParent.setValue(false);
- super.onFailure(err);
- }
- });
- } else {
- updateControls(false);
- }
- }
- });
-
- // add the checkbox and suggestbox widgets to the content panel
- contentPanel.add(changeParent);
- contentPanel.add(base);
- contentPanel.setStyleName(Gerrit.RESOURCES.css().rebaseContentPanel());
- }
-
- @Override
- public void center() {
- super.center();
- GlobalKey.dialog(this);
- updateControls(false);
- }
-
- private void updateControls(boolean changeParentEnabled) {
- if (changeParentEnabled) {
- sendButton.setTitle(null);
- sendButton.setEnabled(true);
- base.setEnabled(true);
- base.setFocus(true);
- } else {
- base.setEnabled(false);
- sendButton.setEnabled(sendEnabled);
- if (sendEnabled) {
- sendButton.setTitle(null);
- sendButton.setFocus(true);
- } else {
- sendButton.setTitle(Util.C.rebaseNotPossibleMessage());
- cancelButton.setFocus(true);
- }
- }
- }
-
- public String getBase() {
- return changeParent.getValue() ? base.getText() : null;
- }
-
- private static class ChangeSuggestion implements Suggestion {
- private ChangeInfo change;
-
- ChangeSuggestion(ChangeInfo change) {
- this.change = change;
- }
-
- @Override
- public String getDisplayString() {
- return String.valueOf(change.legacyId().get()) + ": " + change.subject();
- }
-
- @Override
- public String getReplacementString() {
- return String.valueOf(change.legacyId().get());
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/RemoteSuggestBox.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/RemoteSuggestBox.java
deleted file mode 100644
index 5d741cf..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/RemoteSuggestBox.java
+++ /dev/null
@@ -1,165 +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.client.ui;
-
-import com.google.gwt.event.dom.client.FocusEvent;
-import com.google.gwt.event.dom.client.FocusHandler;
-import com.google.gwt.event.dom.client.KeyCodes;
-import com.google.gwt.event.dom.client.KeyDownEvent;
-import com.google.gwt.event.dom.client.KeyDownHandler;
-import com.google.gwt.event.logical.shared.CloseEvent;
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.event.logical.shared.HasCloseHandlers;
-import com.google.gwt.event.logical.shared.HasSelectionHandlers;
-import com.google.gwt.event.logical.shared.SelectionEvent;
-import com.google.gwt.event.logical.shared.SelectionHandler;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.user.client.ui.Composite;
-import com.google.gwt.user.client.ui.Focusable;
-import com.google.gwt.user.client.ui.HasText;
-import com.google.gwt.user.client.ui.SuggestBox;
-import com.google.gwt.user.client.ui.SuggestBox.DefaultSuggestionDisplay;
-import com.google.gwt.user.client.ui.SuggestOracle;
-import com.google.gwt.user.client.ui.SuggestOracle.Suggestion;
-import com.google.gwt.user.client.ui.TextBoxBase;
-
-public class RemoteSuggestBox extends Composite
- implements Focusable,
- HasText,
- HasSelectionHandlers<String>,
- HasCloseHandlers<RemoteSuggestBox> {
- private final RemoteSuggestOracle remoteSuggestOracle;
- private final DefaultSuggestionDisplay display;
- private final HintTextBox textBox;
- private final SuggestBox suggestBox;
- private boolean submitOnSelection;
-
- public RemoteSuggestBox(SuggestOracle oracle) {
- remoteSuggestOracle = new RemoteSuggestOracle(oracle);
- remoteSuggestOracle.setServeSuggestions(true);
- display = new DefaultSuggestionDisplay();
-
- textBox = new HintTextBox();
- textBox.addKeyDownHandler(
- new KeyDownHandler() {
- @Override
- public void onKeyDown(KeyDownEvent e) {
- submitOnSelection = false;
- if (e.getNativeKeyCode() == KeyCodes.KEY_ESCAPE) {
- CloseEvent.fire(RemoteSuggestBox.this, RemoteSuggestBox.this);
- } else if (e.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
- if (display.isSuggestionListShowing()) {
- if (textBox.getValue().equals(remoteSuggestOracle.getLast())) {
- submitOnSelection = true;
- } else {
- display.hideSuggestions();
- }
- } else {
- SelectionEvent.fire(RemoteSuggestBox.this, getText());
- }
- }
- }
- });
-
- suggestBox = new SuggestBox(remoteSuggestOracle, textBox, display);
- suggestBox.addSelectionHandler(
- new SelectionHandler<Suggestion>() {
- @Override
- public void onSelection(SelectionEvent<Suggestion> event) {
- if (submitOnSelection) {
- SelectionEvent.fire(RemoteSuggestBox.this, getText());
- }
- remoteSuggestOracle.cancelOutstandingRequest();
- display.hideSuggestions();
- }
- });
- initWidget(suggestBox);
- }
-
- public void setHintText(String hint) {
- textBox.setHintText(hint);
- }
-
- public void setVisibleLength(int len) {
- textBox.setVisibleLength(len);
- }
-
- public void setEnabled(boolean enabled) {
- suggestBox.setEnabled(enabled);
- }
-
- public TextBoxBase getTextBox() {
- return textBox;
- }
-
- @Override
- public String getText() {
- return suggestBox.getText();
- }
-
- @Override
- public void setText(String value) {
- suggestBox.setText(value);
- }
-
- @Override
- public void setFocus(boolean focus) {
- suggestBox.setFocus(focus);
- }
-
- @Override
- public int getTabIndex() {
- return suggestBox.getTabIndex();
- }
-
- @Override
- public void setAccessKey(char key) {
- suggestBox.setAccessKey(key);
- }
-
- @Override
- public void setTabIndex(int index) {
- suggestBox.setTabIndex(index);
- }
-
- @Override
- public HandlerRegistration addSelectionHandler(SelectionHandler<String> h) {
- return addHandler(h, SelectionEvent.getType());
- }
-
- @Override
- public HandlerRegistration addCloseHandler(CloseHandler<RemoteSuggestBox> h) {
- return addHandler(h, CloseEvent.getType());
- }
-
- public void selectAll() {
- suggestBox.getValueBox().selectAll();
- }
-
- public void enableDefaultSuggestions() {
- textBox.addFocusHandler(
- new FocusHandler() {
- @Override
- public void onFocus(FocusEvent focusEvent) {
- if (textBox.getText().equals("")) {
- suggestBox.showSuggestionList();
- }
- }
- });
- }
-
- public void setServeSuggestionsOnOracle(boolean serveSuggestions) {
- remoteSuggestOracle.setServeSuggestions(serveSuggestions);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Screen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Screen.java
deleted file mode 100644
index 03ed899..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Screen.java
+++ /dev/null
@@ -1,199 +0,0 @@
-// Copyright (C) 2008 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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gerrit.client.projects.ThemeInfo;
-import com.google.gwt.user.client.ui.FlowPanel;
-import com.google.gwt.user.client.ui.Grid;
-import com.google.gwt.user.client.ui.HasHorizontalAlignment;
-import com.google.gwt.user.client.ui.InlineLabel;
-import com.google.gwt.user.client.ui.Widget;
-import com.google.gwtexpui.user.client.View;
-
-/**
- * A Screen layout with a header and a body.
- *
- * <p>The header is mainly a text title, but it can be decorated in the West, the East, and the
- * FarEast by any Widget. The West and East decorations will surround the text on the left and right
- * respectively, and the FarEast will be right justified to the right edge of the screen. The East
- * decoration will expand to take up any extra space.
- */
-public abstract class Screen extends View {
- private Grid header;
- private InlineLabel headerText;
- private FlowPanel body;
- private String token;
- private boolean requiresSignIn;
- private String windowTitle;
- private Widget titleWidget;
-
- private ThemeInfo theme;
- private boolean setTheme;
-
- protected Screen() {
- initWidget(new FlowPanel());
- setStyleName(Gerrit.RESOURCES.css().screen());
- body = new FlowPanel();
- }
-
- @Override
- protected void onLoad() {
- super.onLoad();
- if (header == null) {
- onInitUI();
- }
- }
-
- @Override
- protected void onUnload() {
- super.onUnload();
- if (setTheme) {
- Gerrit.THEMER.clear();
- }
- }
-
- public void registerKeys() {}
-
- private enum Cols {
- West,
- Title,
- East,
- FarEast
- }
-
- protected void onInitUI() {
- final FlowPanel me = (FlowPanel) getWidget();
- me.add(header = new Grid(1, Cols.values().length));
- me.add(body);
-
- headerText = new InlineLabel();
- if (titleWidget == null) {
- titleWidget = headerText;
- }
- FlowPanel title = new FlowPanel();
- title.add(titleWidget);
- title.setStyleName(Gerrit.RESOURCES.css().screenHeader());
- header.setWidget(0, Cols.Title.ordinal(), title);
-
- header.setStyleName(Gerrit.RESOURCES.css().screenHeader());
- header
- .getCellFormatter()
- .setHorizontalAlignment(0, Cols.FarEast.ordinal(), HasHorizontalAlignment.ALIGN_RIGHT);
- // force FarEast all the way to the right
- header.getCellFormatter().setWidth(0, Cols.FarEast.ordinal(), "100%");
- }
-
- protected void setWindowTitle(String text) {
- windowTitle = text;
- Gerrit.setWindowTitle(this, text);
- }
-
- protected void setPageTitle(String text) {
- final String old = headerText.getText();
- if (text.isEmpty()) {
- header.setVisible(false);
- } else {
- headerText.setText(text);
- header.setVisible(true);
- }
- if (windowTitle == null || windowTitle.equals(old)) {
- setWindowTitle(text);
- }
- }
-
- protected void setHeaderVisible(boolean value) {
- header.setVisible(value);
- }
-
- public void setTitle(Widget w) {
- titleWidget = w;
- }
-
- protected void setTitleEast(Widget w) {
- header.setWidget(0, Cols.East.ordinal(), w);
- }
-
- protected void setTitleFarEast(Widget w) {
- header.setWidget(0, Cols.FarEast.ordinal(), w);
- }
-
- protected void setTitleWest(Widget w) {
- header.setWidget(0, Cols.West.ordinal(), w);
- }
-
- protected void add(Widget w) {
- body.add(w);
- }
-
- protected FlowPanel getBody() {
- return body;
- }
-
- protected void setTheme(ThemeInfo t) {
- theme = t;
- }
-
- /** Get the history token for this screen. */
- public String getToken() {
- return token;
- }
-
- /** Set the history token for this screen. */
- public void setToken(String t) {
- assert t != null && !t.isEmpty();
- token = t;
-
- if (isCurrentView()) {
- Gerrit.updateImpl(token);
- }
- }
-
- /**
- * If this view can display the given token, update it.
- *
- * @param newToken token the UI wants to show.
- * @return true if this view can show the token immediately, false if not.
- */
- public boolean displayToken(String newToken) {
- return false;
- }
-
- /** Set whether or not {@link Gerrit#isSignedIn()} must be true. */
- public final void setRequiresSignIn(boolean b) {
- requiresSignIn = b;
- }
-
- /** Does {@link Gerrit#isSignedIn()} have to be true to be on this screen? */
- public final boolean isRequiresSignIn() {
- return requiresSignIn;
- }
-
- public void onShowView() {
- if (windowTitle != null) {
- Gerrit.setWindowTitle(this, windowTitle);
- }
- Gerrit.EVENT_BUS.fireEvent(new ScreenLoadEvent(this));
- Gerrit.setQueryString(null);
- registerKeys();
-
- if (theme != null) {
- Gerrit.THEMER.set(theme);
- setTheme = true;
- } else {
- Gerrit.THEMER.clear();
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ScreenLoadEvent.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ScreenLoadEvent.java
deleted file mode 100644
index debd9a6..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ScreenLoadEvent.java
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright (C) 2012 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.client.ui;
-
-import com.google.gwt.event.shared.GwtEvent;
-
-public class ScreenLoadEvent extends GwtEvent<ScreenLoadHandler> {
- private final Screen screen;
-
- public ScreenLoadEvent(Screen screen) {
- super();
- this.screen = screen;
- }
-
- public static final Type<ScreenLoadHandler> TYPE = new Type<>();
-
- @Override
- protected void dispatch(ScreenLoadHandler handler) {
- handler.onScreenLoad(this);
- }
-
- @Override
- public GwtEvent.Type<ScreenLoadHandler> getAssociatedType() {
- return TYPE;
- }
-
- public Screen getScreen() {
- return screen;
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ScreenLoadHandler.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ScreenLoadHandler.java
deleted file mode 100644
index 9a5eb03..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/ScreenLoadHandler.java
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright (C) 2012 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.client.ui;
-
-import com.google.gwt.event.shared.EventHandler;
-
-public interface ScreenLoadHandler extends EventHandler {
- void onScreenLoad(ScreenLoadEvent event);
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/SmallHeading.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/SmallHeading.java
deleted file mode 100644
index ea18d62..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/SmallHeading.java
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (C) 2009 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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gwt.user.client.ui.Label;
-
-public class SmallHeading extends Label {
- public SmallHeading() {
- setStyleName(Gerrit.RESOURCES.css().smallHeading());
- }
-
- public SmallHeading(String text) {
- this();
- setText(text);
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/SuggestAfterTypingNCharsOracle.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/SuggestAfterTypingNCharsOracle.java
deleted file mode 100644
index e24f347..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/SuggestAfterTypingNCharsOracle.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (C) 2012 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.client.ui;
-
-import com.google.gerrit.client.Gerrit;
-import com.google.gwtexpui.safehtml.client.HighlightSuggestOracle;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * Suggest oracle that only provides suggestions if the user has typed at least as many characters
- * as configured by 'suggest.from'. If 'suggest.from' is set to 0, suggestions will always be
- * provided.
- */
-public abstract class SuggestAfterTypingNCharsOracle extends HighlightSuggestOracle {
-
- @Override
- protected void onRequestSuggestions(Request req, Callback cb) {
- if (req.getQuery() != null && req.getQuery().length() >= Gerrit.info().suggest().from()) {
- _onRequestSuggestions(req, cb);
- } else {
- List<Suggestion> none = Collections.emptyList();
- cb.onSuggestionsReady(req, new Response(none));
- }
- }
-
- protected abstract void _onRequestSuggestions(Request request, Callback done);
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/TextAreaActionDialog.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/TextAreaActionDialog.java
deleted file mode 100644
index d7d5d6a..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/TextAreaActionDialog.java
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (C) 2015 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.client.ui;
-
-import com.google.gwt.event.logical.shared.CloseHandler;
-import com.google.gwt.user.client.ui.PopupPanel;
-import com.google.gwtexpui.globalkey.client.NpTextArea;
-
-public abstract class TextAreaActionDialog extends CommentedActionDialog
- implements CloseHandler<PopupPanel> {
- protected final NpTextArea message;
-
- public TextAreaActionDialog(String title, String heading) {
- super(title, heading);
-
- message = new NpTextArea();
- message.setCharacterWidth(60);
- message.setVisibleLines(10);
- message.getElement().setPropertyBoolean("spellcheck", true);
- setFocusOn(message);
-
- contentPanel.add(message);
- }
-
- public String getMessageText() {
- return message.getText().trim();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/UIConstants.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/UIConstants.java
deleted file mode 100644
index 32bb796..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/UIConstants.java
+++ /dev/null
@@ -1,41 +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.google.gerrit.client.ui;
-
-import com.google.gwt.i18n.client.Constants;
-
-public interface UIConstants extends Constants {
- String commentedActionButtonSend();
-
- String commentedActionButtonCancel();
-
- String projectName();
-
- String projectDescription();
-
- String projectItemHelp();
-
- String projectStateAbbrev();
-
- String projectStateHelp();
-
- String dialogCreateChangeTitle();
-
- String dialogCreateChangeHeading();
-
- String newChangeBranchSuggestion();
-
- String newChangeTopicSuggestion();
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/UIConstants.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/UIConstants.properties
deleted file mode 100644
index 736e210..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/UIConstants.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-commentedActionButtonSend = Submit
-commentedActionButtonCancel = Cancel
-
-projectName = Project Name
-projectDescription = Project Description
-projectItemHelp = project
-projectStateAbbrev = S
-projectStateHelp = State
-
-dialogCreateChangeTitle = Create Change
-dialogCreateChangeHeading = Description
-newChangeBranchSuggestion = Select branch for new change
-newChangeTopicSuggestion = Enter topic for new change
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/UIMessages.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/UIMessages.java
deleted file mode 100644
index af17390..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/UIMessages.java
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (C) 2012 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.client.ui;
-
-import com.google.gwt.i18n.client.Messages;
-
-public interface UIMessages extends Messages {
- String helpListOpen(String item);
-
- String helpListPrev(String item);
-
- String helpListNext(String item);
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/UIMessages.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/UIMessages.properties
deleted file mode 100644
index 1439245..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/UIMessages.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-helpListOpen = Select {0}
-helpListPrev = Previous {0}
-helpListNext = Next {0}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/UserActivityMonitor.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/UserActivityMonitor.java
deleted file mode 100644
index 2b76b9b..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/UserActivityMonitor.java
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright (C) 2013 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.client.ui;
-
-import com.google.gwt.core.client.Scheduler;
-import com.google.gwt.core.client.Scheduler.RepeatingCommand;
-import com.google.gwt.event.dom.client.KeyPressEvent;
-import com.google.gwt.event.dom.client.KeyPressHandler;
-import com.google.gwt.event.dom.client.MouseMoveEvent;
-import com.google.gwt.event.dom.client.MouseMoveHandler;
-import com.google.gwt.event.logical.shared.HasValueChangeHandlers;
-import com.google.gwt.event.logical.shared.ValueChangeEvent;
-import com.google.gwt.event.logical.shared.ValueChangeHandler;
-import com.google.gwt.event.shared.EventBus;
-import com.google.gwt.event.shared.GwtEvent;
-import com.google.gwt.event.shared.HandlerRegistration;
-import com.google.gwt.event.shared.SimpleEventBus;
-import com.google.gwt.user.client.History;
-import com.google.gwtexpui.globalkey.client.DocWidget;
-
-/** Checks for user keyboard and mouse activity. */
-public class UserActivityMonitor {
- private static final long TIMEOUT = 10 * 60 * 1000;
- private static final MonitorImpl impl;
-
- /**
- * @return true if there has been keyboard and/or mouse activity in recent enough history to
- * believe a user is still controlling this session.
- */
- public static boolean isActive() {
- return impl.active || impl.recent;
- }
-
- public static HandlerRegistration addValueChangeHandler(ValueChangeHandler<Boolean> handler) {
- return impl.addValueChangeHandler(handler);
- }
-
- static {
- impl = new MonitorImpl();
- DocWidget.get().addKeyPressHandler(impl);
- DocWidget.get().addMouseMoveHandler(impl);
- History.addValueChangeHandler(impl);
- Scheduler.get().scheduleFixedDelay(impl, 60 * 1000);
- }
-
- private UserActivityMonitor() {}
-
- private static class MonitorImpl
- implements RepeatingCommand,
- KeyPressHandler,
- MouseMoveHandler,
- ValueChangeHandler<String>,
- HasValueChangeHandlers<Boolean> {
- private final EventBus bus = new SimpleEventBus();
- private boolean recent = true;
- private boolean active = true;
- private long last = System.currentTimeMillis();
-
- @Override
- public void onKeyPress(KeyPressEvent event) {
- recent = true;
- }
-
- @Override
- public void onMouseMove(MouseMoveEvent event) {
- recent = true;
- }
-
- @Override
- public void onValueChange(ValueChangeEvent<String> event) {
- recent = true;
- }
-
- @Override
- public boolean execute() {
- long now = System.currentTimeMillis();
- if (recent) {
- if (!active) {
- ValueChangeEvent.fire(this, active);
- }
- recent = false;
- active = true;
- last = now;
- } else if (active && (now - last) > TIMEOUT) {
- active = false;
- ValueChangeEvent.fire(this, false);
- }
- return true;
- }
-
- @Override
- public HandlerRegistration addValueChangeHandler(ValueChangeHandler<Boolean> handler) {
- return bus.addHandler(ValueChangeEvent.getType(), handler);
- }
-
- @Override
- public void fireEvent(GwtEvent<?> event) {
- bus.fireEvent(event);
- }
- }
-}
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Util.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Util.java
deleted file mode 100644
index 41e3573..0000000
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/ui/Util.java
+++ /dev/null
@@ -1,48 +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.google.gerrit.client.ui;
-
-import com.google.gwt.core.client.GWT;
-import com.google.gwtexpui.safehtml.client.SafeHtmlBuilder;
-
-public class Util {
- public static final UIConstants C = GWT.create(UIConstants.class);
- public static final UIMessages M = GWT.create(UIMessages.class);
-
- public static String highlight(String text, String toHighlight) {
- final SafeHtmlBuilder b = new SafeHtmlBuilder();
- if (toHighlight == null || "".equals(toHighlight)) {
- b.append(text);
- return b.toSafeHtml().asString();
- }
-
- int pos = 0;
- int endPos = 0;
- while ((pos = text.toLowerCase().indexOf(toHighlight.toLowerCase(), pos)) > -1) {
- if (pos > endPos) {
- b.append(text.substring(endPos, pos));
- }
- endPos = pos + toHighlight.length();
- b.openElement("b");
- b.append(text.substring(pos, endPos));
- b.closeElement("b");
- pos = endPos;
- }
- if (endPos < text.length()) {
- b.append(text.substring(endPos));
- }
- return b.toSafeHtml().asString();
- }
-}
diff --git a/gerrit-gwtui/src/main/java/net/codemirror/CodeMirror.gwt.xml b/gerrit-gwtui/src/main/java/net/codemirror/CodeMirror.gwt.xml
deleted file mode 100644
index add033f..0000000
--- a/gerrit-gwtui/src/main/java/net/codemirror/CodeMirror.gwt.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<!--
- Copyright (C) 2013 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>
- <inherits name='com.google.gwt.logging.Logging'/>
- <inherits name='com.google.gwt.resources.Resources'/>
- <source path='addon'/>
- <source path='lib'/>
- <source path='keymap'/>
- <source path='mode'/>
- <source path='theme'/>
-</module>
diff --git a/gerrit-gwtui/src/main/java/net/codemirror/addon/AddonInjector.java b/gerrit-gwtui/src/main/java/net/codemirror/addon/AddonInjector.java
deleted file mode 100644
index cb1891e..0000000
--- a/gerrit-gwtui/src/main/java/net/codemirror/addon/AddonInjector.java
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright (C) 2016 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 net.codemirror.addon;
-
-import com.google.gwt.safehtml.shared.SafeUri;
-import com.google.gwt.user.client.rpc.AsyncCallback;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import net.codemirror.lib.Loader;
-
-public class AddonInjector {
- private static final Map<String, SafeUri> addonUris = new HashMap<>();
-
- static {
- addonUris.put(Addons.I.merge_bundled().getName(), Addons.I.merge_bundled().getSafeUri());
- }
-
- public static SafeUri getAddonScriptUri(String addon) {
- return addonUris.get(addon);
- }
-
- private static boolean canLoad(String addon) {
- return getAddonScriptUri(addon) != null;
- }
-
- private final Set<String> loading = new HashSet<>();
- private int pending;
- private AsyncCallback<Void> appCallback;
-
- public AddonInjector add(String name) {
- if (name == null) {
- return this;
- }
-
- if (!canLoad(name)) {
- Logger.getLogger("net.codemirror")
- .log(Level.WARNING, "CodeMirror addon " + name + " not configured.");
- return this;
- }
-
- loading.add(name);
- return this;
- }
-
- public void inject(AsyncCallback<Void> appCallback) {
- this.appCallback = appCallback;