@Test public void testPerspectiveReadAccessDenied() { when(pluginControllerM.canRead(a)).thenReturn(true); when(pluginControllerM.canRead(b)).thenReturn(true); perspectivesExplorer.show(); InOrder inOrder = inOrder(viewM); inOrder.verify(viewM).clear(); inOrder.verify(viewM).addPerspective(eq("a"), any()); inOrder.verify(viewM).addPerspective(eq("B"), any()); inOrder.verify(viewM, never()).addPerspective(eq("cEE"), any()); }
public void show() { view.clear(); view.setTitle(i18n.capitalizeFirst(i18n.getPerspectivesResourceName())); view.setNewMenuName(i18n.getContentExplorerNew()); view.setNewMenuVisible(pluginController.canCreatePerspectives()); view.setPerspectiveName(i18n.capitalizeFirst(i18n.getPerspectiveResourceName())); perspectivePluginManager.getPerspectivePlugins(perspectivePlugins -> { List<Plugin> filteredPlugins = perspectivePlugins.stream() .filter(pluginController::canRead) .sorted((p1, p2) -> p1.getName().compareToIgnoreCase(p2.getName())) .collect(Collectors.toList()); if (filteredPlugins.isEmpty()) { view.showEmpty(i18n.getNoPerspectives()); } else { filteredPlugins.forEach(p -> view.addPerspective(p.getName(), () -> onPerspectiveClick(p))); } }); this.expand(); }
PerspectivesExplorer implements IsElement { public void show() { view.clear(); view.setTitle(i18n.capitalizeFirst(i18n.getPerspectivesResourceName())); view.setNewMenuName(i18n.getContentExplorerNew()); view.setNewMenuVisible(pluginController.canCreatePerspectives()); view.setPerspectiveName(i18n.capitalizeFirst(i18n.getPerspectiveResourceName())); perspectivePluginManager.getPerspectivePlugins(perspectivePlugins -> { List<Plugin> filteredPlugins = perspectivePlugins.stream() .filter(pluginController::canRead) .sorted((p1, p2) -> p1.getName().compareToIgnoreCase(p2.getName())) .collect(Collectors.toList()); if (filteredPlugins.isEmpty()) { view.showEmpty(i18n.getNoPerspectives()); } else { filteredPlugins.forEach(p -> view.addPerspective(p.getName(), () -> onPerspectiveClick(p))); } }); this.expand(); } }
PerspectivesExplorer implements IsElement { public void show() { view.clear(); view.setTitle(i18n.capitalizeFirst(i18n.getPerspectivesResourceName())); view.setNewMenuName(i18n.getContentExplorerNew()); view.setNewMenuVisible(pluginController.canCreatePerspectives()); view.setPerspectiveName(i18n.capitalizeFirst(i18n.getPerspectiveResourceName())); perspectivePluginManager.getPerspectivePlugins(perspectivePlugins -> { List<Plugin> filteredPlugins = perspectivePlugins.stream() .filter(pluginController::canRead) .sorted((p1, p2) -> p1.getName().compareToIgnoreCase(p2.getName())) .collect(Collectors.toList()); if (filteredPlugins.isEmpty()) { view.showEmpty(i18n.getNoPerspectives()); } else { filteredPlugins.forEach(p -> view.addPerspective(p.getName(), () -> onPerspectiveClick(p))); } }); this.expand(); } @Inject  PerspectivesExplorer(View view,
                                PerspectivePluginManager perspectivePluginManager,
                                PluginController pluginController,
                                NewPluginPopUp newPluginPopUp,
                                PlaceManager placeManager,
                                ContentManagerI18n i18n); }
PerspectivesExplorer implements IsElement { public void show() { view.clear(); view.setTitle(i18n.capitalizeFirst(i18n.getPerspectivesResourceName())); view.setNewMenuName(i18n.getContentExplorerNew()); view.setNewMenuVisible(pluginController.canCreatePerspectives()); view.setPerspectiveName(i18n.capitalizeFirst(i18n.getPerspectiveResourceName())); perspectivePluginManager.getPerspectivePlugins(perspectivePlugins -> { List<Plugin> filteredPlugins = perspectivePlugins.stream() .filter(pluginController::canRead) .sorted((p1, p2) -> p1.getName().compareToIgnoreCase(p2.getName())) .collect(Collectors.toList()); if (filteredPlugins.isEmpty()) { view.showEmpty(i18n.getNoPerspectives()); } else { filteredPlugins.forEach(p -> view.addPerspective(p.getName(), () -> onPerspectiveClick(p))); } }); this.expand(); } @Inject  PerspectivesExplorer(View view,
                                PerspectivePluginManager perspectivePluginManager,
                                PluginController pluginController,
                                NewPluginPopUp newPluginPopUp,
                                PlaceManager placeManager,
                                ContentManagerI18n i18n); @Override HTMLElement getElement(); void setOnExpandCommand(Command onExpandCommand); void show(); void onPerspectiveClick(Plugin plugin); boolean isExpanded(); void expand(); void collapse(); void expandOrCollapse(); void setMaximized(boolean maximized); void createNewPerspective(); void onPerspectivePluginsChanged(@Observes final PerspectivePluginsChangedEvent event); }
PerspectivesExplorer implements IsElement { public void show() { view.clear(); view.setTitle(i18n.capitalizeFirst(i18n.getPerspectivesResourceName())); view.setNewMenuName(i18n.getContentExplorerNew()); view.setNewMenuVisible(pluginController.canCreatePerspectives()); view.setPerspectiveName(i18n.capitalizeFirst(i18n.getPerspectiveResourceName())); perspectivePluginManager.getPerspectivePlugins(perspectivePlugins -> { List<Plugin> filteredPlugins = perspectivePlugins.stream() .filter(pluginController::canRead) .sorted((p1, p2) -> p1.getName().compareToIgnoreCase(p2.getName())) .collect(Collectors.toList()); if (filteredPlugins.isEmpty()) { view.showEmpty(i18n.getNoPerspectives()); } else { filteredPlugins.forEach(p -> view.addPerspective(p.getName(), () -> onPerspectiveClick(p))); } }); this.expand(); } @Inject  PerspectivesExplorer(View view,
                                PerspectivePluginManager perspectivePluginManager,
                                PluginController pluginController,
                                NewPluginPopUp newPluginPopUp,
                                PlaceManager placeManager,
                                ContentManagerI18n i18n); @Override HTMLElement getElement(); void setOnExpandCommand(Command onExpandCommand); void show(); void onPerspectiveClick(Plugin plugin); boolean isExpanded(); void expand(); void collapse(); void expandOrCollapse(); void setMaximized(boolean maximized); void createNewPerspective(); void onPerspectivePluginsChanged(@Observes final PerspectivePluginsChangedEvent event);  }