PageRenderTime 35ms CodeModel.GetById 29ms app.highlight 4ms RepoModel.GetById 0ms app.codeStats 0ms

/bundles/plugins-trunk/RubyPlugin/src/org/jedit/ruby/structure/MemberNode.java

#
Java | 63 lines | 29 code | 12 blank | 22 comment | 0 complexity | c6d77df2df79ffd20c764c36387d144d MD5 | raw file
 1/*
 2 * MemberNode.java - 
 3 *
 4 * Copyright 2005 Robert McKinnon
 5 *
 6 * This program is free software; you can redistribute it and/or
 7 * modify it under the terms of the GNU General Public License
 8 * as published by the Free Software Foundation; either version 2
 9 * of the License, or any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
19 */
20package org.jedit.ruby.structure;
21
22import sidekick.Asset;
23
24import javax.swing.tree.DefaultMutableTreeNode;
25import javax.swing.Icon;
26
27import org.jedit.ruby.ast.Member;
28import org.jedit.ruby.icons.MemberIcon;
29
30/**
31 * @author robmckinnon at users.sourceforge.net
32 */
33final class MemberNode extends Asset {
34
35    private final Icon icon;
36
37    public MemberNode(Member member) {
38        super(member.getDisplayName());
39        MemberIcon memberIcon = new MemberIcon(member);
40        icon = memberIcon.getIcon();
41    }
42
43    public final DefaultMutableTreeNode createTreeNode() {
44       return new DefaultMutableTreeNode(this, true);
45    }
46
47    public final Icon getIcon() {
48        return icon;
49    }
50
51    public final String getShortString() {
52        return getName();
53    }
54
55    public final String getLongString() {
56        return getShortString();
57    }
58
59    public final String toString() {
60        return getName() + " " + getStart() + " " + getEnd();
61    }
62
63}