mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
goto action doesn't take selection from editor (IDEA-79684)
This commit is contained in:
@@ -58,7 +58,7 @@ public class GotoActionAction extends GotoActionBase implements DumbAware {
|
||||
}, ModalityState.NON_MODAL);
|
||||
}
|
||||
}
|
||||
});
|
||||
}, null, false);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -119,21 +119,22 @@ public abstract class GotoActionBase extends AnAction {
|
||||
}
|
||||
|
||||
protected static <T> void showNavigationPopup(AnActionEvent e, ChooseByNameModel model, final GotoActionCallback<T> callback) {
|
||||
showNavigationPopup(e, model, callback, null);
|
||||
showNavigationPopup(e, model, callback, null, true);
|
||||
}
|
||||
|
||||
protected static <T> void showNavigationPopup(AnActionEvent e,
|
||||
ChooseByNameModel model,
|
||||
final GotoActionCallback<T> callback,
|
||||
final String findTitle) {
|
||||
@Nullable final String findUsagesTitle,
|
||||
boolean useSelectionFromEditor) {
|
||||
final Project project = e.getData(PlatformDataKeys.PROJECT);
|
||||
|
||||
boolean mayRequestOpenInCurrentWindow = model.willOpenEditor() && FileEditorManagerEx.getInstanceEx(project).hasSplitOrUndockedWindows();
|
||||
final Class startedAction = myInAction;
|
||||
LOG.assertTrue(startedAction != null);
|
||||
Pair<String, Integer> start = getInitialText(e.getData(PlatformDataKeys.EDITOR));
|
||||
Pair<String, Integer> start = getInitialText(useSelectionFromEditor ? e.getData(PlatformDataKeys.EDITOR) : null);
|
||||
final ChooseByNamePopup popup = ChooseByNamePopup.createPopup(project, model, getPsiContext(e), start.first, mayRequestOpenInCurrentWindow, start.second);
|
||||
popup.setFindUsagesTitle(findTitle);
|
||||
popup.setFindUsagesTitle(findUsagesTitle);
|
||||
final ChooseByNameFilter<T> filter = callback.createFilter(popup);
|
||||
|
||||
popup.invoke(new ChooseByNamePopupComponent.Callback() {
|
||||
|
||||
@@ -78,7 +78,7 @@ public class GotoClassAction extends GotoActionBase implements DumbAware {
|
||||
token.finish();
|
||||
}
|
||||
}
|
||||
}, "Classes matching pattern");
|
||||
}, "Classes matching pattern", true);
|
||||
}
|
||||
|
||||
private static PsiElement getElement(PsiElement element, ChooseByNamePopup popup) {
|
||||
|
||||
@@ -81,7 +81,7 @@ public class GotoFileAction extends GotoActionBase implements DumbAware {
|
||||
}
|
||||
}, ModalityState.NON_MODAL);
|
||||
}
|
||||
}, "Files matching pattern");
|
||||
}, "Files matching pattern", true);
|
||||
}
|
||||
|
||||
protected static class GotoFileFilter extends ChooseByNameFilter<FileType> {
|
||||
|
||||
@@ -46,7 +46,7 @@ public class GotoSymbolAction extends GotoActionBase {
|
||||
public void elementChosen(ChooseByNamePopup popup, Object element) {
|
||||
EditSourceUtil.navigate((NavigationItem)element, true, popup.isOpenInCurrentWindowRequested());
|
||||
}
|
||||
}, "Symbols matching patterns");
|
||||
}, "Symbols matching patterns", true);
|
||||
}
|
||||
|
||||
protected boolean hasContributors(DataContext dataContext) {
|
||||
|
||||
@@ -218,7 +218,7 @@ public abstract class ChooseByNameBase {
|
||||
myToolArea = toolArea;
|
||||
}
|
||||
|
||||
public void setFindUsagesTitle(String findUsagesTitle) {
|
||||
public void setFindUsagesTitle(@Nullable String findUsagesTitle) {
|
||||
myFindUsagesTitle = findUsagesTitle;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user