Example usage for com.google.gwt.inject.client.multibindings GinMapBinder addBinding

List of usage examples for com.google.gwt.inject.client.multibindings GinMapBinder addBinding

Introduction

In this page you can find the example usage for com.google.gwt.inject.client.multibindings GinMapBinder addBinding.

Prototype

public GinLinkedBindingBuilder<V> addBinding(
        TypeLiteral<? extends javax.inject.Provider<? extends K>> keyProvider) 

Source Link

Document

Returns a binding builder used to add a new entry in the map using a key provider.

Usage

From source file:org.eclipse.che.ide.command.CommandApiModule.java

License:Open Source License

@Override
protected void configure() {
    bind(CommandTypeRegistry.class).to(CommandTypeRegistryImpl.class).in(Singleton.class);

    install(new GinFactoryModuleBuilder().build(CommandProducerActionFactory.class));

    GinMapBinder<String, Component> componentsBinder = GinMapBinder.newMapBinder(binder(), String.class,
            Component.class);
    componentsBinder.addBinding("CommandProducerActionManager").to(CommandProducerActionManager.class);
}

From source file:org.eclipse.che.ide.core.CoreGinModule.java

License:Open Source License

@Override
protected void configure() {
    GinMapBinder<String, Perspective> mapBinder = GinMapBinder.newMapBinder(binder(), String.class,
            Perspective.class);
    mapBinder.addBinding(PROJECT_PERSPECTIVE_ID).to(ProjectPerspective.class);

    GinMapBinder.newMapBinder(binder(), String.class, FqnProvider.class);

    install(new GinFactoryModuleBuilder()
            .implement(WorkBenchPartController.class, WorkBenchPartControllerImpl.class)
            .build(WorkBenchControllerFactory.class));
    // generic bindings
    bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
    bind(Resources.class).in(Singleton.class);
    bind(String.class).annotatedWith(RestContext.class).toProvider(RestContextProvider.class)
            .in(Singleton.class);
    bind(ExtensionRegistry.class).in(Singleton.class);
    bind(StandardComponentInitializer.class).in(Singleton.class);
    bind(ClipboardButtonBuilder.class).to(ClipboardButtonBuilderImpl.class);
    bind(AppContext.class).to(AppContextImpl.class);

    install(new GinFactoryModuleBuilder().build(LoaderFactory.class));
    install(new GinFactoryModuleBuilder().implement(PartStackView.class, PartStackViewImpl.class)
            .build(PartStackViewFactory.class));
    install(new GinFactoryModuleBuilder().implement(PartStack.class, PartStackPresenter.class)
            .build(PartStackPresenterFactory.class));

    bind(PreferencesManager.class).to(PreferencesManagerImpl.class);
    GinMultibinder.newSetBinder(binder(), PreferencesManager.class).addBinding()
            .to(PreferencesManagerImpl.class);

    bind(NotificationManager.class).to(NotificationManagerImpl.class).in(Singleton.class);
    bind(ThemeAgent.class).to(ThemeAgentImpl.class).in(Singleton.class);
    bind(FileTypeRegistry.class).to(FileTypeRegistryImpl.class).in(Singleton.class);

    GinMultibinder.newSetBinder(binder(), OAuth2Authenticator.class).addBinding()
            .to(DefaultOAuthAuthenticatorImpl.class);

    configureComponents();/* w  w w  .  ja v  a2s.c  om*/
    configureProjectWizard();
    configureImportWizard();
    configurePlatformApiGwtClients();
    configureApiBinding();
    configureCoreUI();
    configureEditorAPI();
    configureProjectTree();

    GinMultibinder<PersistenceComponent> persistenceComponentsMultibinder = GinMultibinder
            .newSetBinder(binder(), PersistenceComponent.class);
    persistenceComponentsMultibinder.addBinding().to(ShowHiddenFilesPersistenceComponent.class);
    persistenceComponentsMultibinder.addBinding().to(OpenedFilesPersistenceComponent.class);

    install(new GinFactoryModuleBuilder().implement(RecipeWidget.class, RecipeWidgetImpl.class)
            .implement(WorkspaceWidget.class, WorkspaceWidgetImpl.class).build(WorkspaceWidgetFactory.class));
    bind(StartUpActionsProcessor.class).in(Singleton.class);
}

