MyEclipse 10 中增加svn外掛
阿新 • • 發佈:2019-01-25
隨著Myeclipse版本號的變大,外掛的安裝也越來越複雜了,在有了configuration center之後,明明eclipse都能正常使用的update site,在Myeclipse中就是不能使用,真糾結。我試了好幾個外掛的線上安裝,沒有一個能成功的,而且巨慢無比,等待很長一段時間之後告訴你,失敗。所以安裝外掛最好還是採用離線安裝。
網上有另類的解決辦法,親自嘗試了一些,有些已經都不可用了,特記錄一下可用的方式。
首先:下載svn外掛,最新的已經是1.8版本了。svn外掛網站:http://subclipse.tigris.org/,外掛下載地址:http://subclipse.tigris.org/files/documents/906/49209/site-1.8.8.zip
解壓svn包,找到其中的兩個資料夾features和plugins目錄,在Myeclipse目錄下面新建一個資料夾,名稱隨意,可以就叫svn,將解壓的兩個資料夾放在這個新建的目錄中
找到Myeclipse的安裝目錄,在安裝目錄下的configuration\org.eclipse.equinox.simpleconfigurator這個目錄中有個
bundles.info檔案,需要在這個檔案中增加外掛的相關資訊Myeclipse才會去載入。
新增的內容使用下面的類生成:
- import java.io.File;
-
import java.util.ArrayList;
- import java.util.List;
- publicclass PluginConfigCreator
- {
- public PluginConfigCreator()
- {
- }
- publicvoid print(String path)
- {
- 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)
- {
- 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);
- } elseif (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())
- {
- returnnull;
- }
- 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;
- }
- publicstaticvoid main(String[] args)
- {
- String plugin = "F:\\MyEclipse10.0\\myEclipsePlugin\\svn";
- new PluginConfigCreator().print(plugin);
- }
- }
最後就是在bundles.info檔案後增加上面程式碼生成的內容,然後重啟下Myeclipse即可。