环境:MyEclipse8.0,jbpm-jpdl-3.2.3,tomcat6.0。网上没有具体关于MyEclipse8.0如何集成jbpm3的方法,倒是有集成jbpm4.0的方法,但此法不适用jbpm3.0。本文借用“MyEclipse 7.0 安装jbpm插件:jbpm-jpdl-designer-3.1.4”的方法,完成了MyEclipse8.0与jbpm-jpdl-3.2.3的集成,目前运行良好。方法如下:
       假设MyEclipse8.0的安装路径是:D:\Program Files\Genuitec\MyEclipse 8.x Latest;jbpm-jpdl-3.2.3插件的解压路径:E:\Java\jbpm-jpdl-3.2.3\designer。运行以下程序:
 1 import java.io.File;
import java.io.File; 
 2 import java.util.ArrayList;
import java.util.ArrayList; 
 3 import java.util.List;
import java.util.List; 
 4
 5
 public class CreatePluginsConfig
public class CreatePluginsConfig  {
{ 
 6
 7
 public CreatePluginsConfig()
    public CreatePluginsConfig() {
{ 
 8 }
    } 
 9
10
 public void print(String path)
    public void print(String path) {
{ 
11 List list=getFileList(path);
        List list=getFileList(path); 
12
 if(list==null)
        if(list==null) {
{ 
13 return;
            return; 
14 }
        } 
15
16 int length=list.size();
        int length=list.size(); 
17
 for(int i=0;i<length;i++)
        for(int i=0;i<length;i++) {
{ 
18 String result="";
            String result=""; 
19 String thePath=getFormatPath(getString(list.get(i)));
            String thePath=getFormatPath(getString(list.get(i))); 
20 File file=new File(thePath);
            File file=new File(thePath); 
21
 if(file.isDirectory())
            if(file.isDirectory()) {
{ 
22 String fileName=file.getName();
                String fileName=file.getName(); 
23
 if(fileName.indexOf("_")<0)
                if(fileName.indexOf("_")<0) {
{ 
24 print(thePath);
                    print(thePath); 
25 continue;
                    continue; 
26 }
                } 
27 String[] filenames=fileName.split("_");
                String[] filenames=fileName.split("_"); 
28 String filename1=filenames[0];
                String filename1=filenames[0]; 
29 String filename2=filenames[1];
                String filename2=filenames[1]; 
30 result=filename1+","+filename2+",file:/"+path+"\\"+fileName+"\\,4,false";
                result=filename1+","+filename2+",file:/"+path+"\\"+fileName+"\\,4,false"; 
31 System.out.println(result);
                System.out.println(result); 
32
 }else if(file.isFile())
            }else if(file.isFile()) {
{ 
33 String fileName=file.getName();
                String fileName=file.getName(); 
34
 if(fileName.indexOf("_")<0)
                if(fileName.indexOf("_")<0) {
{ 
35 continue;
                    continue; 
36 }
                } 
37 int last = fileName.lastIndexOf("_");// 最后一个下划线的位置
                int last = fileName.lastIndexOf("_");// 最后一个下划线的位置 
38 String filename1 = fileName.substring(0, last);
                String filename1 = fileName.substring(0, last); 
39 String filename2 = fileName.substring(last + 1, fileName .length() - 4);
                String filename2 = fileName.substring(last + 1, fileName .length() - 4); 
40 result = filename1 + "," + filename2 + ",file:/" + path + "\\" + fileName + ",4,false";
                result = filename1 + "," + filename2 + ",file:/" + path + "\\" + fileName + ",4,false"; 
41 System.out.println(result);
                System.out.println(result); 
42 }
            } 
43
44 }
        } 
45 }
    } 
46
47
 public List getFileList(String path)
    public List getFileList(String path) {
{ 
48 path=getFormatPath(path);
        path=getFormatPath(path); 
49 path=path+"/";
        path=path+"/"; 
50 File filePath=new File(path);
        File filePath=new File(path); 
51
 if(!filePath.isDirectory())
        if(!filePath.isDirectory()) {
{ 
52 return null;
            return null; 
53 }
        } 
54 String[] filelist=filePath.list();
        String[] filelist=filePath.list(); 
55 List filelistFilter=new ArrayList();
        List filelistFilter=new ArrayList(); 
56
57
 for(int i=0;i<filelist.length;i++)
        for(int i=0;i<filelist.length;i++) {
{ 
58 String tempfilename=getFormatPath(path+filelist[i]);
            String tempfilename=getFormatPath(path+filelist[i]); 
59 filelistFilter.add(tempfilename);
            filelistFilter.add(tempfilename); 
60 }
        } 
61 return filelistFilter;
        return filelistFilter; 
62 }
    } 
63
64
 public String getString(Object object)
    public String getString(Object object) {
{ 
65
 if(object==null)
        if(object==null) {
{ 
66 return "";
            return ""; 
67 }
        } 
68 return String.valueOf(object);
        return String.valueOf(object); 
69 }
    } 
70
71
 public String getFormatPath(String path)
    public String getFormatPath(String path)  {
{ 
72 path = path.replaceAll("\\\\", "/");
        path = path.replaceAll("\\\\", "/"); 
73 path = path.replaceAll("//", "/");
        path = path.replaceAll("//", "/"); 
74 return path;
        return path; 
75 }
    } 
76
77
 public static void main(String[] args)
    public static void main(String[] args) {
{
78 //插件文件所在目录designer下的目录结构是eclipse/features and plugins的形式
        //插件文件所在目录designer下的目录结构是eclipse/features and plugins的形式
79 String plugin = "E:\\Java\\jbpm-jpdl-3.2.3\\designer";
        String plugin = "E:\\Java\\jbpm-jpdl-3.2.3\\designer"; 
80 new CreatePluginsConfig().print(plugin);
        new CreatePluginsConfig().print(plugin); 
81 }
    } 
82 }
} 
83
 
       将打印出来的插件配置信息复制到
D:\Program Files\Genuitec\MyEclipse 8.x Latest\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info中。然后重启MyEclipse8.0即可!
       
	posted on 2010-04-06 16:04 
matthew 阅读(1302) 
评论(0)  编辑  收藏