2828public 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