From source file:org.eclipse.che.ide.core.CoreGinModule.java

License:Open Source License

private void configureComponents() {
    GinMapBinder<String, Component> componentsBinder = GinMapBinder.newMapBinder(binder(), String.class,
            Component.class);
    componentsBinder.addBinding("Default Icons").to(DefaultIconsComponent.class);
    componentsBinder.addBinding("Font Awesome Icons").to(FontAwesomeInjector.class);
    componentsBinder.addBinding("ZeroClipboard").to(ZeroClipboardInjector.class);
    componentsBinder.addBinding("Preferences").to(PreferencesComponent.class);
    componentsBinder.addBinding("Profile").to(ProfileComponent.class);
    componentsBinder.addBinding("Project templates").to(ProjectTemplatesComponent.class);
    componentsBinder.addBinding("Workspace").toProvider(WorkspaceComponentProvider.class);
    componentsBinder.addBinding("Standard components").to(StandardComponent.class);

    GinMapBinder<String, WsAgentComponent> wsAgentComponentsBinder = GinMapBinder.newMapBinder(binder(),
            String.class, WsAgentComponent.class);
    wsAgentComponentsBinder.addBinding("Project types").to(ProjectTypeComponent.class);
    wsAgentComponentsBinder.addBinding("Start-up actions processor").to(StartUpActionsProcessor.class);
}

From source file:org.eclipse.che.ide.core.inject.CoreGinModule.java

License:Open Source License

/** {@inheritDoc} */
@Override//  w ww  .j  a  v a 2  s  .com
protected void configure() {
    // generic bindings
    bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
    bind(AsyncRequestLoader.class).to(IdeLoader.class).in(Singleton.class);
    bind(Resources.class).in(Singleton.class);
    bind(String.class).annotatedWith(RestContext.class).toProvider(RestContextProvider.class)
            .in(Singleton.class);
    bind(String.class).annotatedWith(WebSocketUrl.class).toProvider(WebSocketUrlProvider.class)
            .in(Singleton.class);
    bind(ExtensionRegistry.class).in(Singleton.class);
    bind(StandardComponentInitializer.class).in(Singleton.class);
    bind(BuildContext.class).to(BuildContextImpl.class).in(Singleton.class);
    bind(ClipboardButtonBuilder.class).to(ClipboardButtonBuilderImpl.class);

    install(new GinFactoryModuleBuilder().implement(PartStackView.class, PartStackViewImpl.class)
            .build(PartStackViewFactory.class));
    install(new GinFactoryModuleBuilder().implement(PartStack.class, PartStackPresenter.class)
            .build(PartStackPresenterFactory.class));

    bind(PreferencesManager.class).to(PreferencesManagerImpl.class).in(Singleton.class);
    bind(NotificationManager.class).to(NotificationManagerImpl.class).in(Singleton.class);
    bind(ThemeAgent.class).to(ThemeAgentImpl.class).in(Singleton.class);
    bind(MessageBus.class).to(MessageBusImpl.class).in(Singleton.class);
    bind(FileTypeRegistry.class).to(FileTypeRegistryImpl.class).in(Singleton.class);

    bind(AnalyticsEventLogger.class).to(AnalyticsEventLoggerImpl.class).in(Singleton.class);
    bind(AnalyticsEventLoggerExt.class).to(AnalyticsEventLoggerImpl.class).in(Singleton.class);

    configureComponents();
    configureProjectWizard();
    configureImportWizard();
    configurePlatformApiGwtClients();
    configureApiBinding();
    configureCoreUI();
    configureEditorAPI();
    configureProjectTree();

    GinMultibinder<PersistenceComponent> componentMultibinder = GinMultibinder.newSetBinder(binder(),
            PersistenceComponent.class);
    componentMultibinder.addBinding().to(ShowHiddenFilesPersistenceComponent.class);
    componentMultibinder.addBinding().to(OpenedFilesPersistenceComponent.class);
    componentMultibinder.addBinding().to(ActiveFilePersistenceComponent.class);
    componentMultibinder.addBinding().to(OpenedNodesPersistenceComponent.class);
    componentMultibinder.addBinding().to(ActiveNodePersistentComponent.class);

    GinMapBinder<String, PersistenceComponent> projectTreeComponentBinder = GinMapBinder.newMapBinder(binder(),
            String.class, PersistenceComponent.class);
    projectTreeComponentBinder.addBinding("openedNodes").to(OpenedNodesPersistenceComponent.class);
    projectTreeComponentBinder.addBinding("activeNode").to(ActiveNodePersistentComponent.class);
    projectTreeComponentBinder.addBinding("showHiddenFiles").to(ShowHiddenFilesPersistenceComponent.class);
}

