本文整理汇总了Java中com.google.gerrit.extensions.client.GerritTopMenu类的典型用法代码示例。如果您正苦于以下问题:Java GerritTopMenu类的具体用法?Java GerritTopMenu怎么用?Java GerritTopMenu使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GerritTopMenu类属于com.google.gerrit.extensions.client包,在下文中一共展示了GerritTopMenu类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: TopMenuExtension
import com.google.gerrit.extensions.client.GerritTopMenu; //导入依赖的package包/类
public TopMenuExtension() {
menuEntries = Lists.newArrayList();
/*
* By adding GerritTopMenu.PROJECTS, we are extending what is currently in the "Projects"
* entry in the top menu with whatever MenuItems we add
*/
menuEntries.add(new MenuEntry(GerritTopMenu.PROJECTS, Collections
.singletonList(new MenuItem("Gerrit-CI", "#/x/gerrit-ci/projects/${projectName}",
"_self"))));
}
示例2: GitBlitTopMenu
import com.google.gerrit.extensions.client.GerritTopMenu; //导入依赖的package包/类
@Inject
public GitBlitTopMenu(@PluginName String pluginName, @PluginCanonicalWebUrl String pluginUrl, Provider<CurrentUser> userProvider,
PluginConfigFactory cfgProvider) {
this.userProvider = userProvider;
String gitBlitBaseUrl = pluginUrl.endsWith("/") ? pluginUrl : pluginUrl + '/';
PluginConfig cfg = cfgProvider.getFromGerritConfig(pluginName, true);
// We don't have to worry about XSS here; the way these menu item get created through GWT ensures that these values read from the config
// end up as text nodes in the DOM, even if they contain potentially malicious code. So if somebody sets these values to some HTML snippet,
// he'll simply end up with a funny looking menu item, but he can't inject things here.
MenuItem repositories = new MenuItem(cfg.getString("repositories", "Repositories"), gitBlitBaseUrl + "repositories/", "");
// GitBlit handles its own "/" url, so Gerrit won't produce any link, not even on the "plugins" page, that would display the documentation.
// I've considered simply redirecting "/" to "/Documentation/" since GitBlit's "/" screen is very similar to its "/activity/" screen, but
// decided finally to provide an explicit documentation submenu instead.
MenuItem documentation = new MenuItem(cfg.getString("documentation", "Documentation"), gitBlitBaseUrl + "Documentation/", "");
restrictedMenuEntries = new MenuEntry(GITBLIT_TOPMENU_NAME, Arrays.asList(repositories, documentation));
List<MenuItem> fullMenuItems = Lists.newArrayList();
fullMenuItems.add(repositories);
fullMenuItems.add(new MenuItem(cfg.getString("activity", "Activity"), gitBlitBaseUrl + "activity/", ""));
String search = cfg.getString("search");
if (search != null && !search.isEmpty()) {
fullMenuItems.add(new MenuItem(search, gitBlitBaseUrl + "lucene/", ""));
}
fullMenuItems.add(documentation);
fullMenuEntries = new MenuEntry(GITBLIT_TOPMENU_NAME, fullMenuItems);
// Actually, I'd like to give the project "browse" link only if the user has the right to see the contents of the repository. But how would
// I know in getEntries() below which is the "current" project? Since I don't know how to do that, we show that link always, based on the
// assumption that if a user can see a project at all, he can also see its contents. If not, gitblit will tell him so...
extraProjectEntries = new MenuEntry(GerritTopMenu.PROJECTS, Arrays.asList(new MenuItem(cfg.getString("browse", "Browse"), gitBlitBaseUrl
+ "summary/?r=${projectName}", "")));
}
示例3: MenuEntry
import com.google.gerrit.extensions.client.GerritTopMenu; //导入依赖的package包/类
public MenuEntry(GerritTopMenu gerritMenu, List<MenuItem> items) {
this(gerritMenu.menuName, items);
}