Skip to content

Commit

Permalink
Improve collection capability names; add task comments capability
Browse files Browse the repository at this point in the history
  • Loading branch information
twschiller committed Nov 7, 2013
1 parent 0c427b8 commit 566d716
Show file tree
Hide file tree
Showing 15 changed files with 76 additions and 16 deletions.
2 changes: 1 addition & 1 deletion edu.washington.cs.cupid.core.feature/feature.xml
Expand Up @@ -2,7 +2,7 @@
<feature <feature
id="edu.washington.cs.cupid.core" id="edu.washington.cs.cupid.core"
label="Cupid for Eclipse" label="Cupid for Eclipse"
version="1.3.3.v20131030-1350" version="1.3.3.v20131106-1900"
provider-name="University of Washington PLSE" provider-name="University of Washington PLSE"
plugin="edu.washington.cs.cupid" plugin="edu.washington.cs.cupid"
license-feature="edu.washington.cs.cupid.license" license-feature="edu.washington.cs.cupid.license"
Expand Down
2 changes: 1 addition & 1 deletion edu.washington.cs.cupid.mylyn.feature/feature.xml
Expand Up @@ -2,7 +2,7 @@
<feature <feature
id="edu.washington.cs.cupid.mylyn" id="edu.washington.cs.cupid.mylyn"
label="Cupid Mylyn Capabilities" label="Cupid Mylyn Capabilities"
version="1.3.2.v20131030-1130" version="1.3.2.v20131106-1900"
provider-name="University of Washington PLSE" provider-name="University of Washington PLSE"
plugin="edu.washington.cs.cupid" plugin="edu.washington.cs.cupid"
license-feature="edu.washington.cs.cupid.license" license-feature="edu.washington.cs.cupid.license"
Expand Down
2 changes: 1 addition & 1 deletion edu.washington.cs.cupid.mylyn/META-INF/MANIFEST.MF
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: Cupid Mylyn Capabilities Bundle-Name: Cupid Mylyn Capabilities
Bundle-SymbolicName: edu.washington.cs.cupid.mylyn;singleton:=true Bundle-SymbolicName: edu.washington.cs.cupid.mylyn;singleton:=true
Bundle-Version: 1.3.2.v20131030-1130 Bundle-Version: 1.3.2.v20131106-1900
Bundle-Activator: edu.washington.cs.cupid.mylyn.internal.Activator Bundle-Activator: edu.washington.cs.cupid.mylyn.internal.Activator
Bundle-Vendor: University of Washington PLSE Bundle-Vendor: University of Washington PLSE
Require-Bundle: org.eclipse.core.runtime, Require-Bundle: org.eclipse.core.runtime,
Expand Down
@@ -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();
}
}
};
}
}
Expand Up @@ -19,6 +19,7 @@
import edu.washington.cs.cupid.mylyn.ActiveContextCapability; import edu.washington.cs.cupid.mylyn.ActiveContextCapability;
import edu.washington.cs.cupid.mylyn.InActiveContextCapability; import edu.washington.cs.cupid.mylyn.InActiveContextCapability;
import edu.washington.cs.cupid.mylyn.MylynTaskCapability; import edu.washington.cs.cupid.mylyn.MylynTaskCapability;
import edu.washington.cs.cupid.mylyn.TaskCommentsCapability;
import edu.washington.cs.cupid.mylyn.TaskContextCapability; import edu.washington.cs.cupid.mylyn.TaskContextCapability;
import edu.washington.cs.cupid.mylyn.TaskFilter; import edu.washington.cs.cupid.mylyn.TaskFilter;
import edu.washington.cs.cupid.mylyn.TasksForResource; import edu.washington.cs.cupid.mylyn.TasksForResource;
Expand Down Expand Up @@ -73,6 +74,7 @@ public void removeChangeListener(ICapabilityChangeListener listener) {
@Override @Override
public ICapability[] publish() { public ICapability[] publish() {
return new ICapability[]{ return new ICapability[]{
new TaskCommentsCapability(),
new MylynTaskCapability(), new MylynTaskCapability(),
new TaskContextCapability(), new TaskContextCapability(),
new ActiveContextCapability(), new ActiveContextCapability(),
Expand Down
2 changes: 1 addition & 1 deletion edu.washington.cs.cupid/META-INF/MANIFEST.MF
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: Cupid Bundle-Name: Cupid
Bundle-SymbolicName: edu.washington.cs.cupid;singleton:=true Bundle-SymbolicName: edu.washington.cs.cupid;singleton:=true
Bundle-Version: 1.3.4.v20131030-1350 Bundle-Version: 1.3.4.v20131106-1900
Bundle-Activator: edu.washington.cs.cupid.internal.CupidActivator Bundle-Activator: edu.washington.cs.cupid.internal.CupidActivator
Require-Bundle: org.eclipse.ui, Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime, org.eclipse.core.runtime,
Expand Down
Expand Up @@ -16,7 +16,7 @@ public class Any extends LinearCapability<Collection<Boolean>, Boolean> {
* A capability that indicates whether any of the elements in the collection are true * A capability that indicates whether any of the elements in the collection are true
*/ */
public Any() { public Any() {
super("Any", super("Any (One or More)",
"True if any of the elements are true", "True if any of the elements are true",
new TypeToken<Collection<Boolean>>(){}, new TypeToken<Collection<Boolean>>(){},
TypeToken.of(Boolean.class), TypeToken.of(Boolean.class),
Expand Down
Expand Up @@ -30,7 +30,7 @@ public final class Count<V> extends GenericLinearCapability<Collection<V>, Integ
*/ */
public Count() { public Count() {
super( super(
"Count", "Count (Number of Elements)",
"Count the number of elements in a collection", "Count the number of elements in a collection",
Flag.PURE); Flag.PURE);
} }
Expand Down
Expand Up @@ -32,7 +32,7 @@ public final class Distinct<V> extends GenericLinearCapability<Collection<V>, Se
*/ */
public Distinct() { public Distinct() {
super( super(
"Distinct", "Distinct (Remove Duplicates)",
"Returns the distinct elements in a collection", "Returns the distinct elements in a collection",
Flag.PURE); Flag.PURE);
} }
Expand Down
Expand Up @@ -29,7 +29,7 @@ public final class Empty<V> extends GenericLinearCapability<Collection<V>, Boole
* A capability that indicates whether or not a collection is empty. * A capability that indicates whether or not a collection is empty.
*/ */
public Empty() { public Empty() {
super("Empty", super("Is Empty",
"True if the input is empty", "True if the input is empty",
Flag.PURE); Flag.PURE);
} }
Expand Down
Expand Up @@ -31,7 +31,7 @@ public final class Last<V> extends GenericLinearCapability<List<V>, V> {
*/ */
public Last() { public Last() {
super( super(
"Last", "Last Element",
"Gets the last item in a list", "Gets the last item in a list",
Flag.PURE); Flag.PURE);
} }
Expand Down
Expand Up @@ -33,7 +33,7 @@ public final class Max<V extends Comparable<V>> extends GenericLinearCapability<
*/ */
public Max() { public Max() {
super( super(
"Max", "Maximum Element",
"Get the maximum element in a collection", "Get the maximum element in a collection",
Flag.PURE); Flag.PURE);
} }
Expand Down
Expand Up @@ -37,7 +37,7 @@ public final class MostFrequent<V> extends GenericLinearCapability<List<V>, V> {
*/ */
public MostFrequent() { public MostFrequent() {
super( super(
"Most Frequent", "Most Frequent Element",
"Get the most frequent element in a collection", "Get the most frequent element in a collection",
Flag.PURE); Flag.PURE);
} }
Expand Down
Expand Up @@ -30,7 +30,7 @@ public final class NonEmpty<V> extends GenericLinearCapability<Collection<V>, Bo
*/ */
public NonEmpty() { public NonEmpty() {
super( super(
"NonEmpty", "Is Non-Empty (Has Elements)",
"True if the input is non empty", "True if the input is non empty",
Flag.PURE); Flag.PURE);
} }
Expand Down
8 changes: 4 additions & 4 deletions snapshots/nightly/site.xml
Expand Up @@ -24,12 +24,12 @@
<feature url="features/edu.washington.cs.cupid.egit_1.3.2.v20131030-1130.jar" id="edu.washington.cs.cupid.egit" version="1.3.2.v20131030-1130"> <feature url="features/edu.washington.cs.cupid.egit_1.3.2.v20131030-1130.jar" id="edu.washington.cs.cupid.egit" version="1.3.2.v20131030-1130">
<category name="edu.washington.cs.cupid.discover"/> <category name="edu.washington.cs.cupid.discover"/>
</feature> </feature>
<feature url="features/edu.washington.cs.cupid.mylyn_1.3.2.v20131030-1130.jar" id="edu.washington.cs.cupid.mylyn" version="1.3.2.v20131030-1130"> <feature url="features/edu.washington.cs.cupid.core_1.3.3.v20131106-1900.jar" id="edu.washington.cs.cupid.core" version="1.3.3.v20131106-1900">
<category name="edu.washington.cs.cupid.discover"/>
</feature>
<feature url="features/edu.washington.cs.cupid.core_1.3.3.v20131030-1350.jar" id="edu.washington.cs.cupid.core" version="1.3.3.v20131030-1350">
<category name="edu.washington.cs.cupid"/> <category name="edu.washington.cs.cupid"/>
</feature> </feature>
<feature url="features/edu.washington.cs.cupid.mylyn_1.3.2.v20131106-1900.jar" id="edu.washington.cs.cupid.mylyn" version="1.3.2.v20131106-1900">
<category name="edu.washington.cs.cupid.discover"/>
</feature>
<category-def name="edu.washington.cs.cupid" label="Cupid"/> <category-def name="edu.washington.cs.cupid" label="Cupid"/>
<category-def name="edu.washington.cs.cupid.discover" label="Integration (Information Discovery)"/> <category-def name="edu.washington.cs.cupid.discover" label="Integration (Information Discovery)"/>
<category-def name="edu.washington.cs.cupid.visualize" label="Visualization"/> <category-def name="edu.washington.cs.cupid.visualize" label="Visualization"/>
Expand Down

0 comments on commit 566d716

Please sign in to comment.