关于MyEclipse 7.0 的插件添加问题
最新版MyEclipse 7.0 正式版与以前的版本有很大不同, 包括MyEclipse 7.0M2 在内的老版本都是myeclipse 快捷方式调用elipse.exe 附加MyEclipse 的JRE 。而正式版7.0 不再调用eclipse.exe, 而且在安装好的目录下面也没有了eclipse.exe 。完全与myeclipse.exe 被整合到一起了, 所以很多的插件如designer 的安装版本是查找不到eclipse.exe 的, 以至于导致无法安装, 只能安装解压包, 解压包的安装方法无非是覆盖和LINK 方法, 但是MyEclipse 7.0 M2 的plugins 目录已经迁移到COMMON 目录下, 导致很多插件无法识别兼容. 下面我提供一种方法:
假设在 myeclipse7.0 下安装插件 jbpm-jpdl-suite-3.2.3 中的设计工具 designer 。
1 、 myeclipse 安装目录: D:/developer/Genuitec
2 、插件文件目录: D:/developer/eclipse-plugins/designer
( 注意 : 一定要将解压后的两个文件夹 plugins 和 feature 放在此目录下的 eclipse 文件夹下 , 也就是说 , 插件文件目录随意 , 但是必须要在那个目录下放置 eclipse 这个文件夹 , 然后将那两个文件夹放进去才行 , 否则编译无效 .)
3.
新建java 如下程序:
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(" D://developer//eclipse-plugins//designer//eclipse//plugins ").print();// 注意此红色标示的路径就是你安装插件的路径, 根据自己的具体路径设置
}
}
4. 编译运行. 将打印出来的插件配置信息复制到D:/developer/Genuitec/MyEclipse 7.0/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info 中。
5, 新建.bat 文件, 用加入myeclipse.exe -clean 命令后保存运行, 重启myeclipse 即可。
转自其他网站