public List<String> getWidgetsWithCustomConfigView(String widgetType) { List<String> folderList = new ArrayList<String>(); WidgetType type = WidgetType.fromString(widgetType); if (type != null) { @SuppressWarnings("unchecked") Enumeration<URL> entries = LabsWebAppActivator.getDefault() .getBundle() .findEntries("/skin/views/HtmlWidget", widgetType + "-*-config.ftl", false); while (entries.hasMoreElements()) { URL url = entries.nextElement(); String[] nodes = url.getPath().split("/"); if (nodes.length > 1) { String lastname = nodes[nodes.length - 1]; lastname = lastname.substring(0, lastname.indexOf("-config.ftl")); lastname = lastname.substring((widgetType + "-").length()); folderList.add(lastname); } } } else { LOG.error("Unknown widget type '" + widgetType + "'"); } return folderList; }
public List<String> getDeclaredHtmlWidgets(String docType) { @SuppressWarnings("unchecked") Enumeration<URL> entries = LabsWebAppActivator.getDefault() .getBundle() .findEntries(LabsSiteWebAppUtils.DIRECTORY_WIDGETS, null, false); List<String> availableWidgets = getAvailableNameWidget(docType); List<String> folderList = new ArrayList<String>(); while (entries.hasMoreElements()) { URL url = entries.nextElement(); String[] nodes = url.getPath().split("/"); if (nodes.length > 1) { String lastname = nodes[nodes.length - 1]; lastname = lastname.substring(0, lastname.indexOf(".ftl")); if (availableWidgets.contains(lastname)) { folderList.add(lastname); } } } return folderList; }