Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Macguire2002-05-03 20:53:23 +0000
committerKevin Macguire2002-05-03 20:53:23 +0000
commitabce45f67fba2aebdf0125564a9ca6ff4def62e6 (patch)
treea49c4f28e6b269f4060424003e2d34b092db4450
parent63af1571666285aba95744991b64cc29ff69ae30 (diff)
downloadeclipse.platform.team-abce45f67fba2aebdf0125564a9ca6ff4def62e6.tar.gz
eclipse.platform.team-abce45f67fba2aebdf0125564a9ca6ff4def62e6.tar.xz
eclipse.platform.team-abce45f67fba2aebdf0125564a9ca6ff4def62e6.zip
12315: optimized decorator updating via LabelProviderChangedEvent
LabelProviderChangedEvent used to only take a single element, now it also takes an array.
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java33
1 files changed, 15 insertions, 18 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java
index e461ea8d9..af74c16b0 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSDecorator.java
@@ -217,16 +217,17 @@ public class CVSDecorator extends LabelProvider implements ILabelDecorator, IRes
* @see IDecorationNotifier#decorated(IResource[], CVSDecoration[])
*/
public synchronized void decorated(IResource[] resources, CVSDecoration[] decorations) {
- List events = new ArrayList();
if(!shutdown) {
+ List decorated = new ArrayList();
+
for (int i = 0; i < resources.length; i++) {
IResource resource= resources[i];
if(resource.exists()) {
cache.put(resource, decorations[i]);
- events.add(new LabelProviderChangedEvent(this, resource));
+ decorated.add(decorations[i]);
}
}
- postLabelEvents((LabelProviderChangedEvent[]) events.toArray(new LabelProviderChangedEvent[events.size()]));
+ postLabelEvent(new LabelProviderChangedEvent(this, decorated.toArray()));
}
}
@@ -307,12 +308,12 @@ public class CVSDecorator extends LabelProvider implements ILabelDecorator, IRes
// post label events for resources that cannot or should not be decorated by CVS
if(!noProviderResources.isEmpty()) {
- List events = new ArrayList();
+ List resourcesToUpdate = new ArrayList();
for (Iterator it = resources.iterator(); it.hasNext();) {
IResource element = (IResource) it.next();
- events.add(new LabelProviderChangedEvent(this, element));
+ resourcesToUpdate.add(element);
}
- postLabelEvents((LabelProviderChangedEvent[]) events.toArray(new LabelProviderChangedEvent[events.size()]));
+ postLabelEvent(new LabelProviderChangedEvent(this, resourcesToUpdate.toArray()));
}
}
@@ -376,22 +377,18 @@ public class CVSDecorator extends LabelProvider implements ILabelDecorator, IRes
}
/**
- * Post the label events to the UI thread
+ * Post the label event to the UI thread
*
* @param events the events to post
*/
- private void postLabelEvents(final LabelProviderChangedEvent[] events) {
- // now post the change events to the UI thread
- if (events.length > 0) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- for (int i = 0; i < events.length; i++) {
- fireLabelProviderChanged(events[i]);
- }
- }
- });
- }
+ private void postLabelEvent(final LabelProviderChangedEvent event) {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ fireLabelProviderChanged(event);
+ }
+ });
}
+
private void shutdown() {
shutdown = true;

Back to the top