Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.mylyn.tasks.activity.core')
-rw-r--r--org.eclipse.mylyn.tasks.activity.core/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityManager.java26
-rw-r--r--org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityStream.java9
-rw-r--r--org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/TaskActivityProvider.java69
-rw-r--r--org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/TaskActivityScope.java33
-rw-r--r--org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/spi/ActivityProvider.java29
-rw-r--r--org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/spi/IActivitySession.java26
7 files changed, 191 insertions, 4 deletions
diff --git a/org.eclipse.mylyn.tasks.activity.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.activity.core/META-INF/MANIFEST.MF
index 0fe8f2f6d..229008ceb 100644
--- a/org.eclipse.mylyn.tasks.activity.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.tasks.activity.core/META-INF/MANIFEST.MF
@@ -9,4 +9,5 @@ Require-Bundle: org.eclipse.core.runtime,
org.eclipse.mylyn.tasks.core;bundle-version="3.8.0"
Bundle-Localization: plugin
Export-Package: org.eclipse.mylyn.internal.tasks.activity.core;x-internal:=true,
- org.eclipse.mylyn.tasks.activity.core;x-internal:=true
+ org.eclipse.mylyn.tasks.activity.core;x-internal:=true,
+ org.eclipse.mylyn.tasks.activity.core.spi
diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityManager.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityManager.java
index fc3664a1e..ecb278670 100644
--- a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityManager.java
+++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityManager.java
@@ -11,17 +11,41 @@
package org.eclipse.mylyn.internal.tasks.activity.core;
+import java.util.Collection;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.eclipse.mylyn.tasks.activity.core.ActivityEvent;
import org.eclipse.mylyn.tasks.activity.core.ActivityScope;
import org.eclipse.mylyn.tasks.activity.core.IActivityManager;
import org.eclipse.mylyn.tasks.activity.core.IActivityStream;
+import org.eclipse.mylyn.tasks.activity.core.spi.IActivitySession;
/**
* @author Steffen Pingel
*/
-public class ActivityManager implements IActivityManager {
+public class ActivityManager implements IActivityManager, IActivitySession {
+
+ private final Map<String, ActivityEvent> events;
+
+ public ActivityManager() {
+ this.events = new ConcurrentHashMap<String, ActivityEvent>();
+ }
+
+ public Collection<ActivityEvent> getEvents(ActivityScope scope) {
+ return events.values();
+ }
public IActivityStream getStream(ActivityScope scope) {
return new ActivityStream(this, scope);
}
+ public IActivityManager getManger() {
+ return this;
+ }
+
+ public void fireActivityEvent(ActivityEvent event) {
+ events.put(event.getHandle(), event);
+ }
+
}
diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityStream.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityStream.java
index 6535573cf..cf5a4210a 100644
--- a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityStream.java
+++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/ActivityStream.java
@@ -29,14 +29,19 @@ public class ActivityStream implements IActivityStream {
private final ActivityScope scope;
- private final IActivityManager manager;
+ private final ActivityManager manager;
- public ActivityStream(IActivityManager manager, ActivityScope scope) {
+ public ActivityStream(ActivityManager manager, ActivityScope scope) {
Assert.isNotNull(manager);
Assert.isNotNull(scope);
this.manager = manager;
this.scope = scope;
this.events = new CopyOnWriteArrayList<ActivityEvent>();
+ initialize();
+ }
+
+ private void initialize() {
+ events.addAll(manager.getEvents(scope));
}
public void addEvent(ActivityEvent event) {
diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/TaskActivityProvider.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/TaskActivityProvider.java
new file mode 100644
index 000000000..faf89fb9f
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/internal/tasks/activity/core/TaskActivityProvider.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.tasks.activity.core;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.mylyn.internal.tasks.core.TaskList;
+import org.eclipse.mylyn.tasks.activity.core.ActivityEvent;
+import org.eclipse.mylyn.tasks.activity.core.ActivityScope;
+import org.eclipse.mylyn.tasks.activity.core.TaskActivityScope;
+import org.eclipse.mylyn.tasks.activity.core.spi.ActivityProvider;
+import org.eclipse.mylyn.tasks.activity.core.spi.IActivitySession;
+import org.eclipse.mylyn.tasks.core.IRepositoryManager;
+import org.eclipse.mylyn.tasks.core.ITask;
+
+/**
+ * @author Steffen Pingel
+ */
+public class TaskActivityProvider extends ActivityProvider {
+
+ private static final String ID_PROVIDER = "org.eclipse.mylyn.tasks.activity.core.providers.TaskActivityProvider"; //$NON-NLS-1$
+
+ private IActivitySession session;
+
+ private final IRepositoryManager repositoryManager;
+
+ private final TaskList taskList;
+
+ public TaskActivityProvider(IRepositoryManager repositoryManager, TaskList taskList) {
+ Assert.isNotNull(repositoryManager);
+ Assert.isNotNull(taskList);
+ this.repositoryManager = repositoryManager;
+ this.taskList = taskList;
+ }
+
+ @Override
+ public void open(IActivitySession session) {
+ this.session = session;
+ }
+
+ @Override
+ public void query(ActivityScope scope, IProgressMonitor monitor) throws CoreException {
+ if (scope instanceof TaskActivityScope) {
+ ITask scopeTask = ((TaskActivityScope) scope).getTask();
+ for (ITask task : taskList.getAllTasks()) {
+ if (task.getSummary().contains(scopeTask.getTaskId())) {
+ ActivityEvent event = new ActivityEvent(task.getHandleIdentifier(), ID_PROVIDER, task.getSummary(),
+ task.getCreationDate(), null);
+ session.fireActivityEvent(event);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void close() {
+ }
+
+}
diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/TaskActivityScope.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/TaskActivityScope.java
new file mode 100644
index 000000000..f9e214580
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/TaskActivityScope.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.tasks.activity.core;
+
+import org.eclipse.mylyn.tasks.core.ITask;
+
+/**
+ * Defines the scope for a single task.
+ *
+ * @author Steffen Pingel
+ */
+public class TaskActivityScope extends ActivityScope {
+
+ private final ITask task;
+
+ public TaskActivityScope(ITask task) {
+ this.task = task;
+ }
+
+ public ITask getTask() {
+ return task;
+ }
+
+}
diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/spi/ActivityProvider.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/spi/ActivityProvider.java
new file mode 100644
index 000000000..12e276d8a
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/spi/ActivityProvider.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.tasks.activity.core.spi;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.mylyn.tasks.activity.core.ActivityScope;
+
+/**
+ * @author Steffen Pingel
+ */
+public abstract class ActivityProvider {
+
+ public abstract void open(IActivitySession session);
+
+ public abstract void query(ActivityScope scope, IProgressMonitor monitor) throws CoreException;
+
+ public abstract void close();
+
+}
diff --git a/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/spi/IActivitySession.java b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/spi/IActivitySession.java
new file mode 100644
index 000000000..0e570ce75
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.activity.core/src/org/eclipse/mylyn/tasks/activity/core/spi/IActivitySession.java
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2012 Tasktop Technologies and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.tasks.activity.core.spi;
+
+import org.eclipse.mylyn.tasks.activity.core.ActivityEvent;
+import org.eclipse.mylyn.tasks.activity.core.IActivityManager;
+
+/**
+ * @author Steffen Pingel
+ */
+public interface IActivitySession {
+
+ IActivityManager getManger();
+
+ void fireActivityEvent(ActivityEvent event);
+
+}

Back to the top