Allow plugins to add custom settings screens

Plugins can now add custom screens which are integrated into the
Gerrit user settings menu. A new entry in the user settings menu loads
and displays the settings screen from the plugin. The user settings
menu on the left side is automatically included into the custom
settings screens.

Plugins must register settings screen early at plugin module load. The
way how settings screens are registered is similar to how plugins can
add normal custom screens.

An example settings screen was implemented in the cookbook plugin.

Change-Id: I4a88e4975ff436a5cdb125ebbde276dfab280ce2
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin
2015-07-08 13:28:40 +02:00
parent 2a8c515a27
commit 70e1112c0d
10 changed files with 222 additions and 1 deletions

View File

@@ -28,6 +28,7 @@ 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_EXTENSION;
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;
@@ -65,6 +66,7 @@ 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.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.changes.AccountDashboardScreen;
@@ -720,6 +722,16 @@ public class Dispatcher {
return new NewAgreementScreen(skip(token));
}
if (matchPrefix(SETTINGS_EXTENSION, token)) {
ExtensionSettingsScreen view =
new ExtensionSettingsScreen(skip(token));
if (view.isFound()) {
return view;
} else {
return new NotFoundScreen();
}
}
return new NotFoundScreen();
}
});