From source file:org.eclipse.che.ide.core.inject.CoreGinModule.java

License:Open Source License

private void configureComponents() {
    GinMapBinder<String, Component> mapBinder = GinMapBinder.newMapBinder(binder(), String.class,
            Component.class);
    mapBinder.addBinding("Default Icons").to(DefaultIconsComponent.class);
    mapBinder.addBinding("ZeroClipboard").to(ZeroClipboardInjector.class);
    mapBinder.addBinding("Preferences").to(PreferencesComponent.class);
    mapBinder.addBinding("Workspace").to(WorkspaceComponent.class);
    mapBinder.addBinding("Profile").to(ProfileComponent.class);
    mapBinder.addBinding("Project Types").to(ProjectTypeComponent.class);
    mapBinder.addBinding("Project Templates").to(ProjectTemplatesComponent.class);
    mapBinder.addBinding("Factory").to(FactoryComponent.class);
    mapBinder.addBinding("Project State Handler").to(ProjectStateHandler.class);
    mapBinder.addBinding("Standard components").to(StandartComponent.class);
}

From source file:org.eclipse.che.ide.core.UiModule.java

License:Open Source License

@Override
protected void configure() {
    bind(IconRegistry.class).to(IconRegistryImpl.class).in(Singleton.class);

    GinMapBinder<String, Component> componentsBinder = GinMapBinder.newMapBinder(binder(), String.class,
            Component.class);
    componentsBinder.addBinding("DefaultIconsComponent").to(DefaultIconsComponent.class);
    componentsBinder.addBinding("FontAwesomeInjector").to(FontAwesomeInjector.class);

    // core UI components
    install(new GinFactoryModuleBuilder()
            .implement(WorkBenchPartController.class, WorkBenchPartControllerImpl.class)
            .build(WorkBenchControllerFactory.class));

    bind(WorkspaceView.class).to(WorkspaceViewImpl.class).in(Singleton.class);
    bind(MainMenuView.class).to(MainMenuViewImpl.class).in(Singleton.class);
    bind(ToolbarView.class).to(ToolbarViewImpl.class);
    bind(ToolbarPresenter.class).annotatedWith(MainToolbar.class).to(ToolbarPresenter.class)
            .in(Singleton.class);

    // dialog factory
    bind(MessageDialogFooter.class);
    bind(MessageDialogView.class).to(MessageDialogViewImpl.class);
    bind(ConfirmDialogFooter.class);
    bind(ConfirmDialogView.class).to(ConfirmDialogViewImpl.class);
    bind(ChoiceDialogFooter.class);
    bind(ChoiceDialogView.class).to(ChoiceDialogViewImpl.class);
    bind(InputDialogFooter.class);
    bind(InputDialogView.class).to(InputDialogViewImpl.class);

    install(new GinFactoryModuleBuilder().implement(MessageDialog.class, MessageDialogPresenter.class)
            .implement(ConfirmDialog.class, ConfirmDialogPresenter.class)
            .implement(ChoiceDialog.class, ChoiceDialogPresenter.class)
            .implement(InputDialog.class, InputDialogPresenter.class).build(DialogFactory.class));

    // drop down list widget
    install(new GinFactoryModuleBuilder().implement(DropDownWidget.class, DropDownWidgetImpl.class)
            .build(DropDownListFactory.class));

    // multi-split panel
    install(new GinFactoryModuleBuilder().implement(SubPanel.class, SubPanelPresenter.class)
            .build(SubPanelFactory.class));
    install(new GinFactoryModuleBuilder().implement(SubPanelView.class, SubPanelViewImpl.class)
            .build(SubPanelViewFactory.class));
    install(new GinFactoryModuleBuilder().implement(Tab.class, TabWidget.class).build(TabItemFactory.class));

    // miscellaneous UI components
    install(new GinFactoryModuleBuilder().implement(ConsoleButton.class, ConsoleButtonImpl.class)
            .build(ConsoleButtonFactory.class));

    bind(StatusPanelGroupView.class).to(StatusPanelGroupViewImpl.class).in(Singleton.class);
}

