Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2007-06-26 14:13:17 +0000
committermkersten2007-06-26 14:13:17 +0000
commite1c829c2555c04763f651fdee94ae5709e6c502e (patch)
tree1e239f7ef570364919096e2cf737b8184ef23e8b
parent749385bb605fab50d8f3f492e51e648759333ff8 (diff)
downloadorg.eclipse.mylyn.tasks-e1c829c2555c04763f651fdee94ae5709e6c502e.tar.gz
org.eclipse.mylyn.tasks-e1c829c2555c04763f651fdee94ae5709e6c502e.tar.xz
org.eclipse.mylyn.tasks-e1c829c2555c04763f651fdee94ae5709e6c502e.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/tasks/ui/TasksUiPlugin.java101
1 files changed, 65 insertions, 36 deletions
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 eeffdb50d..55c522c79 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
@@ -828,22 +828,25 @@ public class TasksUiPlugin extends AbstractUIPlugin implements IStartup {
RepositoryTaskData newTaskData = getTaskDataManager().getNewTaskData(task.getRepositoryUrl(), task.getTaskId());
RepositoryTaskData oldTaskData = getTaskDataManager().getOldTaskData(task.getRepositoryUrl(), task.getTaskId());
- if (newTaskData != null && oldTaskData != null) {
-
- notification.setDescription(getChangedDescription(newTaskData, oldTaskData));
- notification.setDetails(getChangedAttributes(newTaskData, oldTaskData));
-
- if (connector != null) {
- AbstractTaskDataHandler offlineHandler = connector.getTaskDataHandler();
- if (offlineHandler != null && newTaskData.getLastModified() != null) {
- Date modified = newTaskData.getAttributeFactory().getDateForAttributeType(
- RepositoryTaskAttribute.DATE_MODIFIED, newTaskData.getLastModified());
- notification.setDate(modified);
+ try {
+ if (newTaskData != null && oldTaskData != null) {
+ notification.setDescription(getChangedDescription(newTaskData, oldTaskData));
+ notification.setDetails(getChangedAttributes(newTaskData, oldTaskData));
+
+ if (connector != null) {
+ AbstractTaskDataHandler offlineHandler = connector.getTaskDataHandler();
+ if (offlineHandler != null && newTaskData.getLastModified() != null) {
+ Date modified = newTaskData.getAttributeFactory().getDateForAttributeType(
+ RepositoryTaskAttribute.DATE_MODIFIED, newTaskData.getLastModified());
+ notification.setDate(modified);
+ }
}
- }
- } else {
- notification.setDescription("Open to view changes");
+ } else {
+ notification.setDescription("Open to view changes");
+ }
+ } catch (Throwable t) {
+ StatusHandler.fail(t, "Could not format notification for: " + task, false);
}
return notification;
}
@@ -857,7 +860,7 @@ public class TasksUiPlugin extends AbstractUIPlugin implements IStartup {
TaskComment lastComment = taskComments.get(taskComments.size() - 1);
if (lastComment != null) {
descriptionText += "Comment by " + lastComment.getAuthor() + ":\n ";
- String commentText = lastComment.getText();
+ String commentText = lastComment.getText().replaceAll("\\s", " ").trim();
if (commentText.length() > 60) {
commentText = commentText.substring(0, 55) + "...";
}
@@ -866,49 +869,75 @@ public class TasksUiPlugin extends AbstractUIPlugin implements IStartup {
}
}
- 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()) {
+ // HACK delta_ts is not a standard attribute
+ if ("delta_ts,longdesclength,".contains(newAttribute.getId())) {
+ continue;
+ }
List<String> newValues = newAttribute.getValues();
RepositoryTaskAttribute oldAttribute = oldTaskData.getAttribute(newAttribute.getId());
if (oldAttribute == null) {
changes.add(getDiff(newAttribute.getName(), null, newValues));
- break;
}
- List<String> oldValues = oldAttribute.getValues();
- if (!oldValues.equals(newValues)) {
- changes.add(getDiff(newAttribute.getName(), oldValues, newValues));
- break;
+ if (oldAttribute != null) {
+ List<String> oldValues = oldAttribute.getValues();
+ if (!oldValues.equals(newValues)) {
+ changes.add(getDiff(newAttribute.getName(), oldValues, newValues));
+ }
}
}
+
+ for (RepositoryTaskAttribute oldAttribute : oldTaskData.getAttributes()) {
+ if (oldAttribute.isHidden()) { // may not be a good idea
+ continue;
+ }
+ RepositoryTaskAttribute attribute = newTaskData.getAttribute(oldAttribute.getId());
+ List<String> values = oldAttribute.getValues();
+ if (attribute == null && values != null && !values.isEmpty()) {
+ changes.add(getDiff(oldAttribute.getName(), values, null));
+ }
+ }
+
if (changes.isEmpty()) {
return "";
}
String details = "";
String sep = "";
+ int n = 0;
for (Change change : changes) {
- details += sep;
- if (!change.removed.isEmpty()) {
- details += "- " + change.field + " " + change.removed;
- sep = "\n";
+ String removed = change.removed.toString();
+ String added = change.added.toString();
+ details += sep + " " + change.field + " " + removed;
+ if (removed.length() > 30) {
+ details += "\n ";
}
- if (!change.added.isEmpty()) {
- details += sep;
- details += "+ " + change.field + " " + change.added;
- sep = "\n";
+ details += " -> " + added;
+ sep = "\n";
+
+// if (!change.removed.isEmpty()) {
+// details += "- " + change.field + " " + change.removed;
+// sep = "\n";
+// }
+// if (!change.added.isEmpty()) {
+// details += sep;
+// details += "+ " + change.field + " " + change.added;
+// sep = "\n";
+// }
+
+ n++;
+ if (n > 5) { // that may not be enough
+ break;
}
}
+ if (!details.equals("")) {
+ return "Attributes Changed:\n" + details;
+ }
return details;
}
@@ -927,7 +956,7 @@ public class TasksUiPlugin extends AbstractUIPlugin implements IStartup {
}
private static class Change {
-
+
final String field;
final List<String> added;

Back to the top