Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2006-11-15 19:42:37 -0500
committerrelves2006-11-15 19:42:37 -0500
commit798765ec7c7c65a6f9c41e03c53463158201d9ab (patch)
tree796a8fd49dbdafb18cf4e4bc162612a654731201 /org.eclipse.mylyn.trac.core/src
parent0faf12270ee185b17dc53822224d16cd3be794eb (diff)
downloadorg.eclipse.mylyn.tasks-798765ec7c7c65a6f9c41e03c53463158201d9ab.tar.gz
org.eclipse.mylyn.tasks-798765ec7c7c65a6f9c41e03c53463158201d9ab.tar.xz
org.eclipse.mylyn.tasks-798765ec7c7c65a6f9c41e03c53463158201d9ab.zip
ASSIGNED - bug 164536: trac editor should have a People section
https://bugs.eclipse.org/bugs/show_bug.cgi?id=164536
Diffstat (limited to 'org.eclipse.mylyn.trac.core/src')
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttributeFactory.java6
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracOfflineTaskHandler.java13
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java36
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTask.java4
4 files changed, 49 insertions, 10 deletions
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttributeFactory.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttributeFactory.java
index 386e6febd..56534565c 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttributeFactory.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracAttributeFactory.java
@@ -32,16 +32,16 @@ public class TracAttributeFactory extends AbstractAttributeFactory {
private static Map<String, String> tracKeyByTaskKey = new HashMap<String, String>();
public enum Attribute {
- CC(Key.CC, "CC:", RepositoryTaskAttribute.USER_CC),
+ CC(Key.CC, "CC:", RepositoryTaskAttribute.USER_CC, true, false),
CHANGE_TIME(Key.CHANGE_TIME, "Last Modification:", RepositoryTaskAttribute.DATE_MODIFIED, true, true),
COMPONENT(Key.COMPONENT, "Component:", null),
DESCRIPTION(Key.DESCRIPTION, "Description:", RepositoryTaskAttribute.DESCRIPTION, true, false),
ID(Key.ID, "<used by search engine>", null, true),
KEYWORDS(Key.KEYWORDS, "Keywords:", RepositoryTaskAttribute.KEYWORDS),
MILESTONE(Key.MILESTONE, "Milestone:", null),
- OWNER(Key.OWNER, "Owner:", RepositoryTaskAttribute.USER_OWNER, false, true),
+ OWNER(Key.OWNER, "Assigned to:", RepositoryTaskAttribute.USER_ASSIGNED, true, true),
PRIORITY(Key.PRIORITY, "Priority:", null),
- REPORTER(Key.REPORTER, "Reporter:", RepositoryTaskAttribute.USER_REPORTER, false, true),
+ REPORTER(Key.REPORTER, "Reporter:", RepositoryTaskAttribute.USER_REPORTER, true, true),
RESOLUTION(Key.RESOLUTION, "Resolution:", RepositoryTaskAttribute.RESOLUTION, false, true),
SEVERITY(Key.SEVERITY, "Severity:", null),
STATUS(Key.STATUS, "Status:", RepositoryTaskAttribute.STATUS, false, true),
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracOfflineTaskHandler.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracOfflineTaskHandler.java
index d4241da24..9b2c204df 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracOfflineTaskHandler.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracOfflineTaskHandler.java
@@ -21,6 +21,7 @@ import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.StringTokenizer;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
@@ -30,6 +31,7 @@ import org.eclipse.mylar.internal.trac.core.TracAttributeFactory.Attribute;
import org.eclipse.mylar.internal.trac.core.model.TracAttachment;
import org.eclipse.mylar.internal.trac.core.model.TracComment;
import org.eclipse.mylar.internal.trac.core.model.TracTicket;
+import org.eclipse.mylar.internal.trac.core.model.TracTicket.Key;
import org.eclipse.mylar.internal.trac.core.util.TracUtils;
import org.eclipse.mylar.tasks.core.AbstractAttributeFactory;
import org.eclipse.mylar.tasks.core.AbstractRepositoryTask;
@@ -46,6 +48,8 @@ import org.eclipse.mylar.tasks.core.TaskRepository;
*/
public class TracOfflineTaskHandler implements IOfflineTaskHandler {
+ private static final String CC_DELIMETER = ", ";
+
private AbstractAttributeFactory attributeFactory = new TracAttributeFactory();
private TracRepositoryConnector connector;
@@ -111,7 +115,14 @@ public class TracOfflineTaskHandler implements IOfflineTaskHandler {
}
Map<String, String> valueByKey = ticket.getValues();
for (String key : valueByKey.keySet()) {
- data.setAttributeValue(key, valueByKey.get(key));
+ if (Key.CC.getKey().equals(key)) {
+ StringTokenizer t = new StringTokenizer(valueByKey.get(key), CC_DELIMETER);
+ while (t.hasMoreTokens()) {
+ data.addAttributeValue(key, t.nextToken());
+ }
+ } else {
+ data.setAttributeValue(key, valueByKey.get(key));
+ }
}
TracComment[] comments = ticket.getComments();
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java
index 7f7a9660b..85bba8408 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java
@@ -289,16 +289,40 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
List<RepositoryTaskAttribute> attributes = data.getAttributes();
for (RepositoryTaskAttribute attribute : attributes) {
- if (!attribute.isReadOnly()) {
+ if (isInternalAttribute(attribute.getID())) {
+ // ignore
+ } else if (!attribute.isReadOnly()) {
ticket.putValue(attribute.getID(), attribute.getValue());
}
}
+
+ // set cc value
+ StringBuilder sb = new StringBuilder();
+ List<String> removeValues = data.getAttributeValues(RepositoryTaskAttribute.REMOVE_CC);
+ List<String> values = data.getAttributeValues(RepositoryTaskAttribute.USER_CC);
+ for (String user : values) {
+ if (!removeValues.contains(user)) {
+ if (sb.length() > 0) {
+ sb.append(",");
+ }
+ sb.append(user);
+ }
+ }
+ if (data.getAttributeValue(RepositoryTaskAttribute.NEW_CC).length() > 0) {
+ if (sb.length() > 0) {
+ sb.append(",");
+ }
+ sb.append(data.getAttributeValue(RepositoryTaskAttribute.NEW_CC));
+ }
// TODO "1" should not be hard coded here
if ("1".equals(data.getAttributeValue(RepositoryTaskAttribute.ADD_SELF_CC))) {
- String cc = data.getAttributeValue(RepositoryTaskAttribute.USER_CC);
- ticket.putBuiltinValue(Key.CC, cc + "," + repository.getUserName());
+ if (sb.length() > 0) {
+ sb.append(",");
+ }
+ sb.append(repository.getUserName());
}
-
+ ticket.putBuiltinValue(Key.CC, sb.toString());
+
RepositoryOperation operation = data.getSelectedOperation();
if (operation != null) {
String action = operation.getKnobName();
@@ -321,5 +345,9 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
return ticket;
}
+
+ private static boolean isInternalAttribute(String id) {
+ return RepositoryTaskAttribute.REMOVE_CC.equals(id) || RepositoryTaskAttribute.NEW_CC.equals(id);
+ }
} \ No newline at end of file
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTask.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTask.java
index fabd76cd2..fa0d36295 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTask.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTask.java
@@ -157,8 +157,8 @@ public class TracTask extends AbstractRepositoryTask {
@Override
public String getOwner() {
- if (taskData != null && taskData.getAttribute(RepositoryTaskAttribute.USER_OWNER) != null) {
- return taskData.getAttributeValue(RepositoryTaskAttribute.USER_OWNER);
+ if (taskData != null && taskData.getAttribute(RepositoryTaskAttribute.USER_ASSIGNED) != null) {
+ return taskData.getAttributeValue(RepositoryTaskAttribute.USER_ASSIGNED);
} else {
return super.getOwner();
}

Back to the top