Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2005-08-16 21:48:45 -0400
committermkersten2005-08-16 21:48:45 -0400
commitc77665346f6de0c5221cb56d2ed14bdf257213d1 (patch)
tree8751caceba397fce497158d99a558b8d0ac41ec7
parent3d51b567908ae535886079e8d2376fbffba5203c (diff)
downloadorg.eclipse.mylyn.tasks-c77665346f6de0c5221cb56d2ed14bdf257213d1.tar.gz
org.eclipse.mylyn.tasks-c77665346f6de0c5221cb56d2ed14bdf257213d1.tar.xz
org.eclipse.mylyn.tasks-c77665346f6de0c5221cb56d2ed14bdf257213d1.zip
Fixed Bug #106929: Add tooltip for description column in the tasklist
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaHit.java8
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaQueryCategory.java15
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTask.java64
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskListElement.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTasklistPlugin.java7
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskCategory.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/ToolTipHandler.java21
7 files changed, 75 insertions, 50 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaHit.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaHit.java
index 0e3b92ca0..6a2e13002 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaHit.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaHit.java
@@ -157,4 +157,12 @@ public class BugzillaHit implements ITaskListElement {
}
return false;
}
+
+ public String getToolTipText() {
+ if(hasCorrespondingActivatableTask()) {
+ return task.getToolTipText();
+ } else {
+ return null;
+ }
+ }
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaQueryCategory.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaQueryCategory.java
index 5f533f1a9..b46f8dc71 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaQueryCategory.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaQueryCategory.java
@@ -11,6 +11,7 @@
package org.eclipse.mylar.bugzilla.ui.tasklist;
import java.util.ArrayList;
+import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -48,6 +49,8 @@ public class BugzillaQueryCategory extends AbstractCategory {
private List<BugzillaHit> hits = new ArrayList<BugzillaHit>();
private boolean hasBeenRefreshed = false;
+ protected Date lastRefresh;
+
public class BugzillaQueryCategorySearchListener implements ICategorySearchListener {
Map<Integer, BugzillaSearchHit> hits = new HashMap<Integer, BugzillaSearchHit>();
@@ -113,6 +116,7 @@ public class BugzillaQueryCategory extends AbstractCategory {
// execute the search operation
catSearch.execute(new NullProgressMonitor());
hasBeenRefreshed = true;
+ lastRefresh = new Date();
// get the status of the search operation
status[0] = catSearch.getStatus();
@@ -210,4 +214,15 @@ public class BugzillaQueryCategory extends AbstractCategory {
public boolean isCompleted() {
return false;
}
+
+ public String getToolTipText() {
+ String tooltip = "";
+ if (hits.size() == 1) {
+ tooltip += "1 hit";
+ } else {
+ tooltip += hits.size() + " hits";
+ }
+ tooltip += BugzillaTask.getLastRefreshTime(lastRefresh);
+ return tooltip;
+ }
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTask.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTask.java
index acb4df112..3d22fc64d 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTask.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/bugzilla/ui/tasklist/BugzillaTask.java
@@ -78,6 +78,28 @@ public class BugzillaTask extends Task {
/** The last time this task's bug report was downloaded from the server. */
protected Date lastRefresh;
+ /**
+ * TODO: Move
+ */
+ public static String getLastRefreshTime(Date lastRefresh) {
+ String toolTip = "\n-------------------\n"
+ + "Last synchronized: ";
+ Date timeNow = new Date();
+ long timeDifference = (timeNow.getTime() - lastRefresh.getTime())/60000;
+ long minutes = timeDifference % 60;
+ timeDifference /= 60;
+ long hours = timeDifference % 24;
+ timeDifference /= 24;
+ if (timeDifference > 0) {
+ toolTip += timeDifference + ((timeDifference == 1) ? " day, " : " days, ");
+ }
+ if (hours > 0 || timeDifference > 0) {
+ toolTip += hours + ((hours == 1) ? " hour, " : " hours, ");
+ }
+ toolTip += minutes + ((minutes == 1) ? " minute " : " minutes ") + "ago";
+ return toolTip;
+ }
+
public static final ISchedulingRule rule = new ISchedulingRule() {
public boolean isConflicting(ISchedulingRule schedulingRule) {
return schedulingRule == this;
@@ -405,46 +427,16 @@ public class BugzillaTask extends Task {
@Override
public String getToolTipText() {
- if(lastRefresh == null)
- return "";
- // Get the current time.
- Date timeNow = new Date();
-
- // Get the number of minutes between the current time
- // and the last time the bug report was downloaded
- long timeDifference = (timeNow.getTime() - lastRefresh.getTime())/60000;
-
- // Calculate the number of minutes and hours.
- // The amount left in "timeDifference" is the
- // days' difference.
- long minutes = timeDifference % 60;
- timeDifference /= 60;
- long hours = timeDifference % 24;
- timeDifference /= 24;
-
- // Gradually generate the tooltip string...
- String toolTip =
- getDescription(true) +
- "\n-------------------\n";
-
-// if (bugReport == null) {
-// toolTip += "Last attempted download ";
-// }
-// else {
- toolTip += "Last synchronized: ";
-// }
+ if(lastRefresh == null) return "";
+
+ String toolTip = getDescription(true);
+
- if (timeDifference > 0) {
- toolTip += timeDifference + ((timeDifference == 1) ? " day, " : " days, ");
- }
- if (hours > 0 || timeDifference > 0) {
- toolTip += hours + ((hours == 1) ? " hour, " : " hours, ");
- }
- toolTip += minutes + ((minutes == 1) ? " minute " : " minutes ") + "ago";
+ toolTip += getLastRefreshTime(lastRefresh);
return toolTip;
}
-
+
public boolean readBugReport() {
// XXX server name needs to be with the bug report
int location = BugzillaPlugin.getDefault().getOfflineReports().find(getBugId(getHandle()));
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskListElement.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskListElement.java
index 6b2d82b51..80ebf5548 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskListElement.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskListElement.java
@@ -53,5 +53,7 @@ public interface ITaskListElement {
public abstract Font getFont();
+ public abstract String getToolTipText();
+
public abstract boolean isCompleted();
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTasklistPlugin.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTasklistPlugin.java
index 6bed44196..d5f48895d 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTasklistPlugin.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTasklistPlugin.java
@@ -276,11 +276,12 @@ public class MylarTasklistPlugin extends AbstractUIPlugin implements IStartup {
public void earlyStartup() {
final IWorkbench workbench = PlatformUI.getWorkbench();
+
+ taskListManager.readTaskList();
+ if (taskListManager.getTaskList() == null) taskListManager.createNewTaskList();
+
workbench.getDisplay().asyncExec(new Runnable() {
public void run() {
- taskListManager.readTaskList();
- if (taskListManager.getTaskList() == null) taskListManager.createNewTaskList();
-
Workbench.getInstance().getActiveWorkbenchWindow().getShell().addShellListener(SHELL_LISTENER);
MylarPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(PREFERENCE_LISTENER);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskCategory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskCategory.java
index 97d655ba5..266f90039 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskCategory.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/internal/TaskCategory.java
@@ -112,4 +112,12 @@ public class TaskCategory extends AbstractCategory implements Serializable {
public boolean isCompleted(){
return false;
}
+
+ public String getToolTipText() {
+ if (tasks.size() == 1) {
+ return "1 task";
+ } else {
+ return tasks.size() + " tasks";
+ }
+ }
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/ToolTipHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/ToolTipHandler.java
index fe6df132e..af37cdbf4 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/ToolTipHandler.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ui/views/ToolTipHandler.java
@@ -15,7 +15,7 @@
package org.eclipse.mylar.tasklist.ui.views;
import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.mylar.tasklist.ITask;
+import org.eclipse.mylar.tasklist.ITaskListElement;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.HelpEvent;
import org.eclipse.swt.events.HelpListener;
@@ -92,25 +92,24 @@ public class ToolTipHandler {
tipLabelText.setLayoutData(textGridData);
}
- private ITask getTask(Object hoverObject) {
+ private ITaskListElement getTask(Object hoverObject) {
if (hoverObject instanceof Widget) {
Object data = ((Widget) hoverObject).getData();
if (data != null) {
- if (data instanceof ITask) {
- return (ITask) data;
+ if (data instanceof ITaskListElement) {
+ return (ITaskListElement) data;
} else if (data instanceof IAdaptable) {
- return (ITask) ((IAdaptable) data).getAdapter(ITask.class);
- }
-
+ return (ITaskListElement) ((IAdaptable) data).getAdapter(ITaskListElement.class);
+ }
}
}
return null;
}
protected String getToolTipText(Object object) {
- ITask task = getTask(object);
- if (task != null) {
- return task.getToolTipText();
+ ITaskListElement element = getTask(object);
+ if (element != null) {
+ return element.getToolTipText();
}
if (object instanceof Control) {
@@ -120,7 +119,7 @@ public class ToolTipHandler {
}
protected Image getToolTipImage(Object object) {
- ITask projectNode = getTask(object);
+ ITaskListElement projectNode = getTask(object);
if (projectNode != null) {
// TODO Code for determining image
}

Back to the top