static private void init() { try { fBuiltInDictionaryPath = "jar:" + DictionaryManager.class.getClassLoader() .getResource("org.cfeclipse.cfml/dictionary/dictionaryconfig.xml").getFile() .replace("dictionaryconfig.xml", ""); } catch (Exception e) { fBuiltInDictionaryPath = "jar:file:" + DictionaryManager.class.getResource("/dictionaries.zip").getFile() + "!/org.cfeclipse.cfml/dictionary/"; } DICTIONARY_DIR = fPrefs.getDictionaryDir(); CF_DICTIONARY = fPrefs.getCFDictionary(); }
public CFMLParser(String dictionariesPath, String dictionary) { fDictPrefs.setDictionaryDir(dictionariesPath); fDictPrefs.setCFDictionary(dictionary); DictionaryManager.initDictionaries(fDictPrefs); cfdic = DictionaryManager.getDictionaryByVersion(dictionary); if (cfdic == null) { throw new IllegalArgumentException("The syntax dictionary could not be loaded!"); } }
public static void register(ParserPreferences prefs) { if (registered) return; DictionaryPreferences dictPrefs = new DictionaryPreferences(); dictPrefs.setDictionaryDir(prefs.getDictionaryDir()); dictPrefs.setCFDictionary(prefs.getCFDictionary()); DictionaryManager.initDictionaries(dictPrefs); SyntaxDictionary cfdic = DictionaryManager.getDictionary("CF_DICTIONARY"); Set<Tag> cfTags = cfdic.getAllTags(); CFMLStartTag cftag; for (Tag tag : cfTags) { if (!tag.getName().equals("cfif") && tag.getName().equals("cfcomment")) { if (tag.isSingle()) { cftag = new CFMLStartTag(tag.getHelp(), "<" + tag.getName(), ">", null, false, tag.hasParameters(), tag.isXMLStyle()); } else { cftag = new CFMLStartTag(tag.getHelp(), "<" + tag.getName(), ">", EndTagType.NORMAL, false, tag.hasParameters(), tag.isXMLStyle()); } cftag.register(); } } // we register these last so they override anything in the syntax dictionary for (TagType tagType : TAG_TYPES) tagType.register(); registered = true; }
try { if (fPrefs == null) { fPrefs = new DictionaryPreferences(); init(); factory.setCoalescing(true); DocumentBuilder builder = factory.newDocumentBuilder(); if (fPrefs.getDictionaryDir().length() != 0) { dictionaryConfig = builder.parse(new File(fPrefs.getDictionaryDir() + "/dictionaryconfig.xml")); } else {
public CFMLParser() { DictionaryManager.initDictionaries(); cfdic = DictionaryManager.getDictionaryByVersion(fDictPrefs.getCFDictionary()); if (cfdic == null) { throw new IllegalArgumentException("The syntax dictionary could not be loaded!"); } }
private static String getDictionaryLocation(String path) { if (fPrefs.getDictionaryDir().length() == 0) { path = DictionaryManager.class.getResource("/org.cfeclipse.cfml/dictionary/" + path).toString(); if (path == null) { path = fBuiltInDictionaryPath + path; } } else { if (path.startsWith("http")) { File dictFile = new File(fPrefs.getDictionaryDir() + path); if (!dictFile.exists()) { try { URL url = new URL(path); InputStream urlStream = url.openStream(); // write out the freaking file } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } // download the file to dictDir } else { File dictDir = new File(fPrefs.getDictionaryDir()); path = "file:" + dictDir.getAbsolutePath() + "/" + path; } } return path; }