|
38 | 38 | import java.awt.event.MouseEvent; |
39 | 39 | import java.awt.event.MouseListener; |
40 | 40 | import java.util.*; |
| 41 | +import java.util.concurrent.ConcurrentHashMap; |
41 | 42 | import java.util.stream.Collectors; |
42 | 43 |
|
43 | 44 | import static com.intellij.ui.AnimatedIcon.ANIMATION_IN_RENDERER_ALLOWED; |
44 | 45 |
|
45 | 46 | @Slf4j |
46 | 47 | public final class AzureFacetTreeStructureProvider implements TreeStructureProvider { |
47 | 48 | private final Project myProject; |
48 | | - private AzureFacetRootNode azureNode; |
| 49 | + private final Map<Module, AzureFacetRootNode> azureNodes = new ConcurrentHashMap<>(); |
49 | 50 |
|
50 | 51 | public AzureFacetTreeStructureProvider(Project project) { |
51 | 52 | myProject = project; |
@@ -76,9 +77,12 @@ public Collection<AbstractTreeNode<?>> modify(@Nonnull AbstractTreeNode<?> paren |
76 | 77 | .findAny().orElse(null); |
77 | 78 | final List<AbstractTreeNode<?>> nodes = new LinkedList<>(children); |
78 | 79 | nodes.removeIf(n -> Objects.equals(n, dotAzureDir)); |
79 | | - this.azureNode = Optional.ofNullable(this.azureNode).orElseGet(() -> new AzureFacetRootNode(azureModule, settings)); |
80 | | - Disposer.register(ProjectView.getInstance(this.myProject).getCurrentProjectViewPane(), this.azureNode); |
81 | | - nodes.add(this.azureNode); |
| 80 | + final AzureFacetRootNode azureNode = this.azureNodes.computeIfAbsent(azureModule.getModule(), m -> { |
| 81 | + final AzureFacetRootNode node = new AzureFacetRootNode(azureModule, settings); |
| 82 | + Disposer.register(ProjectView.getInstance(this.myProject).getCurrentProjectViewPane(), node); |
| 83 | + return node; |
| 84 | + }); |
| 85 | + nodes.add(azureNode); |
82 | 86 | return nodes; |
83 | 87 | } else { |
84 | 88 | children.removeIf(c -> c instanceof AzureFacetRootNode); |
|
0 commit comments