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:
parent
596bc86602
commit
99be9bb4e7
2 changed files with 54 additions and 10 deletions
|
@ -4278,6 +4278,7 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
||||||
// protected boolean selectionEnableDeleteAction;
|
// protected boolean selectionEnableDeleteAction;
|
||||||
// protected boolean selectionEnableRenameAction;
|
// protected boolean selectionEnableRenameAction;
|
||||||
|
|
||||||
|
|
||||||
// initial these variables to true. Then if set to false even once, leave as false always...
|
// initial these variables to true. Then if set to false even once, leave as false always...
|
||||||
selectionShowRefreshAction = true;
|
selectionShowRefreshAction = true;
|
||||||
selectionShowOpenViewActions = true;
|
selectionShowOpenViewActions = true;
|
||||||
|
@ -4290,10 +4291,12 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
||||||
|
|
||||||
selectionHasAncestorRelation = hasAncestorRelationSelection();
|
selectionHasAncestorRelation = hasAncestorRelationSelection();
|
||||||
|
|
||||||
|
|
||||||
IStructuredSelection selection = (IStructuredSelection) getSelection();
|
IStructuredSelection selection = (IStructuredSelection) getSelection();
|
||||||
Iterator elements = selection.iterator();
|
Iterator elements = selection.iterator();
|
||||||
|
SystemRemoteElementResourceSet lastSet = null;
|
||||||
while (elements.hasNext()) {
|
while (elements.hasNext()) {
|
||||||
|
|
||||||
Object element = elements.next();
|
Object element = elements.next();
|
||||||
ISystemViewElementAdapter adapter = getAdapter(element);
|
ISystemViewElementAdapter adapter = getAdapter(element);
|
||||||
if (adapter == null) continue;
|
if (adapter == null) continue;
|
||||||
|
@ -4317,15 +4320,31 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
||||||
|
|
||||||
if (selectionIsRemoteObject && !selectionFlagsUpdated) {
|
if (selectionIsRemoteObject && !selectionFlagsUpdated) {
|
||||||
ISubSystem srcSubSystem = adapter.getSubSystem(element);
|
ISubSystem srcSubSystem = adapter.getSubSystem(element);
|
||||||
if (srcSubSystem.isConnected() || element instanceof ISystemFilterReference || element instanceof ISubSystem) {
|
if (srcSubSystem.isConnected() || element instanceof ISystemFilterReference || element instanceof ISubSystem)
|
||||||
SystemRemoteElementResourceSet set = getSetFor(srcSubSystem, adapter);
|
{
|
||||||
|
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);
|
set.addResource(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
selectionFlagsUpdated = true;
|
selectionFlagsUpdated = true;
|
||||||
//System.out.println("Inside scan selections: selectionShowOpenViewActions = " + selectionShowOpenViewActions);
|
//System.out.println("Inside scan selections: selectionShowOpenViewActions = " + selectionShowOpenViewActions);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4702,18 +4721,21 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
||||||
|
|
||||||
protected boolean hasSelectedAncestor(TreeItem[] items) {
|
protected boolean hasSelectedAncestor(TreeItem[] items) {
|
||||||
|
|
||||||
|
List cleanParents = new ArrayList();
|
||||||
|
|
||||||
for (int j = 0; j < items.length; j++)
|
for (int j = 0; j < items.length; j++)
|
||||||
{
|
{
|
||||||
TreeItem item = items[j];
|
TreeItem item = items[j];
|
||||||
TreeItem parent = item.getParentItem();
|
TreeItem parent = item.getParentItem();
|
||||||
while (parent != null)
|
while (parent != null && !cleanParents.contains(parent))
|
||||||
{
|
{
|
||||||
if (isTreeItemSelected(parent))
|
if (isTreeItemSelected(parent))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
cleanParents.add(parent);
|
||||||
parent = parent.getParentItem();
|
parent = parent.getParentItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4278,6 +4278,7 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
||||||
// protected boolean selectionEnableDeleteAction;
|
// protected boolean selectionEnableDeleteAction;
|
||||||
// protected boolean selectionEnableRenameAction;
|
// protected boolean selectionEnableRenameAction;
|
||||||
|
|
||||||
|
|
||||||
// initial these variables to true. Then if set to false even once, leave as false always...
|
// initial these variables to true. Then if set to false even once, leave as false always...
|
||||||
selectionShowRefreshAction = true;
|
selectionShowRefreshAction = true;
|
||||||
selectionShowOpenViewActions = true;
|
selectionShowOpenViewActions = true;
|
||||||
|
@ -4290,10 +4291,12 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
||||||
|
|
||||||
selectionHasAncestorRelation = hasAncestorRelationSelection();
|
selectionHasAncestorRelation = hasAncestorRelationSelection();
|
||||||
|
|
||||||
|
|
||||||
IStructuredSelection selection = (IStructuredSelection) getSelection();
|
IStructuredSelection selection = (IStructuredSelection) getSelection();
|
||||||
Iterator elements = selection.iterator();
|
Iterator elements = selection.iterator();
|
||||||
|
SystemRemoteElementResourceSet lastSet = null;
|
||||||
while (elements.hasNext()) {
|
while (elements.hasNext()) {
|
||||||
|
|
||||||
Object element = elements.next();
|
Object element = elements.next();
|
||||||
ISystemViewElementAdapter adapter = getAdapter(element);
|
ISystemViewElementAdapter adapter = getAdapter(element);
|
||||||
if (adapter == null) continue;
|
if (adapter == null) continue;
|
||||||
|
@ -4317,15 +4320,31 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
||||||
|
|
||||||
if (selectionIsRemoteObject && !selectionFlagsUpdated) {
|
if (selectionIsRemoteObject && !selectionFlagsUpdated) {
|
||||||
ISubSystem srcSubSystem = adapter.getSubSystem(element);
|
ISubSystem srcSubSystem = adapter.getSubSystem(element);
|
||||||
if (srcSubSystem.isConnected() || element instanceof ISystemFilterReference || element instanceof ISubSystem) {
|
if (srcSubSystem.isConnected() || element instanceof ISystemFilterReference || element instanceof ISubSystem)
|
||||||
SystemRemoteElementResourceSet set = getSetFor(srcSubSystem, adapter);
|
{
|
||||||
|
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);
|
set.addResource(element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
selectionFlagsUpdated = true;
|
selectionFlagsUpdated = true;
|
||||||
//System.out.println("Inside scan selections: selectionShowOpenViewActions = " + selectionShowOpenViewActions);
|
//System.out.println("Inside scan selections: selectionShowOpenViewActions = " + selectionShowOpenViewActions);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4702,18 +4721,21 @@ public class SystemView extends TreeViewer implements ISystemTree, ISystemResour
|
||||||
|
|
||||||
protected boolean hasSelectedAncestor(TreeItem[] items) {
|
protected boolean hasSelectedAncestor(TreeItem[] items) {
|
||||||
|
|
||||||
|
List cleanParents = new ArrayList();
|
||||||
|
|
||||||
for (int j = 0; j < items.length; j++)
|
for (int j = 0; j < items.length; j++)
|
||||||
{
|
{
|
||||||
TreeItem item = items[j];
|
TreeItem item = items[j];
|
||||||
TreeItem parent = item.getParentItem();
|
TreeItem parent = item.getParentItem();
|
||||||
while (parent != null)
|
while (parent != null && !cleanParents.contains(parent))
|
||||||
{
|
{
|
||||||
if (isTreeItemSelected(parent))
|
if (isTreeItemSelected(parent))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
cleanParents.add(parent);
|
||||||
parent = parent.getParentItem();
|
parent = parent.getParentItem();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue