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.

StructureViewProperties.java 7.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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.util.*;
  16. import org.aspectj.asm.*;
  17. /**
  18. * Nested properties use the typesafe enum pattern.
  19. *
  20. * @author Mik Kersten
  21. */
  22. public class StructureViewProperties {
  23. /**
  24. * @deprecated
  25. */
  26. public static final String SORT_DECLARATIONAL = StructureViewProperties.Sorting.DECLARATIONAL.toString();
  27. /**
  28. * @deprecated
  29. */
  30. public void setSorting(String sorting) { }
  31. private List relations = new ArrayList();
  32. private List filteredMemberAccessibility = new ArrayList();
  33. private List filteredMemberModifiers = new ArrayList();
  34. private List filteredMemberKinds = new ArrayList();
  35. private List grouping = new ArrayList();
  36. private Sorting sorting = Sorting.DECLARATIONAL;
  37. private Granularity granularity = StructureViewProperties.Granularity.DECLARED_ELEMENTS;
  38. public List getRelations() {
  39. return relations;
  40. }
  41. public void setRelations(List relations) {
  42. this.relations = relations;
  43. }
  44. public void addRelation(IRelationship.Kind kind) {
  45. relations.add(kind);
  46. }
  47. public void removeRelation(IRelationship.Kind kind) {
  48. relations.remove(kind);
  49. }
  50. public void setFilteredMemberAccessibility(List memberVisibility) {
  51. this.filteredMemberAccessibility = memberVisibility;
  52. }
  53. public List getFilteredMemberAccessibility() {
  54. return filteredMemberAccessibility;
  55. }
  56. public void addFilteredMemberAccessibility(IProgramElement.Accessibility accessibility) {
  57. this.filteredMemberAccessibility.add(accessibility);
  58. }
  59. public void removeFilteredMemberAccessibility(IProgramElement.Accessibility accessibility) {
  60. this.filteredMemberAccessibility.remove(accessibility);
  61. }
  62. public List getFilteredMemberModifiers() {
  63. return filteredMemberModifiers;
  64. }
  65. public void setFilteredMemberModifiers(List memberModifiers) {
  66. this.filteredMemberModifiers = memberModifiers;
  67. }
  68. public void addFilteredMemberModifiers(IProgramElement.Modifiers modifiers) {
  69. this.filteredMemberModifiers.add(modifiers);
  70. }
  71. public void removeFilteredMemberModifiers(IProgramElement.Modifiers modifiers) {
  72. this.filteredMemberModifiers.remove(modifiers);
  73. }
  74. public StructureViewProperties.Sorting getSorting() {
  75. return sorting;
  76. }
  77. public void setSorting(StructureViewProperties.Sorting sorting) {
  78. this.sorting = sorting;
  79. }
  80. public List getFilteredMemberKinds() {
  81. return filteredMemberKinds;
  82. }
  83. public void setFilteredMemberKinds(List memberKinds) {
  84. this.filteredMemberKinds = memberKinds;
  85. }
  86. public void addFilteredMemberKind(IProgramElement.Kind kind) {
  87. this.filteredMemberKinds.add(kind);
  88. }
  89. public void removeFilteredMemberKind(IProgramElement.Kind kind) {
  90. this.filteredMemberKinds.remove(kind);
  91. }
  92. public List getGrouping() {
  93. return grouping;
  94. }
  95. public void setGrouping(List grouping) {
  96. this.grouping = grouping;
  97. }
  98. public void addGrouping(Grouping grouping) {
  99. this.grouping.add(grouping);
  100. }
  101. public void removeGrouping(Grouping grouping) {
  102. this.grouping.remove(grouping);
  103. }
  104. public Granularity getGranularity() {
  105. return granularity;
  106. }
  107. public void setGranularity(Granularity granularity) {
  108. this.granularity = granularity;
  109. }
  110. public String getName() {
  111. return "<unnamed view>";
  112. }
  113. public String toString() {
  114. return "\nView Properties:"
  115. + "\n-> sorting: " + sorting
  116. + "\n-> grouping: " + grouping
  117. + "\n-> filtered member kinds: " + filteredMemberKinds
  118. + "\n-> filtered member accessibility: " + filteredMemberAccessibility
  119. + "\n-> filtered member modifiers: " + filteredMemberModifiers
  120. + "\n-> relations: " + relations;
  121. }
  122. public static class Hierarchy {
  123. public static final Hierarchy DECLARATION = new Hierarchy("package hierarchy");
  124. public static final Hierarchy CROSSCUTTING = new Hierarchy("crosscutting structure");
  125. public static final Hierarchy INHERITANCE = new Hierarchy("type hierarchy");
  126. public static final Hierarchy[] ALL = { DECLARATION, CROSSCUTTING, INHERITANCE };
  127. private final String name;
  128. private Hierarchy(String name) {
  129. this.name = name;
  130. }
  131. public String toString() {
  132. return name;
  133. }
  134. // The 4 declarations below are necessary for serialization
  135. private static int nextOrdinal = 0;
  136. private final int ordinal = nextOrdinal++;
  137. private Object readResolve() throws ObjectStreamException {
  138. return ALL[ordinal];
  139. }
  140. }
  141. public static class Grouping {
  142. public static final Grouping KIND = new Grouping("group by kind");
  143. public static final Grouping VISIBILITY = new Grouping("group by visibility");
  144. public static final Grouping[] ALL = { KIND, VISIBILITY };
  145. private final String name;
  146. private Grouping(String name) {
  147. this.name = name;
  148. }
  149. public String toString() {
  150. return name;
  151. }
  152. // The 4 declarations below are necessary for serialization
  153. private static int nextOrdinal = 0;
  154. private final int ordinal = nextOrdinal++;
  155. private Object readResolve() throws ObjectStreamException {
  156. return ALL[ordinal];
  157. }
  158. }
  159. public static class Sorting {
  160. public static final Sorting ALPHABETICAL = new Sorting("sort alphabetically");
  161. public static final Sorting DECLARATIONAL = new Sorting("sort declarationally");
  162. public static final Sorting[] ALL = { ALPHABETICAL, DECLARATIONAL };
  163. private final String name;
  164. private Sorting(String name) {
  165. this.name = name;
  166. }
  167. public String toString() {
  168. return name;
  169. }
  170. // The 4 declarations below are necessary for serialization
  171. private static int nextOrdinal = 0;
  172. private final int ordinal = nextOrdinal++;
  173. private Object readResolve() throws ObjectStreamException {
  174. return ALL[ordinal];
  175. }
  176. }
  177. public static class Granularity {
  178. public static final Granularity PACKAGE = new Granularity("package");
  179. public static final Granularity FILE = new Granularity("file");
  180. public static final Granularity TYPE = new Granularity("type");
  181. public static final Granularity MEMBER = new Granularity("member");
  182. public static final Granularity DECLARED_ELEMENTS = new Granularity("declared body elements");
  183. public static final Granularity[] ALL = { PACKAGE, FILE, TYPE, MEMBER, DECLARED_ELEMENTS };
  184. private final String name;
  185. private Granularity(String name) {
  186. this.name = name;
  187. }
  188. public String toString() {
  189. return name;
  190. }
  191. // The 4 declarations below are necessary for serialization
  192. private static int nextOrdinal = 0;
  193. private final int ordinal = nextOrdinal++;
  194. private Object readResolve() throws ObjectStreamException {
  195. return ALL[ordinal];
  196. }
  197. }
  198. }