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


Java BracesMatcher类代码示例

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


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


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