Fix for 30308
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationBuilder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationBuilder.java
index 9ff41be..ae411f2 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationBuilder.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationBuilder.java
@@ -82,12 +82,18 @@
new ArrayList(suffixes),
descriptors);
+ return newResult;
+ }
+
+
+ /**
+ * Clear the contents of the result so it can be reused.
+ */
+ void clearContents() {
this.prefixes.clear();
this.suffixes.clear();
this.descriptors = new ImageDescriptor[DECORATOR_ARRAY_SIZE];
valueSet = false;
-
- return newResult;
}
/**
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationScheduler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationScheduler.java
index 1976935..8176d9c 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationScheduler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/DecorationScheduler.java
@@ -281,18 +281,40 @@
//Don't decorate if there is already a pending result
if (!resultCache.containsKey(reference.getElement())) {
+ //Just build for the resource first
+ Object adapted = reference.getAdaptedElement();
+
+ if (adapted != null) {
+ decoratorManager
+ .getLightweightManager()
+ .getDecorations(
+ adapted,
+ cacheResult);
+ if (cacheResult.hasValue()) {
+ resultCache.put(
+ adapted,
+ cacheResult.createResult());
+
+ }
+ }
+
+ //Now add in the results for the main object
+
decoratorManager
.getLightweightManager()
.getDecorations(
reference.getElement(),
- reference.getAdaptedElement(),
cacheResult);
if (cacheResult.hasValue()) {
- DecorationResult result =
- cacheResult.createResult();
- resultCache.put(reference.getElement(), result);
+ resultCache.put(
+ reference.getElement(),
+ cacheResult.createResult());
+
+ //Add an update for only the original element to
+ //prevent multiple updates and clear the cache.
pendingUpdate.add(reference.getElement());
+ cacheResult.clearContents();
};
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightDecoratorManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightDecoratorManager.java
index bfcc5fa..998fa04 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightDecoratorManager.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/decorators/LightweightDecoratorManager.java
@@ -180,7 +180,6 @@
void getDecorations(
Object element,
- Object adapted,
DecorationBuilder decoration) {
LightweightDecoratorDefinition[] decorators = getDecoratorsFor(element);
@@ -192,16 +191,6 @@
}
}
- if (adapted != null) {
- decorators = getDecoratorsFor(adapted);
-
- for (int i = 0; i < decorators.length; i++) {
- if (decorators[i].getEnablement().isEnabledFor(adapted)) {
- decoration.setCurrentDefinition(decorators[i]);
- decorate(adapted, decoration, decorators[i]);
- }
- }
- }
}