Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve collection capability names; add task comments capability
- Loading branch information
1 parent
0c427b8
commit 566d716
Showing
15 changed files
with
76 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
edu.washington.cs.cupid.mylyn/src/edu/washington/cs/cupid/mylyn/TaskCommentsCapability.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,58 @@ | |||
package edu.washington.cs.cupid.mylyn; | |||
|
|||
import java.util.List; | |||
|
|||
import org.eclipse.core.runtime.IProgressMonitor; | |||
import org.eclipse.mylyn.internal.tasks.core.TaskComment; | |||
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin; | |||
import org.eclipse.mylyn.tasks.core.ITask; | |||
import org.eclipse.mylyn.tasks.core.ITaskComment; | |||
import org.eclipse.mylyn.tasks.core.TaskRepository; | |||
import org.eclipse.mylyn.tasks.core.data.TaskAttribute; | |||
import org.eclipse.mylyn.tasks.core.data.TaskData; | |||
|
|||
import com.google.common.collect.Lists; | |||
import com.google.common.reflect.TypeToken; | |||
|
|||
import edu.washington.cs.cupid.capability.ICapability; | |||
import edu.washington.cs.cupid.capability.linear.LinearCapability; | |||
import edu.washington.cs.cupid.capability.linear.LinearJob; | |||
import edu.washington.cs.cupid.capability.linear.LinearStatus; | |||
|
|||
public final class TaskCommentsCapability extends LinearCapability<ITask, List<ITaskComment>> { | |||
|
|||
public TaskCommentsCapability(){ | |||
super("Task Comments", "Get the comments for a Mylyn task", | |||
TypeToken.of(ITask.class), new TypeToken<List<ITaskComment>>(){}, | |||
ICapability.Flag.PURE); | |||
} | |||
|
|||
@Override | |||
public LinearJob<ITask, List<ITaskComment>> getJob(ITask input) { | |||
return new LinearJob<ITask, List<ITaskComment>>(this, input) { | |||
@Override | |||
protected LinearStatus<List<ITaskComment>> run(final IProgressMonitor monitor) { | |||
try { | |||
ITask task = getInput(); | |||
|
|||
TaskData data = TasksUiPlugin.getTaskDataManager().getTaskData(getInput()); | |||
List<TaskAttribute> commentAttributes = data.getAttributeMapper().getAttributesByType(data, TaskAttribute.TYPE_COMMENT); | |||
TaskRepository repository =TasksUiPlugin.getRepositoryManager().getRepository(data.getRepositoryUrl()); | |||
|
|||
List<ITaskComment> result = Lists.newArrayList(); | |||
|
|||
for (TaskAttribute a : commentAttributes){ | |||
result.add(new TaskComment(repository, task, a)); | |||
} | |||
|
|||
return new LinearStatus<List<ITaskComment>>(TaskCommentsCapability.this, result); | |||
|
|||
} catch (Exception e) { | |||
return new LinearStatus<List<ITaskComment>>(e); | |||
} finally { | |||
monitor.done(); | |||
} | |||
} | |||
}; | |||
} | |||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters