mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
CodeInsight fixture to use find usages options from handler
This commit is contained in:
-3
@@ -273,9 +273,6 @@ public interface CodeInsightTestFixture extends IdeaProjectTestFixture {
|
||||
|
||||
void testRename(String fileAfter, String newName) throws Exception;
|
||||
|
||||
@NotNull
|
||||
FindUsagesOptions getFindUsagesOptions();
|
||||
|
||||
Collection<UsageInfo> testFindUsages(@TestDataFile @NonNls String... fileNames);
|
||||
|
||||
Collection<UsageInfo> findUsages(final PsiElement to) throws Exception;
|
||||
|
||||
+2
-12
@@ -141,8 +141,6 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
private PsiElement myFileContext;
|
||||
private final FileTreeAccessFilter myJavaFilesFilter = new FileTreeAccessFilter();
|
||||
|
||||
private FindUsagesOptions myFindUsagesOptions;
|
||||
|
||||
public CodeInsightTestFixtureImpl(IdeaProjectTestFixture projectFixture, TempDirTestFixture tempDirTestFixture) {
|
||||
myProjectFixture = projectFixture;
|
||||
myTempDirFixture = tempDirTestFixture;
|
||||
@@ -585,15 +583,6 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
actionManager.getActionHandler(actionId).execute(getEditor(), dataContext);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public FindUsagesOptions getFindUsagesOptions() {
|
||||
if (myFindUsagesOptions == null) {
|
||||
myFindUsagesOptions = new FindUsagesOptions(getProject(), null);
|
||||
myFindUsagesOptions.isUsages = myFindUsagesOptions.isReadAccess = myFindUsagesOptions.isWriteAccess = true;
|
||||
}
|
||||
return myFindUsagesOptions;
|
||||
}
|
||||
|
||||
public Collection<UsageInfo> testFindUsages(@NonNls final String... fileNames) {
|
||||
assertInitialized();
|
||||
configureByFiles(fileNames);
|
||||
@@ -610,8 +599,9 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
|
||||
final CommonProcessors.CollectProcessor<UsageInfo> processor = new CommonProcessors.CollectProcessor<UsageInfo>();
|
||||
assert handler != null : "Cannot find handler for: " + targetElement;
|
||||
final PsiElement[] psiElements = ArrayUtil.mergeArrays(handler.getPrimaryElements(), handler.getSecondaryElements(), PsiElement.class);
|
||||
final FindUsagesOptions options = handler.getFindUsagesOptions();
|
||||
for (PsiElement psiElement : psiElements) {
|
||||
handler.processElementUsages(psiElement, processor, getFindUsagesOptions());
|
||||
handler.processElementUsages(psiElement, processor, options);
|
||||
}
|
||||
return processor.getResults();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user