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


Java MatcherContext类代码示例

本文整理汇总了Java中org.netbeans.spi.editor.bracesmatching.MatcherContext的典型用法代码示例。如果您正苦于以下问题:Java MatcherContext类的具体用法?Java MatcherContext怎么用?Java MatcherContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MatcherContext类属于org.netbeans.spi.editor.bracesmatching包,在下文中一共展示了MatcherContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: block

import org.netbeans.spi.editor.bracesmatching.MatcherContext; //导入依赖的package包/类
private void block() throws InterruptedException {
    blocking = true;
    System.out.println(matcherId + ": blocking");
    try {
        //System.out.println("!!! Blocking: " + this + ", offset = " + context.getCaretOffset());
        for( ; !breakOutFromTheLoop; ) {
            if (MatcherContext.isTaskCanceled()) {
                System.out.println(matcherId + ": cancelled");
                return;
            }
        }
    } finally {
        //System.out.println("!!! Not Blocking: " + this + ", offset = " + context.getCaretOffset());
        System.out.println(matcherId + ": block terminated");
        blocking = false;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:MasterMatcherTest.java

示例2: findOrigin

import org.netbeans.spi.editor.bracesmatching.MatcherContext; //导入依赖的package包/类
@Override
public int[] findOrigin() throws InterruptedException, BadLocationException {
    
    if(MatcherContext.isTaskCanceled()) {
        return null;
    }
    int offset = context.getSearchOffset();
    TokenHierarchy th = TokenHierarchy.get(context.getDocument());
    TokenSequence<SilverstripeTokenId> ts = th.tokenSequence(SilverstripeTokenId.getLanguage());
    if(ts == null) {
        return null;
    }
    ts.move(offset);
    if(ts.moveNext() && SilverstripeTokenId.hasMatches(ts.token().id())) {
        return new int[] {ts.token().offset(th), ts.token().offset(th) + ts.token().length()};
    }
    return null;
}
 
开发者ID:jdemeschew,项目名称:stpnb,代码行数:19,代码来源:SilverstripeBracesMatching.java

示例3: createMatcher

import org.netbeans.spi.editor.bracesmatching.MatcherContext; //导入依赖的package包/类
public BracesMatcher createMatcher(MatcherContext context) {
    Document d = context.getDocument();
    
    if (d instanceof BaseDocument) {
        SyntaxSupport ss = ((BaseDocument) d).getSyntaxSupport();
        if (ss instanceof ExtSyntaxSupport && ss.getClass() != ExtSyntaxSupport.class) {
            return new LegacyEssMatcher(context, (ExtSyntaxSupport) ss);
        }
    }
    
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:LegacyEssMatcher.java

示例4: defaultMatcherFactory

import org.netbeans.spi.editor.bracesmatching.MatcherContext; //导入依赖的package包/类
private static BracesMatcherFactory defaultMatcherFactory() {
    return new BracesMatcherFactory() {
        public BracesMatcher createMatcher(MatcherContext context) {
            return defaultMatcher(context, -1, -1);
        }
    };
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:BracesMatcherSupport.java

示例5: CharacterMatcher

import org.netbeans.spi.editor.bracesmatching.MatcherContext; //导入依赖的package包/类
public CharacterMatcher(MatcherContext context, int lowerBound, int upperBound, char... matchingPairs) {
    this.context = context;
    this.lowerBound = lowerBound == -1 ? Integer.MIN_VALUE : lowerBound;
    this.upperBound = upperBound == -1 ? Integer.MAX_VALUE : upperBound;
    
    assert matchingPairs.length % 2 == 0 : "The matchingPairs parameter must contain even number of characters."; //NOI18N
    this.matchingPairs = matchingPairs;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:CharacterMatcher.java

示例6: findOrigin

import org.netbeans.spi.editor.bracesmatching.MatcherContext; //导入依赖的package包/类
public int[] findOrigin() throws InterruptedException, BadLocationException {
    
    if (MatcherContext.isTaskCanceled()) {
        return null;
    }
    //so that we could use this from unit tests
    int[] origin = doFindOrigin();
    if(origin != null)
        return origin;

    defaultMatcher = BracesMatcherSupport.defaultMatcher(context, -1, -1);
    return defaultMatcher.findOrigin();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:XMLBraceMatcher.java

示例7: findMatches

import org.netbeans.spi.editor.bracesmatching.MatcherContext; //导入依赖的package包/类
public int[] findMatches() throws InterruptedException, BadLocationException {
   
    if (MatcherContext.isTaskCanceled()) {
        return null;
    }

    if(defaultMatcher != null) {
        return defaultMatcher.findMatches();
    }

    return doFindMatches();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:XMLBraceMatcher.java

示例8: createMatcher

import org.netbeans.spi.editor.bracesmatching.MatcherContext; //导入依赖的package包/类
private BracesMatcher createMatcher(int offset, boolean searchBackward, int lookahead) {
    MatcherContext context = BracesMatchingTestUtils.createMatcherContext(document, offset, searchBackward, lookahead);
    BracesMatcher matcher = MATCHER_FACTORY.createMatcher(context);
    
    assertNotNull(matcher);
    
    return matcher;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:HtmlMatcherTest.java

示例9: createMatcher

import org.netbeans.spi.editor.bracesmatching.MatcherContext; //导入依赖的package包/类
@Override
public BracesMatcher createMatcher(final MatcherContext context) {
    final SilverstripeBracesMatching[] ret = {null};
    context.getDocument().render(new Runnable() {
        @Override
        public void run() {
            TokenHierarchy<Document> hierarchy = TokenHierarchy.get(context.getDocument());
            if(hierarchy.tokenSequence().language() == SilverstripeTokenId.getLanguage()) {
                ret[0] = new SilverstripeBracesMatching(context);
            }
        }
        
    });
    return ret[0];
}
 
开发者ID:jdemeschew,项目名称:stpnb,代码行数:16,代码来源:SilverstripeBracesMatching.java

示例10: CharacterMatcher

import org.netbeans.spi.editor.bracesmatching.MatcherContext; //导入依赖的package包/类
public CharacterMatcher(MatcherContext context, int lowerBound, int upperBound, char... matchingPairs) {
    this.context = context;
    this.lowerBound = lowerBound == -1 ? Integer.MIN_VALUE : lowerBound;
    this.upperBound = upperBound == -1 ? Integer.MAX_VALUE : upperBound;

    assert matchingPairs.length % 2 == 0 : "The matchingPairs parameter must contain even number of characters."; //NOI18N
    this.matchingPairs = matchingPairs;
}
 
开发者ID:golo-lang,项目名称:golo-netbeans,代码行数:9,代码来源:CharacterMatcher.java

示例11: matchEqualChar

import org.netbeans.spi.editor.bracesmatching.MatcherContext; //导入依赖的package包/类
public static int matchEqualChar(Document document, int offsetBackward, int limitBackward, int offsetForward, int limitForward, char origin, char matching) throws BadLocationException {
    int lookaheadBackward = offsetBackward - limitBackward;
    int lookaheadForward = limitForward - offsetForward;

    // check the character at the left from the caret
    Segment textBackward = new Segment();
    document.getText(offsetBackward - lookaheadBackward, lookaheadBackward, textBackward);
    int countBackward = 0;
    int offsetMatchBackward = -1;
    for (int i = 0; i < lookaheadBackward; i++) {
        if (MatcherContext.isTaskCanceled()) {
            return -1;
        }
        if (origin == textBackward.array[textBackward.offset + i]) {
            countBackward++;
            if (countBackward > 0 && (countBackward % 2) != 0) {
                offsetMatchBackward = offsetBackward - (lookaheadBackward - i);
            } else {
                offsetMatchBackward = -1;
            }
        }
    }
    if (offsetMatchBackward == -1) {
        // check the character at the right from the caret
        Segment textForward = new Segment();
        document.getText(offsetForward, lookaheadForward, textForward);
        for (int i = 0; i < lookaheadForward; i++) {
            if (MatcherContext.isTaskCanceled()) {
                return -1;
            }
            if (origin == textForward.array[textForward.offset + i]) {
                return offsetForward + i;
            }
        }
    }

    return offsetMatchBackward;
}
 
开发者ID:golo-lang,项目名称:golo-netbeans,代码行数:39,代码来源:BracesMatcherGoloSupport.java

示例12: BraceHighlighting

import org.netbeans.spi.editor.bracesmatching.MatcherContext; //导入依赖的package包/类
public BraceHighlighting(String topLevelMimeType, MatcherContext context) {
    this.topLevelMimeType = topLevelMimeType;
    this.context = context;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:BraceHighlighting.java

示例13: createMatcher

import org.netbeans.spi.editor.bracesmatching.MatcherContext; //导入依赖的package包/类
public BracesMatcher createMatcher(MatcherContext context) {
    return new BraceHighlighting(topLevelMimeType, context);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:BraceHighlighting.java

示例14: defaultFindOrigin

import org.netbeans.spi.editor.bracesmatching.MatcherContext; //导入依赖的package包/类
private int [] defaultFindOrigin(MatcherContext context) throws InterruptedException, BadLocationException {
    defaultMatcher = BracesMatcherSupport.defaultMatcher(context, -1, -1);
    return defaultMatcher.findOrigin();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:BraceHighlighting.java

示例15: LegacyEssMatcher

import org.netbeans.spi.editor.bracesmatching.MatcherContext; //导入依赖的package包/类
private LegacyEssMatcher(MatcherContext context, ExtSyntaxSupport ess) {
    this.context = context;
    this.ess = ess;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:LegacyEssMatcher.java


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