Misc fixes for Find In Path:

increase active area to move the window
provide visual border for undecorated dialog
tune 'canClose' logic for clicks outside the dialog / outside the application
This commit is contained in:
Vassiliy.Kudryashov
2018-10-02 19:33:23 +03:00
parent bcf42baa10
commit 3bf2f2e525
@@ -233,6 +233,8 @@ public class FindPopupPanel extends JBPanel implements FindUI {
WindowMoveListener windowListener = new WindowMoveListener(this);
myTitlePanel.addMouseListener(windowListener);
myTitlePanel.addMouseMotionListener(windowListener);
addMouseListener(windowListener);
addMouseMotionListener(windowListener);
Dimension panelSize = getPreferredSize();
Dimension prev = DimensionService.getInstance().getSize(SERVICE_KEY);
if (!myCbPreserveCase.isVisible()) {
@@ -272,6 +274,7 @@ public class FindPopupPanel extends JBPanel implements FindUI {
DumbAwareAction.create(e -> closeImmediately())
.registerCustomShortcutSet(escape == null ? CommonShortcuts.ESCAPE : escape.getShortcutSet(), root, myDisposable);
root.setWindowDecorationStyle(JRootPane.NONE);
root.setBorder(PopupBorder.Factory.create(true, true));
UIUtil.markAsPossibleOwner((Dialog)w);
w.setBackground(UIUtil.getPanelBackground());
w.setMinimumSize(panelSize);
@@ -287,7 +290,7 @@ public class FindPopupPanel extends JBPanel implements FindUI {
if (oppositeWindow == w || oppositeWindow != null && oppositeWindow.getOwner() == w) {
return;
}
if (canBeClosed()) {
if (canBeClosed() || (!myIsPinned.get() && oppositeWindow != null)) {
//closeImmediately();
myDialog.doCancelAction();
}
@@ -312,7 +315,7 @@ public class FindPopupPanel extends JBPanel implements FindUI {
if (!myCanClose.get()) return false;
if (myIsPinned.get()) return false;
if (!ApplicationManager.getApplication().isActive()) return false;
//if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow() == null) return false;
if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusedWindow() == null) return false;
if (myFileMaskField.isPopupVisible()) {
myFileMaskField.setPopupVisible(false);
return false;