1 19 20 package org.netbeans.api.lexer; 21 22 import org.netbeans.lib.lexer.inc.TokenHierarchyEventInfo; 23 import org.netbeans.lib.lexer.inc.TokenListChange; 24 25 31 32 public final class TokenHierarchyEvent extends java.util.EventObject { 33 34 private final TokenHierarchyEventInfo info; 35 36 TokenHierarchyEvent(TokenHierarchyEventInfo info) { 37 super(info.tokenHierarchyOperation().tokenHierarchy()); 38 this.info = info; 39 } 40 41 44 public TokenHierarchy<?> tokenHierarchy() { 45 return (TokenHierarchy<?>)getSource(); 46 } 47 48 51 public TokenHierarchyEventType type() { 52 return info.type(); 53 } 54 55 59 public TokenChange<? extends TokenId> tokenChange() { 60 return info.tokenChange(); 61 } 62 63 72 public <T extends TokenId> TokenChange<T> tokenChange(Language<T> language) { 73 TokenChange<? extends TokenId> tc = tokenChange(); 74 @SuppressWarnings ("unchecked") 75 TokenChange<T> tcl = (tc != null && tc.language() == language) ? (TokenChange<T>)tc : null; 76 return tcl; 77 } 78 79 83 public int affectedStartOffset() { 84 return info.affectedStartOffset(); 85 } 86 87 94 public int affectedEndOffset() { 95 return info.affectedEndOffset(); 96 } 97 98 104 public int modificationOffset() { 105 return info.modificationOffset(); 106 } 107 108 117 public int insertedLength() { 118 return info.insertedLength(); 119 } 120 121 130 public int removedLength() { 131 return info.removedLength(); 132 } 133 134 135 } | Popular Tags |