PluginsInfo { public Map<ClientResourceType, Set<Activity>> getClassifiedPlugins(final Collection<Plugin> plugins) { final Map<ClientResourceType, Set<Activity>> classified = new LinkedHashMap<ClientResourceType, Set<Activity>>(); classified.put(perspectiveLayoutPluginResourceType, new HashSet<Activity>()); classified.put(screenPluginResourceType, new HashSet<Activity>()); classified.put(editorPluginResourceType, new HashSet<Activity>()); classified.put(splashPluginResourceType, new HashSet<Activity>()); classified.put(dynamicMenuResourceType, new HashSet<Activity>()); for (final String screenId : activityBeansInfo.getAvailableWorkbenchScreensIds()) { classified.get(screenPluginResourceType).add(new Activity(screenId, PluginType.SCREEN)); } for (final String perspectiveId : activityBeansInfo.getAvailablePerspectivesIds()) { classified.get(perspectiveLayoutPluginResourceType).add(new Activity(perspectiveId, PluginType.PERSPECTIVE)); } for (final String editorId : activityBeansInfo.getAvailableWorkbenchEditorsIds()) { classified.get(editorPluginResourceType).add(new Activity(editorId, PluginType.EDITOR)); } for (final String splashId : activityBeansInfo.getAvailableSplashScreensIds()) { classified.get(splashPluginResourceType).add(new Activity(splashId, PluginType.SPLASH)); } for (final Plugin plugin : plugins) { final ClientResourceType type = clientTypeRegistry.resolve(plugin.getPath()); if (type != null) { classified.get(type).add(plugin); } } final Collection<SyncBeanDef<JSWorkbenchScreenActivity>> jsscreens = lookupBeans(JSWorkbenchScreenActivity.class); for (final SyncBeanDef<JSWorkbenchScreenActivity> beanDef : jsscreens) { classified.get(screenPluginResourceType).add(new Activity(beanDef.getName(), PluginType.SCREEN)); } final Collection<SyncBeanDef<JSWorkbenchPerspectiveActivity>> jsperspectives = lookupBeans(JSWorkbenchPerspectiveActivity.class); for (final SyncBeanDef<JSWorkbenchPerspectiveActivity> beanDef : jsperspectives) { classified.get(perspectiveLayoutPluginResourceType).add(new Activity(beanDef.getName(), PluginType.PERSPECTIVE)); } final Collection<SyncBeanDef<JSEditorActivity>> jseditors = lookupBeans(JSEditorActivity.class); for (final SyncBeanDef<JSEditorActivity> beanDef : jseditors) { classified.get(editorPluginResourceType).add(new Activity(beanDef.getName(), PluginType.EDITOR)); } final Collection<SyncBeanDef<JSSplashScreenActivity>> jssplashes = lookupBeans(JSSplashScreenActivity.class); for (final SyncBeanDef<JSSplashScreenActivity> beanDef : jssplashes) { classified.get(splashPluginResourceType).add(new Activity(beanDef.getName(), PluginType.SPLASH)); } return classified; } PluginsInfo(); @Inject  PluginsInfo(EditorPluginResourceType editorPluginResourceType,
                       PerspectiveLayoutPluginResourceType perspectiveLayoutPluginResourceType,
                       ScreenPluginResourceType screenPluginResourceType,
                       SplashPluginResourceType splashPluginResourceType,
                       DynamicMenuResourceType dynamicMenuResourceType,
                       ActivityBeansInfo activityBeansInfo,
                       ClientTypeRegistry clientTypeRegistry); Set<Activity> getAllPlugins(final Collection<Plugin> plugins); Map<ClientResourceType, Set<Activity>> getClassifiedPlugins(final Collection<Plugin> plugins); Map<ClientResourceType, String> getPluginsTypeLabels();  }
@Test public void getClassifiedPluginsTest() { final Map<ClientResourceType, Set<Activity>> classifiedPlugins = pluginsInfo.getClassifiedPlugins(getPlugins()); assertEquals(5, classifiedPlugins.keySet().size()); assertEquals(1, classifiedPlugins.get(editorPluginResourceType).size()); assertEquals(2, classifiedPlugins.get(perspectiveLayoutPluginResourceType).size()); assertEquals(3, classifiedPlugins.get(screenPluginResourceType).size()); assertEquals(4, classifiedPlugins.get(splashPluginResourceType).size()); assertEquals(5, classifiedPlugins.get(dynamicMenuResourceType).size()); }