MyEclipse 插件 代码 生成器

 采用在bundles.info文件写入配置信息的方式安装插件。
具体步骤如下:
1) 首先bundles.inf文件在myeclipses安装目录下的..MyEclipse\MyEclipse 9\configuration\org.eclipse.equinox.simpleconfigurator 最好先备份一下。
2) 然后你可以在myeclipse下建立一个文件夹myplugin来存放你需要安装的插件,将你需要安装的插件放到这个目录下。
3)然后新建一个java文件,创建如下内容,注意需要修改main函数里的参数,定位到你刚才新建的文件夹下。运行该java文件,将输出结果全部拷贝到bundles.inf文件中。
4)最后重启myeclipse就可以了
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. public class PluginConfigCreator
  11. {
  12. public PluginConfigCreator()
  13. {
  14. }
  15. public void print(String path)
  16. {
  17. List<String> list = getFileList(path);
  18. if (list == null)
  19. {
  20. return;
  21. }
  22. int length = list.size();
  23. for (int i = 0; i < length; i++)
  24. {
  25. String result = "";
  26. String thePath = getFormatPath(getString(list.get(i)));
  27. File file = new File(thePath);
  28. if (file.isDirectory())
  29. {
  30. String fileName = file.getName();
  31. if (fileName.indexOf("_") < 0)
  32. {
  33. print(thePath);
  34. continue;
  35. }
  36. String[] filenames = fileName.split("_");
  37. String filename1 = filenames[0];
  38. String filename2 = filenames[1];
  39. result = filename1 + "," + filename2 + ",file:/" + path + "\\"
  40. + fileName + "\\,4,false";
  41. System.out.println(result);
  42. } else if (file.isFile())
  43. {
  44. String fileName = file.getName();
  45. if (fileName.indexOf("_") < 0)
  46. {
  47. continue;
  48. }
  49. int last = fileName.lastIndexOf("_");// 最后一个下划线的位置
  50. String filename1 = fileName.substring(0, last);
  51. String filename2 = fileName.substring(last + 1, fileName
  52. .length() - 4);
  53. result = filename1 + "," + filename2 + ",file:/" + path + "\\"
  54. + fileName + ",4,false";
  55. System.out.println(result);
  56. }
  57. }
  58. }
  59. public List<String> getFileList(String path)
  60. {
  61. path = getFormatPath(path);
  62. path = path + "/";
  63. File filePath = new File(path);
  64. if (!filePath.isDirectory())
  65. {
  66. return null;
  67. }
  68. String[] filelist = filePath.list();
  69. List<String> filelistFilter = new ArrayList<String>();
  70. for (int i = 0; i < filelist.length; i++)
  71. {
  72. String tempfilename = getFormatPath(path + filelist[i]);
  73. filelistFilter.add(tempfilename);
  74. }
  75. return filelistFilter;
  76. }
  77. public String getString(Object object)
  78. {
  79. if (object == null)
  80. {
  81. return "";
  82. }
  83. return String.valueOf(object);
  84. }
  85. public String getFormatPath(String path)
  86. {
  87. path = path.replaceAll("\\\\", "/");
  88. path = path.replaceAll("//", "/");
  89. return path;
  90. }
  91. public static void main(String[] args)
  92. {
  93. /*你的插件的安装目录*/
  94. String plugin = "改成安装目录\\Genuitec\\svn";
  95. new PluginConfigCreator().print(plugin);
  96. }
  97. }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值