Skip to content
Open
Show file tree
Hide file tree
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 @@ -16,6 +16,7 @@

import java.util.Arrays;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;

import org.eclipse.core.runtime.IProgressMonitor;
Expand Down Expand Up @@ -1109,13 +1110,24 @@ private void hookZoomChangeListenerForDefaultSizedDialogs() {
}

AtomicReference<Listener> customResizeListener = new AtomicReference<>();
// setSize() sends the next SWT.Resize, which calls this listener again. Without the
// re-entrancy guard the listener recurses until the stack is exhausted whenever the
// computed size is not a fixed point, e.g. because a scrollbar appears and disappears
// with it.
AtomicBoolean adaptingDefaultSize = new AtomicBoolean();
Listener adaptDefaultSizeListener = event -> {
Shell shell = getShell();
if (shell == null || shell.isDisposed()) {
if (shell == null || shell.isDisposed() || !adaptingDefaultSize.compareAndSet(false, true)) {
return;
}
Point size = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
shell.setSize(size);
try {
Point size = shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
if (!size.equals(shell.getSize())) {
shell.setSize(size);
}
} finally {
adaptingDefaultSize.set(false);
}
};
AtomicReference<Listener> zoomChangeListener = new AtomicReference<>();
zoomChangeListener.set(event -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,16 @@ public int getShellStyle() {
return super.getShellStyle();
}

/**
* A wizard dialog is resizable unless a caller has stripped {@link SWT#RESIZE} from its shell
* style, so the answer is read from that style instead of being inherited from
* <code>Dialog</code>, which always answers <code>false</code>.
*/
@Override
protected boolean isResizable() {
return (getShellStyle() & SWT.RESIZE) != 0;
}

private static int getShellModality(boolean modal) {
return modal ? SWT.PRIMARY_MODAL : SWT.NONE;
}
Expand Down
Loading