Skip to content

Commit 7ca4e0d

Browse files
committed
Don't do nested resize operations in TableResizeHelper
Avoids endless resize operations & UI hangs in case resize listener/handler code itself triggers some OS specific resize events. Fixes #3676
1 parent 34049dd commit 7ca4e0d

1 file changed

Lines changed: 13 additions & 5 deletions

File tree

bundles/org.eclipse.text.quicksearch/src/org/eclipse/text/quicksearch/internal/ui/TableResizeHelper.java

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
public class TableResizeHelper {
2929

3030
private final TableViewer tableViewer;
31+
boolean resizeInProgress;
3132

3233
public TableResizeHelper(TableViewer tableViewer) {
3334
this.tableViewer = tableViewer;
@@ -37,7 +38,9 @@ public void enableResizing() {
3738
ControlListener resizeListener = new ControlListener() {
3839
@Override
3940
public void controlResized(ControlEvent e) {
40-
resizeTable();
41+
if (!resizeInProgress) {
42+
resizeTable();
43+
}
4144
}
4245
@Override
4346
public void controlMoved(ControlEvent e) {
@@ -57,14 +60,19 @@ public void controlMoved(ControlEvent e) {
5760
}
5861

5962
protected void resizeTable() {
60-
Composite tableComposite = tableViewer.getTable();//.getParent();
61-
Rectangle tableCompositeArea = tableComposite.getClientArea();
62-
int width = tableCompositeArea.width;
63+
try {
64+
resizeInProgress = true;
65+
Composite tableComposite = tableViewer.getTable();//.getParent();
66+
Rectangle tableCompositeArea = tableComposite.getClientArea();
67+
int width = tableCompositeArea.width;
6368
// ScrollBar sb = tableViewer.getTable().getVerticalBar();
6469
// if (sb!=null && sb.isVisible()) {
6570
// width = width - sb.getSize().x;
6671
// }
67-
resizeTableColumns(width, tableViewer.getTable());
72+
resizeTableColumns(width, tableViewer.getTable());
73+
} finally {
74+
resizeInProgress = false;
75+
}
6876
}
6977

7078
protected void resizeTableColumns(int tableWidth, Table table) {

0 commit comments

Comments
 (0)