Skip to content

Commit

Permalink
Find/Replace overlay: handle the case when moving editor between windows
Browse files Browse the repository at this point in the history
When moving the targeted editor between different windows, the overlay
is closed to allow a retargetting.

fixes #1945
  • Loading branch information
Wittmaxi committed Jun 10, 2024
1 parent 6d6465b commit e543eee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ private void showDialog() {
}

private void showOverlayInEditor() {
if (overlay == null) {
if (overlay == null || !overlay.isOverlayOpen()) {
Shell shellToUse = null;

if (fShell == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,9 @@ public boolean close() {

@Override
public int open() {
if (!okayToUse(getShell())) {
return Window.CANCEL;
}
int returnCode = Window.OK;
if (!overlayOpen) {
returnCode = super.open();
Expand Down Expand Up @@ -763,6 +766,10 @@ private void repositionTextSelection() {
}

private void positionToPart() {
if (getShell() == null || !targetPart.getSite().getShell().equals(getShell().getParent())) {
close();
return;
}
getShell().requestLayout();
if (!(targetPart instanceof StatusTextEditor)) {
return;
Expand Down Expand Up @@ -863,4 +870,8 @@ private static boolean okayToUse(Widget widget) {
public void setPositionToTop(boolean shouldPositionOverlayOnTop) {
positionAtTop = shouldPositionOverlayOnTop;
}

public boolean isOverlayOpen() {
return overlayOpen;
}
}

0 comments on commit e543eee

Please sign in to comment.