PageRenderTime 9ms CodeModel.GetById 2ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/bundles/plugins-trunk/XML/xml/parser/TldXmlTag.java

#
Java | 56 lines | 42 code | 9 blank | 5 comment | 6 complexity | cc33acf7b4c6f42ffed8ce31b6cba268 MD5 | raw file
 1package xml.parser;
 2
 3import javax.swing.Icon;
 4import javax.swing.text.Position;
 5import org.xml.sax.Attributes;
 6
 7import eclipseicons.EclipseIconsPlugin;
 8
 9// A marker class for nodes in a TLD file.
10public class TldXmlTag extends XmlTag {
11
12    private String originalName;
13
14    public TldXmlTag(String name, String namespace, Position start, Attributes attributes) {
15        super(name, namespace, start, attributes);
16        originalName = name;
17    }
18
19    public String getShortString() {
20        return name;
21    }
22    
23    public String getOriginalName() {
24        return originalName;   
25    }
26
27    public Icon getIcon() {
28        if ("tag".equals(originalName)) {
29            return EclipseIconsPlugin.getIcon("tag-html.gif"); 
30        }
31        if ("function".equals(originalName)) {
32            return EclipseIconsPlugin.getIcon("methpub_obj.gif");
33        }
34        if ("tag-file".equals(originalName)) {
35            return EclipseIconsPlugin.getIcon("file_obj.gif");   
36        }
37        if ("listener".equals(originalName)) {
38            return EclipseIconsPlugin.getIcon("activity.gif");
39        }
40        if ("validator".equals(originalName)) {
41            return EclipseIconsPlugin.getIcon("complete_task.gif");
42        }
43        if ("tag-extension".equals(originalName)) {
44            return EclipseIconsPlugin.getIcon("tag_generic_emphasized_obj.gif");
45        }
46        return EclipseIconsPlugin.getIcon("tag.gif");
47    }
48
49	/**
50 	 * @return <code>true</code> if this tag should accumulate the characters from 
51 	 * the body of a tag. This method returns true if the tag name is "name".
52 	 */
53    public boolean canAddCharacters() {
54        return "name".equals(name);
55    }
56}