Search in sources :

Example 1 with ImplementationSearcher

use of com.intellij.codeInsight.navigation.ImplementationSearcher in project intellij-plugins by JetBrains.

the class FlexHighlightingTest method testOverridingMarkersXmlBacked.

@JSTestOptions({ JSTestOption.WithJsSupportLoader, JSTestOption.WithFlexSdk, JSTestOption.WithLineMarkers })
public void testOverridingMarkersXmlBacked() throws Exception {
    doTestFor(true, getTestName(false) + "_B.mxml", getTestName(false) + "_A.mxml", getTestName(false) + "_C.mxml", getTestName(false) + "_D.as", getTestName(false) + "_MyInterface.as");
    int offset = myEditor.getCaretModel().getOffset();
    PsiElement source = InjectedLanguageUtil.findElementAtNoCommit(myFile, offset);
    source = PsiTreeUtil.getParentOfType(source, JSFunction.class);
    PsiElement[] functions = new ImplementationSearcher().searchImplementations(source, myEditor, true, true);
    assertEquals(3, functions.length);
    Collection<String> classNames = new ArrayList<>();
    for (PsiElement function : functions) {
        assertEquals("foo", ((JSFunction) function).getName());
        PsiElement clazz = function.getParent();
        if (clazz instanceof JSFile) {
            clazz = JSResolveUtil.getXmlBackedClass((JSFile) clazz);
        }
        classNames.add(((JSClass) clazz).getName());
    }
    assertTrue(classNames.contains(getTestName(false) + "_B"));
    assertTrue(classNames.contains(getTestName(false) + "_C"));
    assertTrue(classNames.contains(getTestName(false) + "_D"));
}
Also used : ImplementationSearcher(com.intellij.codeInsight.navigation.ImplementationSearcher)

Example 2 with ImplementationSearcher

use of com.intellij.codeInsight.navigation.ImplementationSearcher in project intellij-plugins by JetBrains.

the class FlexHighlightingTest method testOverridingMarkersXmlBacked2.

@JSTestOptions({ JSTestOption.WithJsSupportLoader, JSTestOption.WithFlexSdk, JSTestOption.WithLineMarkers })
public void testOverridingMarkersXmlBacked2() throws Exception {
    doTestFor(true, getTestName(false) + "_MyInterface.as", getTestName(false) + "_A.mxml", getTestName(false) + "_B.mxml");
    int offset = myEditor.getCaretModel().getOffset();
    PsiElement source = myFile.findElementAt(offset);
    source = PsiTreeUtil.getParentOfType(source, JSFunction.class);
    PsiElement[] functions = new ImplementationSearcher().searchImplementations(source, myEditor, true, true);
    assertEquals(2, functions.length);
    //assertEquals(3, functions.length); IDEADEV-34319
    Collection<String> classNames = new ArrayList<>();
    for (PsiElement function : functions) {
        assertEquals("bar", ((JSFunction) function).getName());
        PsiElement clazz = function.getParent();
        if (clazz instanceof JSFile) {
            clazz = JSResolveUtil.getXmlBackedClass((JSFile) clazz);
        }
        classNames.add(((JSClass) clazz).getName());
    }
    assertTrue(classNames.contains(getTestName(false) + "_MyInterface"));
    assertTrue(classNames.contains(getTestName(false) + "_A"));
//assertTrue(classNames.contains(getTestName(false) +"_B")); IDEADEV-34319
}
Also used : ImplementationSearcher(com.intellij.codeInsight.navigation.ImplementationSearcher)

Aggregations

ImplementationSearcher (com.intellij.codeInsight.navigation.ImplementationSearcher)2