Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find/Replace overlay: handle the case when moving editor between windows #1946

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,15 @@ private void updatePlacementAndVisibility() {
getShell().setVisible(false);
return;
}
if (isInvalidTargetShell()) {
getShell().getDisplay().syncExec(() -> {
close();
setParentShell(targetPart.getSite().getShell());
open();
targetPart.setFocus();
});
return;
}
getShell().requestLayout();
if (!(targetPart instanceof StatusTextEditor textEditor)) {
return;
Expand All @@ -902,6 +911,17 @@ private void updatePlacementAndVisibility() {
repositionTextSelection();
}

private boolean isInvalidTargetPart() {
return targetPart == null || targetPart.getSite() == null || targetPart.getSite().getShell() == null;
}

private boolean isInvalidTargetShell() {
if (isInvalidTargetPart()) {
return false;
}
return getShell() == null || !targetPart.getSite().getShell().equals(getShell().getParent());
}

private Rectangle calculateAbsoluteControlBounds(Control control) {
Rectangle localControlBounds = control.getBounds();
int width = localControlBounds.width;
Expand Down
Loading