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


Java DeclarationFinder类代码示例

本文整理汇总了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;
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:Language.java

示例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);
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:DefaultCssModuleTest.java

示例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);
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:DefaultCssModuleTest.java

示例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);
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:DefaultCssModuleTest.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:GoToSupport.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:CslTestBase.java

示例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];
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:CslTestBase.java

示例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;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:CPCssEditorModule.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:DefaultLanguageConfig.java

示例10: getDeclarationFinder

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

示例11: getDeclarationFinder

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

示例12: getDeclarationFinder

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

示例13: getDeclarationFinder

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

示例14: getDeclarationFinder

import org.netbeans.modules.csl.api.DeclarationFinder; //导入依赖的package包/类
@Override
public DeclarationFinder getDeclarationFinder() {
    return apexDeclarationFinder;
}
 
开发者ID:fundacionjala,项目名称:oblivion-netbeans-plugin,代码行数:5,代码来源:ApexTriggerLanguage.java

示例15: getDeclarationFinder

import org.netbeans.modules.csl.api.DeclarationFinder; //导入依赖的package包/类
@Override
public DeclarationFinder getDeclarationFinder()
{
    return new FanDeclarationFinder();
}
 
开发者ID:tcolar,项目名称:fantomidemodule,代码行数:6,代码来源:FanLanguage.java


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