@Test public void testPluginDeleted() { NavTree testTree = TEST_NAV_TREE.cloneTree(); assertThat(testTree.getItemById(PERSPECTIVE_ID)).isNotNull(); when(navigationManager.getNavTree()).thenReturn(testTree); testedPluginManager.onPlugInDeleted(pluginDeletedEvent); assertThat(testTree.getItemById(PERSPECTIVE_ID)).isNull(); verify(navigationManager).saveNavTree(anyObject(), eq(null)); verify(perspectiveChangedEvent).fire(anyObject()); }
public void onPlugInDeleted(@Observes final PluginDeleted event) { String pluginName = event.getPluginName(); pluginMap.remove(pluginName); NavWorkbenchCtx ctx = NavWorkbenchCtx.perspective(pluginName); NavTree navTree = navigationManager.getNavTree(); List<NavItem> itemsToDelete = navTree.searchItems(ctx); for (NavItem item : itemsToDelete) { navTree.deleteItem(item.getId()); } if (!itemsToDelete.isEmpty()) { navigationManager.saveNavTree(navTree, null); } perspectivesChangedEvent.fire(new PerspectivePluginsChangedEvent()); }
PerspectivePluginManager { public void onPlugInDeleted(@Observes final PluginDeleted event) { String pluginName = event.getPluginName(); pluginMap.remove(pluginName); NavWorkbenchCtx ctx = NavWorkbenchCtx.perspective(pluginName); NavTree navTree = navigationManager.getNavTree(); List<NavItem> itemsToDelete = navTree.searchItems(ctx); for (NavItem item : itemsToDelete) { navTree.deleteItem(item.getId()); } if (!itemsToDelete.isEmpty()) { navigationManager.saveNavTree(navTree, null); } perspectivesChangedEvent.fire(new PerspectivePluginsChangedEvent()); } }
PerspectivePluginManager { public void onPlugInDeleted(@Observes final PluginDeleted event) { String pluginName = event.getPluginName(); pluginMap.remove(pluginName); NavWorkbenchCtx ctx = NavWorkbenchCtx.perspective(pluginName); NavTree navTree = navigationManager.getNavTree(); List<NavItem> itemsToDelete = navTree.searchItems(ctx); for (NavItem item : itemsToDelete) { navTree.deleteItem(item.getId()); } if (!itemsToDelete.isEmpty()) { navigationManager.saveNavTree(navTree, null); } perspectivesChangedEvent.fire(new PerspectivePluginsChangedEvent()); } @Inject  PerspectivePluginManager(ClientTypeRegistry clientTypeRegistry,
                                    LayoutGenerator layoutGenerator,
                                    NavigationManager navigationManager,
                                    Caller<PerspectivePluginServices> pluginServices,
                                    Event<PerspectivePluginsChangedEvent> perspectivesChangedEvent); }
PerspectivePluginManager { public void onPlugInDeleted(@Observes final PluginDeleted event) { String pluginName = event.getPluginName(); pluginMap.remove(pluginName); NavWorkbenchCtx ctx = NavWorkbenchCtx.perspective(pluginName); NavTree navTree = navigationManager.getNavTree(); List<NavItem> itemsToDelete = navTree.searchItems(ctx); for (NavItem item : itemsToDelete) { navTree.deleteItem(item.getId()); } if (!itemsToDelete.isEmpty()) { navigationManager.saveNavTree(navTree, null); } perspectivesChangedEvent.fire(new PerspectivePluginsChangedEvent()); } @Inject  PerspectivePluginManager(ClientTypeRegistry clientTypeRegistry,
                                    LayoutGenerator layoutGenerator,
                                    NavigationManager navigationManager,
                                    Caller<PerspectivePluginServices> pluginServices,
                                    Event<PerspectivePluginsChangedEvent> perspectivesChangedEvent); void getPerspectivePlugins(ParameterizedCommand<Collection<Plugin>> callback); boolean isRuntimePerspective(Plugin plugin); boolean isRuntimePerspective(NavItem navItem); boolean isRuntimePerspective(String perspectiveId); String getRuntimePerspectiveId(NavItem navItem); boolean existsPerspectivePlugin(String perspectiveName); void buildPerspectiveWidget(String perspectiveName, ParameterizedCommand<IsWidget> afterBuild, ParameterizedCommand<LayoutRecursionIssue> onInfiniteRecursion); void getLayoutTemplateInfo(String perspectiveName, ParameterizedCommand<LayoutTemplateInfo> callback); void getLayoutTemplateInfo(LayoutTemplate layoutTemplate, ParameterizedCommand<LayoutTemplateInfo> callback); void buildPerspectiveWidget(String perspectiveName, LayoutTemplateContext layoutCtx, ParameterizedCommand<IsWidget> afterBuild, ParameterizedCommand<LayoutRecursionIssue> onInfiniteRecursion); NavGroup getLastBuildPerspectiveNavGroup(); void onPlugInAdded(@Observes final PluginAdded event); void onPlugInSaved(@Observes final PluginSaved event); void onPlugInRenamed(@Observes final PluginRenamed event); void onPlugInDeleted(@Observes final PluginDeleted event); }
PerspectivePluginManager { public void onPlugInDeleted(@Observes final PluginDeleted event) { String pluginName = event.getPluginName(); pluginMap.remove(pluginName); NavWorkbenchCtx ctx = NavWorkbenchCtx.perspective(pluginName); NavTree navTree = navigationManager.getNavTree(); List<NavItem> itemsToDelete = navTree.searchItems(ctx); for (NavItem item : itemsToDelete) { navTree.deleteItem(item.getId()); } if (!itemsToDelete.isEmpty()) { navigationManager.saveNavTree(navTree, null); } perspectivesChangedEvent.fire(new PerspectivePluginsChangedEvent()); } @Inject  PerspectivePluginManager(ClientTypeRegistry clientTypeRegistry,
                                    LayoutGenerator layoutGenerator,
                                    NavigationManager navigationManager,
                                    Caller<PerspectivePluginServices> pluginServices,
                                    Event<PerspectivePluginsChangedEvent> perspectivesChangedEvent); void getPerspectivePlugins(ParameterizedCommand<Collection<Plugin>> callback); boolean isRuntimePerspective(Plugin plugin); boolean isRuntimePerspective(NavItem navItem); boolean isRuntimePerspective(String perspectiveId); String getRuntimePerspectiveId(NavItem navItem); boolean existsPerspectivePlugin(String perspectiveName); void buildPerspectiveWidget(String perspectiveName, ParameterizedCommand<IsWidget> afterBuild, ParameterizedCommand<LayoutRecursionIssue> onInfiniteRecursion); void getLayoutTemplateInfo(String perspectiveName, ParameterizedCommand<LayoutTemplateInfo> callback); void getLayoutTemplateInfo(LayoutTemplate layoutTemplate, ParameterizedCommand<LayoutTemplateInfo> callback); void buildPerspectiveWidget(String perspectiveName, LayoutTemplateContext layoutCtx, ParameterizedCommand<IsWidget> afterBuild, ParameterizedCommand<LayoutRecursionIssue> onInfiniteRecursion); NavGroup getLastBuildPerspectiveNavGroup(); void onPlugInAdded(@Observes final PluginAdded event); void onPlugInSaved(@Observes final PluginSaved event); void onPlugInRenamed(@Observes final PluginRenamed event); void onPlugInDeleted(@Observes final PluginDeleted event);  }