mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-144857 1) Add F4 to navigate from code preview to 'big' editor 2) Don't close popup when application is not active
This commit is contained in:
@@ -86,7 +86,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
public class FindPopupPanel extends JBPanel implements FindUI {
|
||||
public class FindPopupPanel extends JBPanel implements FindUI, DataProvider {
|
||||
private static final Logger LOG = Logger.getInstance(FindPopupPanel.class);
|
||||
|
||||
private static final KeyStroke NEW_LINE = KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0);
|
||||
@@ -151,6 +151,7 @@ public class FindPopupPanel extends JBPanel implements FindUI {
|
||||
.setRequestFocus(true)
|
||||
.setCancelCallback(() -> {
|
||||
if (!myCanClose.get()) return false;
|
||||
if (!ApplicationManager.getApplication().isActive()) return false;
|
||||
List<JBPopup> popups = JBPopupFactory.getInstance().getChildPopups(this);
|
||||
if (!popups.isEmpty()) {
|
||||
for (JBPopup popup : popups) {
|
||||
@@ -1029,6 +1030,15 @@ public class FindPopupPanel extends JBPanel implements FindUI {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Object getData(String dataId) {
|
||||
if (CommonDataKeys.NAVIGATABLE_ARRAY.is(dataId)) {
|
||||
return getSelectedUsages();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private Usage[] getSelectedUsages() {
|
||||
int[] rows = myResultsPreviewTable.getSelectedRows();
|
||||
|
||||
@@ -66,7 +66,8 @@ public final class IdePopupManager implements IdeEventQueue.EventDispatcher {
|
||||
}
|
||||
|
||||
Component ultimateParentForFocusedComponent = UIUtil.findUltimateParent(focused);
|
||||
Component ultimateParentForEventWindow = UIUtil.findUltimateParent(((WindowEvent)e).getWindow());
|
||||
Window sourceWindow = ((WindowEvent)e).getWindow();
|
||||
Component ultimateParentForEventWindow = UIUtil.findUltimateParent(sourceWindow);
|
||||
|
||||
if (!shouldCloseAllPopup && ultimateParentForEventWindow == null || ultimateParentForFocusedComponent == null) {
|
||||
shouldCloseAllPopup = true;
|
||||
@@ -79,6 +80,9 @@ public final class IdePopupManager implements IdeEventQueue.EventDispatcher {
|
||||
shouldCloseAllPopup = true;
|
||||
}
|
||||
}
|
||||
if (!shouldCloseAllPopup && isPopupWindow(sourceWindow) && sourceWindow.getParent() == ultimateParentForFocusedComponent) {
|
||||
shouldCloseAllPopup = true;
|
||||
}
|
||||
|
||||
if (shouldCloseAllPopup) {
|
||||
closeAllPopups();
|
||||
|
||||
Reference in New Issue
Block a user