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 286963 | Differences between
and this patch

Collapse All | Expand All

(-)plugin.properties (+2 lines)
Lines 164-169 Link Here
164
command.showToolTip.name = Show Tooltip Description
164
command.showToolTip.name = Show Tooltip Description
165
command.markTaskRead.name = Mark Task Read
165
command.markTaskRead.name = Mark Task Read
166
command.markTaskUnread.name = Mark Task Unread
166
command.markTaskUnread.name = Mark Task Unread
167
command.markSimilarTasksRead.name = Mark all Similar Tasks as Read 
167
command.markTaskReadGoToNextUnread.name = Mark Task Read and Go To Next Unread Task
168
command.markTaskReadGoToNextUnread.name = Mark Task Read and Go To Next Unread Task
168
command.markTaskReadGoToPreviousUnread.name = Mark Task Read and Go To Previous Unread Task
169
command.markTaskReadGoToPreviousUnread.name = Mark Task Read and Go To Previous Unread Task
169
command.markTaskComplete.name = Mark Task Complete
170
command.markTaskComplete.name = Mark Task Complete
Lines 188-193 Link Here
188
menu.task.mark.label = &Mark as
189
menu.task.mark.label = &Mark as
189
command.markTaskRead.label = Read
190
command.markTaskRead.label = Read
190
command.markTaskUnread.label = Unread
191
command.markTaskUnread.label = Unread
192
command.markAllSimilarTasksRead.label = Read (all Similar Incomings)
191
command.task.clearOutgoing.label = Clear Outgoing
193
command.task.clearOutgoing.label = Clear Outgoing
192
command.markTaskComplete.label = Complete
194
command.markTaskComplete.label = Complete
193
command.markTaskIncomplete.label = Incomplete
195
command.markTaskIncomplete.label = Incomplete
(-)plugin.xml (+17 lines)
Lines 1216-1221 Link Here
1216
      </command>
1216
      </command>
1217
      <command
1217
      <command
1218
            categoryId="org.eclipse.mylyn.tasks.ui.commands"
1218
            categoryId="org.eclipse.mylyn.tasks.ui.commands"
1219
            defaultHandler="org.eclipse.mylyn.internal.tasks.ui.commands.MarkTaskHandler$MarkSimilarTasksReadHandler"
1220
            id="org.eclipse.mylyn.tasks.ui.command.markAllSimilarTasksRead"
1221
            name="%command.markSimilarTasksRead.name">
1222
      </command>
1223
      <command
1224
            categoryId="org.eclipse.mylyn.tasks.ui.commands"
1219
            defaultHandler="org.eclipse.mylyn.internal.tasks.ui.commands.MarkTaskHandler$MarkTaskUnreadHandler"
1225
            defaultHandler="org.eclipse.mylyn.internal.tasks.ui.commands.MarkTaskHandler$MarkTaskUnreadHandler"
1220
            id="org.eclipse.mylyn.tasks.ui.command.markTaskUnread"
1226
            id="org.eclipse.mylyn.tasks.ui.command.markTaskUnread"
1221
            name="%command.markTaskUnread.name">
1227
            name="%command.markTaskUnread.name">
Lines 1728-1733 Link Here
1728
               </visibleWhen>
1734
               </visibleWhen>
1729
            </command>
1735
            </command>
1730
            <command
1736
            <command
1737
                  commandId="org.eclipse.mylyn.tasks.ui.command.markAllSimilarTasksRead"
1738
                  label="%command.markAllSimilarTasksRead.label"
1739
                  style="push">
1740
               <visibleWhen
1741
                     checkEnabled="false">
1742
                  <reference
1743
                        definitionId="org.eclipse.mylyn.tasks.ui.expressions.repositoryElements">
1744
                  </reference>
1745
               </visibleWhen>
1746
            </command>
1747
            <command
1731
                  commandId="org.eclipse.mylyn.tasks.ui.command.task.clearOutgoing"
1748
                  commandId="org.eclipse.mylyn.tasks.ui.command.task.clearOutgoing"
1732
                  label="%command.task.clearOutgoing.label"
1749
                  label="%command.task.clearOutgoing.label"
1733
                  mnemonic="C"
1750
                  mnemonic="C"
