use of com.jetbrains.lang.dart.ide.findUsages.DartServerFindUsagesHandler in project intellij-plugins by JetBrains.
the class DartServerFindUsagesTest method testFileUsage.
public void testFileUsage() {
final PsiFile barFile = myFixture.configureByText("bar.dart", "");
// it is important that foo.dart is not open in the editor
myFixture.addFileToProject("foo.dart", "import '" + barFile.getName() + "';");
// warm up
myFixture.doHighlighting();
final FindUsagesManager manager = ((FindManagerImpl) FindManager.getInstance(getProject())).getFindUsagesManager();
final FindUsagesHandler handler = manager.getFindUsagesHandler(getFile(), false);
assertNotNull(handler);
assertFalse(handler instanceof DartServerFindUsagesHandler);
final Collection<PsiReference> usages = handler.findReferencesToHighlight(getFile(), GlobalSearchScope.allScope(getProject()));
assertSize(1, usages);
final PsiReference reference = usages.iterator().next();
assertInstanceOf(reference, DartFileReference.class);
assertEquals("foo.dart", reference.getElement().getContainingFile().getName());
assertEquals("import '" + barFile.getName() + "';", reference.getElement().getParent().getText());
}
Aggregations