Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2007-06-06 21:49:58 -0400
committermkersten2007-06-06 21:49:58 -0400
commit400338fb44c34970e3e3de908394c9b03ff95123 (patch)
tree030d6b555dabd56c5a75e21cea721ad292d55e49
parent898b59c0bf57880c6babccdaadfef2fdf50d2257 (diff)
downloadorg.eclipse.mylyn.tasks-400338fb44c34970e3e3de908394c9b03ff95123.tar.gz
org.eclipse.mylyn.tasks-400338fb44c34970e3e3de908394c9b03ff95123.tar.xz
org.eclipse.mylyn.tasks-400338fb44c34970e3e3de908394c9b03ff95123.zip
NEW - bug 188429: fix image resource leak in composite Task List images
https://bugs.eclipse.org/bugs/show_bug.cgi?id=188429
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiImages.java41
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java9
2 files changed, 27 insertions, 23 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiImages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiImages.java
index e1cbbe999..f2d43444d 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiImages.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiImages.java
@@ -116,8 +116,6 @@ public class TasksUiImages {
public static final ImageDescriptor OVERLAY_OVER_DUE = create(T_EVIEW, "overlay-overdue.gif");
public static final ImageDescriptor OVERLAY_SOLID_WHITE = create(T_OVR, "solid-white.gif");
-
- public static final ImageDescriptor TASK_WEB = createWithOverlay(TASK, OVERLAY_WEB, false, true);
public static final ImageDescriptor TASK_WEB_REMOTE = create(T_TOOL, "overlay-web.gif");
@@ -173,18 +171,6 @@ public class TasksUiImages {
public static final ImageDescriptor STATUS_CONTEXT = create(T_EVIEW, "status-server-context.gif");
-// public static final ImageDescriptor STATUS_OVERLAY_INCOMMING_NEW = createWithOverlay(STATUS_NORMAL, OVERLAY_INCOMMING_NEW,
-// true, true);
-//
-// public static final ImageDescriptor STATUS_NORMAL_INCOMING = createWithOverlay(STATUS_NORMAL, OVERLAY_INCOMMING,
-// true, true);
-//
-// public static final ImageDescriptor STATUS_NORMAL_OUTGOING = createWithOverlay(STATUS_NORMAL, OVERLAY_OUTGOING,
-// true, true);
-//
-// public static final ImageDescriptor STATUS_NORMAL_CONFLICT = createWithOverlay(STATUS_NORMAL, OVERLAY_CONFLICT,
-// true, true);
-
public static final ImageDescriptor QUERY = create(T_TOOL, "query.gif");
public static final ImageDescriptor QUERY_NEW = create(T_TOOL, "query-new.gif");
@@ -251,11 +237,6 @@ public class TasksUiImages {
// return new TaskListImageDescriptor(base, size);
// }
- public static ImageDescriptor createWithOverlay(ImageDescriptor base, ImageDescriptor overlay, boolean top,
- boolean left) {
- return new TaskListImageDescriptor(base, overlay, top, left);
- }
-
/**
* Lazily initializes image map.
*/
@@ -269,6 +250,28 @@ public class TasksUiImages {
return image;
}
+ public static Image getImageWithOverlay(ImageDescriptor icon, ImageDescriptor overlay, boolean top,
+ boolean left) {
+ if (icon == null) {
+ return null;
+ }
+ String key = "" + icon.hashCode();
+ if (overlay != null) {
+ key += overlay.hashCode();
+ }
+ key += new Boolean(top).hashCode();
+ key += new Boolean(left).hashCode();
+
+ Image image = getImageRegistry().get(key);
+
+ if (image == null) {
+ TaskListImageDescriptor imageDescriptor = new TaskListImageDescriptor(icon, overlay, top, left);
+ image = imageDescriptor.createImage(true);
+ getImageRegistry().put(key, image);
+ }
+ return image;
+ }
+
/**
* Lazily initializes image map.
*
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
index ea9b7ce0c..64f4fdde6 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
@@ -417,8 +417,9 @@ public class TaskEditor extends SharedHeaderFormEditor implements IBusyEditor {
setTitleImage(TasksUiImages.getImage(TasksUiImages.TASK_REPOSITORY));
} else if (getEditorInput() instanceof AbstractTaskEditorInput) {
this.setTitleImage(TasksUiImages.getImage(TasksUiImages.TASK_REMOTE));
- } else if (getUrl() != null) {
- setTitleImage(TasksUiImages.getImage(TasksUiImages.TASK_WEB));
+ } else { //if (getUrl() != null) {
+ setTitleImage(TasksUiImages.getImage(TasksUiImages.TASK_REPOSITORY));
+// setTitleImage(TasksUiImages.getImage(TasksUiImages.TASK_WEB));
}
} catch (PartInitException e) {
@@ -508,10 +509,10 @@ public class TaskEditor extends SharedHeaderFormEditor implements IBusyEditor {
private void setFormHeaderImage(String repositoryKind) {
ImageDescriptor overlay = TasksUiPlugin.getDefault().getOverlayIcon(repositoryKind);
- ImageDescriptor imageDescriptor = TasksUiImages.createWithOverlay(TasksUiImages.REPOSITORY, overlay, false,
+ Image image = TasksUiImages.getImageWithOverlay(TasksUiImages.REPOSITORY, overlay, false,
false);
if (getHeaderForm() != null) {
- getHeaderForm().getForm().setImage(TasksUiImages.getImage(imageDescriptor));
+ getHeaderForm().getForm().setImage(image);
}
}

Back to the top