`
lichaozhangobj
  • 浏览: 98737 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

MyEclipse 7.x 添加 jbpm 3.2.2 插件

阅读更多

执行以下代码,更改47行的path变量,指定插件文件所在目录designer(designer下的目录结构是eclipse/features and plugins的形式),然后按照输出信息操作即可。

 

package cn.it;

import java.io.File;

public class CfgInfo {

	public void generateAndPrintConfigInfo(String pluginPath) {
		File dir = new File(pluginPath);
		if (!dir.isDirectory()) {
			throw new RuntimeException("请提供一个正确插件的路径(目录)");
		}

		for (File file : dir.listFiles()) {
			if (file.getName().indexOf("_") < 0) {
				if (file.isDirectory()) {
					generateAndPrintConfigInfo(file.getAbsolutePath());
				}
				continue;
			}

			if (file.isDirectory()) {
				String[] filenames = file.getName().split("_");
				String result = new StringBuilder(filenames[0])// 插件名?
						.append(",").append(filenames[1])// 版本号?
						.append(",file:/").append(file.getAbsolutePath())//
						.append("\\,4,false")//
						.toString();
				System.out.println(result.replace("\\", "/"));
			} else if (file.isFile()) {
				String filename = file.getName();
				int lastUnderline = filename.lastIndexOf("_");// 最后一个下划线的位置
				String fn1 = filename.substring(0, lastUnderline);
				String fn2 = filename.substring(lastUnderline + 1, filename.length() - 4); // 4是指".jar"扩展名的长度吗?
				String result = new StringBuilder(fn1)//
						.append(",").append(fn2)//
						.append(",file:/").append(file.getAbsolutePath())//
						.append(",4,false")//
						.toString();
				System.out.println(result.replace("\\", "/"));
			}
		}
	}

	public static void main(String[] args) {
//		// 插件文件所在目录designer下的目录结构是eclipse/features and plugins的形式

		String path = "J:\\MySpace\\openSource\\jbpm_jar\\jbpm-jpdl-3.2.2\\designer";

		String info = new StringBuilder("\n插件的路径为:").append(path).append("\n")//
				.append("/*-------------------------------------------------------------------\\ \n")//
				.append("| 将下面的插件配置信息复制到:                                       | \n")//
				.append("| MyEclipse 7.0/configuration/org.eclipse.equinox.simpleconfigurator | \n")//
				.append("| 文件夹下的 bundles.info 文件内容的最后。 然后重启 myeclipse 即可。 | \n")//
				.append("\\-------------------------------------------------------------------*/ \n")//
				// .append("然后使用myeclipse -clean命令重启myeclipse即可。")//
				.toString();

		System.out.println(info);
		new CfgInfo().generateAndPrintConfigInfo(path);
	}
}

 

1
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics