From 81780b4a1890ace3fbd73b0dbe3292f1535a8eef Mon Sep 17 00:00:00 2001 From: David McKnight Date: Thu, 8 Jan 2009 18:14:43 +0000 Subject: [PATCH] [260346] RSE view for jobs does not remember resized columns --- .../eclipse/rse/ui/view/SystemTableView.java | 34 ++++++++++++++++--- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java index 53b29a96178..1c2b9dd7e9e 100644 --- a/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java +++ b/rse/plugins/org.eclipse.rse.ui/UI/org/eclipse/rse/ui/view/SystemTableView.java @@ -22,14 +22,17 @@ * Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading * Martin Oberhuber (Wind River) - [227516] [regression] Fix ArrayIndexOutOfBoundsException in TableView * David McKnight (IBM) - [187058] Incorrect Right Click Menu in Remote System Details View with no selection + * David McKnight (IBM) - [260346] RSE view for jobs does not remember resized columns ********************************************************************************/ package org.eclipse.rse.ui.view; import java.util.ArrayList; import java.util.Enumeration; +import java.util.HashMap; import java.util.Hashtable; import java.util.Iterator; import java.util.List; +import java.util.Map; import java.util.Vector; import org.eclipse.core.resources.WorkspaceJob; @@ -297,13 +300,18 @@ public class SystemTableView private boolean _showColumns = true; - private Image _upI; - private Image _downI; + private Image _upI; + private Image _downI; protected boolean menuListenerAdded = false; private static final int LEFT_BUTTON = 1; private int mouseButtonPressed = LEFT_BUTTON; + + // for bug 260346 - to maintain list of cached column widths + private HashMap _cachedColumnWidths; + + /** * Constructor for the table view * @@ -364,6 +372,8 @@ public class SystemTableView _upI = RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_ARROW_UP_ID); _downI = RSEUIPlugin.getDefault().getImage(ISystemIconConstants.ICON_SYSTEM_ARROW_DOWN_ID); + + _cachedColumnWidths = new HashMap(); } /** @@ -428,6 +438,16 @@ public class SystemTableView if (newObject instanceof IAdaptable) { getTable().setVisible(true); + + // columns may change so we want to keep track of the current ones + int[] lastWidths = getCurrentColumnWidths(); + if (lastWidths.length > 0){ + ISystemViewElementAdapter contentsAdapter = getAdapterForContents(); + + // associate the last contents adapter with the last widths + _cachedColumnWidths.put(contentsAdapter, lastWidths); + } + _objectInput = newObject; computeLayout(); @@ -759,8 +779,14 @@ public class SystemTableView int[] lastWidths = getLastColumnWidths(); if (numColumns > 1) { + int[] cachedWidths = (int[])_cachedColumnWidths.get(getAdapterForContents()); + + // if there are already cached widths, use them + if (cachedWidths != null){ + setCurrentColumnWidths(cachedWidths); + } // check if previous widths can be used - if (lastWidths != null && lastWidths.length == numColumns) + else if (lastWidths != null && lastWidths.length == numColumns) { // use previously established widths @@ -1304,7 +1330,7 @@ public class SystemTableView } table.dispose(); - } + } } /*