1 11 package org.eclipse.core.internal.resources; 12 13 import java.util.HashSet ; 14 import java.util.Set ; 15 import org.eclipse.core.runtime.IConfigurationElement; 16 import org.eclipse.core.runtime.IExtension; 17 18 public class MarkerTypeDefinition { 20 protected String type; 21 protected Set superTypes; 22 protected Set attributeNames; 23 protected boolean persistent = false; 24 protected String name; 25 26 public MarkerTypeDefinition(IExtension ext) { 27 super(); 28 this.type = ext.getUniqueIdentifier(); 29 this.name = ext.getLabel(); 30 IConfigurationElement[] elements = ext.getConfigurationElements(); 31 Set types = null; 32 Set attributes = null; 33 for (int i = 0; i < elements.length; i++) { 34 IConfigurationElement element = elements[i]; 35 36 final String elementName = element.getName(); 38 if (elementName.equalsIgnoreCase("super")) { String type = element.getAttribute("type"); if (type != null) { 41 if (types == null) 42 types = new HashSet (3); 43 types.add(type); 44 } 45 } 46 47 if (elementName.equalsIgnoreCase("attribute")) { String name = element.getAttribute("name"); if (name != null) { 51 if (attributes == null) 52 attributes = new HashSet (3); 53 attributes.add(name); 54 } 55 } 56 57 if (elementName.equalsIgnoreCase("persistent")) { String bool = element.getAttribute("value"); if (bool != null) 61 this.persistent = Boolean.valueOf(bool).booleanValue(); 62 } 63 if (elementName.equalsIgnoreCase("transient")) { String bool = element.getAttribute("value"); if (bool != null) 67 this.persistent = !Boolean.valueOf(bool).booleanValue(); 68 } 69 } 70 71 this.superTypes = types; 73 this.attributeNames = attributes; 74 } 75 76 public Set getAttributeNames() { 77 return attributeNames; 78 } 79 80 public String getName() { 81 return name; 82 } 83 84 public Set getSuperTypes() { 85 return superTypes; 86 } 87 88 public String getType() { 89 return type; 90 } 91 92 public boolean persistent() { 93 return persistent; 94 } 95 96 public String toString() { 97 StringBuffer buffer = new StringBuffer (40); 98 buffer.append(this.getClass().getName()); 99 buffer.append("\n\ttype=" + type); buffer.append("\n\tname=" + name); buffer.append("\n\tsupertypes=" + superTypes); buffer.append("\n\tattributenames=" + attributeNames); buffer.append("\n\tpersistent=" + persistent); return buffer.toString(); 105 } 106 } | Popular Tags |