手工安装MyEclipse7.0的插件

开发J2EE,当然首选MyEclipse。前阵子安装了MyEclipse7.0,想配个SVN插件,可是由于其插件安装方式改变了,每次通过Software Update都提示要升级到7.5先,而MyEclipse早被墙奸已久,是以一直更新不成功,也就造成安装插件失败。

今日心血来潮GOOGLE一番之后再试,终于找到了解决办法如下:

  1. 下载SVN插件,解压到硬盘上,如d:\svn
  2. 新建一个Test类,其内容如下:
    import java.io.File;
    import java.util.ArrayList;
    import java.util.List;
    
    public class Test {
    	private String path;
    
    	public Test(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;
    				}
    				String[] filenames = fileName.split("_");
    				String filename1 = filenames[0];
    				String filename2 = filenames[1].substring(0, filenames[1]
    						.lastIndexOf("."));
    				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 Test("d:\\svn\\plugins").print();//这里设置成插件的位置
    	}
    }
    
  3. 执行完之后,将控制台中打印出的执行结果,复制到MyEclipse7.0安装目录下面的 \configuration\org.eclipse.equinox.simpleconfigurator\bundles.info文件末尾,然后重启MyEclipse即可

似乎还有一种方法,在MyEclipse 7.0的安装目录下面新建一个dropins文件夹,放置要安装的的插件即可。不过插件需要符合这样的路径:  dropins——>插件文件夹——>eclipse——>plugins+features。由于前面已经安装完了,这个方法没有试验。

PS:今天翻墙一看,原来MyEclipse8.0都已经出来了。。。

Advertisements

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: