Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Schmidt2012-08-13 22:22:53 +0000
committerSebastian Schmidt2012-09-18 03:51:15 +0000
commit2fa49654ae8e2643598827019342ef2285ac555c (patch)
tree0f7b4ae2aeeedf37b9c83eaabe350b18d66b23e1
parent5a728b33d7e83a64b4b7be63df07612264945fc9 (diff)
downloadorg.eclipse.mylyn.context-2fa49654ae8e2643598827019342ef2285ac555c.tar.gz
org.eclipse.mylyn.context-2fa49654ae8e2643598827019342ef2285ac555c.tar.xz
org.eclipse.mylyn.context-2fa49654ae8e2643598827019342ef2285ac555c.zip
387156: Allow editor actions to obtain current context
Bug: 387156 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=387156 Change-Id: If0f890469414c8ff58e418333798873fe6b1ca15
-rw-r--r--org.eclipse.mylyn.context.tasks.ui/src/org/eclipse/mylyn/internal/context/tasks/ui/ContextTasksAdapterFactory.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.context.tasks.ui/src/org/eclipse/mylyn/internal/context/tasks/ui/ContextTasksAdapterFactory.java b/org.eclipse.mylyn.context.tasks.ui/src/org/eclipse/mylyn/internal/context/tasks/ui/ContextTasksAdapterFactory.java
index 7a7babf18..a724f827e 100644
--- a/org.eclipse.mylyn.context.tasks.ui/src/org/eclipse/mylyn/internal/context/tasks/ui/ContextTasksAdapterFactory.java
+++ b/org.eclipse.mylyn.context.tasks.ui/src/org/eclipse/mylyn/internal/context/tasks/ui/ContextTasksAdapterFactory.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2011 Tasktop Technologies and others.
+ * Copyright (c) 2011, 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
@@ -7,6 +7,7 @@
*
* Contributors:
* Tasktop Technologies - initial API and implementation
+ * Sebastian Schmidt - bug 387156
*******************************************************************************/
package org.eclipse.mylyn.internal.context.tasks.ui;
@@ -15,6 +16,8 @@ import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.mylyn.context.core.ContextCore;
import org.eclipse.mylyn.context.core.IInteractionContext;
import org.eclipse.mylyn.context.ui.ContextAwareEditorInput;
+import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
+import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
@@ -22,6 +25,7 @@ import org.eclipse.mylyn.tasks.ui.editors.TaskEditorInput;
* Adapts the active task to the active context.
*
* @author Steffen Pingel
+ * @author Sebastian Schmidt
*/
public class ContextTasksAdapterFactory implements IAdapterFactory {
@@ -32,6 +36,10 @@ public class ContextTasksAdapterFactory implements IAdapterFactory {
if (adapterType == IInteractionContext.class) {
if (adaptableObject == TasksUi.getTaskActivityManager().getActiveTask()) {
return ContextCore.getContextManager().getActiveContext();
+ } else if (adaptableObject instanceof TaskEditorInput) {
+ TaskEditorInput editorInput = (TaskEditorInput) adaptableObject;
+ ITask task = editorInput.getTask();
+ return ContextCorePlugin.getContextStore().loadContext(task.getHandleIdentifier());
}
} else if (adapterType == ContextAwareEditorInput.class) {
if (adaptableObject instanceof TaskEditorInput) {

Back to the top