Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 166406 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/mylyn/tasks/ui/TasksUiPlugin.java (-22 / +49 lines)
Lines 570-575 Link Here
570
		store.setDefault(TasksUiPreferenceConstants.FILTER_PRIORITY, PriorityLevel.P5.toString());
570
		store.setDefault(TasksUiPreferenceConstants.FILTER_PRIORITY, PriorityLevel.P5.toString());
571
		store.setDefault(TasksUiPreferenceConstants.EDITOR_TASKS_RICH, true);
571
		store.setDefault(TasksUiPreferenceConstants.EDITOR_TASKS_RICH, true);
572
		store.setDefault(TasksUiPreferenceConstants.ACTIVATE_WHEN_OPENED, false);
572
		store.setDefault(TasksUiPreferenceConstants.ACTIVATE_WHEN_OPENED, false);
573
		store.setDefault(TasksUiPreferenceConstants.SHOW_TRIM, false);
573
574
574
		store.setDefault(TasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED, true);
575
		store.setDefault(TasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_ENABLED, true);
575
		store.setDefault(TasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS, "" + (20 * 60 * 1000));
576
		store.setDefault(TasksUiPreferenceConstants.REPOSITORY_SYNCH_SCHEDULE_MILISECONDS, "" + (20 * 60 * 1000));
Lines 856-862 Link Here
856
				TaskComment lastComment = taskComments.get(taskComments.size() - 1);
857
				TaskComment lastComment = taskComments.get(taskComments.size() - 1);
857
				if (lastComment != null) {
858
				if (lastComment != null) {
858
					descriptionText += "Comment by " + lastComment.getAuthor() + ":\n  ";
859
					descriptionText += "Comment by " + lastComment.getAuthor() + ":\n  ";
859
					String commentText = lastComment.getText();
860
					String commentText = lastComment.getText().replaceAll("\\s", " ").trim();
860
					if (commentText.length() > 60) {
861
					if (commentText.length() > 60) {
861
						commentText = commentText.substring(0, 55) + "...";
862
						commentText = commentText.substring(0, 55) + "...";
862
					}
863
					}
Lines 865-913 Link Here
865
			}
866
			}
866
		}
867
		}
867
868
868
		if (descriptionText.equals("")) {
869
			String attributes = getChangedAttributes(newTaskData, oldTaskData);
870
			if (!attributes.equals("")) {
871
				descriptionText += "Attributes Changed:";
872
			}
873
		}
874
875
		return descriptionText;
869
		return descriptionText;
876
	}
870
	}
877
871
878
	private static String getChangedAttributes(RepositoryTaskData newTaskData, RepositoryTaskData oldTaskData) {
872
	private static String getChangedAttributes(RepositoryTaskData newTaskData, RepositoryTaskData oldTaskData) {
879
		List<Change> changes = new ArrayList<Change>();
873
		List<Change> changes = new ArrayList<Change>();
880
		for (RepositoryTaskAttribute newAttribute : newTaskData.getAttributes()) {
874
		for (RepositoryTaskAttribute newAttribute : newTaskData.getAttributes()) {
875
			// HACK delta_ts is not a standard attribute
876
			if ("delta_ts,longdesclength,".contains(newAttribute.getId())) {
877
				continue;
878
			}
881
			List<String> newValues = newAttribute.getValues();
879
			List<String> newValues = newAttribute.getValues();
882
			RepositoryTaskAttribute oldAttribute = oldTaskData.getAttribute(newAttribute.getId());
880
			RepositoryTaskAttribute oldAttribute = oldTaskData.getAttribute(newAttribute.getId());
883
			if (oldAttribute == null) {
881
			if (oldAttribute == null) {
884
				changes.add(getDiff(newAttribute.getName(), null, newValues));
882
				changes.add(getDiff(newAttribute.getName(), null, newValues));
885
				break;
886
			}
883
			}
887
			List<String> oldValues = oldAttribute.getValues();
884
			if (oldAttribute != null) {
888
			if (!oldValues.equals(newValues)) {
885
				List<String> oldValues = oldAttribute.getValues();
889
				changes.add(getDiff(newAttribute.getName(), oldValues, newValues));
886
				if (!oldValues.equals(newValues)) {
890
				break;
887
					changes.add(getDiff(newAttribute.getName(), oldValues, newValues));
888
				}
891
			}
889
			}
892
		}
890
		}
891
892
		for (RepositoryTaskAttribute oldAttribute : oldTaskData.getAttributes()) {
893
			if (oldAttribute.isHidden()) { // may not be a good idea
894
				continue;
895
			}
896
			RepositoryTaskAttribute attribute = newTaskData.getAttribute(oldAttribute.getId());
897
			List<String> values = oldAttribute.getValues();
898
			if (attribute == null && values != null && !values.isEmpty()) {
899
				changes.add(getDiff(oldAttribute.getName(), values, null));
900
			}
901
		}
902
893
		if (changes.isEmpty()) {
903
		if (changes.isEmpty()) {
894
			return "";
904
			return "";
895
		}
905
		}
896
906
897
		String details = "";
907
		String details = "";
898
		String sep = "";
908
		String sep = "";
909
		int n = 0;
899
		for (Change change : changes) {
910
		for (Change change : changes) {
900
			details += sep;
911
			String removed = change.removed.toString();
901
			if (!change.removed.isEmpty()) {
912
			String added = change.added.toString();
902
				details += "- " + change.field + " " + change.removed;
913
			details += sep + "  " + change.field + " " + removed;
903
				sep = "\n";
914
			if (removed.length() > 30) {
904
			}
915
				details += "\n  ";
905
			if (!change.added.isEmpty()) {
916
			}
906
				details += sep;
917
			details += " -> " + added;
907
				details += "+ " + change.field + " " + change.added;
918
			sep = "\n";
908
				sep = "\n";
919
			
920
//			if (!change.removed.isEmpty()) {
921
//				details += "- " + change.field + " " + change.removed;
922
//				sep = "\n";
923
//			}
924
//			if (!change.added.isEmpty()) {
925
//				details += sep;
926
//				details += "+ " + change.field + " " + change.added;
927
//				sep = "\n";
928
//			}
929
930
			n++;
931
			if (n > 5) {  // that may not be enough
932
				break;
909
			}
933
			}
910
		}
934
		}
935
		if (!details.equals("")) {
936
			return "Attributes Changed:\n" + details;
937
		}
911
		return details;
938
		return details;
912
	}
939
	}

Return to bug 166406