• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java MatcherContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: createMatcherContext

import org.netbeans.spi.editor.bracesmatching.MatcherContext; //导入依赖的package包/类
public static MatcherContext createMatcherContext(Document document, int offset, boolean backward, int lookahead) {
    MasterMatcher.markTestThread();
    return SpiAccessor.get().createCaretContext(document, offset, backward, lookahead);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:BracesMatchingTestUtils.java


示例17: TestMatcher

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


示例18: createMatcher

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


示例19: BlockingMatcher

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


示例20: createMatcher

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Augmentation类代码示例发布时间:2022-05-22
下一篇:
Java RexWindowBound类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap