摘要:这一篇将怎么在spket内置js文件,而不用用户自己去添加。 1. 在开发的Eclipse的 运行配置将下面几个插件勾选上。 2. 在org.eclipse.ui.startup拓展里执行(只需执行一次):JSPlugin.getDefault().getPreferenceStore().setValue("js.profile", "
这一篇将怎么在spket内置js文件,而不用用户自己去添加。
1. 在开发的Eclipse的 运行配置将下面几个插件勾选上。

2. 在org.eclipse.ui.startup拓展里执行(只需执行一次):
JSPlugin.getDefault().getPreferenceStore().setValue("js.profile", "BingoTouch");PS:记得引入com.spket.js的包
3. 生成profiles.xml
这个profiles.xml里面就是:

这份配置其实能在界面操作生成,简单就是调插件代码也就可以生成。但我实在是没耐心去看源码,更何况是没有源码(这个插件不是开源的),于是我直接自己生成这样一个文件:

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 自动生成的 catch 块 e.printStackTrace();
}
}代码还是比较简单的,看看就明白,之后第一次打开Eclipse就有:
