Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2007-06-26 17:14:56 -0400
committermkersten2007-06-26 17:14:56 -0400
commit79fd06a373816ed8bcfb8d72d001c18de530bf3d (patch)
tree404cf34d5e2dbbe575f969fddceac47391eecfc8
parentd5b3fe308dafbb2c40f923c274b32910890fa9a5 (diff)
downloadorg.eclipse.mylyn.tasks-79fd06a373816ed8bcfb8d72d001c18de530bf3d.tar.gz
org.eclipse.mylyn.tasks-79fd06a373816ed8bcfb8d72d001c18de530bf3d.tar.xz
org.eclipse.mylyn.tasks-79fd06a373816ed8bcfb8d72d001c18de530bf3d.zip
NEW - bug 187550: Task List is picking wrong category gradient colors on start
https://bugs.eclipse.org/bugs/show_bug.cgi?id=187550
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java65
1 files changed, 37 insertions, 28 deletions
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 f6e7559d0..a8428dc4c 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
@@ -597,38 +597,47 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
categoryGradientEnd = themeManager.getCurrentTheme().getColorRegistry().get(
TaskListColorsAndFonts.THEME_COLOR_CATEGORY_GRADIENT_END);
+ boolean customized = true;
+ if (categoryGradientStart != null && categoryGradientStart.getRed() == 240
+ && categoryGradientStart.getGreen() == 240 && categoryGradientStart.getBlue() == 240
+ && categoryGradientEnd != null && categoryGradientEnd.getRed() == 220
+ && categoryGradientEnd.getGreen() == 220 && categoryGradientEnd.getBlue() == 220) {
+ customized = false;
+ }
+
if (gradientListenerAdded == false && categoryGradientStart != null
&& !categoryGradientStart.equals(categoryGradientEnd)) {
getViewer().getTree().addListener(SWT.EraseItem, CATEGORY_GRADIENT_DRAWER);
+ gradientListenerAdded = true;
+ if (!customized) {
+ // Set parent-based colors
+ Color parentBackground = getViewer().getTree().getParent().getBackground();
+ double GRADIENT_TOP = 1.05;// 1.02;
+ double GRADIENT_BOTTOM = .995;// 1.035;
- // TODO: weird override of custom gradients
- Color parentBackground = getViewer().getTree().getParent().getBackground();
- double GRADIENT_TOP = 1.05;// 1.02;
- double GRADIENT_BOTTOM = .995;// 1.035;
-
- int red = Math.min(255, (int) (parentBackground.getRed() * GRADIENT_TOP));
- int green = Math.min(255, (int) (parentBackground.getGreen() * GRADIENT_TOP));
- int blue = Math.min(255, (int) (parentBackground.getBlue() * GRADIENT_TOP));
+ int red = Math.min(255, (int) (parentBackground.getRed() * GRADIENT_TOP));
+ int green = Math.min(255, (int) (parentBackground.getGreen() * GRADIENT_TOP));
+ int blue = Math.min(255, (int) (parentBackground.getBlue() * GRADIENT_TOP));
- try {
- categoryGradientStart = new Color(Display.getDefault(), red, green, blue);
- } catch (Exception e) {
- categoryGradientStart = getViewer().getTree().getParent().getBackground();
- StatusHandler.fail(e, "Could not set color: " + red + ", " + green + ", " + blue, false);
- }
- red = Math.max(0, (int) (parentBackground.getRed() / GRADIENT_BOTTOM));
- green = Math.max(0, (int) (parentBackground.getGreen() / GRADIENT_BOTTOM));
- blue = Math.max(0, (int) (parentBackground.getBlue() / GRADIENT_BOTTOM));
- if (red > 255) {
- red = 255;
- }
- try {
- categoryGradientEnd = new Color(Display.getDefault(), red, green, blue);
- } catch (Exception e) {
- categoryGradientStart = getViewer().getTree().getParent().getBackground();
- StatusHandler.fail(e, "Could not set color: " + red + ", " + green + ", " + blue, false);
+ try {
+ categoryGradientStart = new Color(Display.getDefault(), red, green, blue);
+ } catch (Exception e) {
+ categoryGradientStart = getViewer().getTree().getParent().getBackground();
+ StatusHandler.fail(e, "Could not set color: " + red + ", " + green + ", " + blue, false);
+ }
+ red = Math.max(0, (int) (parentBackground.getRed() / GRADIENT_BOTTOM));
+ green = Math.max(0, (int) (parentBackground.getGreen() / GRADIENT_BOTTOM));
+ blue = Math.max(0, (int) (parentBackground.getBlue() / GRADIENT_BOTTOM));
+ if (red > 255) {
+ red = 255;
+ }
+ try {
+ categoryGradientEnd = new Color(Display.getDefault(), red, green, blue);
+ } catch (Exception e) {
+ categoryGradientStart = getViewer().getTree().getParent().getBackground();
+ StatusHandler.fail(e, "Could not set color: " + red + ", " + green + ", " + blue, false);
+ }
}
- gradientListenerAdded = true;
} else if (categoryGradientStart != null && categoryGradientStart.equals(categoryGradientEnd)) {
getViewer().getTree().removeListener(SWT.EraseItem, CATEGORY_GRADIENT_DRAWER);
gradientListenerAdded = false;
@@ -794,7 +803,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
linkValue = Boolean.parseBoolean(taskListMemento.getString(MEMENTO_LINK_WITH_EDITOR));
}
setLinkWithEditor(linkValue);
-
+
getViewer().setSorter(new TaskListTableSorter(this, sortByIndex));
getViewer().refresh();
}
@@ -1696,7 +1705,7 @@ public class TaskListView extends ViewPart implements IPropertyChangeListener {
this.sortByIndex = sortByIndex;
getViewer().setSorter(new TaskListTableSorter(this, sortByIndex));
}
-
+
public void setSortDirection(int sortDirection) {
this.sortDirection = sortDirection;
getViewer().setSorter(new TaskListTableSorter(this, sortByIndex));

Back to the top