1
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 package com.unitesk.atp.tree.tool;
33
34 import com.unitesk.atp.tree.Node;
35 import com.unitesk.atp.tool.PluginClass;
36
37 /***
38 * Plug-in is a tool functionality extention module.
39 *
40 * @author <A href="mailto:demakov@ispras.ru">Alexey Demakov</A>
41 * @version $Id: Plugin.java,v 1.1 2004/10/09 06:40:12 all-x Exp $
42 */
43 public abstract class Plugin extends PluginClass
44 {
45 protected Tree tree;
46 public void setCurrentTree( Tree tree ) { this.tree = tree; }
47 public Tree getCurrentTree() { return tree; }
48
49 /***
50 * Performs an action with the specified name over the same tree.
51 * Calls {@link PluginManager#process(String,Tree) pm.process( name, tree )}
52 *
53 * @param name The name of an action.
54 */
55 public final void process( String name )
56 {
57 ((PluginManager)pm).process( name, tree );
58 }
59
60 /***
61 * Computes an attribute with the specified name of the specified
62 * node of the same tree.
63 * Calls {@link Tool#get(String,Tree,Node) tool.get( name, tree, node )}
64 *
65 * @param name The name of attribute.
66 * @param node The tree node.
67 * @return The value of <code>node</code> attribute <code>name</code>.
68 */
69 public final Object get( String name, Node node )
70 {
71 return ((PluginManager)pm).get( name, tree, node );
72 }
73
74 /***
75 * {@inheritDoc}
76 */
77 public void init( com.unitesk.atp.tool.PluginManager pm, String name )
78 {
79 super.init( pm, name );
80
81 if( pm instanceof PluginManager )
82 {
83 this.pm = (PluginManager)pm;
84 }
85 }
86
87 protected PluginManager pm;
88 }