use of com.intellij.openapi.fileEditor.FileEditorLocation in project intellij-community by JetBrains.
the class FindUsagesManager method findUsagesInEditor.
private void findUsagesInEditor(@NotNull final PsiElement[] primaryElements, @NotNull final PsiElement[] secondaryElements, @NotNull FindUsagesHandler handler, @NotNull PsiFile scopeFile, @NotNull FileSearchScope direction, @NotNull final FindUsagesOptions findUsagesOptions, @NotNull FileEditor fileEditor) {
initLastSearchElement(findUsagesOptions, primaryElements, secondaryElements);
clearStatusBar();
final FileEditorLocation currentLocation = fileEditor.getCurrentLocation();
PsiElement2UsageTargetAdapter[] primaryTargets = PsiElement2UsageTargetAdapter.convert(primaryElements);
PsiElement2UsageTargetAdapter[] secondaryTargets = PsiElement2UsageTargetAdapter.convert(primaryElements);
final UsageSearcher usageSearcher = createUsageSearcher(primaryTargets, secondaryTargets, handler, findUsagesOptions, scopeFile);
AtomicBoolean usagesWereFound = new AtomicBoolean();
Usage fUsage = findSiblingUsage(usageSearcher, direction, currentLocation, usagesWereFound, fileEditor);
if (fUsage != null) {
fUsage.navigate(true);
fUsage.selectInEditor();
} else if (!usagesWereFound.get()) {
String message = getNoUsagesFoundMessage(primaryElements[0]) + " in " + scopeFile.getName();
showHintOrStatusBarMessage(message, fileEditor);
} else {
fileEditor.putUserData(KEY_START_USAGE_AGAIN, VALUE_START_USAGE_AGAIN);
showHintOrStatusBarMessage(getSearchAgainMessage(primaryElements[0], direction), fileEditor);
}
}
use of com.intellij.openapi.fileEditor.FileEditorLocation in project intellij-community by JetBrains.
the class ShowUsagesAction method getEditorFor.
@Nullable
private static Editor getEditorFor(@NotNull Usage usage) {
FileEditorLocation location = usage.getLocation();
FileEditor newFileEditor = location == null ? null : location.getEditor();
return newFileEditor instanceof TextEditor ? ((TextEditor) newFileEditor).getEditor() : null;
}
Aggregations