From source file:org.eclipse.che.ide.ext.java.client.inject.JavaGinModule.java

License:Open Source License

/** {@inheritDoc} */
@Override//  www  .j  a  v  a 2 s  . co  m
protected void configure() {
    GinMapBinder<String, ProposalAction> proposalActionMapBinder = GinMapBinder.newMapBinder(binder(),
            String.class, ProposalAction.class);
    proposalActionMapBinder.addBinding(JAVA_ORGANIZE_IMPORT_ID).to(OrganizeImportsAction.class);

    bind(NewJavaSourceFileView.class).to(NewJavaSourceFileViewImpl.class).in(Singleton.class);
    bind(QuickDocumentation.class).to(QuickDocPresenter.class).in(Singleton.class);
    bind(JavaNavigationService.class).to(JavaNavigationServiceImpl.class);
    bind(JavaClasspathServiceClient.class).to(JavaClasspathServiceClientImpl.class);
    bind(JavaSearchService.class).to(JavaSearchServiceWS.class);

    bind(JavaNodeManager.class);

    GinMapBinder<String, SettingsProvider> mapBinder = GinMapBinder.newMapBinder(binder(), String.class,
            SettingsProvider.class);
    mapBinder.addBinding("java").to(JavaNodeSettingsProvider.class);

    GinMultibinder.newSetBinder(binder(), NodeInterceptor.class).addBinding()
            .to(JavaContentRootInterceptor.class);
    GinMultibinder.newSetBinder(binder(), NodeInterceptor.class).addBinding().to(JavaClassInterceptor.class);
    GinMultibinder.newSetBinder(binder(), NodeInterceptor.class).addBinding()
            .to(TestContentRootDecorator.class);

    GinMultibinder.newSetBinder(binder(), CommandType.class).addBinding().to(JavaCommandType.class);

    GinMapBinder<String, FqnProvider> fqnProviders = GinMapBinder.newMapBinder(binder(), String.class,
            FqnProvider.class);
    fqnProviders.addBinding("maven").to(JavaFqnProvider.class);

    install(new GinFactoryModuleBuilder().build(JavaNodeFactory.class));
    install(new GinFactoryModuleBuilder().implement(PropertyWidget.class, PropertyWidgetImpl.class)
            .build(PropertyWidgetFactory.class));

    install(new GinFactoryModuleBuilder().build(NodeFactory.class));
    install(new GinFactoryModuleBuilder()
            .build(org.eclipse.che.ide.ext.java.client.navigation.factory.NodeFactory.class));

    GinMultibinder<PreferencePagePresenter> settingsBinder = GinMultibinder.newSetBinder(binder(),
            PreferencePagePresenter.class);
    settingsBinder.addBinding().to(JavaCompilerPreferencePresenter.class);

    bind(PreferencesManager.class).annotatedWith(JavaCompilerPreferenceManager.class)
            .to(ErrorsWarningsPreferenceManager.class);
    GinMultibinder.newSetBinder(binder(), PreferencesManager.class).addBinding()
            .to(ErrorsWarningsPreferenceManager.class);

    GinMultibinder.newSetBinder(binder(), CommandPropertyValueProvider.class).addBinding()
            .to(ClasspathProvider.class);
    GinMultibinder.newSetBinder(binder(), CommandPropertyValueProvider.class).addBinding()
            .to(OutputDirProvider.class);
    GinMultibinder.newSetBinder(binder(), CommandPropertyValueProvider.class).addBinding()
            .to(MainClassProvider.class);
    GinMultibinder.newSetBinder(binder(), CommandPropertyValueProvider.class).addBinding()
            .to(SourcepathProvider.class);
    GinMultibinder.newSetBinder(binder(), CommandPropertyValueProvider.class).addBinding()
            .to(CurrentClassFQNProvider.class);
    GinMultibinder.newSetBinder(binder(), ClasspathPagePresenter.class).addBinding()
            .to(LibEntryPresenter.class);
    GinMultibinder.newSetBinder(binder(), ClasspathPagePresenter.class).addBinding()
            .to(SourceEntryPresenter.class);
}

