本文整理汇总了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
}
}
}
示例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();
}
示例3: cancel
import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
@Override
public void cancel() {
final HintsProvider curProvider = this.pendingProvider;
if (curProvider != null) {
curProvider.cancel();
}
}
示例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;
}
示例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));
}
示例6: cancel
import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
public @Override void cancel() {
final HintsProvider p = pendingProvider;
if (p != null) {
p.cancel();
}
}
示例7: cancel
import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
public @Override void cancel() {
final HintsProvider proc = pendingProvider;
if (proc != null) {
proc.cancel();
}
}
示例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;
}
示例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;
}
示例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;
}
示例11: getHintsProvider
import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
@Override
public HintsProvider getHintsProvider() {
return null;
}
示例12: getHintsProvider
import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
@Override
public HintsProvider getHintsProvider() {
return new CssHintsProvider();
}
示例13: HtmlErrorFilter
import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
public HtmlErrorFilter() {
htmlHintsProvider = new HtmlHintsProvider();
htmlHintsManager = HintsProvider.HintsManager.getManagerForMimeType(HtmlKit.HTML_MIME_TYPE);
}
示例14: getHintsProvider
import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
@Override
public HintsProvider getHintsProvider() {
return new HtmlHintsProvider();
}
示例15: getHintsProvider
import org.netbeans.modules.csl.api.HintsProvider; //导入依赖的package包/类
@Override
public HintsProvider getHintsProvider() {
return new RoutesHintsProvider();
}