myeclipse加入插件的方式有很多种,这个是本人常用的一种。因为和几个朋友(朋友在不同的地区)准备开发一个项目来耍耍。所以用到了谷歌的域,使用svn提交,没有在myeclipse里面用过svn,记录下面希望可以帮助别人也可以给自己以后翻阅。
首先把svn的插件下载下来,然后解压,在电脑随便一个位置新建一个文件夹,这里选择是D盘的根目录下建立一个SVN的文件夹,然后把里面的features和plugins目录放到里面。再myeclipse里面运行如下代码:
package com.take.test;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
/**
* MyEclipse9 插件配置代码生成器
*/
public class ShowDemo{
public ShowDemo() {
}
public void print(String path) {
List<String> 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) {
print(thePath);
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<String> getFileList(String path) {
path = getFormatPath(path);
path = path + "/";
File filePath = new File(path);
if (!filePath.isDirectory()) {
return null;
}
String[] filelist = filePath.list();
List<String> filelistFilter = new ArrayList<String>();
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) {
//插件摆放的位置,写到features的父目录就可以了
String plugin = "E:\\SVN";
new ShowDemo().print(plugin);
}
}
上面代码的包的名字和类的名字需要修改成为自己的包的名字和类的名字。
再找到你的myeclipse的安装目录下的configuration下面的
org.eclipse.equinox.simpleconfigurator文件夹里面的bundles.info,把
bundles.info打开复制上面在控制台输出的语句放到最后面。保存,退出。重启myeclipse就OK了。