/** * @return an instanciation of the given content-type class name, or null if class wasn't found */ public static ContentType getContentTypeFromClassName(String contentTypeClassName) { if (contentTypeClassName == null) contentTypeClassName = getAvailableContentTypes()[DEFAULT_CONTENT_TYPE_INDEX]; ContentType ct = null; try { Class clazz = Class.forName(contentTypeClassName); ct = (ContentType) clazz.newInstance(); } catch (ClassNotFoundException cnfex) { if (jpicedt.Log.DEBUG) cnfex.printStackTrace(); JPicEdt.getMDIManager() .showMessageDialog( "The pluggable content-type you asked for (class " + cnfex.getLocalizedMessage() + ") isn't currently installed, using default instead...", Localizer.currentLocalizer().get("msg.LoadingContentTypeClass"), JOptionPane.ERROR_MESSAGE); } catch (Exception ex) { if (jpicedt.Log.DEBUG) ex.printStackTrace(); JPicEdt.getMDIManager() .showMessageDialog( ex.getLocalizedMessage(), Localizer.currentLocalizer().get("msg.LoadingContentTypeClass"), JOptionPane.ERROR_MESSAGE); } return ct; }