1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-10 01:35:39 +02:00

[182622] dont' expand things that dont' have children

This commit is contained in:
David McKnight 2007-04-18 17:53:05 +00:00
parent 5923ec7386
commit 9c2d3393e7

View file

@ -2244,8 +2244,17 @@ ISelectionChangedListener, ITreeViewerListener, ISystemResourceChangeEvents, ISy
// first, restore previous selection...
if (prevSelection != null) selectRemoteObjects(prevSelection, ss, parentSelectionItem);
TreeItem selectedItem = getFirstSelectedTreeItem();
if (selectedItem != null) {
if (!selectedItem.getExpanded()) // if the filter is expanded, then we already refreshed it...
if (selectedItem != null)
{
Object data = selectedItem.getData();
boolean allowExpand = true;
ISystemViewElementAdapter adapter = getViewAdapter(data);
if (adapter != null && data instanceof IAdaptable)
{
allowExpand = adapter.hasChildren((IAdaptable)data);
}
if (allowExpand && !selectedItem.getExpanded()) // if the filter is expanded, then we already refreshed it...
{
createChildren(selectedItem);
selectedItem.setExpanded(true);
@ -2805,8 +2814,14 @@ ISelectionChangedListener, ITreeViewerListener, ISystemResourceChangeEvents, ISy
(data == remoteObject)) // same binary object as given?
{
firstSelection = false;
if ((toSelect != null) && originatedHere) {
if (!getExpanded(match)) // assume if callers wants to select kids that they want to expand parent
if ((toSelect != null) && originatedHere)
{
boolean allowExpand = true;
if (rmtAdapter != null && data instanceof IAdaptable)
{
allowExpand = rmtAdapter.hasChildren((IAdaptable)data);
}
if (allowExpand && !getExpanded(match)) // assume if callers wants to select kids that they want to expand parent
{
createChildren(match);
setExpanded(match, true);