PageRenderTime 64ms CodeModel.GetById 12ms 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
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
  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. */
  20. package org.jedit.ruby.structure;
  21. import sidekick.Asset;
  22. import javax.swing.tree.DefaultMutableTreeNode;
  23. import javax.swing.Icon;
  24. import org.jedit.ruby.ast.Member;
  25. import org.jedit.ruby.icons.MemberIcon;
  26. /**
  27. * @author robmckinnon at users.sourceforge.net
  28. */
  29. final class MemberNode extends Asset {
  30. private final Icon icon;
  31. public MemberNode(Member member) {
  32. super(member.getDisplayName());
  33. MemberIcon memberIcon = new MemberIcon(member);
  34. icon = memberIcon.getIcon();
  35. }
  36. public final DefaultMutableTreeNode createTreeNode() {
  37. return new DefaultMutableTreeNode(this, true);
  38. }
  39. public final Icon getIcon() {
  40. return icon;
  41. }
  42. public final String getShortString() {
  43. return getName();
  44. }
  45. public final String getLongString() {
  46. return getShortString();
  47. }
  48. public final String toString() {
  49. return getName() + " " + getStart() + " " + getEnd();
  50. }
  51. }