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: react to target relocation instead of paint events #2253

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 @@ -28,7 +28,6 @@
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.events.ShellAdapter;
import org.eclipse.swt.events.ShellEvent;
Expand All @@ -42,6 +41,7 @@
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.ScrollBar;
import org.eclipse.swt.widgets.Scrollable;
import org.eclipse.swt.widgets.Shell;
Expand Down Expand Up @@ -204,7 +204,7 @@ public void controlResized(ControlEvent e) {
}
};

private PaintListener widgetMovementListener = __ -> asyncExecIfOpen(
private Listener targetRelocationListener = __ -> asyncExecIfOpen(
FindReplaceOverlay.this::updatePlacementAndVisibility);

private void asyncExecIfOpen(Runnable operation) {
Expand Down Expand Up @@ -423,7 +423,8 @@ private void unbindListeners() {
Control targetWidget = textEditor.getAdapter(ITextViewer.class).getTextWidget();
if (targetWidget != null) {
targetWidget.getShell().removeControlListener(shellMovementListener);
targetWidget.removePaintListener(widgetMovementListener);
targetWidget.removeListener(SWT.Move, targetRelocationListener);
targetWidget.removeListener(SWT.Resize, targetRelocationListener);
targetWidget.removeKeyListener(closeOnTargetEscapeListener);
targetPart.getSite().getPage().removePartListener(targetPartVisibilityHandler);
}
Expand All @@ -436,7 +437,8 @@ private void bindListeners() {
Control targetWidget = textEditor.getAdapter(ITextViewer.class).getTextWidget();

targetWidget.getShell().addControlListener(shellMovementListener);
targetWidget.addPaintListener(widgetMovementListener);
targetWidget.addListener(SWT.Move, targetRelocationListener);
targetWidget.addListener(SWT.Resize, targetRelocationListener);
targetWidget.addKeyListener(closeOnTargetEscapeListener);
targetPart.getSite().getPage().addPartListener(targetPartVisibilityHandler);
}
Expand Down
Loading