|
Lines 12-18
Link Here
|
| 12 |
package org.eclipse.mylyn.internal.trac.core; |
12 |
package org.eclipse.mylyn.internal.trac.core; |
| 13 |
|
13 |
|
| 14 |
import java.util.ArrayList; |
14 |
import java.util.ArrayList; |
| 15 |
import java.util.Arrays; |
|
|
| 16 |
import java.util.Collection; |
15 |
import java.util.Collection; |
| 17 |
import java.util.Date; |
16 |
import java.util.Date; |
| 18 |
import java.util.HashSet; |
17 |
import java.util.HashSet; |
|
Lines 28-33
Link Here
|
| 28 |
import org.eclipse.mylyn.commons.net.Policy; |
27 |
import org.eclipse.mylyn.commons.net.Policy; |
| 29 |
import org.eclipse.mylyn.internal.trac.core.client.ITracClient; |
28 |
import org.eclipse.mylyn.internal.trac.core.client.ITracClient; |
| 30 |
import org.eclipse.mylyn.internal.trac.core.client.InvalidTicketException; |
29 |
import org.eclipse.mylyn.internal.trac.core.client.InvalidTicketException; |
|
|
30 |
import org.eclipse.mylyn.internal.trac.core.model.TracAction; |
| 31 |
import org.eclipse.mylyn.internal.trac.core.model.TracAttachment; |
31 |
import org.eclipse.mylyn.internal.trac.core.model.TracAttachment; |
| 32 |
import org.eclipse.mylyn.internal.trac.core.model.TracComment; |
32 |
import org.eclipse.mylyn.internal.trac.core.model.TracComment; |
| 33 |
import org.eclipse.mylyn.internal.trac.core.model.TracTicket; |
33 |
import org.eclipse.mylyn.internal.trac.core.model.TracTicket; |
|
Lines 208-248
Link Here
|
| 208 |
} |
208 |
} |
| 209 |
} |
209 |
} |
| 210 |
|
210 |
|
| 211 |
String[] actions = ticket.getActions(); |
211 |
TracAction[] actions = ticket.getActions(); |
| 212 |
if (actions != null) { |
212 |
if (actions != null) { |
| 213 |
// add operations in a defined order |
213 |
for (TracAction action : actions) { |
| 214 |
List<String> actionList = new ArrayList<String>(Arrays.asList(actions)); |
214 |
addOperation(repository, data, ticket, action); |
| 215 |
addOperation(repository, data, ticket, actionList, "leave"); //$NON-NLS-1$ |
215 |
} |
| 216 |
addOperation(repository, data, ticket, actionList, "accept"); //$NON-NLS-1$ |
|
|
| 217 |
addOperation(repository, data, ticket, actionList, "resolve"); //$NON-NLS-1$ |
| 218 |
addOperation(repository, data, ticket, actionList, "reopen"); //$NON-NLS-1$ |
| 219 |
} |
216 |
} |
| 220 |
|
217 |
|
| 221 |
return changedAttributes; |
218 |
return changedAttributes; |
| 222 |
} |
219 |
} |
| 223 |
|
220 |
|
| 224 |
private static void addOperation(TaskRepository repository, TaskData data, TracTicket ticket, List<String> actions, |
221 |
private static void addOperation(TaskRepository repository, TaskData data, TracTicket ticket, TracAction action) { |
| 225 |
String action) { |
222 |
String label = action.getName(); |
| 226 |
if (!actions.remove(action)) { |
223 |
if (label == null) { |
| 227 |
return; |
224 |
if ("leave".equals(action.getId())) { //$NON-NLS-1$ |
| 228 |
} |
225 |
// TODO provide better label for Leave action |
| 229 |
|
226 |
//label = "Leave as " + data.getStatus() + " " + data.getResolution(); |
| 230 |
String label = null; |
227 |
label = "Leave"; |
| 231 |
if ("leave".equals(action)) { //$NON-NLS-1$ |
228 |
} else if ("accept".equals(action.getId())) { //$NON-NLS-1$ |
| 232 |
// TODO provide better label for Leave action |
229 |
label = "Accept"; |
| 233 |
//label = "Leave as " + data.getStatus() + " " + data.getResolution(); |
230 |
} else if ("resolve".equals(action.getId())) { //$NON-NLS-1$ |
| 234 |
label = "Leave"; //$NON-NLS-1$ |
231 |
label = "Resolve as"; |
| 235 |
} else if ("accept".equals(action)) { //$NON-NLS-1$ |
232 |
} else if ("reopen".equals(action.getId())) { //$NON-NLS-1$ |
| 236 |
label = "Accept"; //$NON-NLS-1$ |
233 |
label = "Reopen"; |
| 237 |
} else if ("resolve".equals(action)) { //$NON-NLS-1$ |
234 |
} |
| 238 |
label = "Resolve as"; //$NON-NLS-1$ |
|
|
| 239 |
} else if ("reopen".equals(action)) { //$NON-NLS-1$ |
| 240 |
label = "Reopen"; //$NON-NLS-1$ |
| 241 |
} |
235 |
} |
| 242 |
|
236 |
|
| 243 |
if (label != null) { |
237 |
if (label != null) { |
| 244 |
TaskAttribute attribute = data.getRoot().createAttribute(TaskAttribute.PREFIX_OPERATION + action); |
238 |
TaskAttribute attribute = data.getRoot().createAttribute(TaskAttribute.PREFIX_OPERATION + action); |
| 245 |
TaskOperation.applyTo(attribute, action, label); |
239 |
TaskOperation.applyTo(attribute, action.getId(), label); |
| 246 |
if ("resolve".equals(action)) { //$NON-NLS-1$ |
240 |
if ("resolve".equals(action)) { //$NON-NLS-1$ |
| 247 |
attribute.getMetaData().putValue(TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID, |
241 |
attribute.getMetaData().putValue(TaskAttribute.META_ASSOCIATED_ATTRIBUTE_ID, |
| 248 |
TracAttribute.RESOLUTION.getTracKey()); |
242 |
TracAttribute.RESOLUTION.getTracKey()); |
|
Lines 551-556
Link Here
|
| 551 |
ticket.putValue("status", TracRepositoryConnector.TaskStatus.NEW.toStatusString()); //$NON-NLS-1$ |
545 |
ticket.putValue("status", TracRepositoryConnector.TaskStatus.NEW.toStatusString()); //$NON-NLS-1$ |
| 552 |
} |
546 |
} |
| 553 |
} |
547 |
} |
|
|
548 |
ticket.putValue("action", action); //$NON-NLS-1$ |
| 554 |
} |
549 |
} |
| 555 |
|
550 |
|
| 556 |
return ticket; |
551 |
return ticket; |