myeclipse9或myeclipse10安裝svn的方法

下載最新的SVN包   site-1.6.5.zipjava

從中解壓出features與plugins文件夾,複製到C:\toBeInstalledSVN 裏面,其它的*.xml文件不要web

複製下列java代碼,修改路徑並執行windows

import java.io.File;
import java.util.ArrayList;

import java.util.List;

/**
 * MyEclipse9 插件配置代碼生成器
 * 
 */
public class PluginConfigCreator {
    public PluginConfigCreator() {

    }

    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) {
        /* 你的插件的安裝目錄 */

        String plugin = "C:\\toBeInstalledSVN";

        new PluginConfigCreator().print(plugin);
    }
}
View Code

 這裏須要注意的是修改爲爲剛纔svn所在路徑,建議改成絕對路徑。好比個人svn在「/opt/soft/Genuitec/myplugins/svn/」,那麼就這樣:String 
plugin = 
"/opt/soft/Genuitec/myplugins/svn/";

用windows的朋友只須要設置大家的絕對路徑就能夠了,好比d:/myplugins/svn/。。。

五、找到「$myeclipse_home/configuration/org.eclipse.equinox.simpleconfigurator/」,打開其中的「bundles.inf」文件,爲了防止分不清是否是咱們本身後加的東西,在最後面多回幾回車,而後粘貼第4步運行該java文件後,將輸出結果所有拷貝到bundles.inf文件中,保存

六、重啓myeclipse

七、import工程,看看最下面是否是多了一個「other」文件夾?沒錯,就是他了,咱們的svn終於回來了!eclipse

相關文章
相關標籤/搜索