1 public class DiagramEditor extends GraphicalEditorWithFlyoutPalette implements
2 IPersistableEditor {
?
1 |
|
1 public static final String ID = "ttcn3.gft.editor.editor.DiagramEditor";
2
3 public static String WARN_FILEEXIST = "diagram file is not exists.";
4 //这是Palette的名字。一共定义了四个Palette。
5 public final static String TTYPE_TST = "testcase";
6 public final static String TTYPE_ALT = "altstep";
7 public final static String TTYPE_CNT = "module";
8 public final static String TTYPE_FUN = "function";
9
10 private PaletteRoot root;
11
12 private GraphicalViewer viewer;
13
14 private DiagramModel diagram;
15 private ResourceChangeListener resourceChangeListener;//???
16 private EditorPartListener editorListener;// ??
17
18 private String type = "";
?
1 |
|
?
1 |
|
1 class EditorPartListener implements IPartListener2 {
2 DiagramEditor editor;
3
4 public EditorPartListener(DiagramEditor editor) {
5 super();
6 this.editor = editor;
7 }
8
9 // part listener
10 这一段不知道在干吗。将todoitem的viewer的text设为空?
11 public void partActivated(IWorkbenchPartReference partRef) {
12 // TODO Auto-generated method stub
13 if (partRef.getPart(true).equals(editor)) {
14
15 if (ToDoItemTemplate.getWinstate()) {
16 ToDoItemTemplate.getTDIViewer().setText("");
17 }
18 }
19 }
20
21 public void partBroughtToTop(IWorkbenchPartReference partRef) {
22 // TODO Auto-generated method stub
23 }
24
25
26 public void partClosed(IWorkbenchPartReference partRef) {
27 // TODO Auto-generated method stub
28 if (partRef.getPart(true).equals(editor)) {
29 CoreLangTemplate.removeFileWiter(editor);
30
31 if (ToDoItemTemplate.getWinstate()) {
32
33 }
34
35 }
36
37 }
38
39 @Override
40 public void partDeactivated(IWorkbenchPartReference partRef) {
41 // TODO Auto-generated method stub
42 }
43
44 @Override
45 public void partHidden(IWorkbenchPartReference partRef) {
46 // TODO Auto-generated method stub
47 }
48
49 @Override
50 public void partInputChanged(IWorkbenchPartReference partRef) {
51 // TODO Auto-generated method stub
52 }
53
54 @Override
55 public void partOpened(IWorkbenchPartReference partRef) {
56 // TODO Auto-generated method stub
57 if (partRef.getPart(true).equals(editor)) {
58
59 if (ToDoItemTemplate.getWinstate()) {
60 // add here
61 ToDoItemTemplate.getTDIViewer().setText("");
62 }
63
64 refreshTitleImage();
65 }
66 }
67
68 @Override
69 public void partVisible(IWorkbenchPartReference partRef) {
70 // TODO Auto-generated method stub
71 }
72 }
?
1 |
|
lass EditorDropListener extends TemplateTransferDropTargetListener {
public EditorDropListener() {
this(getGraphicalViewer());
}public EditorDropListener(EditPartViewer viewer) {
super(viewer);
// TODO Auto-generated constructor stub
}@Override
protected CreationFactory getFactory(Object template) {
if (template instanceof CreationFactory) {
return ((CreationFactory) template);
}
return null;
}};
?
1 |
|
?
1 |
|
?
1 |
6.12 xml part5 DiagramEidtor