Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2010-07-06 13:35:59 -0400
committerspingel2010-07-06 13:35:59 -0400
commit25174399722b94157d80c66ee789297cd0c5c06a (patch)
treea35052f22eeeb6ce859a2d5a312c6de80e543eb1
parent2a96da91a0ba982f27a8a05cb7c00581d94aed95 (diff)
downloadorg.eclipse.mylyn.tasks-25174399722b94157d80c66ee789297cd0c5c06a.tar.gz
org.eclipse.mylyn.tasks-25174399722b94157d80c66ee789297cd0c5c06a.tar.xz
org.eclipse.mylyn.tasks-25174399722b94157d80c66ee789297cd0c5c06a.zip
NEW - bug 318954: support stories and improve sub task creation
https://bugs.eclipse.org/bugs/show_bug.cgi?id=318954
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryConnector.java10
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java31
-rw-r--r--org.eclipse.mylyn.trac.ui/icons/eview16/overlay-story.gifbin0 -> 103 bytes
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracConnectorUi.java6
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracImages.java2
5 files changed, 39 insertions, 10 deletions
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 179793777..743f835ad 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
@@ -59,7 +59,7 @@ import org.eclipse.mylyn.tasks.core.sync.ISynchronizationSession;
public class TracRepositoryConnector extends AbstractRepositoryConnector {
public enum TaskKind {
- DEFECT, ENHANCEMENT, TASK;
+ DEFECT, ENHANCEMENT, TASK, STORY;
public static TaskKind fromString(String type) {
if (type == null) {
@@ -74,6 +74,9 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
if (type.equals("Task")) { //$NON-NLS-1$
return TASK;
}
+ if (type.equals("Story")) { //$NON-NLS-1$
+ return STORY;
+ }
return null;
}
@@ -90,6 +93,9 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
if (type.equals("task")) { //$NON-NLS-1$
return TASK;
}
+ if (type.equals("story")) { //$NON-NLS-1$
+ return STORY;
+ }
return null;
}
@@ -102,6 +108,8 @@ public class TracRepositoryConnector extends AbstractRepositoryConnector {
return "Enhancement"; //$NON-NLS-1$
case TASK:
return "Task"; //$NON-NLS-1$
+ case STORY:
+ return "Story"; //$NON-NLS-1$
default:
return ""; //$NON-NLS-1$
}
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java
index 0412194e1..eee7fa9fd 100644
--- a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskDataHandler.java
@@ -17,9 +17,9 @@ import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
import java.util.Set;
import java.util.StringTokenizer;
-import java.util.Map.Entry;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -32,15 +32,15 @@ import org.eclipse.mylyn.internal.trac.core.model.TracAction;
import org.eclipse.mylyn.internal.trac.core.model.TracAttachment;
import org.eclipse.mylyn.internal.trac.core.model.TracComment;
import org.eclipse.mylyn.internal.trac.core.model.TracTicket;
-import org.eclipse.mylyn.internal.trac.core.model.TracTicketField;
import org.eclipse.mylyn.internal.trac.core.model.TracTicket.Key;
+import org.eclipse.mylyn.internal.trac.core.model.TracTicketField;
import org.eclipse.mylyn.internal.trac.core.util.TracUtil;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
import org.eclipse.mylyn.tasks.core.RepositoryResponse;
+import org.eclipse.mylyn.tasks.core.RepositoryResponse.ResponseKind;
import org.eclipse.mylyn.tasks.core.RepositoryStatus;
import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.RepositoryResponse.ResponseKind;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
import org.eclipse.mylyn.tasks.core.data.TaskAttachmentMapper;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
@@ -57,6 +57,10 @@ import org.eclipse.osgi.util.NLS;
*/
public class TracTaskDataHandler extends AbstractTaskDataHandler {
+ private static final String TASK_TYPE_TASK = "task"; //$NON-NLS-1$
+
+ public static final String TASK_TYPE_STORY = "story"; //$NON-NLS-1$
+
private static final String TASK_DATA_VERSION = "2"; //$NON-NLS-1$
public static final String ATTRIBUTE_BLOCKED_BY = "blockedby"; //$NON-NLS-1$
@@ -318,11 +322,17 @@ public class TracTaskDataHandler extends AbstractTaskDataHandler {
}
createAttribute(data, client, TracAttribute.CC);
if (existingTask) {
- data.getRoot().createAttribute(TracAttributeMapper.NEW_CC).getMetaData().setType(
- TaskAttribute.TYPE_SHORT_TEXT).setReadOnly(false);
+ data.getRoot()
+ .createAttribute(TracAttributeMapper.NEW_CC)
+ .getMetaData()
+ .setType(TaskAttribute.TYPE_SHORT_TEXT)
+ .setReadOnly(false);
data.getRoot().createAttribute(TracAttributeMapper.REMOVE_CC);
- data.getRoot().createAttribute(TaskAttribute.COMMENT_NEW).getMetaData().setType(
- TaskAttribute.TYPE_LONG_RICH_TEXT).setReadOnly(false);
+ data.getRoot()
+ .createAttribute(TaskAttribute.COMMENT_NEW)
+ .getMetaData()
+ .setType(TaskAttribute.TYPE_LONG_RICH_TEXT)
+ .setReadOnly(false);
}
// operations
data.getRoot().createAttribute(TaskAttribute.OPERATION).getMetaData().setType(TaskAttribute.TYPE_OPERATION);
@@ -488,6 +498,13 @@ public class TracTaskDataHandler extends AbstractTaskDataHandler {
if (blockedByAttribute != null) {
blockedByAttribute.clearValues();
}
+ // special handling for stories which should have tasks as subtasks
+ TaskAttribute typeAttribute = taskData.getRoot().getAttribute(TracAttribute.TYPE.getTracKey());
+ if (typeAttribute != null && TASK_TYPE_STORY.equals(typeAttribute.getValue())) {
+ if (typeAttribute.getOptions().containsKey(TASK_TYPE_TASK)) {
+ typeAttribute.setValue(TASK_TYPE_TASK);
+ }
+ }
return true;
}
diff --git a/org.eclipse.mylyn.trac.ui/icons/eview16/overlay-story.gif b/org.eclipse.mylyn.trac.ui/icons/eview16/overlay-story.gif
new file mode 100644
index 000000000..4d4c27f1c
--- /dev/null
+++ b/org.eclipse.mylyn.trac.ui/icons/eview16/overlay-story.gif
Binary files differ
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracConnectorUi.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracConnectorUi.java
index 2638f9b57..0bd1b9063 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracConnectorUi.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracConnectorUi.java
@@ -106,6 +106,8 @@ public class TracConnectorUi extends AbstractRepositoryConnectorUi {
return TracImages.OVERLAY_DEFECT;
} else if (taskKind == TaskKind.ENHANCEMENT) {
return TracImages.OVERLAY_ENHANCEMENT;
+ } else if (taskKind == TaskKind.STORY) {
+ return TracImages.OVERLAY_STORY;
} else if (taskKind == TaskKind.TASK) {
return null;
}
@@ -126,8 +128,8 @@ public class TracConnectorUi extends AbstractRepositoryConnectorUi {
if (taskComment == null) {
return NLS.bind(Messages.TracConnectorUi_Replying_to__ticket_X_X_, task.getTaskKey(), task.getOwner());
} else if (includeTask) {
- return NLS.bind(Messages.TracConnectorUi_Replying_to__comment_ticket_X_X_X_, new Object[] {
- task.getTaskKey(), taskComment.getNumber(), taskComment.getAuthor().getPersonId() });
+ return NLS.bind(Messages.TracConnectorUi_Replying_to__comment_ticket_X_X_X_,
+ new Object[] { task.getTaskKey(), taskComment.getNumber(), taskComment.getAuthor().getPersonId() });
} else {
return NLS.bind(Messages.TracConnectorUi_Replying_to__comment_X_X_, taskComment.getNumber(),
taskComment.getAuthor().getPersonId());
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracImages.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracImages.java
index f02c57314..7ba70ee0b 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracImages.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracImages.java
@@ -31,6 +31,8 @@ public class TracImages {
public static final ImageDescriptor OVERLAY_ENHANCEMENT = create(T_VIEW, "overlay-enhancement.gif"); //$NON-NLS-1$
+ public static final ImageDescriptor OVERLAY_STORY = create(T_VIEW, "overlay-story.gif"); //$NON-NLS-1$
+
private static ImageDescriptor create(String prefix, String name) {
try {
return ImageDescriptor.createFromURL(makeIconFileURL(prefix, name));

Back to the top