Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2010-11-12 14:49:28 -0500
committerspingel2010-11-12 14:49:28 -0500
commit6e9f2e1b272f20afd7e72ff0472bceac5d341bf7 (patch)
tree17bcf597ad3efd7a2a440d5546a7f7d8a96a1033
parenteeaa6ff41929f1165b56e914598a4277180debc0 (diff)
downloadorg.eclipse.mylyn.tasks-6e9f2e1b272f20afd7e72ff0472bceac5d341bf7.tar.gz
org.eclipse.mylyn.tasks-6e9f2e1b272f20afd7e72ff0472bceac5d341bf7.tar.xz
org.eclipse.mylyn.tasks-6e9f2e1b272f20afd7e72ff0472bceac5d341bf7.zip
NEW - bug 254686: wrong tooltip displayed when hovering over task that is not in task list
https://bugs.eclipse.org/bugs/show_bug.cgi?id=254686
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskHyperlinkPresenter.java23
3 files changed, 21 insertions, 5 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java
index b0c89b385..d190ab818 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/Messages.java
@@ -271,5 +271,7 @@ public class Messages extends NLS {
public static String TaskEditorExtensionSettingsContribution_Select_the_capabilities_of_the_task_editor;
+ public static String TaskHyperlinkPresenter_Not_In_Task_List;
+
public static String TaskUrlHyperlink_Open_URL_in_Task_Editor;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties
index 8f92b633e..73eccbd4c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/messages.properties
@@ -151,4 +151,5 @@ TaskEditorExtensionSettingsContribution__default_=\ (default)
TaskEditorExtensionSettingsContribution_Editor=Task Editor Settings
TaskEditorExtensionSettingsContribution_Plain_Text=Plain Text
TaskEditorExtensionSettingsContribution_Select_the_capabilities_of_the_task_editor=Select the capabilities of the task editor
+TaskHyperlinkPresenter_Not_In_Task_List=Open {0} from Repository
TaskUrlHyperlink_Open_URL_in_Task_Editor=Open ''{0}'' in Task Editor
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskHyperlinkPresenter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskHyperlinkPresenter.java
index f4c19dd4f..70b1a63f5 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskHyperlinkPresenter.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TaskHyperlinkPresenter.java
@@ -23,7 +23,10 @@ import org.eclipse.jface.text.hyperlink.IHyperlink;
import org.eclipse.jface.text.hyperlink.MultipleHyperlinkPresenter;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
+import org.eclipse.mylyn.internal.tasks.ui.editors.Messages;
+import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.ITask;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.custom.StyleRange;
import org.eclipse.swt.graphics.RGB;
@@ -42,7 +45,9 @@ public final class TaskHyperlinkPresenter extends MultipleHyperlinkPresenter {
* Stores which task a tooltip is being displayed for. It is used to avoid having the same tooltip being set
* multiple times while you move the mouse over a task hyperlink (bug#209409)
*/
- private ITask currentTaskHyperlink;
+ private ITask currentTask;
+
+ private TaskHyperlink currentTaskHyperlink;
private ITextViewer textViewer;
@@ -78,7 +83,7 @@ public final class TaskHyperlinkPresenter extends MultipleHyperlinkPresenter {
public void applyTextPresentation(TextPresentation textPresentation) {
super.applyTextPresentation(textPresentation);
// decorate hyperlink as strike-through if task is completed, this is now also handled by TaskHyperlinkTextPresentationManager
- if (activeRegion != null && currentTaskHyperlink != null && currentTaskHyperlink.isCompleted()) {
+ if (activeRegion != null && currentTask != null && currentTask.isCompleted()) {
Iterator<StyleRange> styleRangeIterator = textPresentation.getAllStyleRangeIterator();
while (styleRangeIterator.hasNext()) {
StyleRange styleRange = styleRangeIterator.next();
@@ -107,12 +112,19 @@ public final class TaskHyperlinkPresenter extends MultipleHyperlinkPresenter {
task = taskList.getTaskByKey(repositoryUrl, hyperlink.getTaskId());
}
- if (task != null && task != currentTaskHyperlink) {
- currentTaskHyperlink = task;
+ if (!hyperlinks[0].equals(currentTaskHyperlink)) {
+ currentTaskHyperlink = (TaskHyperlink) hyperlinks[0];
+ currentTask = task;
activeRegion = hyperlink.getHyperlinkRegion();
if (textViewer != null && textViewer.getTextWidget() != null
&& !textViewer.getTextWidget().isDisposed()) {
- if (task.getTaskKey() == null) {
+ if (task == null) {
+ String taskLabel = TasksUiInternal.getTaskPrefix(hyperlink.getRepository()
+ .getConnectorKind());
+ taskLabel += currentTaskHyperlink.getTaskId();
+ textViewer.getTextWidget().setToolTipText(
+ NLS.bind(Messages.TaskHyperlinkPresenter_Not_In_Task_List, taskLabel));
+ } else if (task.getTaskKey() == null) {
textViewer.getTextWidget().setToolTipText(task.getSummary());
} else {
textViewer.getTextWidget().setToolTipText(task.getTaskKey() + ": " + task.getSummary()); //$NON-NLS-1$
@@ -131,6 +143,7 @@ public final class TaskHyperlinkPresenter extends MultipleHyperlinkPresenter {
textViewer.getTextWidget().setToolTipText(null);
}
currentTaskHyperlink = null;
+ currentTask = null;
}
super.hideHyperlinks();
}

Back to the top