1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-08 16:55:38 +02:00

[167620] improve performance of large select

This commit is contained in:
David McKnight 2006-12-12 17:49:23 +00:00
parent 596bc86602
commit 99be9bb4e7
2 changed files with 54 additions and 10 deletions

View file

@ -4278,6 +4278,7 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
// protected boolean selectionEnableDeleteAction;
// protected boolean selectionEnableRenameAction;
// initial these variables to true. Then if set to false even once, leave as false always...
selectionShowRefreshAction = true;
selectionShowOpenViewActions = true;
@ -4293,7 +4294,9 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
IStructuredSelection selection = (IStructuredSelection) getSelection();
Iterator elements = selection.iterator();
SystemRemoteElementResourceSet lastSet = null;
while (elements.hasNext()) {
Object element = elements.next();
ISystemViewElementAdapter adapter = getAdapter(element);
if (adapter == null) continue;
@ -4317,15 +4320,31 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
if (selectionIsRemoteObject && !selectionFlagsUpdated) {
ISubSystem srcSubSystem = adapter.getSubSystem(element);
if (srcSubSystem.isConnected() || element instanceof ISystemFilterReference || element instanceof ISubSystem) {
SystemRemoteElementResourceSet set = getSetFor(srcSubSystem, adapter);
if (srcSubSystem.isConnected() || element instanceof ISystemFilterReference || element instanceof ISubSystem)
{
SystemRemoteElementResourceSet set = null;
if (lastSet != null)
{
if (lastSet.getAdapter() == adapter && lastSet.getSubSystem() == srcSubSystem)
{
set = lastSet;
}
}
if (set == null)
{
set = getSetFor(srcSubSystem, adapter);
lastSet = set;
}
set.addResource(element);
}
}
}
selectionFlagsUpdated = true;
//System.out.println("Inside scan selections: selectionShowOpenViewActions = " + selectionShowOpenViewActions);
}
/**
@ -4702,11 +4721,13 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
protected boolean hasSelectedAncestor(TreeItem[] items) {
List cleanParents = new ArrayList();
for (int j = 0; j < items.length; j++)
{
TreeItem item = items[j];
TreeItem parent = item.getParentItem();
while (parent != null)
while (parent != null && !cleanParents.contains(parent))
{
if (isTreeItemSelected(parent))
{
@ -4714,6 +4735,7 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
}
else
{
cleanParents.add(parent);
parent = parent.getParentItem();
}
}

View file

@ -4278,6 +4278,7 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
// protected boolean selectionEnableDeleteAction;
// protected boolean selectionEnableRenameAction;
// initial these variables to true. Then if set to false even once, leave as false always...
selectionShowRefreshAction = true;
selectionShowOpenViewActions = true;
@ -4293,7 +4294,9 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
IStructuredSelection selection = (IStructuredSelection) getSelection();
Iterator elements = selection.iterator();
SystemRemoteElementResourceSet lastSet = null;
while (elements.hasNext()) {
Object element = elements.next();
ISystemViewElementAdapter adapter = getAdapter(element);
if (adapter == null) continue;
@ -4317,15 +4320,31 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
if (selectionIsRemoteObject && !selectionFlagsUpdated) {
ISubSystem srcSubSystem = adapter.getSubSystem(element);
if (srcSubSystem.isConnected() || element instanceof ISystemFilterReference || element instanceof ISubSystem) {
SystemRemoteElementResourceSet set = getSetFor(srcSubSystem, adapter);
if (srcSubSystem.isConnected() || element instanceof ISystemFilterReference || element instanceof ISubSystem)
{
SystemRemoteElementResourceSet set = null;
if (lastSet != null)
{
if (lastSet.getAdapter() == adapter && lastSet.getSubSystem() == srcSubSystem)
{
set = lastSet;
}
}
if (set == null)
{
set = getSetFor(srcSubSystem, adapter);
lastSet = set;
}
set.addResource(element);
}
}
}
selectionFlagsUpdated = true;
//System.out.println("Inside scan selections: selectionShowOpenViewActions = " + selectionShowOpenViewActions);
}
/**
@ -4702,11 +4721,13 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
protected boolean hasSelectedAncestor(TreeItem[] items) {
List cleanParents = new ArrayList();
for (int j = 0; j < items.length; j++)
{
TreeItem item = items[j];
TreeItem parent = item.getParentItem();
while (parent != null)
while (parent != null && !cleanParents.contains(parent))
{
if (isTreeItemSelected(parent))
{
@ -4714,6 +4735,7 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
}
else
{
cleanParents.add(parent);
parent = parent.getParentItem();
}
}