Bug 486155

Summary: The tree viewer state restoration upon Eclipse startup occasionally failing
Product: [Automotive] Sphinx Reporter: Stephan Eberle <stephaneberle9>
Component: Navigator & Editor SocketsAssignee: Stephan Eberle <stephaneberle9>
Status: CLOSED WONTFIX QA Contact:
Severity: major    
Priority: P3 CC: balazs.grill, graf
Version: 0.10.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 10   
Whiteboard:

Description Stephan Eberle CLA 2016-01-20 02:51:53 EST
= Problem description =

After having shut down Eclipse with a workspace in where one or several model files had been expanded in the Model Explorer, it occasionally happens that the expansion state is not fully restored when the workbench is restarted again. The common observation is that only the root element(s) of the model files are expanded in such cases but the expansion state of the nested model elements is not restored.

= Problem analysis =

The root cause of this problem seems to be located in the first while loop of TreeViewerStateRecorder#applyState(): Here, it can happen that a model file is skipped because it has not been loaded yet but the model elements contained in that file are not skipped because apparently the file has been loaded in parallel to this iteration. 

= Proposed solution =

To avoid this kind of trouble, TreeViewerStateRecorder#applyState() must be made aware of the tree paths behind the recorded tree element state providers and skip all remaining tree element state providers that are on the same tree path if a given tree element state provider turn out to be not loaded yet. This can be achieved by changing ITreeViewerState#getExpandedElements() from a flat list of tree element state providers into a list of tree element state provider lists where the inner list contains the tree element state providers that are on the same tree path. The logic in #recordState(), #saveState() and #restoreState() to be adapted accordingly. When #applyState() detects that a given tree element state provider from this 2-dimensional list is not loaded yet then it must skip all remaining tree element state providers on the same inner list (i.e., on the same tree path) instead of skipping only the current one.
Comment 1 Balazs Grill CLA 2024-05-06 23:13:33 EDT
Closed stale issue before migration