本文整理汇总了Java中org.netbeans.modules.csl.api.DeclarationFinder类的典型用法代码示例。如果您正苦于以下问题:Java DeclarationFinder类的具体用法?Java DeclarationFinder怎么用?Java DeclarationFinder使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DeclarationFinder类属于org.netbeans.modules.csl.api包,在下文中一共展示了DeclarationFinder类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: Language
import org.netbeans.modules.csl.api.DeclarationFinder; //导入依赖的package包/类
/** For testing purposes only!*/
public Language(String iconBase, String mime, List<Action> actions,
GsfLanguage gsfLanguage, CodeCompletionHandler completionProvider, InstantRenamer renamer,
DeclarationFinder declarationFinder, Formatter formatter, KeystrokeHandler bracketCompletion, EmbeddingIndexerFactory indexerFactory ,
StructureScanner structure, /*PaletteController*/Object palette, boolean useCustomEditorKit) {
this.iconBase = iconBase;
this.mime = mime;
this.actions = actions;
this.language = gsfLanguage;
this.completionProvider = completionProvider;
this.renamer = renamer;
this.declarationFinder = declarationFinder;
this.formatter = formatter;
this.keystrokeHandler = bracketCompletion;
this.indexerFactory = indexerFactory;
this.structure = structure;
// this.palette = palette;
this.useCustomEditorKit = useCustomEditorKit;
}
示例2: testGetDeclarationForURIQuoted
import org.netbeans.modules.csl.api.DeclarationFinder; //导入依赖的package包/类
public void testGetDeclarationForURIQuoted() {
BaseDocument document = getDocument("div { background: url(\"hello.png\"); } ");
// 0123456789012345678901 23456789012 34567890123456789
// 0 1 2 3
DefaultCssEditorModule dm = new DefaultCssEditorModule();
Pair<OffsetRange, FutureParamTask<DeclarationFinder.DeclarationLocation, EditorFeatureContext>> declaration = dm.getDeclaration(document, 25);
assertNotNull(declaration);
OffsetRange range = declaration.first();
assertNotNull(range);
assertEquals(23, range.getStart());
assertEquals(32, range.getEnd());
FutureParamTask<DeclarationFinder.DeclarationLocation, EditorFeatureContext> task = declaration.second();
assertNotNull(task);
}
示例3: testGetDeclarationForURIUnquoted
import org.netbeans.modules.csl.api.DeclarationFinder; //导入依赖的package包/类
public void testGetDeclarationForURIUnquoted() {
BaseDocument document = getDocument("div { background: url(hello.png); } ");
// 01234567890123456789012345678901234567890123456789
// 0 1 2 3
DefaultCssEditorModule dm = new DefaultCssEditorModule();
Pair<OffsetRange, FutureParamTask<DeclarationFinder.DeclarationLocation, EditorFeatureContext>> declaration = dm.getDeclaration(document, 25);
assertNotNull(declaration);
OffsetRange range = declaration.first();
assertNotNull(range);
assertEquals(22, range.getStart());
assertEquals(31, range.getEnd());
FutureParamTask<DeclarationFinder.DeclarationLocation, EditorFeatureContext> task = declaration.second();
assertNotNull(task);
}
示例4: testGetDeclarationForImport
import org.netbeans.modules.csl.api.DeclarationFinder; //导入依赖的package包/类
public void testGetDeclarationForImport() {
BaseDocument document = getDocument("@import \"hello.css\"; ");
// 01234567 8901234567 8901
// 0 1 2 3
DefaultCssEditorModule dm = new DefaultCssEditorModule();
Pair<OffsetRange, FutureParamTask<DeclarationFinder.DeclarationLocation, EditorFeatureContext>> declaration = dm.getDeclaration(document, 10);
assertNotNull(declaration);
OffsetRange range = declaration.first();
assertNotNull(range);
assertEquals(9, range.getStart());
assertEquals(18, range.getEnd());
FutureParamTask<DeclarationFinder.DeclarationLocation, EditorFeatureContext> task = declaration.second();
assertNotNull(task);
}
示例5: identifyActiveFindersLanguage
import org.netbeans.modules.csl.api.DeclarationFinder; //导入依赖的package包/类
private static Language identifyActiveFindersLanguage(Document doc, int offset) {
FileObject fo = getFileObject(doc);
if (fo == null) {
//do nothing if FO is not attached to the document - the goto would not work anyway:
return null;
}
List<Language> list = LanguageRegistry.getInstance().getEmbeddedLanguages((BaseDocument) doc, offset);
//according to the lexical embedding iterate over the
//languages from the leaf to the root and try to find
//their declrations finders. If there is and indicates
//it is interested in the given offset return its result
//otherwise continue to the root.
for (Language l : list) {
DeclarationFinder finder = l.getDeclarationFinder();
if (finder != null) {
OffsetRange range = finder.getReferenceSpan(doc, offset);
if (range == null) {
throw new NullPointerException(finder + " violates its contract; should not return null from getReferenceSpan."); //NOI18N
} else if (range != OffsetRange.NONE) {
return l;
}
}
}
return null;
}
示例6: getFinder
import org.netbeans.modules.csl.api.DeclarationFinder; //导入依赖的package包/类
protected DeclarationFinder getFinder() {
DeclarationFinder finder = getPreferredLanguage().getDeclarationFinder();
if (finder == null) {
fail("You must override getFinder()");
}
return finder;
}
示例7: findDeclaration
import org.netbeans.modules.csl.api.DeclarationFinder; //导入依赖的package包/类
protected DeclarationLocation findDeclaration(String relFilePath, final String caretLine) throws Exception {
Source testSource = getTestSource(getTestFile(relFilePath));
final int caretOffset = getCaretOffset(testSource.createSnapshot().getText().toString(), caretLine);
enforceCaretOffset(testSource, caretOffset);
final DeclarationLocation [] location = new DeclarationLocation[] { null };
UserTask task = new UserTask() {
public @Override void run(ResultIterator resultIterator) throws Exception {
Parser.Result r = resultIterator.getParserResult();
assertTrue(r instanceof ParserResult);
ParserResult pr = (ParserResult) r;
DeclarationFinder finder = getFinder();
location[0] = finder.findDeclaration(pr, caretOffset);
}
};
if (classPathsForTest == null || classPathsForTest.isEmpty()) {
ParserManager.parse(Collections.singleton(testSource), task);
} else {
Future<Void> future = ParserManager.parseWhenScanFinished(Collections.singleton(testSource), task);
if (!future.isDone()) {
future.get();
}
}
return location[0];
}
示例8: compareTo
import org.netbeans.modules.csl.api.DeclarationFinder; //导入依赖的package包/类
@Override
public int compareTo(DeclarationFinder.AlternativeLocation o) {
CpAlternativeLocation cpal = (CpAlternativeLocation) o;
if (isLocalDeclaration() == cpal.isLocalDeclaration()) {
return location.getFileObject().getPath().compareTo(o.getLocation().getFileObject().getPath());
} else {
return isLocalDeclaration() && !cpal.isLocalDeclaration() ? -1 : +1;
}
}
示例9: getDeclarationFinder
import org.netbeans.modules.csl.api.DeclarationFinder; //导入依赖的package包/类
/**
* A DeclarationFinder for this language, or null if none is available
* @return a declaration finder
*/
@CheckForNull
public DeclarationFinder getDeclarationFinder() {
return null;
}
示例10: getDeclarationFinder
import org.netbeans.modules.csl.api.DeclarationFinder; //导入依赖的package包/类
@Override
public DeclarationFinder getDeclarationFinder() {
return null;
}
示例11: getDeclarationFinder
import org.netbeans.modules.csl.api.DeclarationFinder; //导入依赖的package包/类
@Override
public DeclarationFinder getDeclarationFinder() {
return new CssDeclarationFinder();
}
示例12: getDeclarationFinder
import org.netbeans.modules.csl.api.DeclarationFinder; //导入依赖的package包/类
@Override
public DeclarationFinder getDeclarationFinder() {
return new EmptyDeclarationFinder();
}
示例13: getDeclarationFinder
import org.netbeans.modules.csl.api.DeclarationFinder; //导入依赖的package包/类
@Override
public DeclarationFinder getDeclarationFinder() {
return new HtmlDeclarationFinder();
}
示例14: getDeclarationFinder
import org.netbeans.modules.csl.api.DeclarationFinder; //导入依赖的package包/类
@Override
public DeclarationFinder getDeclarationFinder() {
return apexDeclarationFinder;
}
示例15: getDeclarationFinder
import org.netbeans.modules.csl.api.DeclarationFinder; //导入依赖的package包/类
@Override
public DeclarationFinder getDeclarationFinder()
{
return new FanDeclarationFinder();
}