当前位置: 首页>>代码示例>>Java>>正文


Java TokenHierarchyEvent类代码示例

本文整理汇总了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);
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:SyntaxHighlighting.java

示例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);
        }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:OQLEditor.java

示例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");
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:TokenHierarchyOperation.java

示例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);
                }
            }
        }
    }
}
 
开发者ID:shannah,项目名称:mirah-nbm,代码行数:17,代码来源:TokenBalance.java

示例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;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:EditHistory.java

示例6: tokenHierarchyChanged

import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
@Override
public void tokenHierarchyChanged(TokenHierarchyEvent evt) {
    synchronized (this) {
        version++;
    }

    fireHighlightsChange(evt.affectedStartOffset(), evt.affectedEndOffset());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:EmbeddedSectionsHighlighting.java

示例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);
                }
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:TokenBalance.java

示例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);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:TokenBalance.java

示例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]);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:Highlighting.java

示例10: tokenHierarchyChanged

import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
@Override
public void tokenHierarchyChanged(TokenHierarchyEvent evt) {
    synchronized (this) {
        version++;
    }
    
    fireHighlightsChange(evt.affectedStartOffset(), evt.affectedEndOffset());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:EmbeddingHighlightsContainer.java

示例11: tokenHierarchyChanged

import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
public void tokenHierarchyChanged(TokenHierarchyEvent evt) {
    synchronized (this) {
        version++;
    }
    
    fireHighlightsChange(evt.affectedStartOffset(), evt.affectedEndOffset());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:XhtmlElHighlighting.java

示例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();
    }
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:TokenListUpdaterExtraTest.java

示例13: tokenHierarchyChanged

import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
public void tokenHierarchyChanged (TokenHierarchyEvent evt) {
    ParserManagerImpl pm = getPM ();
    if (pm == null) return;
    pm.startParsing ();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:ParserManagerImpl.java

示例14: tokenHierarchyChanged

import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
@Override
public void tokenHierarchyChanged(TokenHierarchyEvent evt) {
    resetState (true, false, evt.affectedStartOffset(), evt.affectedEndOffset(), false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:EventSupport.java

示例15: createTokenChangeEvent

import org.netbeans.api.lexer.TokenHierarchyEvent; //导入依赖的package包/类
public abstract TokenHierarchyEvent createTokenChangeEvent(
TokenHierarchyEventInfo info);
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:3,代码来源:LexerApiPackageAccessor.java


注:本文中的org.netbeans.api.lexer.TokenHierarchyEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。