Community
Participate
Working Groups
Build Identifier: 3.6.1 In org.eclipse.debug.internal.ui.viewers.model.provisional.IColumnPresentation, I can specify my initial columns through getInitialColumns(). I need to specify my initial widths as well either through this interface or its derived interface. The org.eclipse.debug.internal.ui.viewers.model.InternalTreeModelViewer protected void buildColumns(IColumnPresentation presentation) method gets the initial columns from IColumnPresentation, but it computes the inital column widths using an average approach (if not restored from memento) as coded in its private void initColumns(int widthHint) method. The average approach makes a view of 4 columns in a tree widget width of 193 end up having each column width of 72. This is too less for the name column in a variables view or expression view for variables that has recursive nested variables. Users have to resize columns to see the tree of var. The method may look like this, int[] getInitialWidths(int treeWidgetWidth). And the InternalTreeModelViewer calls this method with treeWidegtWidth being tree2.getSize().x. This flexiblity enables viewer model provider to specify its logic of computing the initial column width. Reproducible: Always
I think its fair to call this an enhancement. Also if we were to start messing with column widths it seems that we should also have a mechanism to persist the user changes to them.
Created attachment 187309 [details] patch of this enhancement The change is small and backward compatible. A new interface IColumnPresentation2 is added and InternalTreeModelViewer is modified. IColumnPresentation2 is optional. If a view model does not implement this interface, the behavior is same as before this patch is applied. The only time that InternalTreeModelViewer uses IColumnPresentation2.getInitialColumnWidth is when fColumnSizes does not store the width of a given column. This ensures we do not mess up user settings and memento. Also, if IColumnPresentation2.getInitialColumnWidth returns -1, InternalTreeModelViewer will use the average width as before.
Could someone please review this change ASAP? I want to make sure this change can be merged before eclipse 3.7 API is frozen. thanks.
(In reply to comment #3) > Could someone please review this change ASAP? I want to make sure this change > can be merged before eclipse 3.7 API is frozen. thanks. Smart thinking, and thanks for the patch! It'll be easiest if we can get this in for M5 (i.e. end of next week). Although this is a small change so I think we could still swing it in M6 with more paperwork. I have one request though. I'd rather not put in an API without a use case where it can be tested. Also I've made a big effort to unit-test the flex hierarchy viewer as much as possible. So can you try to write a unit test for this feature? If a unit test turns out impossible, then an extension to the PDA example would be good enough to let us test this manualy.
M5 is this week after all, will look at this for M6.
Created attachment 187695 [details] testcase add unit test case as requested
Created attachment 187762 [details] testcase2 Please ignore testcase, and use testcase2 that contains up-to-date test cases.
I committed the interface extension and the tests. I had to modify the tests because they didn't work on my Linux system.
verified. I updated the copyrights of IColumnPresentation2 and implemented IColumnPresentation2 in AbstractColumnPresentation (does nothing, just consuming the new API).