Skip to content

Commit 1a6b291

Browse files
facchinmcmaglie
authored andcommitted
Find/Replace: display on top of the related Editor
If the editor is focused, acquire alwaysOnTop capabilities but drop them as soon as both the editor and the dialog are out of focus
1 parent 3831ced commit 1a6b291

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

app/src/cc/arduino/view/findreplace/FindReplace.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,24 @@ public FindReplace(Editor editor, Map<String, Object> state) {
7373

7474
Base.setIcon(this);
7575

76+
editor.addWindowListener(new WindowAdapter() {
77+
public void windowActivated(WindowEvent e) {
78+
findField.requestFocusInWindow();
79+
findField.selectAll();
80+
setAlwaysOnTop(true);
81+
}
82+
public void windowDeactivated(WindowEvent e) {
83+
setAlwaysOnTop(false);
84+
}
85+
});
86+
7687
addWindowListener(new WindowAdapter() {
7788
public void windowActivated(WindowEvent e) {
7889
findField.requestFocusInWindow();
7990
findField.selectAll();
91+
setAlwaysOnTop(true);
92+
}
93+
public void windowDeactivated(WindowEvent e) {
8094
}
8195
});
8296

0 commit comments

Comments
 (0)