From source file:org.eclipse.che.ide.extension.machine.client.inject.MachineGinModule.java

License:Open Source License

/** {@inheritDoc} */
@Override/*  w  ww.  jav  a  2s  .c  om*/
protected void configure() {
    GinMapBinder<String, Perspective> perspectiveBinder = GinMapBinder.newMapBinder(binder(), String.class,
            Perspective.class);
    perspectiveBinder.addBinding(OPERATIONS_PERSPECTIVE_ID).to(OperationsPerspective.class);

    bind(ToolbarPresenter.class).annotatedWith(MachineConsoleToolbar.class).to(ToolbarPresenter.class)
            .in(Singleton.class);
    bind(MachineConsoleView.class).to(MachineConsoleViewImpl.class).in(Singleton.class);

    bind(CreateMachineView.class).to(CreateMachineViewImpl.class);
    bind(OutputConsoleView.class).to(OutputConsoleViewImpl.class);
    install(new GinFactoryModuleBuilder()
            .implement(CommandOutputConsole.class, Names.named("command"), CommandOutputConsolePresenter.class)
            .implement(OutputConsole.class, Names.named("default"), DefaultOutputConsole.class)
            .build(CommandConsoleFactory.class));

    bind(OutputsContainerView.class).to(OutputsContainerViewImpl.class).in(Singleton.class);
    bind(ConsolesPanelView.class).to(ConsolesPanelViewImpl.class).in(Singleton.class);

    bind(EditCommandsView.class).to(EditCommandsViewImpl.class).in(Singleton.class);

    bind(TargetsView.class).to(TargetsViewImpl.class).in(Singleton.class);

    GinMultibinder.newSetBinder(binder(), CommandType.class).addBinding().to(CustomCommandType.class);

    bind(CommandPropertyValueProviderRegistry.class).to(CommandPropertyValueProviderRegistryImpl.class)
            .in(Singleton.class);

    final GinMultibinder<CommandPropertyValueProvider> valueProviderBinder = GinMultibinder
            .newSetBinder(binder(), CommandPropertyValueProvider.class);
    valueProviderBinder.addBinding().to(DevMachineHostNameProvider.class);
    valueProviderBinder.addBinding().to(CurrentProjectPathProvider.class);
    valueProviderBinder.addBinding().to(CurrentProjectRelativePathProvider.class);

    install(new GinFactoryModuleBuilder().implement(TabHeader.class, TabHeaderImpl.class)
            .implement(EditorButtonWidget.class, EditorButtonWidgetImpl.class).build(WidgetsFactory.class));
    install(new GinFactoryModuleBuilder().implement(Tab.class, TabImpl.class).build(EntityFactory.class));
    install(new GinFactoryModuleBuilder().build(TerminalFactory.class));

    bind(MachineManager.class).to(MachineManagerImpl.class).in(Singleton.class);

    bindConstant().annotatedWith(Names.named("machine.extension.api_port")).to(Constants.WS_AGENT_PORT);

    bind(SshView.class).to(SshViewImpl.class);
    bind(DockerView.class).to(DockerViewImpl.class);
    bind(DevelopmentView.class).to(DevelopmentViewImpl.class);

    bind(Target.class).to(BaseTarget.class);

    final GinMultibinder<CategoryPage> categoryPageBinder = GinMultibinder.newSetBinder(binder(),
            CategoryPage.class);
    categoryPageBinder.addBinding().to(SshCategoryPresenter.class);
    categoryPageBinder.addBinding().to(DockerCategoryPresenter.class);
    categoryPageBinder.addBinding().to(DevelopmentCategoryPresenter.class);
}

