use of com.intellij.util.AdapterProcessor in project android by JetBrains.
the class SearchInBuildFilesHyperlink method searchInBuildFiles.
public static void searchInBuildFiles(@NotNull String text, @NotNull final Project project) {
FindManager findManager = FindManager.getInstance(project);
UsageViewManager usageViewManager = UsageViewManager.getInstance(project);
FindModel findModel = findManager.getFindInProjectModel().clone();
findModel.setStringToFind(text);
findModel.setReplaceState(false);
findModel.setOpenInNewTabVisible(true);
findModel.setOpenInNewTabEnabled(true);
findModel.setOpenInNewTab(true);
findModel.setFileFilter(SdkConstants.FN_BUILD_GRADLE);
findManager.getFindInProjectModel().copyFrom(findModel);
final FindModel findModelCopy = findModel.clone();
UsageViewPresentation presentation = setupViewPresentation(findModel.isOpenInNewTabEnabled(), findModelCopy);
boolean showPanelIfOnlyOneUsage = !FindSettings.getInstance().isSkipResultsWithOneUsage();
final FindUsagesProcessPresentation processPresentation = setupProcessPresentation(project, showPanelIfOnlyOneUsage, presentation);
UsageTarget usageTarget = new StringUsageTarget(project, findModel);
usageViewManager.searchAndShowUsages(new UsageTarget[] { usageTarget }, new Factory<UsageSearcher>() {
@Override
public UsageSearcher create() {
return new UsageSearcher() {
@Override
public void generate(@NotNull final Processor<Usage> processor) {
AdapterProcessor<UsageInfo, Usage> consumer = new AdapterProcessor<UsageInfo, Usage>(processor, UsageInfo2UsageAdapter.CONVERTER);
findUsages(findModelCopy, project, consumer, processPresentation);
}
};
}
}, processPresentation, presentation, null);
}
Aggregations