本文整理汇总了Java中org.netbeans.spi.editor.bracesmatching.BracesMatcherFactory类的典型用法代码示例。如果您正苦于以下问题:Java BracesMatcherFactory类的具体用法?Java BracesMatcherFactory怎么用?Java BracesMatcherFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BracesMatcherFactory类属于org.netbeans.spi.editor.bracesmatching包,在下文中一共展示了BracesMatcherFactory类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: findFactories
import org.netbeans.spi.editor.bracesmatching.BracesMatcherFactory; //导入依赖的package包/类
private static Collection<? extends BracesMatcherFactory> findFactories(final Document document,
final int offset, final boolean backward
) {
final MimePath[] mimePath = { null };
document.render(new Runnable() {
public void run() {
TokenHierarchy<? extends Document> th = TokenHierarchy.get(document);
if (th.isActive()) {
List<TokenSequence<?>> sequences = th.embeddedTokenSequences(offset, backward);
if (!sequences.isEmpty()) {
String path = sequences.get(sequences.size() - 1).languagePath().mimePath();
mimePath[0] = MimePath.parse(path);
}
} else {
String mimeType = (String) document.getProperty("mimeType"); //NOI18N
mimePath[0] = mimeType != null ? MimePath.parse(mimeType) : MimePath.EMPTY;
}
}
});
Collection<? extends BracesMatcherFactory> factories = mimePath[0] == null ?
Collections.<BracesMatcherFactory>emptyList() :
MimeLookup.getLookup(mimePath[0]).lookupAll(BracesMatcherFactory.class);
// System.out.println("@@@ '" + (mimePath == null ? "null" : mimePath.getPath()) + "', offset = " + offset + ", backward = " + backward + " -> {");
// for(BracesMatcherFactory f : factories) {
// System.out.println("@@@ " + f);
// }
// System.out.println("@@@ } --------------");
return factories;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:MasterMatcher.java
示例2: defaultMatcherFactory
import org.netbeans.spi.editor.bracesmatching.BracesMatcherFactory; //导入依赖的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
注:本文中的org.netbeans.spi.editor.bracesmatching.BracesMatcherFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论