aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWojciech Sudol2013-10-10 05:35:43 (EDT)
committerGerrit Code Review @ Eclipse.org2014-02-28 10:47:23 (EST)
commit95132c5bfa61546ce0fbf31a324b8be3809cf3b3 (patch)
treed332613cad9601a6d88514421c72e09880ff0bb2
parent81ca4aa7523ef2b4e1edcbee471f2add9d6df98f (diff)
downloadeclipse.platform.ui-95132c5bfa61546ce0fbf31a324b8be3809cf3b3.zip
eclipse.platform.ui-95132c5bfa61546ce0fbf31a324b8be3809cf3b3.tar.gz
eclipse.platform.ui-95132c5bfa61546ce0fbf31a324b8be3809cf3b3.tar.bz2
Bug 409332: Image/Icon information returned by EditorReferencerefs/changes/72/19072/2
implementation is inconsistent with the IEditorPart implementation Change-Id: Ib47ac90b3d4fcd899de62ff21195780aa920367c Signed-off-by: Wojciech Sudol <wojciech.sudol@pl.ibm.com>
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java27
1 files changed, 22 insertions, 5 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java
index 33638dd..7698ef4 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java
@@ -133,9 +133,15 @@ public abstract class WorkbenchPartReference implements IWorkbenchPartReference,
* Stores the current Image for this part reference. Lazily created. Null if not allocated.
*/
private Image image = null;
-
+
+ /**
+ * Stores reference to the image kept in the legacyPart. Used for quick check
+ * if the image changed.
+ */
+ private Image legacyPartImage = null;
+
private ImageDescriptor defaultImageDescriptor;
-
+
/**
* Stores the current image descriptor for the part.
*/
@@ -401,13 +407,24 @@ public abstract class WorkbenchPartReference implements IWorkbenchPartReference,
if (isDisposed()) {
return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_DEF_VIEW);
}
-
- if (image == null) {
+
+ Image newLegacyPartImage = null;
+ if (legacyPart != null) {
+ newLegacyPartImage = legacyPart.getTitleImage();
+ }
+ // refresh the local image if the image in the legacyPart changed
+ if (newLegacyPartImage != null && newLegacyPartImage != legacyPartImage) {
+ legacyPartImage = newLegacyPartImage;
+ // the setImageDescriptor(ImageDescriptor) method sets the image field to null,
+ // so a new value will be assigned to the image in the conditional statement below
+ setImageDescriptor(computeImageDescriptor());
+ }
+ if (image == null) {
image = JFaceResources.getResources().createImageWithDefault(imageDescriptor);
}
return image;
}
-
+
public ImageDescriptor getTitleImageDescriptor() {
if (isDisposed()) {
return PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_DEF_VIEW);