/** * Filters the matching editors for the given resource type from the list of all available editors.<p> * * @param resourceType the resource type to filter * @return a map of filtered editor configurations sorted asceding by the ranking for the current resource type, with the (Float) ranking as key */ private SortedMap<Float, CmsWorkplaceEditorConfiguration> filterEditorsForResourceType(String resourceType) { SortedMap<Float, CmsWorkplaceEditorConfiguration> filteredEditors = new TreeMap<Float, CmsWorkplaceEditorConfiguration>(); Iterator<CmsWorkplaceEditorConfiguration> i = m_editorConfigurations.iterator(); while (i.hasNext()) { CmsWorkplaceEditorConfiguration currentConfig = i.next(); if (currentConfig.matchesResourceType(resourceType)) { float key = currentConfig.getRankingForResourceType(resourceType); if (key >= 0) { filteredEditors.put(new Float(key), currentConfig); } } } return filteredEditors; }
/** * Filters the matching editors for the given resource type from the list of all available editors.<p> * * @param resourceType the resource type to filter * @return a map of filtered editor configurations sorted asceding by the ranking for the current resource type, with the (Float) ranking as key */ private SortedMap filterEditorsForResourceType(String resourceType) { SortedMap filteredEditors = new TreeMap(); Iterator i = m_editorConfigurations.iterator(); while (i.hasNext()) { CmsWorkplaceEditorConfiguration currentConfig = (CmsWorkplaceEditorConfiguration)i.next(); if (currentConfig.matchesResourceType(resourceType)) { float key = currentConfig.getRankingForResourceType(resourceType); if (key >= 0) { filteredEditors.put(new Float(key), currentConfig); } } } return filteredEditors; }
/** * Checks if there is an editor which can process the given resource.<p> * * @param res the resource * * @return true if the given resource can be edited with one of the configured editors */ public boolean isEditorAvailableForResource(CmsResource res) { I_CmsResourceType type = OpenCms.getResourceManager().getResourceType(res); String typeName = type.getTypeName(); for (CmsWorkplaceEditorConfiguration editorConfig : m_editorConfigurations) { if (editorConfig.matchesResourceType(typeName)) { return true; } } return false; }