/** * @return an array containing the class names of the currently available ContentType's [pending] * fetch from a Properties on disk ? */ public static String[] getAvailableContentTypes() { ContentTypeBasics[] v = ContentTypeBasics.values(); String[] a = new String[v.length]; int i = 0; for (ContentTypeBasics e : v) a[i++] = e.getClassName(); return a; }
/** * Utility to retrieve the index of the given content-type class name in the array returned by * <code>getAvailableContentTypes</code> ; to be used by JComboBox'es. * * @param contentTypeClassName e.g. "jpicedt.format.latex.LatexContentType" * @return DEFAULT_CONTENT_TYPE_INDEX if not found. */ public static int getContentTypeIndex(String contentTypeClassName) { ContentTypeBasics[] v = ContentTypeBasics.values(); int i = 0; for (ContentTypeBasics c : v) { if (c.getClassName().equals(contentTypeClassName)) return i; else ++i; } return DEFAULT_CONTENT_TYPE_INDEX; }