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

Java BracesMatcher类代码示例

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

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



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

示例1: fireMatchesHighlighted

import org.netbeans.spi.editor.bracesmatching.BracesMatcher; //导入依赖的package包/类
private void fireMatchesHighlighted(Position[] origin, Position[] matches, BracesMatcher.ContextLocator locator) {
    MatchListener[] ll;
    synchronized (LOCK) {
        if (matchListeners.isEmpty()) {
            return;
        }
        ll = (MatchListener[]) matchListeners.toArray(new MatchListener[matchListeners.size()]);
    }
    if (ll.length == 0) {
        return;
    }
    MatchEvent evt = new MatchEvent(component, locator, this);
    evt.setHighlights(origin, matches);
    for (int i = 0; i < ll.length; i++) {
        MatchListener matchListener = ll[i];
        matchListener.matchHighlighted(evt);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:MasterMatcher.java


示例2: testBoundaries

import org.netbeans.spi.editor.bracesmatching.BracesMatcher; //导入依赖的package包/类
public void testBoundaries() throws Exception {
    setDocumentText("<p><a></a></p>");
    //               0123456789012345678901234567890123456789
    //               0         1         2         3

    //backward search
    BracesMatcher matcher = createMatcher(10, false, 1);
    assertOrigin(10, 14, matcher);
    assertMatch(0, 2, 2, 3, matcher);
    
    matcher = createMatcher(6, false, 1);
    assertOrigin(6, 10, matcher);
    assertMatch(3, 5, 5, 6, matcher);

    //forward search
    matcher = createMatcher(10, true, 1);
    assertOrigin(6, 10, matcher);
    assertMatch(3, 5, 5, 6, matcher);

    matcher = createMatcher(6, true, 1);
    assertOrigin(3, 6, matcher);
    assertMatch(6, 10, -1, -1, matcher);
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:HtmlMatcherTest.java


示例3: createMatcher

import org.netbeans.spi.editor.bracesmatching.BracesMatcher; //导入依赖的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.BracesMatcher; //导入依赖的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: testMatchingOnEmptyFile

import org.netbeans.spi.editor.bracesmatching.BracesMatcher; //导入依赖的package包/类
public void testMatchingOnEmptyFile() throws Exception {
    setDocumentText(" ");
    BracesMatcher matcher = createMatcher(0, false, 1);
    
    assertNull(matcher.findOrigin());
    assertNull(matcher.findMatches());
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:HtmlMatcherTest.java


示例6: testNoOrigin

import org.netbeans.spi.editor.bracesmatching.BracesMatcher; //导入依赖的package包/类
public void testNoOrigin() throws Exception {
    setDocumentText("<html>  <body> nazdar </body> </html>");
    //               0123456789012345678901234567890123456789
    //               0         1         2         3
    BracesMatcher matcher = createMatcher(7, false, 1);
    assertNull(matcher.findOrigin());
    assertNull(matcher.findMatches());
    
    matcher = createMatcher(17, false, 1);
    assertNull(matcher.findOrigin());
    assertNull(matcher.findMatches());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:HtmlMatcherTest.java


示例7: testForward

import org.netbeans.spi.editor.bracesmatching.BracesMatcher; //导入依赖的package包/类
public void testForward() throws Exception {
    setDocumentText("<p><a> nazdar </a> </p>");
    //               0123456789012345678901234567890123456789
    //               0         1         2         3
    BracesMatcher matcher = createMatcher(0, false, 1);
    assertOrigin(0, 3, matcher);
    assertMatch(19, 23, matcher);
    
    matcher = createMatcher(4, false, 1);
    assertOrigin(3, 6, matcher);
    assertMatch(14, 18, matcher);
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:HtmlMatcherTest.java


示例8: testBackward

import org.netbeans.spi.editor.bracesmatching.BracesMatcher; //导入依赖的package包/类
public void testBackward() throws Exception {
    setDocumentText("<p><a> nazdar </a> </p>");
    //               0123456789012345678901234567890123456789
    //               0         1         2         3
    BracesMatcher matcher = createMatcher(15, false, 1);
    assertOrigin(14, 18, matcher);
    assertMatch(3, 5, 5, 6, matcher);
    
    matcher = createMatcher(20, false, 1);
    assertOrigin(19, 23, matcher);
    assertMatch(0, 2, 2, 3, matcher);
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:HtmlMatcherTest.java


示例9: testNoMatch

import org.netbeans.spi.editor.bracesmatching.BracesMatcher; //导入依赖的package包/类
public void testNoMatch() throws Exception {
    setDocumentText("<html><div></body></html>");
    //               0123456789012345678901234567890123456789
    //               0         1         2         3
    BracesMatcher matcher = createMatcher(13, false, 1);
    assertOrigin(11, 18, matcher);
    assertMatch(13, 13, matcher); //body has optional end tag so returning the searched position range (hack)
    
    matcher = createMatcher(8, false, 1);
    assertOrigin(6, 11, matcher);
    assertNull(matcher.findMatches());
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:HtmlMatcherTest.java


示例10: testBlockComment

import org.netbeans.spi.editor.bracesmatching.BracesMatcher; //导入依赖的package包/类
public void testBlockComment() throws Exception {
    setDocumentText("<!-- comment -->");
    //               0123456789012345678901234567890123456789
    //               0         1         2         3
    BracesMatcher matcher = createMatcher(1, false, 1);
    assertOrigin(0, 4, matcher);
    assertMatch(13, 16, matcher);
    
    matcher = createMatcher(14, false, 1);
    assertOrigin(13, 16, matcher);
    assertMatch(0, 4, matcher);
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:HtmlMatcherTest.java


示例11: testMultilineBlockComment

import org.netbeans.spi.editor.bracesmatching.BracesMatcher; //导入依赖的package包/类
public void testMultilineBlockComment() throws Exception {
    setDocumentText("<!-- comment\ncomment line2 -->");
    //               0123456789012 345678901234567890123456789
    //               0         1         2         3
    BracesMatcher matcher = createMatcher(1, false, 1);
    assertOrigin(0, 4, matcher);
    assertMatch(27, 30, matcher);
    
    matcher = createMatcher(28, false, 1);
    assertOrigin(27, 30, matcher);
    assertMatch(0, 4, matcher);
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:HtmlMatcherTest.java


示例12: testBlockCommentWithPrefix

import org.netbeans.spi.editor.bracesmatching.BracesMatcher; //导入依赖的package包/类
public void testBlockCommentWithPrefix() throws Exception {
    setDocumentText(" <!-- comment -->");
    //               0123456789012345678901234567890123456789
    //               0         1         2         3
    BracesMatcher matcher = createMatcher(1, true, 1);
    assertNull(matcher.findOrigin());
    
    matcher = createMatcher(1, false, 1);
    assertOrigin(1, 5, matcher);
    assertMatch(14, 17, matcher);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:HtmlMatcherTest.java


示例13: testBlockCommentBoundary

import org.netbeans.spi.editor.bracesmatching.BracesMatcher; //导入依赖的package包/类
public void testBlockCommentBoundary() throws Exception {
    setDocumentText(" <!-- com\nment -->");
    //               0123456789 012345678901234567890123456789
    //               0         1         2         3
    BracesMatcher matcher = createMatcher(18, true, 2);
    assertOrigin(15, 18, matcher);
    assertMatch(1, 5, matcher);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:HtmlMatcherTest.java


示例14: assertMatch

import org.netbeans.spi.editor.bracesmatching.BracesMatcher; //导入依赖的package包/类
private void assertMatch(int expectedStart1, int expectedEnd1, int expectedStart2, int expectedEnd2, BracesMatcher matcher) throws InterruptedException, BadLocationException {
    int[] match = matcher.findMatches();
    assertNotNull(match);
    assertEquals("Incorrect match block start:", expectedStart1, match[0]);
    assertEquals("Incorrect match block end:", expectedEnd1, match[1]);
    if(expectedStart2 != -1) {
        assertEquals("Incorrect match block start:", expectedStart2, match[2]);
    }
    if(expectedEnd2 != -1) {
        assertEquals("Incorrect match block end:", expectedEnd2, match[3]);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:HtmlMatcherTest.java


示例15: createMatcher

import org.netbeans.spi.editor.bracesmatching.BracesMatcher; //导入依赖的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


示例16: createMatcher

import org.netbeans.spi.editor.bracesmatching.BracesMatcher; //导入依赖的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


示例17: createMatcher

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


示例18: scheduleMatchHighlighted

import org.netbeans.spi.editor.bracesmatching.BracesMatcher; //导入依赖的package包/类
private void scheduleMatchHighlighted(Result r, int[] origin, int[] matches, BracesMatcher.ContextLocator locator, Document d) throws BadLocationException {
    PR.post(new Firer(r, toPositions(component, origin), toPositions(component, matches), locator), 200);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:MasterMatcher.java


示例19: Firer

import org.netbeans.spi.editor.bracesmatching.BracesMatcher; //导入依赖的package包/类
public Firer(Result myResult, Position[] origin, Position[] matches, BracesMatcher.ContextLocator locator) {
    this.myResult = myResult;
    this.origin = origin;
    this.matches = matches;
    this.locator = locator;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:MasterMatcher.java


示例20: createMatcher

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java MetadataSerializer类代码示例发布时间:2022-05-22
下一篇:
Java JXHeader类代码示例发布时间: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