You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

IStructureViewNode.java 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /* *******************************************************************
  2. * Copyright (c) 1999-2001 Xerox Corporation,
  3. * 2002 Palo Alto Research Center, Incorporated (PARC).
  4. * All rights reserved.
  5. * This program and the accompanying materials are made available
  6. * under the terms of the Eclipse Public License v1.0
  7. * which accompanies this distribution and is available at
  8. * http://www.eclipse.org/legal/epl-v10.html
  9. *
  10. * Contributors:
  11. * Xerox/PARC initial implementation
  12. * ******************************************************************/
  13. package org.aspectj.ajde.ui;
  14. import java.io.ObjectStreamException;
  15. import java.io.Serializable;
  16. import java.util.List;
  17. import org.aspectj.asm.IProgramElement;
  18. /**
  19. * @author Mik Kersten
  20. */
  21. public interface IStructureViewNode {
  22. public IProgramElement getStructureNode();
  23. public AbstractIcon getIcon();
  24. /**
  25. * Add a child node.
  26. */
  27. public void add(IStructureViewNode child);
  28. /**
  29. * Add a child node.
  30. */
  31. public void add(IStructureViewNode child, int position);
  32. /**
  33. * Remove a child node.
  34. */
  35. public void remove(IStructureViewNode child);
  36. /**
  37. * @return an empty list if there are no children
  38. */
  39. public List getChildren();
  40. public Kind getKind();
  41. public String getRelationshipName();
  42. /**
  43. * Uses "typesafe enum" pattern.
  44. */
  45. public static class Kind implements Serializable {
  46. private static final long serialVersionUID = 6730849292562214877L;
  47. public static final Kind DECLARATION = new Kind("declaration");
  48. public static final Kind RELATIONSHIP = new Kind("relationship");
  49. public static final Kind LINK = new Kind("link");
  50. public static final Kind[] ALL = { DECLARATION, RELATIONSHIP, LINK };
  51. private final String name;
  52. private Kind(String name) {
  53. this.name = name;
  54. }
  55. public String toString() {
  56. return name;
  57. }
  58. // The 4 declarations below are necessary for serialization
  59. private static int nextOrdinal = 0;
  60. private final int ordinal = nextOrdinal++;
  61. private Object readResolve() throws ObjectStreamException {
  62. return ALL[ordinal];
  63. }
  64. }
  65. }