安装完myeclipse 7,发现原来的插件无法再用link添加,上网搜之,找到被很多人转的一段程序用来添加插件,但是我的插件都是统一放在d:/java/myplugins下的,有10来个,一个一个运行太麻烦了,于是把搜到的程序改一下,也没什么技术含量,只是做个备忘,等myeclipse的新版本出来应该会改良这个功能,这段程序到时候也许就没用了。
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
public class AddPluginsConfig
{
private static void createContent(String path, StringBuffer buffer)
{
List<String> list = getFileList(path);
if (list == null || list.isEmpty())
{
return;
}
String thePath = null;
String fileName = null;
String[] filenames = null;
File file = null;
for (String filePath : list)
{
thePath = getFormatPath(getString(filePath));
file = new File(thePath);
if (file.isDirectory())
{
fileName = file.getName();
if (fileName.indexOf("_") < 0)
{
continue;
}
filenames = fileName.split("_");
buffer.append(filenames[0]).append(",").append(filenames[1]).append(",file:/").append(path).append(fileName).append("/,4,false");
}
else if (file.isFile())
{
fileName = file.getName();
if (fileName.indexOf("_") < 0)
{
continue;
}
filenames = fileName.split("_");
buffer.append(filenames[0]).append(",").append(filenames[1].substring(0, filenames[1] .lastIndexOf("."))).append(",file:/").append(path).append(fileName).append(",4,false");
}
buffer.append(System.getProperty("line.separator"));
}
}
private static 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;
}
private static String getString(Object object) {
if (object == null)
{
return "";
}
return String.valueOf(object);
}
private static String getFormatPath(String path)
{
path = path.replaceAll("\\\\", "/");
path = path.replaceAll("//", "/");
return path;
}
private static void addContentByWriter(String fileName, String content) throws IOException
{
FileWriter writer = new FileWriter(fileName, true);
writer.write(content);
writer.close();
}
/**
* 将插件路径加入文件
* @param directory 自定义插件路径
* @param path myeclipse7安装路径
* @throws IOException
*/
public static void addContent(String directory, String path) throws IOException
{
File parentDir = new File(directory);
File[] list = parentDir.listFiles();
StringBuffer buffer = new StringBuffer();
for (File dir : list)
{
if (dir.isDirectory())
{
createContent(dir.getPath() + "/eclipse/plugins", buffer);
}
}
addContentByWriter(path + "/MyEclipse 7.0/configuration/org.eclipse.equinox.simpleconfigurator/bundles.info", buffer.toString());
}
public static void main(String[] args) throws IOException
{
addContent("d:/java/myplugins", "d:/Program Files/Genuitec");
}
}
分享到:
相关推荐
MyEclipse 7.x 插件很难安装。研究了2天才实现了SVN插件的安装,下载本包(其内含有使用说明)。 解压即可使用,不用编写程序,不用重启系统,restart MyEclipse 7.x即可。
myeclipse2017破解插件myeclipse2017破解插件myeclipse2017破解插件myeclipse2017破解插件myeclipse2017破解插件myeclipse2017破解插件myeclipse2017破解插件myeclipse2017破解插件myeclipse2017破解插件myeclipse...
myeclipse maven插件
site-1.6.17.zip myeclipse svn插件 myeclipse svn插件 myeclipse svn插件 myeclipse svn插件 myeclipse svn插件
myeclipse安装插件的方法
Eclipse(MyEclipse)离线插件安装工具 C:\>java -jar instPlug4MyEclipse.jar Use:java -jar instPlug4MyEclipse.jar PluginPath eclipsePath 如:java -jar instPlug4MyEclipse.jar D:/ADT-18.0.0 D:/myeclipse10 ...
svn 插件 myeclipse 插件文件+安装方法在压缩包内
myeclipse常用设置 myeclipse加速 myeclipse插件 myeclipse编码
Myeclipse7下安装插件. Myeclipse 7 的插件安装方式与原先的方式完全不一样了,具体请看附件.
用于Myeclipse2017SVN插件安装
Myeclipse svn 插件, 附带Myeclipse 中 插件的安装教程
myeclipse插件myeclipse插件myeclipse插件myeclipse插件
Myeclipse js插件工具,附带说明 自己用的,存放...
制作的MyEclipse9.0插件版,有8个压缩文件,对应的eclipse是3.6.2,需要你自己下载
eclipse、myeclipse常用插件汇总.rar
将资源解压到myeclipse的dropins目录下,重启myeclipse即可
MyEclipseSVN插件 1.找到MyEclipse10 在安装目录下的dropins文件夹 2.打开dropins文件夹,新建一个svn文件夹 3.解压缩下载好的压缩包 4.把features和plugins文件夹拷贝到dropins文件夹下的SVN文件夹中
SVN myeclipse9 插件 免安装
MyEclipse SVN插件安装,直接按照解压缩之后的txt说明文档操作就可以。
myEclipse5.5插件版(基于eclipse3.2) 官网下载地址链接,直接下。myeclipse官网不能直接登录,你懂的。