Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2007-06-12 16:09:20 -0400
committermkersten2007-06-12 16:09:20 -0400
commit916e633c605fc0213dffc5cc91fe82c020bcc830 (patch)
treef51a5f71e97abb9522a2d9c779eb21777707eee3
parent9634326d61778ba55c8e0ec24dec261aa7564c5b (diff)
downloadorg.eclipse.mylyn.tasks-916e633c605fc0213dffc5cc91fe82c020bcc830.tar.gz
org.eclipse.mylyn.tasks-916e633c605fc0213dffc5cc91fe82c020bcc830.tar.xz
org.eclipse.mylyn.tasks-916e633c605fc0213dffc5cc91fe82c020bcc830.zip
RESOLVED - 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.java13
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskNavigateDropDownAction.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskElementLabelProvider.java40
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/WorkweekProgressBar.java2
6 files changed, 15 insertions, 46 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 ebfa15c09..f5b7b07aa 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
@@ -279,7 +279,7 @@ public class TasksUiImages {
*
* @param icon cannot be null
*/
- public static Image getCompositeTaskImage(ImageDescriptor icon, ImageDescriptor overlayKind, ImageDescriptor contextToggle) {
+ public static Image getCompositeTaskImage(ImageDescriptor icon, ImageDescriptor overlayKind) {
if (icon == null) {
return null;
}
@@ -287,9 +287,6 @@ public class TasksUiImages {
if (overlayKind != null) {
key += overlayKind.hashCode();
}
- if (contextToggle != null) {
- key += contextToggle.hashCode();
- }
Image image = getImageRegistry().get(key);
@@ -301,18 +298,14 @@ public class TasksUiImages {
return image;
}
- public static Image getCompositeContainerImage(ImageDescriptor icon, ImageDescriptor overlay) {
+ public static Image getCompositeContainerImage(ImageDescriptor icon) {
if (icon == null) {
return null;
}
String key = "" + icon.hashCode();
- if (overlay != null) {
- key += overlay.hashCode();
- }
-
Image image = getImageRegistry().get(key);
if (image == null) {
- CompositeContainerImageDescriptor imageDescriptor = new CompositeContainerImageDescriptor(icon, overlay);
+ CompositeContainerImageDescriptor imageDescriptor = new CompositeContainerImageDescriptor(icon, OVERLAY_BLANK);
image = imageDescriptor.createImage(true);
getImageRegistry().put(key, image);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskNavigateDropDownAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskNavigateDropDownAction.java
index 3aba4c516..d5ca5d501 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskNavigateDropDownAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/TaskNavigateDropDownAction.java
@@ -33,7 +33,7 @@ public abstract class TaskNavigateDropDownAction extends Action implements IMenu
protected Menu dropDownMenu = null;
- protected TaskElementLabelProvider labelProvider = new TaskElementLabelProvider(true);
+ protected TaskElementLabelProvider labelProvider = new TaskElementLabelProvider();
/** Maximum number of items to appear in the drop-down menu */
protected final static int MAX_ITEMS_TO_DISPLAY = 12;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java
index f9bd602f3..ddf2a289a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/search/RepositorySearchResultView.java
@@ -152,7 +152,7 @@ public class RepositorySearchResultView extends AbstractTextSearchViewPage imple
TaskListColorsAndFonts.THEME_COLOR_TASKLIST_CATEGORY);
SearchViewTableLabelProvider taskListTableLabelProvider = new SearchViewTableLabelProvider(
- new TaskElementLabelProvider(true),
+ new TaskElementLabelProvider(),
PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(), categoryBackground);
viewer.setLabelProvider(taskListTableLabelProvider);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskElementLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskElementLabelProvider.java
index 2a7f91e5e..6f26443f5 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskElementLabelProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskElementLabelProvider.java
@@ -50,50 +50,37 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
private static final Pattern pattern = Pattern.compile("\\d*: .*");
- private boolean compositeImages = false;
-
private class CompositeImageDescriptor {
ImageDescriptor icon;
ImageDescriptor overlayKind;
-
- ImageDescriptor overlaySynch;
+
};
public TaskElementLabelProvider() {
super();
}
- /**
- * @param treeViewer
- * can be null
- */
- public TaskElementLabelProvider(boolean compositeImages) {
- super();
- this.compositeImages = compositeImages;
- }
-
@Override
public Image getImage(Object element) {
- CompositeImageDescriptor compositeDescriptor = getImageDescriptor(element, compositeImages);
+ CompositeImageDescriptor compositeDescriptor = getImageDescriptor(element);
if (element instanceof ITask) {
if (compositeDescriptor.overlayKind == null) {
compositeDescriptor.overlayKind = TasksUiImages.OVERLAY_BLANK;
}
- return TasksUiImages.getCompositeTaskImage(compositeDescriptor.icon, compositeDescriptor.overlayKind,
- compositeDescriptor.overlaySynch);
+ return TasksUiImages.getCompositeTaskImage(compositeDescriptor.icon, compositeDescriptor.overlayKind);
} else if (element instanceof AbstractTaskContainer) {
- if (compositeDescriptor.overlaySynch == null) {
- compositeDescriptor.overlaySynch = TasksUiImages.OVERLAY_BLANK;
- }
- return TasksUiImages.getCompositeContainerImage(compositeDescriptor.icon, compositeDescriptor.overlaySynch);
+// if (compositeDescriptor.overlaySynch == null) {
+// compositeDescriptor.overlaySynch = TasksUiImages.OVERLAY_BLANK;
+// }
+ return TasksUiImages.getCompositeContainerImage(compositeDescriptor.icon);
} else {
- return TasksUiImages.getCompositeTaskImage(compositeDescriptor.icon, null, null);
+ return TasksUiImages.getCompositeTaskImage(compositeDescriptor.icon, null);
}
}
- private CompositeImageDescriptor getImageDescriptor(Object object, boolean showSynchState) {
+ private CompositeImageDescriptor getImageDescriptor(Object object) {
CompositeImageDescriptor compositeDescriptor = new CompositeImageDescriptor();
if (object instanceof TaskArchive) {
compositeDescriptor.icon = TasksUiImages.CATEGORY_ARCHIVE;
@@ -112,9 +99,6 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
if (connectorUi != null) {
compositeDescriptor.overlayKind = connectorUi.getTaskKindOverlay(repositoryTask);
}
- if (showSynchState) {
- compositeDescriptor.overlaySynch = getSynchronizationImageDescriptor(element, false);
- }
} else if (element instanceof AbstractRepositoryQuery) {
connectorUi = TasksUiPlugin.getRepositoryUi(((AbstractRepositoryQuery) element).getRepositoryKind());
}
@@ -123,12 +107,6 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
compositeDescriptor.icon = connectorUi.getTaskListElementIcon(element);
return compositeDescriptor;
} else {
- if (element instanceof ITask) {
- if (showSynchState) {
- compositeDescriptor.overlaySynch = getSynchronizationImageDescriptor(element, false);
- }
- }
-
if (element instanceof AbstractRepositoryQuery) {
compositeDescriptor.icon = TasksUiImages.QUERY;
} else if (element instanceof ITask) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
index f015ef30a..773465fac 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java
@@ -785,7 +785,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
final IThemeManager themeManager = getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
Color categoryBackground = themeManager.getCurrentTheme().getColorRegistry().get(
TaskListColorsAndFonts.THEME_COLOR_TASKLIST_CATEGORY);
- taskListTableLabelProvider = new TaskTableLabelProvider(new TaskElementLabelProvider(true), PlatformUI
+ taskListTableLabelProvider = new TaskTableLabelProvider(new TaskElementLabelProvider(), PlatformUI
.getWorkbench().getDecoratorManager().getLabelDecorator(), categoryBackground);
getViewer().setLabelProvider(taskListTableLabelProvider);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/WorkweekProgressBar.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/WorkweekProgressBar.java
index f460be0ad..11683cc8b 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/WorkweekProgressBar.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/WorkweekProgressBar.java
@@ -12,8 +12,6 @@ import org.eclipse.mylyn.internal.tasks.ui.TaskListColorsAndFonts;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.PaintEvent;
import org.eclipse.swt.events.PaintListener;
import org.eclipse.swt.graphics.Color;

Back to the top