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


Java HintsProvider类代码示例

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


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

示例1: computeSuggestions

import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
@Override
public void computeSuggestions(HintsProvider.HintsManager manager, RuleContext context, List<Hint> hints, int caretOffset) {
    HtmlParserResult result = (HtmlParserResult) context.parserResult;
    Node root = result.root(SyntaxAnalyzerResult.FILTERED_CODE_NAMESPACE);
    Snapshot snapshot = result.getSnapshot();
    int embeddedCaretOffset = snapshot.getEmbeddedOffset(caretOffset);
    Element found = ElementUtils.findByPhysicalRange(root, embeddedCaretOffset, false);
    if (found != null) {
        switch (found.type()) {
            case OPEN_TAG:
            case CLOSE_TAG:
                Named named = (Named) found;
                String elementName = named.name().toString();
                Configuration conf = Configuration.get(snapshot.getSource().getFileObject());
                if (conf.getTagsNames().contains(elementName)) {
                    //custom element
                    hints.add(new CustomElementHint(elementName, context, new OffsetRange(snapshot.getOriginalOffset(found.from()), snapshot.getOriginalOffset(found.to()))));

                }

            //TODO add check + fix for missing required attributes
        }
    }

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:CustomHtmlExtension.java

示例2: GsfHintsManager

import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
public GsfHintsManager(String mimeType, HintsProvider provider, Language language) {
    this.mimeType = mimeType;
    this.provider = provider;

    this.id = language.getMimeType().replace('/', '_') + '_';
    
    // XXX Start listening on the rules folder, to handle module set changes.
    initErrors();
    initHints();
    initSuggestions();
    initSelectionHints();
    initBuiltins();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:GsfHintsManager.java

示例3: cancel

import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
@Override
public void cancel() {
    final HintsProvider curProvider = this.pendingProvider;
    if (curProvider != null) {
        curProvider.cancel();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:GsfHintsProvider.java

示例4: getHintsProvider

import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
/**
 * Get an associated hints provider, if any
 */
@CheckForNull
public HintsProvider getHintsProvider() {
    if (hintsProvider == null) {
        if (hintsProviderFile != null) {
            hintsProvider = (HintsProvider)createInstance(hintsProviderFile);
            if (hintsProvider == null) {
                // Don't keep trying
                hintsProviderFile = null;
            }
        } else {
            getGsfLanguage(); // Also initializes languageConfig
            if (languageConfig != null) {
                hintsProvider = languageConfig.getHintsProvider();
                if (hintsProvider != null) {
                    // You MUST return true from this method if you provide a hints
                    // provider
                    assert languageConfig.hasHintsProvider();
                }
            }
        }
        if (hintsProvider != null) {
            hintsManager = new GsfHintsManager(getMimeType(), hintsProvider, this);
        }
    }
    return hintsProvider;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:Language.java

示例5: computeErrors

import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
@Override
public void computeErrors(HintsProvider.HintsManager manager, final RuleContext context, final List<Hint> hints, List<Error> unhandled) {
    HtmlParserResult result = (HtmlParserResult) context.parserResult;
    Node root = result.root(SyntaxAnalyzerResult.FILTERED_CODE_NAMESPACE);
    final Snapshot snapshot = result.getSnapshot();
    final Configuration conf = Configuration.get(snapshot.getSource().getFileObject());
    ElementUtils.visitChildren(root, CheckerElementVisitor.getChecker(context, conf, snapshot, hints));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:CustomHtmlExtension.java

示例6: cancel

import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
public @Override void cancel() {
    final HintsProvider p = pendingProvider;
    if (p != null) {
        p.cancel();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:SelectionHintsTask.java

示例7: cancel

import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
public @Override void cancel() {
    final HintsProvider proc = pendingProvider;
    if (proc != null) {
        proc.cancel();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:HintsTask.java

示例8: processProviderErrors

import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
private List<Error> processProviderErrors(
            final List<ErrorDescription> descriptions, 
            Snapshot topLevelSnapshot, final ParserResult r, final Language language) throws ParseException {
        
        HintsProvider provider = language.getHintsProvider();
        if (provider == null) {
            return null;
        }

        GsfHintsManager manager = language.getHintsManager();
        if (manager == null) {
            return null;
        }
        RuleContext ruleContext = manager.createRuleContext(r, language, -1, -1, -1);
        if (ruleContext == null) {
            return null;
        }
        List<Hint> hints = new ArrayList<Hint>();
        List<Error> errors = new ArrayList<Error>();
        try {
            synchronized (this) {
                pendingProvider = provider;
                if (cancel.isCancelled()) {
                    return errors;
                }
            }
            provider.computeErrors(manager, ruleContext, hints, errors);
        } finally {
            pendingProvider = null;
        }
        
        boolean allowDisableEmpty = true;
        for (int i = 0; i < hints.size(); i++) {
            Hint hint = hints.get(i);
            OffsetRange range = hint.getRange();
            if (range != null &&
                    range.getStart() >= 0 && range.getStart() <= topLevelSnapshot.getText().length() &&
                    range.getEnd() >= 0 && range.getEnd() <= topLevelSnapshot.getText().length() &&
                    range.getStart() <= range.getEnd()
            ) {
                ErrorDescription errorDesc = manager.createDescription(hint, ruleContext, allowDisableEmpty, i == hints.size()-1);
                descriptions.add(errorDesc);
            } else {
                String msg = provider + " supplied hint " + hint + " with invalid range " + range + //NOI18N
                        ", topLevelSnapshot.length=" + topLevelSnapshot.getText().length() +
                        ", file=" + topLevelSnapshot.getSource().getFileObject(); //NOI18N
//                                            assert false : msg;
                LOG.log(Level.FINE, msg);
            }
        }
        return errors;
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:53,代码来源:GsfHintsProvider.java

示例9: getHintsProvider

import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
/**
 * A HintsProvider for this language, or null if none is available
 * @return the hints provider
 */
@CheckForNull
public HintsProvider getHintsProvider() {
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:DefaultLanguageConfig.java

示例10: getHintsProvider

import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
protected HintsProvider getHintsProvider() {
    HintsProvider provider = getPreferredLanguage().getHintsProvider();
    assertNotNull("You must override getHintsProvider, either from your GsfLanguage or your test class", provider);
    return provider;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:6,代码来源:CslTestBase.java

示例11: getHintsProvider

import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
@Override
public HintsProvider getHintsProvider() {
    return null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:LanguageRegistryTest.java

示例12: getHintsProvider

import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
@Override
public HintsProvider getHintsProvider() {
    return new CssHintsProvider();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:CssLanguage.java

示例13: HtmlErrorFilter

import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
public HtmlErrorFilter() {
    htmlHintsProvider = new HtmlHintsProvider();
    htmlHintsManager = HintsProvider.HintsManager.getManagerForMimeType(HtmlKit.HTML_MIME_TYPE);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:HtmlErrorFilter.java

示例14: getHintsProvider

import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
@Override
public HintsProvider getHintsProvider() {
    return new HtmlHintsProvider();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:HtmlLanguage.java

示例15: getHintsProvider

import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
@Override
public HintsProvider getHintsProvider() {
    return new RoutesHintsProvider();
}
 
开发者ID:pedrohidalgo,项目名称:pleasure,代码行数:5,代码来源:RoutesLanguage.java


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