根据网上提供的几种方法都不成功,最后用以下方法成功了
假设
Myeclipse 7的安装路径为:C:/Program Files/Genuitec
JBossTools-2.1.2.GA插件的路径为: C:/eclipse-plugins/plugins/spket-1.6.16/eclipse/plugins
将下面这段代码编译后执行
import java.io.File;
import java.util.ArrayList;
import java.util.List;
public class CreatePluginsConfig {
private String path;
public CreatePluginsConfig(String path) {
this.path = path;
}
public void print() {
List list = getFileList(path);
if (list == null) {
return;
}
int length = list.size();
for (int i = 0; i < length; i++) {
String result = "";
String thePath = getFormatPath(getString(list.get(i)));
File file = new File(thePath);
if (file.isDirectory()) {
String fileName = file.getName();
if (fileName.indexOf("_") < 0) {
continue;
}
String[] filenames = fileName.split("_");
String filename1 = filenames[0];
String filename2 = filenames[1];
result = filename1 + "," + filename2 + ",file:/" + path + "//"
+ fileName + "//,4,false";
System.out.println(result);
} else if (file.isFile()) {
String fileName = file.getName();
if (fileName.indexOf("_") < 0) {
continue;
}
int last = fileName.lastIndexOf("_");// 最后一个下划线的位置
String filename1 = fileName.substring(0, last);
String filename2 = fileName.substring(last + 1, fileName
.length() - 4);
result = filename1 + "," + filename2 + ",file:/" + path + "//"
+ fileName + ",4,false";
System.out.println(result);
}
}
}
public List getFileList(String path) {
path = getFormatPath(path);
path = path + "/";
File filePath = new File(path);
if (!filePath.isDirectory()) {
return null;
}
String[] filelist = filePath.list();
List filelistFilter = new ArrayList();
for (int i = 0; i < filelist.length; i++) {
String tempfilename = getFormatPath(path + filelist[i]);
filelistFilter.add(tempfilename);
}
return filelistFilter;
}
public String getString(Object object) {
if (object == null) {
return "";
}
return String.valueOf(object);
}
public String getFormatPath(String path) {
path = path.replaceAll("", "/");
path = path.replaceAll("//", "/");
return path;
}
public static void main(String[] args) {
new CreatePluginsConfig(
"C://eclipse-plugins//plugins//spket-1.6.16//eclipse//plugins").print();
}
}
执行完之后,将控制台中打印出的执行结果,直接复制到下面这个文件中:
C:/Program Files /Genuitec/MyEclipse 7.0/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info
完成后重启Myeclipse,
二、配置Spket
注意:如果在安装spket过程中,你的eclipse或者Myeclipse是打开的,请重启eclipse或者Myeclipse。以便初始化插件,下面才会在Preferences中看到 Spket选项。
基本步骤如下:
1)Window → Preferences → Spket ;
2)Spket → JavaScript Profiles → New, 输入“ExtJS”点击OK;
3)选择“ExtJS” 并点击“Add Library”然后在下拉条中选取“ExtJS”;
4)选择 “ExtJS”并点击“Add File”,然后在你的./ext-2.x/source目录中选取“ext.jsb” 文件;
5)设置新的ExtJS Profile,选中并点击“JavaScript Profiles” 对话框右手边的“Defalut”按钮;
下面这个操作,根据自己需要设置(可以全选)。
6)重启eclipse或者Myeclipse;
7)创建新的JS文件并输入: Ext这样就可设置Ext Code代码自动完成的功能。
效果如下:
重新启动Myeclipse即了完成插件的安装。
本文来自:http://blog.csdn.net/yefei679/archive/2009/04/22/4100872.aspx