環境: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;
2
import java.util.ArrayList;
3
import java.util.List;
4
5
public class CreatePluginsConfig {
6
7
public CreatePluginsConfig(){
8
}
9
10
public void print(String path){
11
List list=getFileList(path);
12
if(list==null){
13
return;
14
}
15
16
int length=list.size();
17
for(int i=0;i<length;i++){
18
String result="";
19
String thePath=getFormatPath(getString(list.get(i)));
20
File file=new File(thePath);
21
if(file.isDirectory()){
22
String fileName=file.getName();
23
if(fileName.indexOf("_")<0){
24
print(thePath);
25
continue;
26
}
27
String[] filenames=fileName.split("_");
28
String filename1=filenames[0];
29
String filename2=filenames[1];
30
result=filename1+","+filename2+",file:/"+path+"\\"+fileName+"\\,4,false";
31
System.out.println(result);
32
}else if(file.isFile()){
33
String fileName=file.getName();
34
if(fileName.indexOf("_")<0){
35
continue;
36
}
37
int last = fileName.lastIndexOf("_");// 最后一個下劃線的位置
38
String filename1 = fileName.substring(0, last);
39
String filename2 = fileName.substring(last + 1, fileName .length() - 4);
40
result = filename1 + "," + filename2 + ",file:/" + path + "\\" + fileName + ",4,false";
41
System.out.println(result);
42
}
43
44
}
45
}
46
47
public List getFileList(String path){
48
path=getFormatPath(path);
49
path=path+"/";
50
File filePath=new File(path);
51
if(!filePath.isDirectory()){
52
return null;
53
}
54
String[] filelist=filePath.list();
55
List filelistFilter=new ArrayList();
56
57
for(int i=0;i<filelist.length;i++){
58
String tempfilename=getFormatPath(path+filelist[i]);
59
filelistFilter.add(tempfilename);
60
}
61
return filelistFilter;
62
}
63
64
public String getString(Object object){
65
if(object==null){
66
return "";
67
}
68
return String.valueOf(object);
69
}
70
71
public String getFormatPath(String path) {
72
path = path.replaceAll("\\\\", "/");
73
path = path.replaceAll("//", "/");
74
return path;
75
}
76
77
public static void main(String[] args){
78
//插件文件所在目錄designer下的目錄結構是eclipse/features and plugins的形式
79
String plugin = "E:\\Java\\jbpm-jpdl-3.2.3\\designer";
80
new CreatePluginsConfig().print(plugin);
81
}
82
}
83

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

將打印出來的插件配置信息復制到
D:\Program Files\Genuitec\MyEclipse 8.x Latest\configuration\org.eclipse.equinox.simpleconfigurator\bundles.info中。然后重啟MyEclipse8.0即可!