Eclipse安装javaScript插件Spket

   今天安装了一个Eclipse发现没有javascript插件,于是乎搞了一个强大的js插件Spket.具体安装步骤如下。当然此方法适合很多的Eclipse插件安装方式哦。

一:第一步

      官网下载:http://www.spket.com/download.html下载Plugin,下载完之后解压后可以找到两个文件夹features和plugins然后将这两个文件夹放到同一个文件夹spket下。之后将spket文件夹拷贝到Eclipse安装目录下plugins中。

二:第二步

 将该方法放到main中执行以下,当然执行之前需要改一下路径

package app;

import java.io.File;

import java.util.ArrayList;

import java.util.List;

/**

 * 

 * Function:配置插件

 *

 * Author:gaoqi  

 *

 * Date:2015年6月4日 上午9:22:44  

 *

 */

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);

            }

        }

    }

  /**

   * 

   * @param path

   * @return   

   * List<String>

   */

    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)

    {

        //此处path就是刚刚spket文件夹所在的路径。当然你的path不一定是我这样,稍微改动一下吧

    String path = "E://Company//Java//eclipse-java-luna-SR1-win32-x86_64//eclipse//plugins//spket";

        new PluginConfigCreator().print(path);

    }

}

三:第三步:

 找bundles.info或是bundles.inf中将上面执行的控制台代码拷贝进去,保存以下

四:第四步

 重启以下eclipse,ok,插件安装完成了

      

猜你喜欢

转载自bigseven.iteye.com/blog/2216966