本文整理汇总了Java中org.netbeans.api.lexer.TokenHierarchyEvent类的典型用法代码示例。如果您正苦于以下问题:Java TokenHierarchyEvent类的具体用法?Java TokenHierarchyEvent怎么用?Java TokenHierarchyEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
TokenHierarchyEvent类属于org.netbeans.api.lexer包,在下文中一共展示了TokenHierarchyEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tokenHierarchyChanged
import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
public @Override void tokenHierarchyChanged(TokenHierarchyEvent evt) {
if (evt.type() == TokenHierarchyEventType.LANGUAGE_PATHS) {
// ignore
return;
}
synchronized (this) {
version++;
}
if (LOG.isLoggable(Level.FINEST)) {
StringBuilder sb = new StringBuilder();
TokenSequence<?> ts = hierarchy.tokenSequence();
sb.append("\n"); //NOI18N
sb.append("Tokens after change: <").append(evt.affectedStartOffset()).append(", ").append(evt.affectedEndOffset()).append(">\n"); //NOI18N
dumpSequence(ts, sb);
sb.append("--------------------------------------------\n\n"); //NOI18N
LOG.finest(sb.toString());
}
fireHighlightsChange(evt.affectedStartOffset(), evt.affectedEndOffset());
// fireHighlightsChange(0, Integer.MAX_VALUE);
}
示例2: tokenHierarchyChanged
import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
public void tokenHierarchyChanged(TokenHierarchyEvent evt) {
TokenSequence ts = evt.tokenHierarchy().tokenSequence();
validFlag = true;
if (ts.tokenCount() == 0) {
validFlag = false;
} else {
while (ts.moveNext()) {
if (ts.token().id() == OQLTokenId.ERROR) {
validFlag = false;
break;
}
}
}
getValidationCallback(document).callback(validFlag);
// parent.firePropertyChange(VALIDITY_PROPERTY, oldValidity, validFlag);
}
示例3: fireTokenHierarchyChanged
import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
public void fireTokenHierarchyChanged(TokenHierarchyEventInfo eventInfo) {
TokenHierarchyEvent evt = LexerApiPackageAccessor.get().createTokenChangeEvent(eventInfo);
Object[] listeners = listenerList.getListenerList();
int listenersLength = listeners.length;
boolean loggable = LOG_EVENT.isLoggable(Level.FINE);
long tm = 0;
if (loggable) {
LOG_EVENT.fine("Firing " + evt + " to " + listenersLength/2 + " listeners:\n");
}
for (int i = 1; i < listenersLength; i += 2) {
if (loggable) {
tm = System.currentTimeMillis();
}
((TokenHierarchyListener)listeners[i]).tokenHierarchyChanged(evt);
if (loggable) {
LOG_EVENT.fine(String.valueOf(System.currentTimeMillis() - tm) + "ms: Fired to " + listeners[i] + "\n");
}
}
if (loggable) {
LOG_EVENT.fine("----- Finished firing of " + evt + "\n");
}
}
示例4: tokenHierarchyChanged
import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
public void tokenHierarchyChanged(TokenHierarchyEvent evt) {
synchronized (lang2handler) {
if (evt.type() == TokenHierarchyEventType.ACTIVITY ||
evt.type() == TokenHierarchyEventType.REBUILD)
{
scanDone = false;
} else {
if (scanDone) { // Only update if the full scan was already done
for (LanguageHandler<?> handler : lang2handler.values()) {
handler.handleEvent(evt);
}
}
}
}
}
示例5: tokenHierarchyChanged
import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
public void tokenHierarchyChanged(TokenHierarchyEvent evt) {
TokenHierarchyEventType type = evt.type();
if (type == TokenHierarchyEventType.MODIFICATION) {
changed(evt.tokenChange());
} else if (type == TokenHierarchyEventType.REBUILD) {
// Lexing has fundamentally changed, don't try to do anything incremental
valid = false;
}
}
示例6: tokenHierarchyChanged
import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
@Override
public void tokenHierarchyChanged(TokenHierarchyEvent evt) {
synchronized (this) {
version++;
}
fireHighlightsChange(evt.affectedStartOffset(), evt.affectedEndOffset());
}
示例7: tokenHierarchyChanged
import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
public void tokenHierarchyChanged(TokenHierarchyEvent evt) {
synchronized (lang2handler) {
if (evt.type() == TokenHierarchyEventType.ACTIVITY ||
evt.type() == TokenHierarchyEventType.REBUILD)
{
scanDone = false;
} else {
if (scanDone) { // Only update if the full scan was already done
for (LanguageHandler<?> handler : lang2handler.values()) {
handler.handleEvent(evt);
}
}
}
}
}
示例8: handleEvent
import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
public void handleEvent(TokenHierarchyEvent evt) {
for (TokenChange<T> tokenChange : collectTokenChanges(evt.tokenChange(), new ArrayList<TokenChange<T>>())) {
if (tokenChange.removedTokenCount() > 0) {
processTokenSequence(tokenChange.removedTokenSequence(), tokenChange.removedTokenCount(), false, -1);
}
if (tokenChange.addedTokenCount() > 0) {
processTokenSequence(tokenChange.currentTokenSequence(), tokenChange.addedTokenCount(), false, +1);
}
}
}
示例9: tokenHierarchyChanged
import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
@Override
public void tokenHierarchyChanged(TokenHierarchyEvent evt) {
TokenChange<?> tc = evt.tokenChange();
int affectedArea [] = null;
TokenSequence<? extends TokenId> seq = tc.currentTokenSequence();
if (seq.language().equals(JavadocTokenId.language())) {
// Change inside javadoc
int [] firstSentence = findFirstSentence(seq);
if (firstSentence != null) {
if (tc.offset() <= firstSentence[1]) {
// Change before the end of the first sentence
affectedArea = firstSentence;
}
} else {
// XXX: need the embedding token (i.e. JavaTokenId.JAVADOC_COMMENT*)
// and fire a change in its whole area
affectedArea = new int [] { tc.offset(), evt.affectedEndOffset() };
}
} else {
// The change may or may not involve javadoc, so reset everyting.
// It would be more efficient to traverse the changed area and
// find out whether it really involves javadoc or not.
affectedArea = new int [] { tc.offset(), evt.affectedEndOffset() };
}
if (affectedArea != null) {
synchronized (this) {
version++;
}
fireHighlightsChange(affectedArea[0], affectedArea[1]);
}
}
示例10: tokenHierarchyChanged
import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
@Override
public void tokenHierarchyChanged(TokenHierarchyEvent evt) {
synchronized (this) {
version++;
}
fireHighlightsChange(evt.affectedStartOffset(), evt.affectedEndOffset());
}
示例11: tokenHierarchyChanged
import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
public void tokenHierarchyChanged(TokenHierarchyEvent evt) {
synchronized (this) {
version++;
}
fireHighlightsChange(evt.affectedStartOffset(), evt.affectedEndOffset());
}
示例12: testSaveTokensWithinLookahead
import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
public void testSaveTokensWithinLookahead() throws Exception {
Document doc = new ModificationTextDocument();
String text = "aabc";
doc.insertString(0, text, null);
doc.putProperty(Language.class, TestSaveTokensInLATokenId.language());
TokenHierarchy<?> hi = TokenHierarchy.get(doc);
((AbstractDocument)doc).readLock();
try {
TokenSequence<?> ts = hi.tokenSequence();
ts.moveEnd(); // Force creation of all tokens
LexerTestUtilities.initLastTokenHierarchyEventListening(doc);
} finally {
((AbstractDocument)doc).readUnlock();
}
doc.remove(1, 1);
((AbstractDocument)doc).readLock();
try {
TokenHierarchyEvent evt = LexerTestUtilities.getLastTokenHierarchyEvent(doc);
TokenChange<?> change = evt.tokenChange();
assertEquals(1, change.addedTokenCount());
} finally {
((AbstractDocument)doc).readUnlock();
}
}
示例13: tokenHierarchyChanged
import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
public void tokenHierarchyChanged (TokenHierarchyEvent evt) {
ParserManagerImpl pm = getPM ();
if (pm == null) return;
pm.startParsing ();
}
示例14: tokenHierarchyChanged
import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
@Override
public void tokenHierarchyChanged(TokenHierarchyEvent evt) {
resetState (true, false, evt.affectedStartOffset(), evt.affectedEndOffset(), false);
}
示例15: createTokenChangeEvent
import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
public abstract TokenHierarchyEvent createTokenChangeEvent(
TokenHierarchyEventInfo info);