1 2 25 26 package org.aspectj.ajde.ui; 27 28 import java.util.List ; 29 import java.io.*; 30 31 import org.aspectj.asm.StructureNode; 32 33 36 public class BuildConfigNode extends StructureNode { 37 38 private String resourcePath; 39 private Kind kind; 40 private boolean isActive = true; 41 42 public BuildConfigNode(String name, Kind kind, String resourcePath) { 43 super(name, kind.toString()); 44 this.kind = kind; 45 this.resourcePath = resourcePath; 46 } 47 48 public BuildConfigNode(String name, String kind, String resourcePath, List children) { 49 super(name, kind, children); 50 this.resourcePath = resourcePath; 51 } 52 53 public String getResourcePath() { 54 return resourcePath; 55 } 56 57 public void setResourcePath(String resourcePath) { 58 this.resourcePath = resourcePath; 59 } 60 61 public boolean isValidResource() { 62 return name.endsWith(".java") 63 || name.endsWith(".aj") 64 || name.endsWith(".lst"); 65 } 66 67 public boolean isActive() { 68 return isActive; 69 } 70 71 public void setActive(boolean isActive) { 72 this.isActive = isActive; 73 } 74 75 78 public static class Kind implements Serializable { 79 80 public static final Kind FILE_JAVA = new Kind("Java source file"); 81 public static final Kind FILE_ASPECTJ = new Kind("AspectJ source file"); 82 public static final Kind FILE_LST = new Kind("build configuration file"); 83 public static final Kind ERROR = new Kind("error"); 84 public static final Kind DIRECTORY = new Kind("directory"); 85 86 87 public static final Kind[] ALL = { FILE_JAVA, FILE_ASPECTJ, FILE_LST, DIRECTORY }; 88 89 private final String name; 90 91 private Kind(String name) { 92 this.name = name; 93 } 94 95 public String toString() { 96 return name; 97 } 98 99 public boolean equals(Object o) { 100 return o.equals(name); 101 } 102 103 public boolean isDeclareKind() { 104 return name.startsWith("declare"); 105 } 106 107 private static int nextOrdinal = 0; 109 private final int ordinal = nextOrdinal++; 110 private Object readResolve() throws ObjectStreamException { 111 return ALL[ordinal]; 112 } 113 } 114 115 public Kind getBuildConfigNodeKind() { 116 return kind; 117 } 118 } 119 120 121 122 | Popular Tags |