myeclipse中安装svn插件

1、下载最新的SVN包(我下的是1.0.6版):

http://subclipse.tigris.org/servlets/ProjectDocumentList?folderID=2240

 

2、在你的磁盘上任意位置创建文件夹:“myplugins/svn”。名字可以任取,为了方便插件管理,建议名称为“myplugins”。

 

3、将解压的svn里的两个文件夹拷贝到“myplugins/svn”下。

 

4、复制下列java代码,修改路径并执行:

  1. package app; 
  2. import java.io.File; 
  3. import java.util.ArrayList; 
  4. import java.util.List; 
  5. /**
  6. * MyEclipse9 插件配置代码生成器
  7. *
  8. *
  9. */ 
  10. publicclass PluginConfigCreator 
  11.     public PluginConfigCreator() 
  12.     { 
  13.     } 
  14.     publicvoid print(String path) 
  15.     { 
  16.         List<String> list = getFileList(path); 
  17.         if (list == null
  18.         { 
  19.             return
  20.         } 
  21.         int length = list.size(); 
  22.         for (int i = 0; i < length; i++) 
  23.         { 
  24.             String result = ""
  25.             String thePath = getFormatPath(getString(list.get(i))); 
  26.             File file = new File(thePath); 
  27.             if (file.isDirectory()) 
  28.             { 
  29.                 String fileName = file.getName(); 
  30.                 if (fileName.indexOf("_") < 0
  31.                 { 
  32.                     print(thePath); 
  33.                     continue
  34.                 } 
  35.                 String[] filenames = fileName.split("_"); 
  36.                 String filename1 = filenames[0]; 
  37.                 String filename2 = filenames[1]; 
  38.                 result = filename1 + "," + filename2 + ",file:/" + path + "/" 
  39.                         + fileName + "//,4,false"
  40.                 System.out.println(result); 
  41.             } elseif (file.isFile()) 
  42.             { 
  43.                 String fileName = file.getName(); 
  44.                 if (fileName.indexOf("_") < 0
  45.                 { 
  46.                     continue
  47.                 } 
  48.                 int last = fileName.lastIndexOf("_");// 最后一个下划线的位置 
  49.                 String filename1 = fileName.substring(0, last); 
  50.                 String filename2 = fileName.substring(last + 1, fileName 
  51.                         .length() - 4); 
  52.                 result = filename1 + "," + filename2 + ",file:/" + path + "/" 
  53.                         + fileName + ",4,false"
  54.                 System.out.println(result); 
  55.             } 
  56.         } 
  57.     } 
  58.     public List<String> getFileList(String path) 
  59.     { 
  60.         path = getFormatPath(path); 
  61.         path = path + "/"
  62.         File filePath = new File(path); 
  63.         if (!filePath.isDirectory()) 
  64.         { 
  65.             returnnull
  66.         } 
  67.         String[] filelist = filePath.list(); 
  68.         List<String> filelistFilter = new ArrayList<String>(); 
  69.         for (int i = 0; i < filelist.length; i++) 
  70.         { 
  71.             String tempfilename = getFormatPath(path + filelist[i]); 
  72.             filelistFilter.add(tempfilename); 
  73.         } 
  74.         return filelistFilter; 
  75.     } 
  76.     public String getString(Object object) 
  77.     { 
  78.         if (object == null
  79.         { 
  80.             return""
  81.         } 
  82.         return String.valueOf(object); 
  83.     } 
  84.     public String getFormatPath(String path) 
  85.     { 
  86.         path = path.replaceAll("////", "/"); 
  87.         path = path.replaceAll("//", "/"); 
  88.         return path; 
  89.     } 
  90.     publicstaticvoid main(String[] args) 
  91.     { 
  92.         /*你的插件的安装目录*/ 
  93.             String plugin = "改成安装目录//Genuitec//svn"
  94.         new PluginConfigCreator().print(plugin); 
  95.     } 

 

 

这里需要注意的是修改成为刚才svn所在路径,建议改为绝对路径。比如我的svn在“/opt/soft/Genuitec/myplugins/svn/”,那么就这样:String plugin = "/opt/soft/Genuitec/myplugins/svn/";

用windows的朋友只需要设置你们的绝对路径就可以了,比如d:/myplugins/svn/。。。

 

5、找到“$myeclipse_home/configuration/org.eclipse.equinox.simpleconfigurator/”,打开其中的“bundles.inf”文件,为了防止分不清是不是我们自己后加的东西,在最后面多回几次车,然后粘贴第4步运行后的代码,保存

 

6、重启myeclipse

posted @ 2012-08-30 10:50  zdp072  阅读(142)  评论(0编辑  收藏  举报