Search in sources :

Example 1 with WorkspacePathResolverProvider

use of com.google.idea.blaze.base.sync.workspace.WorkspacePathResolverProvider in project intellij by bazelbuild.

the class ProjectViewUi method setDummyWorkspacePathResolverProvider.

private void setDummyWorkspacePathResolverProvider(WorkspacePathResolver workspacePathResolver) {
    MutablePicoContainer container = (MutablePicoContainer) getProject().getPicoContainer();
    Class<WorkspacePathResolverProvider> key = WorkspacePathResolverProvider.class;
    Object oldProvider = container.getComponentInstance(key);
    container.unregisterComponent(key.getName());
    container.registerComponentInstance(key.getName(), (WorkspacePathResolverProvider) () -> workspacePathResolver);
    if (!settingsInitialized) {
        Disposer.register(parentDisposable, () -> {
            container.unregisterComponent(key.getName());
            if (oldProvider != null) {
                container.registerComponentInstance(key.getName(), oldProvider);
            }
        });
    }
}
Also used : MutablePicoContainer(org.picocontainer.MutablePicoContainer) WorkspacePathResolverProvider(com.google.idea.blaze.base.sync.workspace.WorkspacePathResolverProvider)

Aggregations

WorkspacePathResolverProvider (com.google.idea.blaze.base.sync.workspace.WorkspacePathResolverProvider)1 MutablePicoContainer (org.picocontainer.MutablePicoContainer)1