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 (+4 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
168
command.markPlanningIncomingsRead.name = Mark Planning Incomings as Read  
167
command.markTaskReadGoToNextUnread.name = Mark Task Read and Go To Next Unread Task
169
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
170
command.markTaskReadGoToPreviousUnread.name = Mark Task Read and Go To Previous Unread Task
169
command.markTaskComplete.name = Mark Task Complete
171
command.markTaskComplete.name = Mark Task Complete
Lines 188-193 Link Here
188
menu.task.mark.label = &Mark as
190
menu.task.mark.label = &Mark as
189
command.markTaskRead.label = Read
191
command.markTaskRead.label = Read
190
command.markTaskUnread.label = Unread
192
command.markTaskUnread.label = Unread
193
command.markAllSimilarTasksRead.label = Read (all Similar Incomings)
194
command.markPlanningIncomingsRead.label = Read (all Planning Incomings)
191
command.task.clearOutgoing.label = Clear Outgoing
195
command.task.clearOutgoing.label = Clear Outgoing
192
command.markTaskComplete.label = Complete
196
command.markTaskComplete.label = Complete
193
command.markTaskIncomplete.label = Incomplete
197
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 (+62 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
		public static final String ID_COMMAND = "org.eclipse.mylyn.tasks.ui.command.markAllSimilarTasksRead"; //$NON-NLS-1$
126
127
		@Override
128
		protected void execute(ExecutionEvent event, ITask currentTask) throws ExecutionException {
129
			//get incomings of the current task (only first level attributes)
130
			TaskListNotifier currentNotifier = new TaskListNotifier(TasksUiPlugin.getRepositoryModel(),
131
					TasksUiPlugin.getTaskDataManager());
132
			TaskDataDiff currentDiff = currentNotifier.getDiff(currentTask);
133
			if (currentDiff != null && TasksUiPlugin.getTaskList() != null) {
134
				//go through all tasks in tasklist of the given repository
135
				for (ITask otherTask : TasksUiPlugin.getTaskList().getTasks(currentTask.getRepositoryUrl())) {
136
					if (otherTask != currentTask
137
							&& otherTask.getSynchronizationState() == SynchronizationState.INCOMING) {
138
						boolean isSameChange = false;
139
						isSameChange = isEqualChangedAttributesSet(currentDiff, otherTask, isSameChange);
140
						if (isSameChange) {
141
							TasksUiPlugin.getTaskDataManager().setTaskRead(otherTask, true);
142
						}
143
					}
144
				}
145
			}
146
			TasksUiPlugin.getTaskDataManager().setTaskRead(currentTask, true);
147
		}
148
149
		private boolean isEqualChangedAttributesSet(TaskDataDiff currentDiff, ITask otherTask, boolean isSameChange) {
150
			//only check other tasks which have incomings for exactly the same set of changed attributes
151
			TaskListNotifier otherNotifier = new TaskListNotifier(TasksUiPlugin.getRepositoryModel(),
152
					TasksUiPlugin.getTaskDataManager());
153
			TaskDataDiff otherDiff = otherNotifier.getDiff(otherTask);
154
			Collection<TaskAttributeDiff> otherChangedAttributes = otherDiff.getChangedAttributes();
155
			if (otherDiff != null && currentDiff.getChangedAttributes().size() == otherChangedAttributes.size()) {
156
				//same diff size, compare individual changed attributes
157
				Iterator<TaskAttributeDiff> currentIterator = currentDiff.getChangedAttributes().iterator();
158
				while (currentIterator.hasNext()) {
159
					TaskAttributeDiff currentAttributeDiff = currentIterator.next();
160
					Iterator<TaskAttributeDiff> otherIterator = otherChangedAttributes.iterator();
161
					while (otherIterator.hasNext()) {
162
						TaskAttributeDiff otherAttributeDiff = otherIterator.next();
163
						if (currentAttributeDiff.getNewAttribute()
164
								.getId()
165
								.equals(otherAttributeDiff.getNewAttribute().getId())) {
166
							//found a match, remove from other diff
167
							otherChangedAttributes.remove(otherAttributeDiff);
168
							break;
169
						}
170
					}
171
				}
172
				//if sets are equal, otherChangedAttributes should be empty now
173
				isSameChange = otherChangedAttributes.isEmpty();
174
				//now check comments
175
				isSameChange = currentDiff.getNewComments().size() == otherDiff.getNewComments().size();
176
			}
177
			return isSameChange;
178
		}
179
	}
118
}
180
}

Return to bug 286963