(-)src/org/eclipse/mylyn/internal/tasks/ui/commands/MarkTaskHandler.java (+59 lines)
Lines 11-18 Link Here
11
11
12
package org.eclipse.mylyn.internal.tasks.ui.commands;
12
package org.eclipse.mylyn.internal.tasks.ui.commands;
13
13
14
import java.util.Collection;
14
import java.util.Collections;
15
import java.util.Collections;
15
import java.util.Date;
16
import java.util.Date;
17
import java.util.Iterator;
16
18
17
import org.eclipse.core.commands.ExecutionEvent;
19
import org.eclipse.core.commands.ExecutionEvent;
18
import org.eclipse.core.commands.ExecutionException;
20
import org.eclipse.core.commands.ExecutionException;
Lines 21-31 Link Here
21
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
23
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
22
import org.eclipse.mylyn.internal.tasks.ui.actions.ClearOutgoingAction;
24
import org.eclipse.mylyn.internal.tasks.ui.actions.ClearOutgoingAction;
23
import org.eclipse.mylyn.internal.tasks.ui.editors.Messages;
25
import org.eclipse.mylyn.internal.tasks.ui.editors.Messages;
26
import org.eclipse.mylyn.internal.tasks.ui.notifications.TaskAttributeDiff;
27
import org.eclipse.mylyn.internal.tasks.ui.notifications.TaskDataDiff;
28
import org.eclipse.mylyn.internal.tasks.ui.notifications.TaskListNotifier;
24
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
29
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
25
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
30
import org.eclipse.mylyn.internal.tasks.ui.views.TaskListView;
26
import org.eclipse.mylyn.monitor.ui.MonitorUi;
31
import org.eclipse.mylyn.monitor.ui.MonitorUi;
27
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
32
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
28
import org.eclipse.mylyn.tasks.core.ITask;
33
import org.eclipse.mylyn.tasks.core.ITask;
34
import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
29
35
30
/**
36
/**
31
 * @author Steffen Pingel
37
 * @author Steffen Pingel
Lines 115-118 Link Here
115
		}
121
		}
116
	}
122
	}
117
123
124
	public static class MarkSimilarTasksReadHandler extends AbstractTaskHandler {
125
		@Override
126
		protected void execute(ExecutionEvent event, ITask currentTask) throws ExecutionException {
127
			//get incomings of the current task (only first level attributes)
128
			TaskListNotifier currentNotifier = new TaskListNotifier(TasksUiPlugin.getRepositoryModel(),
129
					TasksUiPlugin.getTaskDataManager());
130
			TaskDataDiff currentDiff = currentNotifier.getDiff(currentTask);
131
			if (currentDiff != null && TasksUiPlugin.getTaskList() != null) {
132
				//go through all tasks in tasklist of the given repository
133
				for (ITask otherTask : TasksUiPlugin.getTaskList().getTasks(currentTask.getRepositoryUrl())) {
134
					if (otherTask != currentTask
135
							&& otherTask.getSynchronizationState() == SynchronizationState.INCOMING) {
136
						boolean isSameChange = false;
137
						isSameChange = isEqualChangedAttributesSet(currentDiff, otherTask, isSameChange);
138
						if (isSameChange) {
139
							TasksUiPlugin.getTaskDataManager().setTaskRead(otherTask, true);
140
						}
141
					}
142
				}
143
			}
144
			TasksUiPlugin.getTaskDataManager().setTaskRead(currentTask, true);
145
		}
146
147
		private boolean isEqualChangedAttributesSet(TaskDataDiff currentDiff, ITask otherTask, boolean isSameChange) {
148
			//only check other tasks which have incomings for exactly the same set of changed attributes
149
			TaskListNotifier otherNotifier = new TaskListNotifier(TasksUiPlugin.getRepositoryModel(),
150
					TasksUiPlugin.getTaskDataManager());
151
			TaskDataDiff otherDiff = otherNotifier.getDiff(otherTask);
152
			Collection<TaskAttributeDiff> otherChangedAttributes = otherDiff.getChangedAttributes();
153
			if (otherDiff != null
154
					&& currentDiff.getChangedAttributes().size() == otherChangedAttributes.size()) {
155
				//same diff size, compare individual changed attributes
156
				Iterator<TaskAttributeDiff> currentIterator = currentDiff.getChangedAttributes().iterator();
157
				while (currentIterator.hasNext()) {
158
					TaskAttributeDiff currentAttributeDiff = currentIterator.next();
159
					Iterator<TaskAttributeDiff> otherIterator = otherChangedAttributes.iterator();
160
					while (otherIterator.hasNext()) {
161
						TaskAttributeDiff otherAttributeDiff = otherIterator.next();
162
						if (currentAttributeDiff.getNewAttribute()
163
								.getId()
164
								.equals(otherAttributeDiff.getNewAttribute().getId())) {
165
							//found a match, remove from other diff
166
							otherChangedAttributes.remove(otherAttributeDiff);
167
							break;
168
						}
169
					}
170
				}
171
				//if sets are equal, otherChangedAttributes should be empty now
172
				isSameChange = otherChangedAttributes.isEmpty();
173
			}
174
			return isSameChange;
175
		}
176
	}
118
}
177
}

Return to bug 286963