Search in sources :

Example 1 with JavaScriptPlugin

use of com.google.gerrit.extensions.webui.JavaScriptPlugin in project gerrit by GerritCodeReview.

the class AutoRegisterModules method makeSystemModule.

private Module makeSystemModule() {
    return new AbstractModule() {

        @Override
        protected void configure() {
            for (Class<?> clazz : sysSingletons) {
                bind(clazz).in(Scopes.SINGLETON);
            }
            for (Map.Entry<TypeLiteral<?>, Class<?>> e : sysListen.entries()) {
                @SuppressWarnings("unchecked") TypeLiteral<Object> type = (TypeLiteral<Object>) e.getKey();
                @SuppressWarnings("unchecked") Class<Object> impl = (Class<Object>) e.getValue();
                Annotation n = calculateBindAnnotation(impl);
                bind(type).annotatedWith(n).to(impl);
            }
            if (initJs != null) {
                DynamicSet.bind(binder(), WebUiPlugin.class).toInstance(new JavaScriptPlugin(initJs));
            }
        }
    };
}
Also used : JavaScriptPlugin(com.google.gerrit.extensions.webui.JavaScriptPlugin) AutoRegisterUtil.calculateBindAnnotation(com.google.gerrit.server.plugins.AutoRegisterUtil.calculateBindAnnotation) Annotation(java.lang.annotation.Annotation) AbstractModule(com.google.inject.AbstractModule) TypeLiteral(com.google.inject.TypeLiteral) WebUiPlugin(com.google.gerrit.extensions.webui.WebUiPlugin) Map(java.util.Map)

Aggregations

JavaScriptPlugin (com.google.gerrit.extensions.webui.JavaScriptPlugin)1 WebUiPlugin (com.google.gerrit.extensions.webui.WebUiPlugin)1 AutoRegisterUtil.calculateBindAnnotation (com.google.gerrit.server.plugins.AutoRegisterUtil.calculateBindAnnotation)1 AbstractModule (com.google.inject.AbstractModule)1 TypeLiteral (com.google.inject.TypeLiteral)1 Annotation (java.lang.annotation.Annotation)1 Map (java.util.Map)1