From source file:org.eclipse.che.ide.preferences.PreferencesApiModule.java

License:Open Source License

@Override
protected void configure() {
    bind(PreferencesServiceClient.class).to(PreferencesServiceClientImpl.class).in(Singleton.class);

    bind(PreferencesManager.class).to(PreferencesManagerImpl.class).in(Singleton.class);
    GinMultibinder.newSetBinder(binder(), PreferencesManager.class).addBinding()
            .to(PreferencesManagerImpl.class);

    bind(PreferencesView.class).to(PreferencesViewImpl.class).in(Singleton.class);

    GinMultibinder<PreferencePagePresenter> pagesBinder = GinMultibinder.newSetBinder(binder(),
            PreferencePagePresenter.class);
    pagesBinder.addBinding().to(AppearancePresenter.class);
    pagesBinder.addBinding().to(ExtensionManagerPresenter.class);

    bind(AppearanceView.class).to(AppearanceViewImpl.class).in(Singleton.class);
    bind(ExtensionManagerView.class).to(ExtensionManagerViewImpl.class).in(Singleton.class);

    GinMapBinder<String, Component> componentsBinder = GinMapBinder.newMapBinder(binder(), String.class,
            Component.class);
    componentsBinder.addBinding("PreferencesComponent").to(PreferencesComponent.class);
}

From source file:org.eclipse.che.ide.resources.ResourceApiModule.java

License:Open Source License

@Override
protected void configure() {
    install(new GinFactoryModuleBuilder().build(ResourceManager.ResourceFactory.class));
    install(new GinFactoryModuleBuilder().build(ResourceManager.ResourceManagerFactory.class));
    install(new GinFactoryModuleBuilder().build(ResourceNode.NodeFactory.class));

    GinMultibinder.newSetBinder(binder(), ResourceInterceptor.class).addBinding()
            .to(ResourceInterceptor.NoOpInterceptor.class);

    GinMultibinder<NodeInterceptor> nodeInterceptors = GinMultibinder.newSetBinder(binder(),
            NodeInterceptor.class);
    nodeInterceptors.addBinding().to(DefaultNodeInterceptor.class);

    bind(SettingsProvider.class).to(DummySettingsProvider.class).in(Singleton.class);

    GinMultibinder<NodeIconProvider> themeBinder = GinMultibinder.newSetBinder(binder(),
            NodeIconProvider.class);
    themeBinder.addBinding().to(FileIconProvider.class);
    themeBinder.addBinding().to(DockerfileIconProvider.class);

    bind(TreeResourceRevealer.class);

    bind(ClipboardManager.class).to(ClipboardManagerImpl.class);

    bind(ResourceManagerInitializer.class).to(AppContextImpl.class).in(Singleton.class);
    GinMapBinder<String, WsAgentComponent> mapBinder = GinMapBinder.newMapBinder(binder(), String.class,
            WsAgentComponent.class);
    mapBinder.addBinding("Resource Manager").to(ResourceManagerComponent.class);
}