Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2007-04-04 16:36:49 -0400
committermkersten2007-04-04 16:36:49 -0400
commit1302ca7e0995856bfdfa01c2efc571e3045c1667 (patch)
tree16b61f774739fe493a1bd9e03f473a363b9db654
parent2f3dd35613a23ea6782cc4f30b1b127bdc553049 (diff)
downloadorg.eclipse.mylyn.tasks-1302ca7e0995856bfdfa01c2efc571e3045c1667.tar.gz
org.eclipse.mylyn.tasks-1302ca7e0995856bfdfa01c2efc571e3045c1667.tar.xz
org.eclipse.mylyn.tasks-1302ca7e0995856bfdfa01c2efc571e3045c1667.zip
REOPENED - bug 176669: use cool RSS Owl category shading
https://bugs.eclipse.org/bugs/show_bug.cgi?id=176669
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListView.java154
1 files changed, 81 insertions, 73 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 bd4299bab..be6fe3a19 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
@@ -107,10 +107,18 @@ import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.graphics.Region;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.Scrollable;
+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;
@@ -250,9 +258,9 @@ public class TaskListView extends ViewPart {
int sortDirection = DEFAULT_SORT_DIRECTION;
-// private Color categoryGradientStart;
-//
-// private Color categoryGradientEnd;
+ private Color categoryGradientStart;
+
+ private Color categoryGradientEnd;
private final static int MAX_SELECTION_HISTORY_SIZE = 10;
@@ -295,40 +303,59 @@ public class TaskListView extends ViewPart {
*/
protected boolean isPaused = false;
-// private final Listener CATEGORY_GRADIENT_DRAWER = new Listener() {
-// public void handleEvent(Event event) {
-// if (event.item.getData() instanceof AbstractTaskContainer) {
-// Scrollable scrollable = (Scrollable) event.widget;
-// GC gc = event.gc;
-//
-// Rectangle area = scrollable.getClientArea();
-// Rectangle rect = event.getBounds();
-//
-// /* Paint the selection beyond the end of last column */
-// expandRegion(event, scrollable, gc, area);
-//
-// /* Draw Gradient Rectangle */
-// Color oldForeground = gc.getForeground();
-// Color oldBackground = gc.getBackground();
-//
-// gc.setForeground(categoryGradientStart);
-// gc.setBackground(categoryGradientEnd);
-// gc.fillGradientRectangle(0, rect.y, area.width, rect.height, true);
-//
-// /* Bottom Line */
-// gc.setForeground(categoryGradientEnd);
-// gc.drawLine(0, rect.y + rect.height - 1, area.width, rect.y + rect.height - 1);
-//
-// gc.setForeground(oldForeground);
-// gc.setBackground(oldBackground);
-//
-// /* Mark as Background being handled */
-// event.detail &= ~SWT.BACKGROUND;
-// }
-// }
-// };
-//
-// private boolean gradientListenerAdded = false;
+ private final Listener CATEGORY_GRADIENT_DRAWER = new Listener() {
+ public void handleEvent(Event event) {
+ if (event.item.getData() instanceof AbstractTaskContainer) {
+ Scrollable scrollable = (Scrollable) event.widget;
+ GC gc = event.gc;
+
+ Rectangle area = scrollable.getClientArea();
+ Rectangle rect = event.getBounds();
+
+ /* Paint the selection beyond the end of last column */
+ expandRegion(event, scrollable, gc, area);
+
+ /* Draw Gradient Rectangle */
+ Color oldForeground = gc.getForeground();
+ Color oldBackground = gc.getBackground();
+
+ gc.setForeground(categoryGradientStart);
+ gc.setBackground(categoryGradientEnd);
+ gc.fillGradientRectangle(0, rect.y, area.width, rect.height, true);
+
+ /* Bottom Line */
+ gc.setForeground(categoryGradientEnd);
+ gc.drawLine(0, rect.y + rect.height - 1, area.width, rect.y + rect.height - 1);
+
+ gc.setForeground(oldForeground);
+ gc.setBackground(oldBackground);
+
+ /* Mark as Background being handled */
+ event.detail &= ~SWT.BACKGROUND;
+ }
+ }
+
+ private void expandRegion(Event event, Scrollable scrollable, GC gc, Rectangle area) {
+ int columnCount;
+ if (scrollable instanceof Table)
+ columnCount = ((Table) scrollable).getColumnCount();
+ else
+ columnCount = ((Tree) scrollable).getColumnCount();
+
+ if (event.index == columnCount - 1 || columnCount == 0) {
+ int width = area.x + area.width - event.x;
+ if (width > 0) {
+ Region region = new Region();
+ gc.getClipping(region);
+ region.add(event.x, event.y, width, event.height);
+ gc.setClipping(region);
+ region.dispose();
+ }
+ }
+ }
+ };
+
+ private boolean gradientListenerAdded = false;
private final ITaskActivityListener TASK_ACTIVITY_LISTENER = new ITaskActivityListener() {
public void taskActivated(final ITask task) {
@@ -489,19 +516,19 @@ public class TaskListView extends ViewPart {
};
private void updateGradientColors() {
-// categoryGradientStart = themeManager.getCurrentTheme().getColorRegistry().get(
-// TaskListColorsAndFonts.THEME_COLOR_CATEGORY_GRADIENT_START);
-// categoryGradientEnd = themeManager.getCurrentTheme().getColorRegistry().get(
-// TaskListColorsAndFonts.THEME_COLOR_CATEGORY_GRADIENT_END);
-
-// if (gradientListenerAdded == false && categoryGradientStart != null
-// && !categoryGradientStart.equals(categoryGradientEnd)) {
-// getViewer().getTree().addListener(SWT.EraseItem, CATEGORY_GRADIENT_DRAWER);
-// gradientListenerAdded = true;
-// } else if (categoryGradientStart != null && categoryGradientStart.equals(categoryGradientEnd)) {
-// getViewer().getTree().removeListener(SWT.EraseItem, CATEGORY_GRADIENT_DRAWER);
-// gradientListenerAdded = false;
-// }
+ categoryGradientStart = themeManager.getCurrentTheme().getColorRegistry().get(
+ TaskListColorsAndFonts.THEME_COLOR_CATEGORY_GRADIENT_START);
+ categoryGradientEnd = themeManager.getCurrentTheme().getColorRegistry().get(
+ TaskListColorsAndFonts.THEME_COLOR_CATEGORY_GRADIENT_END);
+
+ if (gradientListenerAdded == false && categoryGradientStart != null
+ && !categoryGradientStart.equals(categoryGradientEnd)) {
+ getViewer().getTree().addListener(SWT.EraseItem, CATEGORY_GRADIENT_DRAWER);
+ gradientListenerAdded = true;
+ } else if (categoryGradientStart != null && categoryGradientStart.equals(categoryGradientEnd)) {
+ getViewer().getTree().removeListener(SWT.EraseItem, CATEGORY_GRADIENT_DRAWER);
+ gradientListenerAdded = false;
+ }
}
public static TaskListView getFromActivePerspective() {
@@ -931,12 +958,12 @@ public class TaskListView extends ViewPart {
if (!filteredTree.getFilterControl().getText().equals("")) {
filteredTree.getFilterControl().setText("");
}
- if(presentation.getPresentationName().equals(PRESENTATION_SCHEDULED)) {
+ if (presentation.getPresentationName().equals(PRESENTATION_SCHEDULED)) {
TasksUiPlugin.getTaskListManager().parseFutureReminders();
}
getViewer().setContentProvider(presentation.getContentProvider());
refreshAndFocus(isFocusedMode());
-
+
currentPresentation = presentation;
} finally {
getViewer().getControl().setRedraw(true);
@@ -984,25 +1011,6 @@ public class TaskListView extends ViewPart {
}
}
-// private void expandRegion(Event event, Scrollable scrollable, GC gc, Rectangle area) {
-// int columnCount;
-// if (scrollable instanceof Table)
-// columnCount = ((Table) scrollable).getColumnCount();
-// else
-// columnCount = ((Tree) scrollable).getColumnCount();
-//
-// if (event.index == columnCount - 1 || columnCount == 0) {
-// int width = area.x + area.width - event.x;
-// if (width > 0) {
-// Region region = new Region();
-// gc.getClipping(region);
-// region.add(event.x, event.y, width, event.height);
-// gc.setClipping(region);
-// region.dispose();
-// }
-// }
-// }
-
private void initDragAndDrop(Composite parent) {
Transfer[] dragTypes = new Transfer[] { TaskTransfer.getInstance(), TextTransfer.getInstance(),
FileTransfer.getInstance() };
@@ -1501,8 +1509,8 @@ public class TaskListView extends ViewPart {
isPaused = paused;
IStatusLineManager statusLineManager = getViewSite().getActionBars().getStatusLineManager();
if (isPaused) {
- statusLineManager.setMessage(TasksUiImages.getImage(TasksUiImages.TASKLIST),
- "Mylar context capture paused");
+ statusLineManager
+ .setMessage(TasksUiImages.getImage(TasksUiImages.TASKLIST), "Mylar context capture paused");
setPartName("(paused) " + PART_NAME);
} else {
statusLineManager.setMessage("");

Back to the top