abstrak:這一篇將怎么在spket內(nèi)置js文件,而不用用戶自己去添加。 1. 在開發(fā)的Eclipse的 運(yùn)行配置將下面幾個(gè)插件勾選上。 2. 在org.eclipse.ui.startup拓展里執(zhí)行(只需執(zhí)行一次):JSPlugin.getDefault().getPreferenceStore().setValue("js.profile", "
這一篇將怎么在spket內(nèi)置js文件,而不用用戶自己去添加。
1. 在開發(fā)的Eclipse的 運(yùn)行配置將下面幾個(gè)插件勾選上。
2. 在org.eclipse.ui.startup拓展里執(zhí)行(只需執(zhí)行一次):
JSPlugin.getDefault().getPreferenceStore().setValue("js.profile", "BingoTouch");
PS:記得引入com.spket.js的包
3. 生成profiles.xml
這個(gè)profiles.xml里面就是:
這份配置其實(shí)能在界面操作生成,簡單就是調(diào)插件代碼也就可以生成。但我實(shí)在是沒耐心去看源碼,更何況是沒有源碼(這個(gè)插件不是開源的),于是我直接自己生成這樣一個(gè)文件:
String comSpketJs = JSPlugin.getDefault().getStateLocation().toString(); //com.spket.js目錄地址File file = new File(comSpketJs);if(!file.exists()) file.mkdir(); FileUtil.createSpketProfilesXml(comSpketJs + File.separator + "profiles.xml"); public static void createSpketProfilesXml(String path) { String jstipFolder = eclipseRootPath + "/resource/config/jstip"; File file = new File(jstipFolder); PrintWriter pw; try { pw = new PrintWriter(new FileWriter(path)); pw.write("<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"); pw.print("<profiles>\n"); pw.print("<profile id=\"BingoTouch\" name=\"BingoTouch\">use namespace jQuery;\n"); File[] fs = file.listFiles(); for(File f : fs){ pw.print("include '" + f.getAbsolutePath().replaceAll("\\\\", "\\\\\\\\") + "';\n"); } pw.print("</profile>\n"); pw.print("</profiles>"); pw.close(); } catch (IOException e) { // TODO 自動(dòng)生成的 catch 塊 e.printStackTrace(); } }
代碼還是比較簡單的,看看就明白,之后第一次打開Eclipse就有: