Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2007-06-25 20:32:40 -0400
committermkersten2007-06-25 20:32:40 -0400
commitcb09d8e236b92d03c476a4151ba382ca61608fc0 (patch)
treeeaafcc9838d329373108c12f94c73029722c7297
parent133df02e12aa06318d60d90eb865385428a18dcb (diff)
downloadorg.eclipse.mylyn.tasks-cb09d8e236b92d03c476a4151ba382ca61608fc0.tar.gz
org.eclipse.mylyn.tasks-cb09d8e236b92d03c476a4151ba382ca61608fc0.tar.xz
org.eclipse.mylyn.tasks-cb09d8e236b92d03c476a4151ba382ca61608fc0.zip
NEW - bug 166406: Improve query tooltip layout
https://bugs.eclipse.org/bugs/show_bug.cgi?id=166406
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITaskListNotification.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListNotificationIncoming.java11
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskSearchPage.java1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTipHandler.java12
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java94
5 files changed, 93 insertions, 27 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITaskListNotification.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITaskListNotification.java
index 0c2677b29..78de98e19 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITaskListNotification.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/ITaskListNotification.java
@@ -24,6 +24,8 @@ public interface ITaskListNotification extends Comparable<ITaskListNotification>
public String getDescription();
+ public String getDetails();
+
public String getLabel();
public Image getNotificationIcon();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListNotificationIncoming.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListNotificationIncoming.java
index 81bdd08d0..7e35b6b11 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListNotificationIncoming.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskListNotificationIncoming.java
@@ -29,11 +29,14 @@ public class TaskListNotificationIncoming implements ITaskListNotification {
private String description = null;
+ private String details = null;
+
private DecoratingLabelProvider labelProvider = new DecoratingLabelProvider(new TaskElementLabelProvider(true),
PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator());
private Date date;
+
public TaskListNotificationIncoming(AbstractTask task) {
this.task = task;
}
@@ -49,6 +52,14 @@ public class TaskListNotificationIncoming implements ITaskListNotification {
public void setDescription(String description) {
this.description = description;
}
+
+ public String getDetails() {
+ return details;
+ }
+
+ public void setDetails(String details) {
+ this.details = details;
+ }
public void openTask() {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskSearchPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskSearchPage.java
index 50fbb97ad..d9fa04412 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskSearchPage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TaskSearchPage.java
@@ -40,7 +40,6 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
import org.eclipse.ui.forms.events.HyperlinkAdapter;
import org.eclipse.ui.forms.events.HyperlinkEvent;
import org.eclipse.ui.forms.events.IHyperlinkListener;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTipHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTipHandler.java
index 348eb85d1..b4995b8d9 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTipHandler.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListToolTipHandler.java
@@ -179,14 +179,22 @@ public class TaskListToolTipHandler {
AbstractRepositoryConnector connector = TasksUiPlugin.getRepositoryManager().getRepositoryConnector(
task);
if (connector != null) {
- ITaskListNotification notification = TasksUiPlugin.getIncommingNotification(connector, task);
+ ITaskListNotification notification = TasksUiPlugin.getDefault().getIncommingNotification(connector, task);
if (notification != null) {
+ String res = null;
if (notification.getDescription() != null) {
String descriptionText = notification.getDescription();
if (descriptionText != null && descriptionText.length() > 0) {
- return descriptionText;
+ res = descriptionText;
}
}
+ if(notification.getDetails() !=null) {
+ String details = notification.getDetails();
+ if (details != null && details.length() > 0) {
+ res = res==null ? details : res + "\n" + details;
+ }
+ }
+ return res;
}
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java
index 447e86741..24b56dcc0 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java
@@ -252,7 +252,7 @@ public class TasksUiPlugin extends AbstractUIPlugin implements IStartup {
.getRepositoryTasks(repository.getUrl())) {
if ((repositoryTask.getLastReadTimeStamp() == null || repositoryTask.getSynchronizationState() == RepositoryTaskSyncState.INCOMING)
&& repositoryTask.isNotified() == false) {
- TaskListNotificationIncoming notification = getIncommingNotification(connector,
+ TaskListNotificationIncoming notification = INSTANCE.getIncommingNotification(connector,
repositoryTask);
notifications.add(notification);
repositoryTask.setNotified(true);
@@ -820,21 +820,20 @@ public class TasksUiPlugin extends AbstractUIPlugin implements IStartup {
return getTaskDataManager().getNewRepositoryTaskId();
}
- public static TaskListNotificationIncoming getIncommingNotification(AbstractRepositoryConnector connector,
- AbstractTask repositoryTask) {
+ /**
+ * TODO: move, uses internal class.
+ */
+ public TaskListNotificationIncoming getIncommingNotification(AbstractRepositoryConnector connector,
+ AbstractTask task) {
- TaskListNotificationIncoming notification = new TaskListNotificationIncoming(repositoryTask);
- RepositoryTaskData newTaskData = getTaskDataManager().getNewTaskData(repositoryTask.getRepositoryUrl(),
- repositoryTask.getTaskId());
- RepositoryTaskData oldTaskData = getTaskDataManager().getOldTaskData(repositoryTask.getRepositoryUrl(),
- repositoryTask.getTaskId());
+ TaskListNotificationIncoming notification = new TaskListNotificationIncoming(task);
+ RepositoryTaskData newTaskData = getTaskDataManager().getNewTaskData(task.getRepositoryUrl(), task.getTaskId());
+ RepositoryTaskData oldTaskData = getTaskDataManager().getOldTaskData(task.getRepositoryUrl(), task.getTaskId());
if (newTaskData != null && oldTaskData != null) {
- String descriptionText = getChangedDescription(newTaskData, oldTaskData);
- if (descriptionText != null) {
- notification.setDescription(descriptionText);
- }
+ notification.setDescription(getChangedDescription(newTaskData, oldTaskData));
+ notification.setDetails(getChangedAttributes(newTaskData, oldTaskData));
if (connector != null) {
AbstractTaskDataHandler offlineHandler = connector.getTaskDataHandler();
@@ -852,7 +851,6 @@ public class TasksUiPlugin extends AbstractUIPlugin implements IStartup {
}
private static String getChangedDescription(RepositoryTaskData newTaskData, RepositoryTaskData oldTaskData) {
-
String descriptionText = "";
if (newTaskData.getComments().size() > oldTaskData.getComments().size()) {
@@ -870,29 +868,77 @@ public class TasksUiPlugin extends AbstractUIPlugin implements IStartup {
}
}
- boolean attributeChanged = false;
+ if (descriptionText.equals("")) {
+ String attributes = getChangedAttributes(newTaskData, oldTaskData);
+ if (!attributes.equals("")) {
+ descriptionText += "Attributes Changed:";
+ }
+ }
+
+ return descriptionText;
+ }
+ private static String getChangedAttributes(RepositoryTaskData newTaskData, RepositoryTaskData oldTaskData) {
+ List<Change> changes = new ArrayList<Change>();
for (RepositoryTaskAttribute newAttribute : newTaskData.getAttributes()) {
+ List<String> newValues = newAttribute.getValues();
RepositoryTaskAttribute oldAttribute = oldTaskData.getAttribute(newAttribute.getId());
if (oldAttribute == null) {
- attributeChanged = true;
+ changes.add(getDiff(newAttribute.getName(), null, newValues));
break;
}
- if (oldAttribute.getValue() != null && !oldAttribute.getValue().equals(newAttribute.getValue())) {
- attributeChanged = true;
- break;
- } else if (oldAttribute.getValues() != null && !oldAttribute.getValues().equals(newAttribute.getValues())) {
- attributeChanged = true;
+ List<String> oldValues = oldAttribute.getValues();
+ if (!oldValues.equals(newValues)) {
+ changes.add(getDiff(newAttribute.getName(), oldValues, newValues));
break;
}
}
+ if (changes.isEmpty()) {
+ return "";
+ }
- if (attributeChanged) {
- if (descriptionText.equals("")) {
- descriptionText += "Attributes changed";
+ String details = "";
+ String sep = "";
+ for (Change change : changes) {
+ details += sep;
+ if (!change.removed.isEmpty()) {
+ details += "- " + change.field + " " + change.removed;
+ sep = "\n";
+ }
+ if (!change.added.isEmpty()) {
+ details += sep;
+ details += "+ " + change.field + " " + change.added;
+ sep = "\n";
}
}
- return descriptionText;
+ return details;
+ }
+
+ private static Change getDiff(String field, List<String> oldValues, List<String> newValues) {
+ Change change = new Change(field, newValues);
+ if (oldValues != null) {
+ for (String value : oldValues) {
+ if (change.added.contains(value)) {
+ change.added.remove(value);
+ } else {
+ change.removed.add(value);
+ }
+ }
+ }
+ return change;
}
+ private static class Change {
+
+ final String field;
+
+ final List<String> added;
+
+ final List<String> removed = new ArrayList<String>();
+
+ public Change(String field, List<String> newValues) {
+ this.field = field;
+ this.added = new ArrayList<String>(newValues);
+ }
+ }
}

Back to the top