Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2007-05-01 02:54:49 +0000
committermkersten2007-05-01 02:54:49 +0000
commit111d50abbae286139683be9b664b9b0c6ba047bd (patch)
tree5aeb9551f9111f6061edb0eeae2664452cac7d1f
parentdc089c2b1b51915f9032cb703ba404f84856f311 (diff)
downloadorg.eclipse.mylyn.tasks-111d50abbae286139683be9b664b9b0c6ba047bd.tar.gz
org.eclipse.mylyn.tasks-111d50abbae286139683be9b664b9b0c6ba047bd.tar.xz
org.eclipse.mylyn.tasks-111d50abbae286139683be9b664b9b0c6ba047bd.zip
NEW - bug 182772: improve Task List table/tree layout
https://bugs.eclipse.org/bugs/show_bug.cgi?id=182772
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/icons/eview16/overlay-critical.gifbin0 -> 105 bytes
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/icons/eview16/overlay-enhancement.gifbin0 -> 81 bytes
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/icons/eview16/overlay-major.gifbin0 -> 77 bytes
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/icons/eview16/overlay-minor.gifbin0 -> 77 bytes
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/plugin.xml15
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaImages.java8
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryUi.java27
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskDecorator.java64
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/task-active.gifbin197 -> 183 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/task-context.gifbin194 -> 180 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/task-inactive.gifbin128 -> 121 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/task-narrow.gifbin0 -> 209 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/etool16/task.gifbin211 -> 215 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/eview16/overlay-incoming-new.gifbin116 -> 175 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/eview16/overlay-incoming.gifbin170 -> 177 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/eview16/overlay-outgoing.gifbin117 -> 174 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p1.gifbin136 -> 0 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p2.gifbin122 -> 0 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p3.gifbin50 -> 0 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p4.gifbin177 -> 0 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p5.gifbin186 -> 0 bytes
-rw-r--r--org.eclipse.mylyn.tasks.ui/plugin.xml6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/CompositeSynchronizationImageDescriptor.java59
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/CompositeTaskContainerImageDescriptor.java59
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/CompositeTaskImageDescriptor.java85
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/RepositoryTaskDecorator.java89
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListImageDescriptor.java9
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiImages.java146
-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.java138
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java39
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListTableLabelProvider.java90
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListTableSorter.java14
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java63
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java34
36 files changed, 651 insertions, 302 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/icons/eview16/overlay-critical.gif b/org.eclipse.mylyn.bugzilla.ui/icons/eview16/overlay-critical.gif
new file mode 100644
index 000000000..41497b1df
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.ui/icons/eview16/overlay-critical.gif
Binary files differ
diff --git a/org.eclipse.mylyn.bugzilla.ui/icons/eview16/overlay-enhancement.gif b/org.eclipse.mylyn.bugzilla.ui/icons/eview16/overlay-enhancement.gif
new file mode 100644
index 000000000..9a75b1efe
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.ui/icons/eview16/overlay-enhancement.gif
Binary files differ
diff --git a/org.eclipse.mylyn.bugzilla.ui/icons/eview16/overlay-major.gif b/org.eclipse.mylyn.bugzilla.ui/icons/eview16/overlay-major.gif
new file mode 100644
index 000000000..2ec19fb9d
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.ui/icons/eview16/overlay-major.gif
Binary files differ
diff --git a/org.eclipse.mylyn.bugzilla.ui/icons/eview16/overlay-minor.gif b/org.eclipse.mylyn.bugzilla.ui/icons/eview16/overlay-minor.gif
new file mode 100644
index 000000000..376dbb403
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.ui/icons/eview16/overlay-minor.gif
Binary files differ
diff --git a/org.eclipse.mylyn.bugzilla.ui/plugin.xml b/org.eclipse.mylyn.bugzilla.ui/plugin.xml
index d1ff45600..d74f0deca 100644
--- a/org.eclipse.mylyn.bugzilla.ui/plugin.xml
+++ b/org.eclipse.mylyn.bugzilla.ui/plugin.xml
@@ -38,19 +38,4 @@
<newWizardShortcut id="org.eclipse.mylar.bugzilla.bugWizard"/>
</perspectiveExtension>
</extension>
-
- <extension
- point="org.eclipse.ui.decorators">
- <decorator
- class="org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTaskDecorator"
- id="org.eclipse.mylar.bugzilla.ui.decorator.task"
- label="Mylar Bugzilla Task Decorator"
- lightweight="true"
- objectClass="org.eclipse.mylar.tasks.core.ITaskListElement"
- state="true">
- <description>
- Mylar Bugzilla Task Decorator
- </description>
- </decorator>
- </extension>
</plugin>
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaImages.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaImages.java
index db1f076c5..9799cfed7 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaImages.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaImages.java
@@ -47,11 +47,13 @@ public class BugzillaImages {
public static final ImageDescriptor OPEN = create("", "openresult.gif");
- public static final ImageDescriptor OVERLAY_MAJOR = create(T_VIEW, "overlay-bug.gif");
+ public static final ImageDescriptor OVERLAY_CRITICAL = create(T_VIEW, "overlay-critical.gif");
+
+ public static final ImageDescriptor OVERLAY_MAJOR = create(T_VIEW, "overlay-major.gif");
- public static final ImageDescriptor OVERLAY_ENHANCEMENT = create(T_VIEW, "overlay-feature.gif");
+ public static final ImageDescriptor OVERLAY_ENHANCEMENT = create(T_VIEW, "overlay-enhancement.gif");
- public static final ImageDescriptor OVERLAY_NORMAL = create(T_VIEW, "overlay-normal.gif");
+ public static final ImageDescriptor OVERLAY_MINOR = create(T_VIEW, "overlay-minor.gif");
private static ImageDescriptor create(String prefix, String name) {
try {
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryUi.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryUi.java
index 97b8f01d3..50918c42d 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryUi.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryUi.java
@@ -15,6 +15,7 @@ import java.util.ArrayList;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
+import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.hyperlink.IHyperlink;
@@ -25,6 +26,7 @@ import org.eclipse.mylar.internal.bugzilla.core.BugzillaReportElement;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryQuery;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaTask;
import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants;
+import org.eclipse.mylar.internal.bugzilla.ui.BugzillaImages;
import org.eclipse.mylar.internal.bugzilla.ui.search.BugzillaSearchPage;
import org.eclipse.mylar.internal.bugzilla.ui.wizard.NewBugzillaTaskWizard;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
@@ -44,6 +46,30 @@ import org.eclipse.mylar.tasks.ui.wizards.AbstractRepositorySettingsPage;
public class BugzillaRepositoryUi extends AbstractRepositoryConnectorUi {
private static final int TASK_NUM_GROUP = 3;
+ @Override
+ public ImageDescriptor getTaskKindOverlay(AbstractRepositoryTask task) {
+ if (task instanceof BugzillaTask) {
+ BugzillaTask bugzillaTask = (BugzillaTask)task;
+ String severity = bugzillaTask.getSeverity();
+
+ if (severity != null) {
+ // XXX: refactor to use configuration
+ if ("blocker".equals(severity) || "critical".equals(severity)) {
+ return BugzillaImages.OVERLAY_CRITICAL;
+ } else if ("major".equals(severity)) {
+ return BugzillaImages.OVERLAY_MAJOR;
+ } else if ("enhancement".equals(severity)) {
+ return BugzillaImages.OVERLAY_ENHANCEMENT;
+ } else if ("trivial".equals(severity) || "minor".equals(severity)) {
+ return BugzillaImages.OVERLAY_MINOR;
+ } else {
+ return null;
+ }
+ }
+ }
+ return super.getTaskKindOverlay(task);
+ }
+
private static final String regexp = "(duplicate of|bug|task)(\\s#|#|#\\s|\\s|)(\\s\\d+|\\d+)";
private static final Pattern PATTERN = Pattern.compile(regexp, Pattern.CASE_INSENSITIVE);
@@ -96,7 +122,6 @@ public class BugzillaRepositoryUi extends AbstractRepositoryConnectorUi {
}
}
-
public String getTaskKindLabel(AbstractRepositoryTask repositoryTask) {
return IBugzillaConstants.BUGZILLA_TASK_KIND;
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskDecorator.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskDecorator.java
deleted file mode 100644
index d96f53974..000000000
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskDecorator.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 - 2006 Mylar eclipse.org project and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Mylar project committers - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.mylar.internal.bugzilla.ui.tasklist;
-
-import org.eclipse.jface.viewers.IDecoration;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.mylar.internal.bugzilla.core.BugzillaQueryHit;
-import org.eclipse.mylar.internal.bugzilla.core.BugzillaTask;
-import org.eclipse.mylar.internal.bugzilla.ui.BugzillaImages;
-import org.eclipse.mylar.tasks.ui.AbstractTaskDecorator;
-
-/**
- * @author Mik Kersten
- */
-public class BugzillaTaskDecorator extends AbstractTaskDecorator {
-
- public void decorate(Object element, IDecoration decoration) {
- if (element instanceof BugzillaTask) {
- BugzillaTask task = (BugzillaTask) element;
- String severity = task.getSeverity();
-
- if (severity != null) {
- // XXX: refactor to use configuration
- if ("major".equals(severity) || "blocker".equals(severity) || "critical".equals(severity)) {
- decoration.addOverlay(BugzillaImages.OVERLAY_MAJOR, getQuadrantForKind());
- } else if ("enhancement".equals(severity)) {
- decoration.addOverlay(BugzillaImages.OVERLAY_ENHANCEMENT, getQuadrantForKind());
- } else {
- decoration.addOverlay(BugzillaImages.OVERLAY_NORMAL, getQuadrantForKind());
- }
- }
- } else if (element instanceof BugzillaQueryHit) {
- BugzillaQueryHit hit = (BugzillaQueryHit) element;
- if (hit.getCorrespondingTask() != null) {
- decorate(hit.getCorrespondingTask(), decoration);
- }
- }
- }
-
- public void addListener(ILabelProviderListener listener) {
- // ignore
- }
-
- public void dispose() {
- // ignore
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- // ignore
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-active.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-active.gif
index 79510e888..cc089a708 100644
--- a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-active.gif
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-active.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-context.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-context.gif
index e41316f1b..e5dd32ba4 100644
--- a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-context.gif
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-context.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-inactive.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-inactive.gif
index dd7090c55..7bd7982e4 100644
--- a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-inactive.gif
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-inactive.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/task-narrow.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-narrow.gif
new file mode 100644
index 000000000..03b9e2897
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/task-narrow.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/etool16/task.gif b/org.eclipse.mylyn.tasks.ui/icons/etool16/task.gif
index 754611bbd..14246d168 100644
--- a/org.eclipse.mylyn.tasks.ui/icons/etool16/task.gif
+++ b/org.eclipse.mylyn.tasks.ui/icons/etool16/task.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/eview16/overlay-incoming-new.gif b/org.eclipse.mylyn.tasks.ui/icons/eview16/overlay-incoming-new.gif
index fee0e1b1c..f9b1fb7d1 100644
--- a/org.eclipse.mylyn.tasks.ui/icons/eview16/overlay-incoming-new.gif
+++ b/org.eclipse.mylyn.tasks.ui/icons/eview16/overlay-incoming-new.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/eview16/overlay-incoming.gif b/org.eclipse.mylyn.tasks.ui/icons/eview16/overlay-incoming.gif
index af601c5b2..ea5b6d04c 100644
--- a/org.eclipse.mylyn.tasks.ui/icons/eview16/overlay-incoming.gif
+++ b/org.eclipse.mylyn.tasks.ui/icons/eview16/overlay-incoming.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/eview16/overlay-outgoing.gif b/org.eclipse.mylyn.tasks.ui/icons/eview16/overlay-outgoing.gif
index 16d234d8d..7bd8d5731 100644
--- a/org.eclipse.mylyn.tasks.ui/icons/eview16/overlay-outgoing.gif
+++ b/org.eclipse.mylyn.tasks.ui/icons/eview16/overlay-outgoing.gif
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p1.gif b/org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p1.gif
deleted file mode 100644
index c02b062ce..000000000
--- a/org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p1.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p2.gif b/org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p2.gif
deleted file mode 100644
index 7b33bb888..000000000
--- a/org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p2.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p3.gif b/org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p3.gif
deleted file mode 100644
index bc468f71e..000000000
--- a/org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p3.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p4.gif b/org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p4.gif
deleted file mode 100644
index 47b83dc67..000000000
--- a/org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p4.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p5.gif b/org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p5.gif
deleted file mode 100644
index 30b6322b1..000000000
--- a/org.eclipse.mylyn.tasks.ui/icons/eview16/priority-p5.gif
+++ /dev/null
Binary files differ
diff --git a/org.eclipse.mylyn.tasks.ui/plugin.xml b/org.eclipse.mylyn.tasks.ui/plugin.xml
index 2b5456b85..359715df5 100644
--- a/org.eclipse.mylyn.tasks.ui/plugin.xml
+++ b/org.eclipse.mylyn.tasks.ui/plugin.xml
@@ -532,18 +532,18 @@
id="org.eclipse.mylar.tasks.ui.colors.category.gradient.start"
isEditable="true"
label="Task List - Category Gradient Top"
- value="247,247,247">
+ value="240,240,240">
<description>
Background start color for Task List category gradients.
</description>
</colorDefinition>
-
+
<colorDefinition
categoryId="org.eclipse.mylar.tasklist.ui.presentation"
id="org.eclipse.mylar.tasks.ui.colors.category.gradient.end"
isEditable="true"
label="Task List - Category Gradient Bottom"
- value="234,233,237"> <!-- was all 220 -->
+ value="220,220,220"> <!-- was all 220, 234,233,237 -->
<description>
Background end color for Task List category gradients.
</description>
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/CompositeSynchronizationImageDescriptor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/CompositeSynchronizationImageDescriptor.java
new file mode 100644
index 000000000..7479d6f12
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/CompositeSynchronizationImageDescriptor.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2006 - 2006 Mylar eclipse.org project and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mylar project committers - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylar.internal.tasks.ui;
+
+import org.eclipse.jface.resource.CompositeImageDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
+
+/**
+ * @author Mik Kersten
+ */
+public class CompositeSynchronizationImageDescriptor extends CompositeImageDescriptor {
+
+ private ImageData base;
+
+ private ImageData overlay;
+
+ protected Point size;
+
+ public CompositeSynchronizationImageDescriptor(ImageDescriptor icon, ImageDescriptor overlay) {
+ this.base = getImageData(icon);
+ if (overlay != null) {
+ this.overlay = getImageData(overlay);
+ }
+ this.size = new Point(CompositeTaskImageDescriptor.WIDTH, base.height);
+ }
+
+ @Override
+ protected void drawCompositeImage(int width, int height) {
+ if (overlay != null) {
+ drawImage(overlay, 2, 0);
+ }
+ drawImage(base, 13, 2);
+ }
+
+ private ImageData getImageData(ImageDescriptor descriptor) {
+ ImageData data = descriptor.getImageData();
+ // see bug 51965: getImageData can return null
+ if (data == null) {
+ data = DEFAULT_IMAGE_DATA;
+ }
+ return data;
+ }
+
+ @Override
+ protected Point getSize() {
+ return new Point(size.x, size.y);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/CompositeTaskContainerImageDescriptor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/CompositeTaskContainerImageDescriptor.java
new file mode 100644
index 000000000..995b0e2c7
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/CompositeTaskContainerImageDescriptor.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2006 - 2006 Mylar eclipse.org project and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mylar project committers - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylar.internal.tasks.ui;
+
+import org.eclipse.jface.resource.CompositeImageDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
+
+/**
+ * @author Mik Kersten
+ */
+public class CompositeTaskContainerImageDescriptor extends CompositeImageDescriptor {
+
+ private ImageData base;
+
+ private ImageData overlay;
+
+ protected Point size;
+
+ public CompositeTaskContainerImageDescriptor(ImageDescriptor icon, ImageDescriptor overlay) {
+ this.base = getImageData(icon);
+ if (overlay != null) {
+ this.overlay = getImageData(overlay);
+ }
+ this.size = new Point(CompositeTaskImageDescriptor.WIDTH, base.height);
+ }
+
+ @Override
+ protected void drawCompositeImage(int width, int height) {
+ drawImage(base, 0, 0);
+// if (overlay != null) {
+// drawImage(overlay, base.width, 0);
+// }
+ }
+
+ private ImageData getImageData(ImageDescriptor descriptor) {
+ ImageData data = descriptor.getImageData();
+ // see bug 51965: getImageData can return null
+ if (data == null) {
+ data = DEFAULT_IMAGE_DATA;
+ }
+ return data;
+ }
+
+ @Override
+ protected Point getSize() {
+ return new Point(size.x, size.y);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/CompositeTaskImageDescriptor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/CompositeTaskImageDescriptor.java
new file mode 100644
index 000000000..d2e46da6f
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/CompositeTaskImageDescriptor.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2006 - 2006 Mylar eclipse.org project and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Mylar project committers - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylar.internal.tasks.ui;
+
+import org.eclipse.jface.resource.CompositeImageDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
+
+/**
+ * @author Mik Kersten
+ */
+public class CompositeTaskImageDescriptor extends CompositeImageDescriptor {
+
+ private ImageData base;
+
+ private ImageData context;
+
+ private ImageData kind;
+
+ private ImageData priority;
+
+ protected Point size;
+
+ private static final int WIDTH_PRIORITY = 0;//5;
+
+ private static final int WIDTH_CONTEXT = 8;
+
+ private static final int WIDTH_SQUISH = 1;
+
+ private static final int WIDTH_ICON = 16;
+
+ static int WIDTH = WIDTH_CONTEXT + WIDTH_PRIORITY + WIDTH_ICON - WIDTH_SQUISH;
+
+ public CompositeTaskImageDescriptor(ImageDescriptor icon, ImageDescriptor overlayKind, ImageDescriptor overlayPriority, ImageDescriptor contextToggle) {
+ this.base = getImageData(icon);
+ if (overlayKind != null) {
+ this.kind = getImageData(overlayKind);
+ }
+ if (overlayPriority != null) {
+ this.priority = getImageData(overlayPriority);
+ }
+ if (contextToggle != null) {
+ this.context = getImageData(contextToggle);
+ }
+ this.size = new Point(WIDTH, base.height);
+ }
+
+ @Override
+ protected void drawCompositeImage(int width, int height) {
+ if (context != null) {
+ drawImage(context, 0, 0);
+ }
+// if (priority != null) {
+// drawImage(priority, WIDTH_CONTEXT+2, 0);
+// }
+ drawImage(base, WIDTH_CONTEXT + WIDTH_PRIORITY - WIDTH_SQUISH, 0);
+ if (kind != null) {
+ drawImage(kind, WIDTH_CONTEXT + WIDTH_PRIORITY + 3, 5);
+ }
+ }
+
+ private ImageData getImageData(ImageDescriptor descriptor) {
+ ImageData data = descriptor.getImageData();
+ // see bug 51965: getImageData can return null
+ if (data == null) {
+ data = DEFAULT_IMAGE_DATA;
+ }
+ return data;
+ }
+
+ @Override
+ protected Point getSize() {
+ return new Point(size.x, size.y);
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/RepositoryTaskDecorator.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/RepositoryTaskDecorator.java
index eea82ac60..be5133cdd 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/RepositoryTaskDecorator.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/RepositoryTaskDecorator.java
@@ -19,17 +19,11 @@ import org.eclipse.jface.viewers.IDecoration;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ILightweightLabelDecorator;
import org.eclipse.mylar.tasks.core.AbstractQueryHit;
-import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
-import org.eclipse.mylar.tasks.core.AbstractTaskContainer;
import org.eclipse.mylar.tasks.core.ITask;
-import org.eclipse.mylar.tasks.core.ITaskListElement;
import org.eclipse.mylar.tasks.core.TaskRepository;
-import org.eclipse.mylar.tasks.core.Task.PriorityLevel;
-import org.eclipse.mylar.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
-import org.eclipse.mylar.tasks.ui.TasksUiUtil;
/**
* @author Mik Kersten
@@ -55,43 +49,44 @@ public class RepositoryTaskDecorator implements ILightweightLabelDecorator {
}
} else if (element instanceof AbstractRepositoryTask) {
AbstractRepositoryTask task = (AbstractRepositoryTask) element;
- AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getRepositoryUi(task.getRepositoryKind());
- if (connectorUi != null) {
- if (!connectorUi.hasRichEditor()) {
- decoration.addOverlay(TasksUiImages.OVERLAY_WEB, IDecoration.BOTTOM_LEFT);
- }
- }
+// AbstractRepositoryConnectorUi connectorUi = TasksUiPlugin.getRepositoryUi(task.getRepositoryKind());
+// if (connectorUi != null) {
+// if (!connectorUi.hasRichEditor()) {
+// decoration.addOverlay(TasksUiImages.OVERLAY_WEB, IDecoration.BOTTOM_RIGHT);
+// }
+// }
if (!task.isCompleted() && TasksUiPlugin.getTaskListManager().isOverdue(task)) {
- decoration.addOverlay(TasksUiImages.OVERLAY_OVER_DUE, IDecoration.TOP_LEFT);
+ decoration.addOverlay(TasksUiImages.OVERLAY_OVER_DUE, IDecoration.TOP_RIGHT);
} else if (!task.isCompleted() && task.getDueDate() != null) {
- decoration.addOverlay(TasksUiImages.OVERLAY_HAS_DUE, IDecoration.TOP_LEFT);
+ decoration.addOverlay(TasksUiImages.OVERLAY_HAS_DUE, IDecoration.TOP_RIGHT);
}
- decoration.addOverlay(getPriorityImageDescriptor(element), IDecoration.TOP_RIGHT);
-
- AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
- task.getRepositoryKind());
- TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository(task.getRepositoryKind(),
- task.getRepositoryUrl());
- if (connectorUi != null) {
- if (connector != null && connector.hasRepositoryContext(repository, task)) {
- decoration.addOverlay(TasksUiImages.OVERLAY_REPOSITORY_CONTEXT, IDecoration.BOTTOM_RIGHT);
- }
- }
+// decoration.addOverlay(getPriorityImageDescriptor(element), IDecoration.BOTTOM_RIGHT);
+// decoration.addOverlay(getContextActivationImage(element), IDecoration.BOTTOM_RIGHT);
+// AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
+// task.getRepositoryKind());
+// TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository(task.getRepositoryKind(),
+// task.getRepositoryUrl());
+// if (connectorUi != null) {
+// if (connector != null && connector.hasRepositoryContext(repository, task)) {
+// decoration.addOverlay(TasksUiImages.OVERLAY_REPOSITORY_CONTEXT, IDecoration.BOTTOM_LEFT);
+// }
+// }
} else if (element instanceof AbstractQueryHit) {
ITask correspondingTask = ((AbstractQueryHit) element).getCorrespondingTask();
decorate(correspondingTask, decoration);
} else if (element instanceof ITask) {
ITask task = (ITask) element;
- String url = task.getTaskUrl();
- if (url != null && !url.trim().equals("") && !url.equals("http://")) {
- decoration.addOverlay(TasksUiImages.OVERLAY_WEB, IDecoration.BOTTOM_LEFT);
- }
+// String url = task.getTaskUrl();
+// if (url != null && !url.trim().equals("") && !url.equals("http://")) {
+// decoration.addOverlay(TasksUiImages.OVERLAY_WEB, IDecoration.BOTTOM_RIGHT);
+// }
if (!task.isCompleted() && TasksUiPlugin.getTaskListManager().isOverdue(task)) {
- decoration.addOverlay(TasksUiImages.OVERLAY_OVER_DUE, IDecoration.TOP_LEFT);
+ decoration.addOverlay(TasksUiImages.OVERLAY_OVER_DUE, IDecoration.TOP_RIGHT);
}
- decoration.addOverlay(getPriorityImageDescriptor(element), IDecoration.TOP_RIGHT);
+// decoration.addOverlay(getPriorityImageDescriptor(element), IDecoration.BOTTOM_RIGHT);
+// decoration.addOverlay(getContextActivationImage(element), IDecoration.BOTTOM_LEFT);
} else if (element instanceof TaskRepository) {
ImageDescriptor overlay = TasksUiPlugin.getDefault().getOverlayIcon(((TaskRepository) element).getKind());
@@ -101,13 +96,31 @@ public class RepositoryTaskDecorator implements ILightweightLabelDecorator {
}
}
- private ImageDescriptor getPriorityImageDescriptor(Object element) {
- if (element instanceof ITaskListElement && !(element instanceof AbstractTaskContainer)) {
- ITaskListElement taskElement = (ITaskListElement) element;
- return TasksUiUtil.getImageDescriptorForPriority(PriorityLevel.fromString(taskElement.getPriority()));
- }
- return null;
- }
+// private ImageDescriptor getContextActivationImage(Object element) {
+// ITask task = TaskElementLabelProvider.getCorrespondingTask((ITaskListElement) element);
+// if (task != null) {
+// if (task.isActive()) {
+// return TasksUiImages.TASK_ACTIVE;
+// } else {
+// if (ContextCorePlugin.getContextManager().hasContext(task.getHandleIdentifier())) {
+// return TasksUiImages.TASK_INACTIVE_CONTEXT;
+// } else {
+// return TasksUiImages.TASK_INACTIVE;
+// }
+// }
+// } else {
+// return TasksUiImages.TASK_INACTIVE;
+// }
+// }
+//
+// private ImageDescriptor getPriorityImageDescriptor(Object element) {
+// if (element instanceof ITaskListElement && !(element instanceof AbstractTaskContainer)) {
+// ITaskListElement taskElement = (ITaskListElement) element;
+// return TasksUiUtil.getImageDescriptorForPriority(PriorityLevel.fromString(taskElement.getPriority()));
+// }
+// return null;
+// }
+
public void addListener(ILabelProviderListener listener) {
// ignore
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListImageDescriptor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListImageDescriptor.java
index ede3562fa..9b09c7a8c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListImageDescriptor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListImageDescriptor.java
@@ -71,15 +71,6 @@ public class TaskListImageDescriptor extends CompositeImageDescriptor {
return data;
}
- /**
- * Sets the size of the image created by calling
- * <code>createImage()</code>.
- *
- * @param size
- * the size of the image returned from calling
- * <code>createImage()</code>
- * @see ImageDescriptor#createImage()
- */
public void setImageSize(Point size) {
this.size = size;
}
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 57ad08b18..8529816e5 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
@@ -41,43 +41,41 @@ public class TasksUiImages {
private static final String T_OVR = "ovr16";
- public static final Point SIZE = new Point(16, 16);
+// public static final Point SIZE = new Point(16, 16);
- public static final Point SIZE_WIDE = new Point(23, 16);
+// public static final Point SIZE_WIDE = new Point(30, 16);
private static final URL baseURL = TasksUiPlugin.getDefault().getBundle().getEntry("/icons/");
- public static final ImageDescriptor TASK_ACTIVE = createSize(create(T_TOOL, "task-active.gif"), SIZE);
+ public static final ImageDescriptor TASK_ACTIVE = create(T_TOOL, "task-active.gif");
- public static final ImageDescriptor TASK_ACTIVE_CENTERED = createSize(create(T_TOOL, "task-active-centered.gif"),
- SIZE);
+ public static final ImageDescriptor TASK_ACTIVE_CENTERED = create(T_TOOL, "task-active-centered.gif");
- public static final ImageDescriptor TASK_INACTIVE = createSize(create(T_TOOL, "task-inactive.gif"), SIZE);
+ public static final ImageDescriptor TASK_INACTIVE = create(T_TOOL, "task-inactive.gif");
- public static final ImageDescriptor TASK_INACTIVE_CONTEXT = createSize(create(T_TOOL, "task-context.gif"), SIZE);
+ public static final ImageDescriptor TASK_INACTIVE_CONTEXT = create(T_TOOL, "task-context.gif");
public static final ImageDescriptor TASK_COMPLETE = create(T_TOOL, "task-complete.gif");
public static final ImageDescriptor TASK_INCOMPLETE = create(T_TOOL, "task-incomplete.gif");
- public static final ImageDescriptor TASK = createSize(create(T_TOOL, "task.gif"), SIZE);
+ public static final ImageDescriptor TASK = create(T_TOOL, "task.gif");
- public static final ImageDescriptor TASK_COMPLETED = createSize(create(T_TOOL, "task-completed.gif"), SIZE);
+ public static final ImageDescriptor TASK_COMPLETED = create(T_TOOL, "task-completed.gif");
- public static final ImageDescriptor TASK_NOTES = createSize(create(T_TOOL, "task-notes.gif"), SIZE);
+ public static final ImageDescriptor TASK_NOTES = create(T_TOOL, "task-notes.gif");
public static final ImageDescriptor TASK_NEW = create(T_TOOL, "task-new.gif");
- public static final ImageDescriptor TASK_REPOSITORY_HISTORY = createSize(create(T_TOOL,
- "task-repository-history.gif"), SIZE);
+ public static final ImageDescriptor TASK_REPOSITORY_HISTORY = create(T_TOOL,
+ "task-repository-history.gif");
- public static final ImageDescriptor TASK_REPOSITORY_NOTES = createSize(create(T_TOOL, "task-repository-notes.gif"),
- SIZE);
+ public static final ImageDescriptor TASK_REPOSITORY_NOTES = create(T_TOOL, "task-repository-notes.gif");
- public static final ImageDescriptor TASK_REPOSITORY_COMPLETED = createSize(create(T_TOOL,
- "task-repository-completed.gif"), SIZE);
+ public static final ImageDescriptor TASK_REPOSITORY_COMPLETED = create(T_TOOL,
+ "task-repository-completed.gif");
- public static final ImageDescriptor TASK_REMOTE = createSize(create(T_TOOL, "task-remote.gif"), SIZE);
+ public static final ImageDescriptor TASK_REMOTE = create(T_TOOL, "task-remote.gif");
public static final ImageDescriptor TASKLIST = create("eview16", "task-list.gif");
@@ -117,13 +115,13 @@ public class TasksUiImages {
public static final ImageDescriptor TASK_WEB_REMOTE = create(T_TOOL, "overlay-web.gif");
- public static final ImageDescriptor CATEGORY = createSize(create(T_TOOL, "category.gif"), SIZE);
+ public static final ImageDescriptor CATEGORY = create(T_TOOL, "category.gif");
public static final ImageDescriptor CATEGORY_NEW = create(T_TOOL, "category-new.gif");
- public static final ImageDescriptor CATEGORY_ARCHIVE = createSize(create(T_TOOL, "category-archive.gif"), SIZE);
+ public static final ImageDescriptor CATEGORY_ARCHIVE = create(T_TOOL, "category-archive.gif");
- public static final ImageDescriptor TASK_REPOSITORY = createSize(create(T_TOOL, "task-repository.gif"), SIZE);
+ public static final ImageDescriptor TASK_REPOSITORY = create(T_TOOL, "task-repository.gif");
public static final ImageDescriptor TASK_REPOSITORY_NEW = create(T_TOOL, "task-repository-new.gif");
@@ -157,6 +155,9 @@ 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);
@@ -166,16 +167,16 @@ public class TasksUiImages {
public static final ImageDescriptor STATUS_NORMAL_CONFLICT = createWithOverlay(STATUS_NORMAL, OVERLAY_CONFLICT,
true, true);
- public static final ImageDescriptor STATUS_CONTEXT_INCOMING = createWithOverlay(STATUS_CONTEXT, OVERLAY_INCOMMING,
- true, true);
+// public static final ImageDescriptor STATUS_CONTEXT_INCOMING = createWithOverlay(STATUS_CONTEXT, OVERLAY_INCOMMING,
+// true, true);
+//
+// public static final ImageDescriptor STATUS_CONTEXT_OUTGOING = createWithOverlay(STATUS_CONTEXT, OVERLAY_OUTGOING,
+// true, true);
+//
+// public static final ImageDescriptor STATUS_CONTEXT_CONFLICT = createWithOverlay(STATUS_CONTEXT, OVERLAY_CONFLICT,
+// true, true);
- public static final ImageDescriptor STATUS_CONTEXT_OUTGOING = createWithOverlay(STATUS_CONTEXT, OVERLAY_OUTGOING,
- true, true);
-
- public static final ImageDescriptor STATUS_CONTEXT_CONFLICT = createWithOverlay(STATUS_CONTEXT, OVERLAY_CONFLICT,
- true, true);
-
- public static final ImageDescriptor QUERY = createSize(create(T_TOOL, "query.gif"), SIZE);
+ public static final ImageDescriptor QUERY = create(T_TOOL, "query.gif");
public static final ImageDescriptor QUERY_NEW = create(T_TOOL, "query-new.gif");
@@ -215,7 +216,7 @@ public class TasksUiImages {
public static final ImageDescriptor PRIORITY_5 = create(T_EVIEW, "priority-5.gif");
- public static final ImageDescriptor CALENDAR = createSize(create(T_TOOL, "calendar.gif"), SIZE);
+ public static final ImageDescriptor CALENDAR = create(T_TOOL, "calendar.gif");
public static final ImageDescriptor CALENDAR_SMALL = create(T_OBJ, "calendar-small.gif");
@@ -240,41 +241,92 @@ public class TasksUiImages {
}
}
- private static ImageDescriptor createSize(ImageDescriptor base, Point size) {
- return new TaskListImageDescriptor(base, size);
- }
-
+// private static ImageDescriptor createSize(ImageDescriptor base, Point size) {
+// 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.
+ */
public static Image getImage(ImageDescriptor imageDescriptor) {
- return getImage(imageDescriptor, false);
+ ImageRegistry imageRegistry = getImageRegistry();
+ Image image = imageRegistry.get(""+imageDescriptor.hashCode());
+ if (image == null) {
+ image = imageDescriptor.createImage(true);
+ imageRegistry.put(""+imageDescriptor.hashCode(), image);
+ }
+ return image;
}
-
+
/**
- * Lazily initializes image map.
+ * Lazily initializes image map.
+ *
+ * @param icon cannot be null
*/
- public static Image getImage(ImageDescriptor imageDescriptor, boolean wide) {
- String suffix = "";
- if (wide) {
- suffix = ".wide";
+ public static Image getCompositeTaskImage(ImageDescriptor icon, ImageDescriptor overlayKind, ImageDescriptor overlayPriority, ImageDescriptor contextToggle) {
+ if (icon == null) {
+ return null;
}
+ String key = "" + icon.hashCode();
+ if (overlayKind != null) {
+ key += overlayKind.hashCode();
+ }
+ if (overlayPriority != null) {
+ key += overlayPriority.hashCode();
+ }
+ if (contextToggle != null) {
+ key += contextToggle.hashCode();
+ }
+
+ Image image = getImageRegistry().get(key);
- ImageRegistry imageRegistry = getImageRegistry();
- Image image = imageRegistry.get(imageDescriptor.hashCode() + suffix);
+ if (image == null) {
+ CompositeTaskImageDescriptor imageDescriptor = new CompositeTaskImageDescriptor(icon, overlayKind, overlayPriority, contextToggle);
+ image = imageDescriptor.createImage(true);
+ getImageRegistry().put(key, image);
+ }
+ return image;
+ }
+ public static Image getCompositeContainerImage(ImageDescriptor icon, ImageDescriptor overlay) {
+ String key = "" + icon.hashCode();
+ if (overlay != null) {
+ key += overlay.hashCode();
+ }
+
+ Image image = getImageRegistry().get(key);
if (image == null) {
- if (wide && imageDescriptor instanceof TaskListImageDescriptor) {
- ((TaskListImageDescriptor) imageDescriptor).setImageSize(SIZE_WIDE);
- }
+ CompositeTaskContainerImageDescriptor imageDescriptor = new CompositeTaskContainerImageDescriptor(icon, overlay);
image = imageDescriptor.createImage(true);
- imageRegistry.put(imageDescriptor.hashCode() + suffix, image);
+ getImageRegistry().put(key, image);
}
return image;
}
+ public static Image getCompositeSynchronizationImage(ImageDescriptor icon, ImageDescriptor overlay) {
+ if (icon == null) {
+ return null;
+ }
+ String key = "" + icon.hashCode();
+ if (overlay != null) {
+ key += overlay.hashCode();
+ }
+
+ Image image = getImageRegistry().get(key);
+
+ if (image == null) {
+ CompositeSynchronizationImageDescriptor imageDescriptor = new CompositeSynchronizationImageDescriptor(icon, overlay);
+ image = imageDescriptor.createImage(true);
+ getImageRegistry().put(key, image);
+ }
+ return image;
+ }
+
private static ImageRegistry getImageRegistry() {
if (imageRegistry == null) {
imageRegistry = new ImageRegistry();
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 1dc0819d1..12b0849a0 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
@@ -236,7 +236,7 @@ public class RepositorySearchResultView extends AbstractTextSearchViewPage imple
class SearchViewTableLabelProvider extends TaskListTableLabelProvider {
public SearchViewTableLabelProvider(ILabelProvider provider, ILabelDecorator decorator, Color parentBackground) {
- super(provider, decorator, parentBackground, null);
+ super(provider, decorator, parentBackground, null, true);
}
@Override
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 ef2e3dee8..c2d9e9a10 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
@@ -17,6 +17,7 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IColorProvider;
import org.eclipse.jface.viewers.IFontProvider;
import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.mylar.context.core.ContextCorePlugin;
import org.eclipse.mylar.internal.tasks.ui.ITaskHighlighter;
import org.eclipse.mylar.internal.tasks.ui.TaskListColorsAndFonts;
import org.eclipse.mylar.internal.tasks.ui.TasksUiImages;
@@ -28,7 +29,10 @@ import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.ITaskListElement;
import org.eclipse.mylar.tasks.core.TaskArchive;
import org.eclipse.mylar.tasks.core.TaskCategory;
+import org.eclipse.mylar.tasks.core.Task.PriorityLevel;
+import org.eclipse.mylar.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
+import org.eclipse.mylar.tasks.ui.TasksUiUtil;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
@@ -46,51 +50,124 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
private static final Pattern pattern = Pattern.compile("\\d*: .*");
- private boolean wide = false;
+ private boolean compositeImages = false;
+ private class CompositeImageDescriptor {
+
+ ImageDescriptor icon;
+
+ ImageDescriptor overlayKind;
+
+ ImageDescriptor overlayPriority;
+
+ ImageDescriptor contextToggle;
+ };
+
public TaskElementLabelProvider() {
super();
}
-
+
/**
- * @parma wide set true for wide images, with whitespace to right of icon.
+ * @parma wide set true for wide images, with whitespace to right of icon.
*/
- public TaskElementLabelProvider(boolean wide) {
+ public TaskElementLabelProvider(boolean compositeImages) {
super();
- this.wide = wide;
+ this.compositeImages = compositeImages;
}
@Override
public Image getImage(Object element) {
- return TasksUiImages.getImage(getImageDescriptor(element), wide);
+ CompositeImageDescriptor compositeDescriptor = getImageDescriptor(element);
+ if (compositeImages) {
+ if (element instanceof ITask || element instanceof AbstractQueryHit) {
+ return TasksUiImages.getCompositeTaskImage(compositeDescriptor.icon, compositeDescriptor.overlayKind, compositeDescriptor.overlayPriority, compositeDescriptor.contextToggle);
+ } else if (element instanceof AbstractTaskContainer) {
+// return null;
+ return TasksUiImages.getCompositeContainerImage(compositeDescriptor.icon, null);
+ } else {
+ return TasksUiImages.getImage(compositeDescriptor.icon);
+ }
+ } else {
+ return super.getImage(element);
+ }
}
- public ImageDescriptor getImageDescriptor(Object element) {
- if (element instanceof TaskArchive) {
- return TasksUiImages.CATEGORY_ARCHIVE;
- } else if (element instanceof TaskCategory) {
- return TasksUiImages.CATEGORY;
- } else if (element instanceof AbstractRepositoryQuery) {
- return TasksUiImages.QUERY;
- } else if (element instanceof AbstractQueryHit) {
- AbstractQueryHit hit = (AbstractQueryHit) element;
- if (hit.getCorrespondingTask() != null) {
- return getImageDescriptor(hit.getCorrespondingTask());
- } else {
- return TasksUiImages.TASK_REMOTE;
+ private CompositeImageDescriptor getImageDescriptor(Object object) {
+ CompositeImageDescriptor compositeDescriptor = new CompositeImageDescriptor();
+ if (object instanceof TaskArchive) {
+ compositeDescriptor.icon = TasksUiImages.CATEGORY_ARCHIVE;
+ return compositeDescriptor;
+ } else if (object instanceof TaskCategory) {
+ compositeDescriptor.icon = TasksUiImages.CATEGORY;
+ return compositeDescriptor;
+ } else if (object instanceof ITaskListElement) {
+ ITaskListElement element = (ITaskListElement)object;
+
+ AbstractRepositoryConnectorUi connectorUi = null;
+ if (element instanceof AbstractRepositoryTask) {
+ AbstractRepositoryTask repositoryTask = (AbstractRepositoryTask)element;
+ connectorUi = TasksUiPlugin.getRepositoryUi(((AbstractRepositoryTask)element).getRepositoryKind());
+ compositeDescriptor.overlayKind = connectorUi.getTaskKindOverlay(repositoryTask);
+ compositeDescriptor.overlayPriority = connectorUi.getTaskPriorityOverlay(repositoryTask);
+ compositeDescriptor.contextToggle = getContextActivationImage(element);
+ } else if (element instanceof AbstractQueryHit) {
+ AbstractRepositoryTask repositoryTask = ((AbstractQueryHit)element).getCorrespondingTask();
+ if (repositoryTask != null) {
+ return getImageDescriptor(repositoryTask);
+ }
+ } else if (element instanceof AbstractTaskContainer) {
+ connectorUi = TasksUiPlugin.getRepositoryUi(((AbstractRepositoryQuery)element).getRepositoryKind());
}
- } else if (element instanceof ITask) {
- ITask task = (ITask) element;
- if (task.isCompleted()) {
- return TasksUiImages.TASK_COMPLETED;
- } else if (task.getNotes() != null && !task.getNotes().trim().equals("")) {
- return TasksUiImages.TASK_NOTES;
+
+ if (connectorUi != null) {
+ compositeDescriptor.icon = connectorUi.getTaskListElementIcon(element);
+ return compositeDescriptor;
} else {
- return TasksUiImages.TASK;
- }
+ if (element instanceof ITask) {
+ compositeDescriptor.overlayPriority = TasksUiUtil.getImageDescriptorForPriority(PriorityLevel.fromString(((ITask)element).getPriority()));
+ compositeDescriptor.contextToggle = getContextActivationImage(element);
+ } else if (element instanceof AbstractQueryHit) {
+ ITask correspondingTask = getCorrespondingTask(element);
+ if (correspondingTask != null) {
+ compositeDescriptor.overlayPriority = TasksUiUtil.getImageDescriptorForPriority(PriorityLevel.fromString(correspondingTask.getPriority()));
+ } else {
+ compositeDescriptor.overlayPriority = TasksUiUtil.getImageDescriptorForPriority(PriorityLevel.fromString(((AbstractQueryHit)element).getPriority()));
+ }
+ compositeDescriptor.contextToggle = getContextActivationImage(element);
+ }
+ if (element instanceof ITask || element instanceof AbstractQueryHit) {
+
+ }
+ if (element instanceof AbstractRepositoryQuery) {
+ compositeDescriptor.icon = TasksUiImages.QUERY;
+ } else if (element instanceof AbstractQueryHit) {
+ compositeDescriptor.icon = TasksUiImages.TASK;
+ } else if (element instanceof ITask) {
+ compositeDescriptor.icon = TasksUiImages.TASK;
+ }
+ return compositeDescriptor;
+ }
}
return null;
}
+
+ private ImageDescriptor getContextActivationImage(Object element) {
+ ITask task = TaskElementLabelProvider.getCorrespondingTask((ITaskListElement) element);
+ if (task != null) {
+ if (task.isActive()) {
+ return TasksUiImages.TASK_ACTIVE;
+ } else {
+ // XXX: should not be reading from disk when refreshing
+ if (ContextCorePlugin.getContextManager().hasContext(task.getHandleIdentifier())) {
+ return TasksUiImages.TASK_INACTIVE_CONTEXT;
+ } else {
+ return TasksUiImages.TASK_INACTIVE;
+ }
+ }
+ } else {
+ return TasksUiImages.TASK_INACTIVE;
+ }
+ }
@Override
public String getText(Object object) {
@@ -122,9 +199,6 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
} else {
return task.getSummary();
}
- // return
- // AbstractRepositoryTask.getTaskId(task.getHandleIdentifier())
- // + ": " + task.getDescription();
} else {
return task.getSummary();
}
@@ -135,7 +209,7 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
return super.getText(object);
}
}
-
+
public Color getForeground(Object object) {
if (object instanceof AbstractTaskContainer) {
for (ITask child : ((AbstractTaskContainer) object).getChildren()) {
@@ -250,7 +324,7 @@ public class TaskElementLabelProvider extends LabelProvider implements IColorPro
}
}
} else if (element instanceof AbstractQueryHit) {
- if (((AbstractQueryHit)element).isCompleted()) {
+ if (((AbstractQueryHit) element).isCompleted()) {
return TaskListColorsAndFonts.STRIKETHROUGH;
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java
index e0b072d33..ad524b208 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java
@@ -93,19 +93,7 @@ class TaskListCellModifier implements ICellModifier {
case 1:
break;
case 2:
- if (taskListElement instanceof AbstractQueryHit) {
- task = ((AbstractQueryHit) taskListElement).getOrCreateCorrespondingTask();
- }
- if (task != null) {
- if (task.isActive()) {
- new TaskDeactivateAction().run(task);
- this.taskListView.previousTaskAction.setButtonStatus();
- } else {
- new TaskActivateAction().run(task);
- this.taskListView.addTaskToHistory(task);
- this.taskListView.previousTaskAction.setButtonStatus();
- }
- }
+ toggleTaskActivation(taskListElement);
break;
}
}
@@ -114,4 +102,29 @@ class TaskListCellModifier implements ICellModifier {
}
this.taskListView.getViewer().refresh();
}
+
+ public void toggleTaskActivation(ITaskListElement taskListElement) {
+ ITask task = null;
+ if (taskListElement instanceof ITask) {
+ task = (ITask) taskListElement;
+ } else if (taskListElement instanceof AbstractQueryHit) {
+ if (((AbstractQueryHit) taskListElement).getCorrespondingTask() != null) {
+ task = ((AbstractQueryHit) taskListElement).getCorrespondingTask();
+ }
+ }
+
+ if (taskListElement instanceof AbstractQueryHit) {
+ task = ((AbstractQueryHit) taskListElement).getOrCreateCorrespondingTask();
+ }
+ if (task != null) {
+ if (task.isActive()) {
+ new TaskDeactivateAction().run(task);
+ this.taskListView.previousTaskAction.setButtonStatus();
+ } else {
+ new TaskActivateAction().run(task);
+ this.taskListView.addTaskToHistory(task);
+ this.taskListView.previousTaskAction.setButtonStatus();
+ }
+ }
+ }
} \ No newline at end of file
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree.java
index f7219f3cb..eda4b4c2c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListFilteredTree.java
@@ -60,9 +60,11 @@ public class TaskListFilteredTree extends AbstractMylarFilteredTree {
// Use a single Composite for the Tree to being able to use the
// TreeColumnLayout. See Bug 177891 for more details.
Composite container = new Composite(parent, SWT.None);
- container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gridData.verticalIndent = 0;
+ gridData.horizontalIndent = 0;
+ container.setLayoutData(gridData);
container.setLayout(new TreeColumnLayout());
-
return super.doCreateTreeViewer(container, style);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListTableLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListTableLabelProvider.java
index d501631d4..688fb02e4 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListTableLabelProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListTableLabelProvider.java
@@ -22,7 +22,6 @@ import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITableColorProvider;
import org.eclipse.jface.viewers.ITableFontProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.mylar.context.core.ContextCorePlugin;
import org.eclipse.mylar.internal.tasks.ui.TaskListColorsAndFonts;
import org.eclipse.mylar.internal.tasks.ui.TasksUiImages;
import org.eclipse.mylar.tasks.core.AbstractQueryHit;
@@ -34,6 +33,10 @@ import org.eclipse.mylar.tasks.core.ITask;
import org.eclipse.mylar.tasks.core.ITaskListElement;
import org.eclipse.mylar.tasks.core.TaskArchive;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask.RepositoryTaskSyncState;
+import org.eclipse.mylar.tasks.core.Task.PriorityLevel;
+import org.eclipse.mylar.tasks.ui.AbstractRepositoryConnectorUi;
+import org.eclipse.mylar.tasks.ui.TasksUiPlugin;
+import org.eclipse.mylar.tasks.ui.TasksUiUtil;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
@@ -47,16 +50,19 @@ public class TaskListTableLabelProvider extends DecoratingLabelProvider implemen
private Color categoryBackgroundColor;
private TaskListView view;
+
+ private boolean wideImages = false;
/**
* @param view
* can be null
*/
public TaskListTableLabelProvider(ILabelProvider provider, ILabelDecorator decorator, Color parentBackground,
- TaskListView view) {
+ TaskListView view, boolean wideImages) {
super(provider, decorator);
this.categoryBackgroundColor = parentBackground;
this.view = view;
+ this.wideImages = wideImages;
}
public String getColumnText(Object obj, int columnIndex) {
@@ -71,10 +77,6 @@ public class TaskListTableLabelProvider extends DecoratingLabelProvider implemen
return super.getText(obj);
case 1:
return null;
- case 2:
- return null;
- case 3:
- return null;
}
}
return null;
@@ -85,80 +87,68 @@ public class TaskListTableLabelProvider extends DecoratingLabelProvider implemen
return null;
}
if (columnIndex == 0) {
- if (element instanceof DateRangeContainer) {
- return TasksUiImages.getImage(TasksUiImages.CALENDAR, true);
- } else {
- return super.getImage(element);
-// TaskElementLabelProvider taskElementProvider = (TaskElementLabelProvider) super.getLabelProvider();
-// return TasksUiImages.getImage(taskElementProvider.getImageDescriptor(element), true);
- }
+ return super.getImage(element);
} else if (columnIndex == 1) {
- return getSynchronizationStateImage(element);
- } else if (columnIndex == 2) {
- if (!(element instanceof AbstractTaskContainer)) {
- return getContextActivationImage(element);
+ AbstractRepositoryConnectorUi connectorUi = null;
+ ImageDescriptor priorityOverlay = null;
+ if (element instanceof AbstractRepositoryTask) {
+ AbstractRepositoryTask repositoryTask = (AbstractRepositoryTask)element;
+ connectorUi = TasksUiPlugin.getRepositoryUi(((AbstractRepositoryTask)element).getRepositoryKind());
+ priorityOverlay = connectorUi.getTaskPriorityOverlay(repositoryTask);
+ }
+
+ if (priorityOverlay == null && (element instanceof ITask || element instanceof AbstractQueryHit)) {
+ ITask task = TaskElementLabelProvider.getCorrespondingTask((ITaskListElement)element);
+ if (task != null) {
+ priorityOverlay = TasksUiUtil.getImageDescriptorForPriority(PriorityLevel.fromString(task.getPriority()));
+ }
}
- }
+ return TasksUiImages.getCompositeSynchronizationImage(getSynchronizationImageDescriptor(element), priorityOverlay);
+ }
return null;
}
-
- private Image getSynchronizationStateImage(Object element) {
+
+ private ImageDescriptor getSynchronizationImageDescriptor(Object element) {
AbstractRepositoryTask repositoryTask = null;
- ImageDescriptor image = null;
+ ImageDescriptor imageDescriptor = null;
if (element instanceof AbstractQueryHit) {
repositoryTask = ((AbstractQueryHit) element).getCorrespondingTask();
if (repositoryTask == null) {
-// return TasksUiImages.getImage(TasksUiImages.OVERLAY_INCOMMING_NEW, true);
+ return TasksUiImages.STATUS_OVERLAY_INCOMMING_NEW;
}
} else if (element instanceof AbstractRepositoryTask) {
repositoryTask = (AbstractRepositoryTask) element;
}
if (repositoryTask != null) {
if (repositoryTask.getSyncState() == RepositoryTaskSyncState.OUTGOING) {
- image = TasksUiImages.STATUS_NORMAL_OUTGOING;
+ imageDescriptor = TasksUiImages.STATUS_NORMAL_OUTGOING;
} else if (repositoryTask.getSyncState() == RepositoryTaskSyncState.INCOMING) {
- image = TasksUiImages.STATUS_NORMAL_INCOMING;
+ imageDescriptor = TasksUiImages.STATUS_NORMAL_INCOMING;
} else if (repositoryTask.getSyncState() == RepositoryTaskSyncState.CONFLICT) {
- image = TasksUiImages.STATUS_NORMAL_CONFLICT;
+ imageDescriptor = TasksUiImages.STATUS_NORMAL_CONFLICT;
}
- if (image == null && repositoryTask.getStatus() != null) {
- return TasksUiImages.getImage(TasksUiImages.STATUS_WARNING, true);
- } else if (image != null) {
- return TasksUiImages.getImage(image, true);
+ if (imageDescriptor == null && repositoryTask.getStatus() != null) {
+ return TasksUiImages.STATUS_WARNING;
+ } else if (imageDescriptor != null) {
+ return imageDescriptor;
}
} else if (element instanceof AbstractQueryHit) {
- return TasksUiImages.getImage(TasksUiImages.STATUS_NORMAL_INCOMING, true);
+ return TasksUiImages.STATUS_NORMAL_INCOMING;
} else if (element instanceof AbstractTaskContainer) {
AbstractTaskContainer container = (AbstractTaskContainer) element;
if (container instanceof AbstractRepositoryQuery) {
AbstractRepositoryQuery query = (AbstractRepositoryQuery) container;
if (query.getStatus() != null) {
- return TasksUiImages.getImage(TasksUiImages.STATUS_WARNING, true);
+ return TasksUiImages.STATUS_WARNING;
}
}
if (view != null && !Arrays.asList(view.getViewer().getExpandedElements()).contains(element)
&& hasIncoming(container)) {
- return TasksUiImages.getImage(TasksUiImages.STATUS_NORMAL_INCOMING, true);
- }
- }
- return null;
- }
-
- private Image getContextActivationImage(Object element) {
- ITask task = TaskElementLabelProvider.getCorrespondingTask((ITaskListElement) element);
- if (task != null) {
- if (task.isActive()) {
- return TasksUiImages.getImage(TasksUiImages.TASK_ACTIVE, true);
- } else {
- if (ContextCorePlugin.getContextManager().hasContext(task.getHandleIdentifier())) {
- return TasksUiImages.getImage(TasksUiImages.TASK_INACTIVE_CONTEXT, true);
- } else {
- return TasksUiImages.getImage(TasksUiImages.TASK_INACTIVE, true);
- }
+ return TasksUiImages.STATUS_NORMAL_INCOMING;
}
- } else {
- return TasksUiImages.getImage(TasksUiImages.TASK_INACTIVE, true);
}
+ // HACK: need blank image
+ return TasksUiImages.PRIORITY_3;
}
private boolean hasIncoming(AbstractTaskContainer container) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListTableSorter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListTableSorter.java
index b0e8c4e95..fcbbfb114 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListTableSorter.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListTableSorter.java
@@ -105,13 +105,13 @@ public class TaskListTableSorter extends ViewerSorter {
private int compareElements(ITaskListElement element1, ITaskListElement element2) {
if (column != null && column.equals(this.view.columnNames[1])) {
return 0;
- } else if (column == this.view.columnNames[2]) {
- return this.view.sortDirection * element1.getPriority().compareTo(element2.getPriority());
- } else if (column == this.view.columnNames[4]) {
- String summary1 = getSortableSummaryFromElement(element1);
- String summary2 = getSortableSummaryFromElement(element2);
- element2.getSummary();
- return this.view.sortDirection * taskKeyComparator.compare(summary1, summary2);
+// } else if (column == this.view.columnNames[2]) {
+// return this.view.sortDirection * element1.getPriority().compareTo(element2.getPriority());
+// } else if (column == this.view.columnNames[3]) {
+// String summary1 = getSortableSummaryFromElement(element1);
+// String summary2 = getSortableSummaryFromElement(element2);
+// element2.getSummary();
+// return this.view.sortDirection * taskKeyComparator.compare(summary1, summary2);
} else {
return 0;
}
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 0286315de..e19232151 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
@@ -35,6 +35,7 @@ import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnPixelData;
import org.eclipse.jface.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.IOpenListener;
import org.eclipse.jface.viewers.ISelection;
@@ -105,6 +106,8 @@ import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
@@ -121,6 +124,7 @@ import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
+import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IViewPart;
@@ -178,6 +182,8 @@ public class TaskListView extends ViewPart {
private boolean focusedMode = false;
+ private TaskListCellModifier taskListCellModifier = new TaskListCellModifier(this);
+
private IThemeManager themeManager;
private TaskListFilteredTree filteredTree;
@@ -236,9 +242,9 @@ public class TaskListView extends ViewPart {
private Set<AbstractTaskListFilter> filters = new HashSet<AbstractTaskListFilter>();
- protected String[] columnNames = new String[] { " Summary", " ?", " !" };
+ protected String[] columnNames = new String[] { "Summary", " " };
- protected int[] columnWidths = new int[] { 100, 14, 15 };
+ protected int[] columnWidths = new int[] { 200, 29 };
private TreeColumn[] columns;
@@ -250,7 +256,7 @@ public class TaskListView extends ViewPart {
private static final int DEFAULT_SORT_DIRECTION = 1;
- private int sortIndex = 2;
+ private int sortIndex = 0;
private ITaskListPresentation currentPresentation;
@@ -321,19 +327,23 @@ public class TaskListView extends ViewPart {
Color oldForeground = gc.getForeground();
Color oldBackground = gc.getBackground();
+ gc.setForeground(categoryGradientEnd);
+ gc.drawLine(0, rect.y, area.width, rect.y);
+
gc.setForeground(categoryGradientStart);
- gc.setBackground(TaskListView.this.getViewer().getControl().getParent().getBackground());
+ gc.setBackground(categoryGradientEnd);
// gc.setForeground(categoryGradientStart);
// gc.setBackground(categoryGradientEnd);
+// gc.setForeground(new Color(Display.getCurrent(), 255, 0, 0));
- gc.fillGradientRectangle(0, rect.y, area.width, rect.height, true);
+ gc.fillGradientRectangle(0, rect.y+1, area.width, rect.height, true);
/* Bottom Line */
- gc.setForeground(TaskListView.this.getViewer().getControl().getParent().getBackground());
-// gc.setForeground(categoryGradientEnd);
+// gc.setForeground();
+ gc.setForeground(categoryGradientEnd);
gc.drawLine(0, rect.y + rect.height - 1, area.width, rect.y + rect.height - 1);
-
+
gc.setForeground(oldForeground);
gc.setBackground(oldBackground);
@@ -697,11 +707,11 @@ public class TaskListView extends ViewPart {
themeManager = getSite().getWorkbenchWindow().getWorkbench().getThemeManager();
themeManager.addPropertyChangeListener(THEME_CHANGE_LISTENER);
- filteredTree = new TaskListFilteredTree(parent, SWT.MULTI | SWT.VERTICAL | SWT.H_SCROLL | SWT.V_SCROLL
+ filteredTree = new TaskListFilteredTree(parent, SWT.MULTI | SWT.VERTICAL | /*SWT.H_SCROLL |*/ SWT.V_SCROLL
| SWT.FULL_SELECTION | SWT.HIDE_SELECTION, new TaskListPatternFilter());
- getViewer().getTree().setHeaderVisible(true);
- getViewer().getTree().setLinesVisible(true);
+ getViewer().getTree().setHeaderVisible(false);
+// getViewer().getTree().setLinesVisible(true);
getViewer().setUseHashlookup(true);
configureColumns(columnNames, columnWidths);
@@ -710,7 +720,7 @@ public class TaskListView extends ViewPart {
Color categoryBackground = themeManager.getCurrentTheme().getColorRegistry().get(
TaskListColorsAndFonts.THEME_COLOR_TASKLIST_CATEGORY);
taskListTableLabelProvider = new TaskListTableLabelProvider(new TaskElementLabelProvider(true), PlatformUI
- .getWorkbench().getDecoratorManager().getLabelDecorator(), categoryBackground, this);
+ .getWorkbench().getDecoratorManager().getLabelDecorator(), categoryBackground, this, true);
getViewer().setLabelProvider(taskListTableLabelProvider);
CellEditor[] editors = new CellEditor[columnNames.length];
@@ -720,11 +730,11 @@ public class TaskListView extends ViewPart {
// editors[1] = new ComboBoxCellEditor(getViewer().getTree(),
// PRIORITY_LEVEL_DESCRIPTIONS, SWT.READ_ONLY);
editors[1] = null;
- editors[2] = null;
+// editors[2] = null;
// editors[2] = new CheckboxCellEditor();
-
+
getViewer().setCellEditors(editors);
- getViewer().setCellModifier(new TaskListCellModifier(this));
+ getViewer().setCellModifier(taskListCellModifier);
tableSorter = new TaskListTableSorter(this, columnNames[sortIndex]);
getViewer().setSorter(tableSorter);
@@ -732,6 +742,29 @@ public class TaskListView extends ViewPart {
drillDownAdapter = new DrillDownAdapter(getViewer());
getViewer().setInput(getViewSite());
+
+ getViewer().getTree().addMouseListener(new MouseListener() {
+
+ public void mouseDoubleClick(MouseEvent e) {
+ }
+
+ public void mouseDown(MouseEvent e) {
+ TreeItem[] selected = getViewer().getTree().getSelection();
+ if (selected.length == 1) {
+ Object selectedObject = selected[0].getData();
+ if (selectedObject instanceof ITask || selectedObject instanceof AbstractQueryHit) {
+ if (e.x < selected[0].getBounds(0).x + 10) {
+ taskListCellModifier.toggleTaskActivation((ITaskListElement)selectedObject);
+ }
+ }
+ }
+ }
+
+ public void mouseUp(MouseEvent e) {
+ }
+
+ });
+
getViewer().getTree().addKeyListener(new KeyListener() {
public void keyPressed(KeyEvent e) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java
index 5747fb037..264019d84 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/AbstractRepositoryConnectorUi.java
@@ -9,19 +9,26 @@
package org.eclipse.mylar.tasks.ui;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.text.hyperlink.IHyperlink;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.mylar.core.MylarStatusHandler;
+import org.eclipse.mylar.internal.tasks.core.WebTask;
import org.eclipse.mylar.internal.tasks.ui.TaskListPreferenceConstants;
+import org.eclipse.mylar.internal.tasks.ui.TasksUiImages;
import org.eclipse.mylar.internal.tasks.ui.wizards.CommonAddExistingTaskWizard;
+import org.eclipse.mylar.tasks.core.AbstractQueryHit;
import org.eclipse.mylar.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylar.tasks.core.AbstractRepositoryQuery;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
+import org.eclipse.mylar.tasks.core.ITask;
+import org.eclipse.mylar.tasks.core.ITaskListElement;
import org.eclipse.mylar.tasks.core.TaskRepository;
import org.eclipse.mylar.tasks.core.TaskRepositoryManager;
+import org.eclipse.mylar.tasks.core.Task.PriorityLevel;
import org.eclipse.mylar.tasks.ui.wizards.AbstractRepositorySettingsPage;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IWorkbenchPage;
@@ -39,7 +46,7 @@ public abstract class AbstractRepositoryConnectorUi {
private static final String LABEL_TASK_DEFAULT = "Task";
private boolean customNotificationHandling = false;
-
+
/**
* @return the unique type of the repository, e.g. "bugzilla"
*/
@@ -78,6 +85,29 @@ public abstract class AbstractRepositoryConnectorUi {
return LABEL_TASK_DEFAULT;
}
+ public ImageDescriptor getTaskListElementIcon(ITaskListElement element) {
+ if (element instanceof AbstractRepositoryQuery) {
+ return TasksUiImages.QUERY;
+ } else if (element instanceof AbstractQueryHit) {
+ return TasksUiImages.TASK;
+ } else if (element instanceof ITask) {
+ return TasksUiImages.TASK;
+ } else {
+ return null;
+ }
+ }
+
+ public ImageDescriptor getTaskPriorityOverlay(AbstractRepositoryTask task) {
+ return TasksUiUtil.getImageDescriptorForPriority(PriorityLevel.fromString(task.getPriority()));
+ }
+
+ public ImageDescriptor getTaskKindOverlay(AbstractRepositoryTask task) {
+ if (!hasRichEditor() || task instanceof WebTask) {
+ return TasksUiImages.OVERLAY_WEB;
+ }
+ return null;
+ }
+
public void openEditQueryDialog(AbstractRepositoryQuery query) {
try {
TaskRepository repository = TasksUiPlugin.getRepositoryManager().getRepository(query.getRepositoryKind(),
@@ -151,7 +181,7 @@ public abstract class AbstractRepositoryConnectorUi {
public void setCustomNotificationHandling(boolean customNotifications) {
this.customNotificationHandling = customNotifications;
}
-
+
public boolean hasCustomNotificationHandling() {
return customNotificationHandling;
}

Back to the top