Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2011-07-15 17:58:32 -0400
committerSteffen Pingel2011-07-22 11:01:06 -0400
commitd02ba239c8c77469ff137cbf4d939a834ff39c97 (patch)
treef30768db8e457635c881dbabc7f5880ed8ad989b
parentd870fb4251d55f32cccb6c7ba23bb815570136a2 (diff)
downloadorg.eclipse.mylyn.tasks-d02ba239c8c77469ff137cbf4d939a834ff39c97.tar.gz
org.eclipse.mylyn.tasks-d02ba239c8c77469ff137cbf4d939a834ff39c97.tar.xz
org.eclipse.mylyn.tasks-d02ba239c8c77469ff137cbf4d939a834ff39c97.zip
NEW - bug 336430: separate Context framework from Tasks
https://bugs.eclipse.org/bugs/show_bug.cgi?id=336430
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java5
-rw-r--r--org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java3
-rw-r--r--org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.mylyn.tasks.core/plugin.xml29
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/context/AbstractTaskContextStore.java61
-rw-r--r--org.eclipse.mylyn.tasks.search/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java10
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteAction.java3
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskMigrator.java7
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/AttachmentUtil.java16
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java3
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TableDecoratingLabelProvider.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java5
-rw-r--r--org.eclipse.mylyn.trac.core/META-INF/MANIFEST.MF1
-rw-r--r--org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/core/TracRepositoryConnectorTest.java6
17 files changed, 93 insertions, 64 deletions
diff --git a/org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF b/org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF
index 54c899784..2b90e9bb8 100644
--- a/org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.bugzilla.tests/META-INF/MANIFEST.MF
@@ -15,7 +15,6 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.mylyn.bugzilla.ui,
org.eclipse.mylyn.tasks.ui,
org.eclipse.mylyn.tests.util,
- org.eclipse.mylyn.context.core,
org.eclipse.mylyn.tasks.core,
org.eclipse.ui.forms,
org.eclipse.search,
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java
index 392e3d8b3..e39d557ed 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaAttachmentHandlerTest.java
@@ -27,8 +27,6 @@ import org.eclipse.mylyn.internal.bugzilla.core.BugzillaClient;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaStatus;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler;
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
-import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
-import org.eclipse.mylyn.internal.tasks.core.RepositoryTaskHandleUtil;
import org.eclipse.mylyn.internal.tasks.core.TaskAttachment;
import org.eclipse.mylyn.internal.tasks.core.data.FileTaskAttachmentSource;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
@@ -478,8 +476,7 @@ public class BugzillaAttachmentHandlerTest extends AbstractBugzillaTest {
ITask task = TasksUi.getRepositoryModel().createTask(repository, taskData.getTaskId());
TasksUiPlugin.getTaskList().addTask(task);
TasksUi.getTaskActivityManager().activateTask(task);
- File sourceContextFile = ContextCorePlugin.getContextStore().getFileForContext(
- RepositoryTaskHandleUtil.getHandle(repository.getRepositoryUrl(), taskData.getTaskId()));
+ File sourceContextFile = TasksUiPlugin.getContextStore().getFileForContext(repository, task);
sourceContextFile.createNewFile();
sourceContextFile.deleteOnExit();
repository.setCredentials(AuthenticationType.REPOSITORY, new AuthenticationCredentials("wrong", "wrong"), false);
diff --git a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java
index d08e377b5..e6decda2f 100644
--- a/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java
+++ b/org.eclipse.mylyn.bugzilla.tests/src/org/eclipse/mylyn/bugzilla/tests/BugzillaRepositoryConnectorTest.java
@@ -31,7 +31,6 @@ import org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskDataHandler;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaVersion;
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration;
-import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryLocation;
@@ -830,7 +829,7 @@ public class BugzillaRepositoryConnectorTest extends AbstractBugzillaTest {
ITask task = generateLocalTaskAndDownload(data.getTaskId());
assertNotNull(task);
TasksUiPlugin.getTaskActivityManager().activateTask(task);
- File sourceContextFile = ContextCorePlugin.getContextStore().getFileForContext(task.getHandleIdentifier());
+ File sourceContextFile = TasksUiPlugin.getContextStore().getFileForContext(repository, task);
assertEquals(SynchronizationState.SYNCHRONIZED, task.getSynchronizationState());
sourceContextFile.createNewFile();
sourceContextFile.deleteOnExit();
diff --git a/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF
index 3d293d712..24f80728d 100644
--- a/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.tasks.core/META-INF/MANIFEST.MF
@@ -17,6 +17,7 @@ Export-Package: org.eclipse.mylyn.internal.provisional.tasks.core;x-internal:=tr
org.eclipse.mylyn.internal.tasks.core.notifications;x-friends:="org.eclipse.mylyn.tasks.ui,org.eclipse.mylyn.tasks.bugs",
org.eclipse.mylyn.internal.tasks.core.sync;x-friends:="org.eclipse.mylyn.tasks.ui,org.eclipse.mylyn.tasks.bugs",
org.eclipse.mylyn.tasks.core,
+ org.eclipse.mylyn.tasks.core.context,
org.eclipse.mylyn.tasks.core.data,
org.eclipse.mylyn.tasks.core.sync
Import-Package: com.sun.syndication.feed;version="0.9.0";resolution:=optional,
diff --git a/org.eclipse.mylyn.tasks.core/plugin.xml b/org.eclipse.mylyn.tasks.core/plugin.xml
index 8d2161501..2e643afcc 100644
--- a/org.eclipse.mylyn.tasks.core/plugin.xml
+++ b/org.eclipse.mylyn.tasks.core/plugin.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?><!--
+<?eclipse version="3.0"?>
+<!--
Copyright (c) 2009 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
@@ -9,33 +10,7 @@
Contributors:
Tasktop Technologies - initial API and implementation
-->
-
<plugin>
<extension-point id="templates" name="templates" schema="schema/templates.exsd"/>
<extension-point id="synchronizationParticipants" name="Synchronization Participants" schema="schema/synchronizationParticipants.exsd"/>
-
- <!--
- <extension
- point="org.eclipse.ui.workbench.texteditor.hyperlinkDetectors">
- <hyperlinkDetector class="org.eclipse.mylyn.internal.bugs.java.BugzillaHyperLinkDetector"/>
- </extension>
- -->
-
-<!--
- <extension
- point="org.eclipse.mylyn.core.context">
- <structureBridge
- activeSearchIcon="icons/elcl16/edge-ref-bug.gif"
- activeSearchLabel="Bugzilla References"
- class="org.eclipse.mylyn.bugs.BugzillaStructureBridge"
- name="Bugzilla Structure Bridge"/>
- </extension>
-
- <extension
- point="org.eclipse.mylyn.ui.context">
- <uiBridge
- class="org.eclipse.mylyn.bugs.BugzillaUiBridge"
- contentType="bugzilla"/>
- </extension>
--->
</plugin>
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/context/AbstractTaskContextStore.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/context/AbstractTaskContextStore.java
new file mode 100644
index 000000000..0187ba72c
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/context/AbstractTaskContextStore.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.core.context;
+
+import java.io.File;
+import java.io.InputStream;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.mylyn.tasks.core.ITask;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+
+/**
+ * A store for persisting task context.
+ *
+ * @author Steffen Pingel
+ * @since 3.7
+ */
+public abstract class AbstractTaskContextStore {
+
+ /**
+ * @since 3.7
+ */
+ public abstract boolean hasContext(ITask task);
+
+ /**
+ * @throws CoreException
+ * thrown when the import fails
+ * @since 3.7
+ */
+ public abstract void importContext(ITask task, InputStream source) throws CoreException;
+
+ /**
+ * Copies the context from <code>sourceTask</code> to <code>destinationTask</code>. Creates a new context if a
+ * <code>sourceTask</code> does not have a context.
+ *
+ * @since 3.7
+ */
+ public abstract void cloneContext(ITask sourceTask, ITask destinationTask);
+
+ /**
+ * Return the location of the context for <code>task</code>.
+ *
+ * @return null, if context for <code>task</code> does not exist
+ * @since 3.7
+ */
+ public abstract File getFileForContext(TaskRepository repository, ITask task);
+
+ public abstract void deleteContext(ITask oldTask);
+
+ public abstract void saveActiveContext();
+
+}
diff --git a/org.eclipse.mylyn.tasks.search/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.search/META-INF/MANIFEST.MF
index 6cb690166..ff75ecfb5 100644
--- a/org.eclipse.mylyn.tasks.search/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.tasks.search/META-INF/MANIFEST.MF
@@ -17,7 +17,6 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.ui.ide,
org.eclipse.ui.views,
org.eclipse.ui.workbench.texteditor,
- org.eclipse.mylyn.context.core;bundle-version="[3.0.0,4.0.0)",
org.eclipse.mylyn.commons.core;bundle-version="[3.0.0,4.0.0)",
org.eclipse.mylyn.monitor.ui;bundle-version="[3.0.0,4.0.0)",
org.eclipse.mylyn.tasks.core;bundle-version="[3.0.0,4.0.0)",
diff --git a/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF
index e77b31ba3..890526108 100644
--- a/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.tasks.ui/META-INF/MANIFEST.MF
@@ -18,7 +18,6 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.ui.navigator;resolution:=optional,
org.eclipse.ui.views,
org.eclipse.ui.workbench.texteditor,
- org.eclipse.mylyn.context.core;bundle-version="[3.0.0,4.0.0)",
org.eclipse.mylyn.commons.core;bundle-version="[3.0.0,4.0.0)",
org.eclipse.mylyn.monitor.ui;bundle-version="[3.0.0,4.0.0)",
org.eclipse.mylyn.tasks.core;bundle-version="[3.0.0,4.0.0)",
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
index 7c91d3c40..75d8ade74 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/TasksUiPlugin.java
@@ -53,11 +53,9 @@ import org.eclipse.jface.util.SafeRunnable;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.net.AuthenticationType;
import org.eclipse.mylyn.commons.net.WebUtil;
-import org.eclipse.mylyn.context.core.ContextCore;
import org.eclipse.mylyn.internal.commons.identity.IdentityModel;
import org.eclipse.mylyn.internal.commons.identity.gravatar.GravatarConnector;
import org.eclipse.mylyn.internal.commons.ui.TaskBarManager;
-import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
import org.eclipse.mylyn.internal.discovery.ui.DiscoveryUi;
import org.eclipse.mylyn.internal.monitor.ui.MonitorUiPlugin;
import org.eclipse.mylyn.internal.provisional.commons.ui.AbstractNotification;
@@ -102,6 +100,7 @@ import org.eclipse.mylyn.tasks.core.ITaskContainer;
import org.eclipse.mylyn.tasks.core.RepositoryTemplate;
import org.eclipse.mylyn.tasks.core.TaskActivationAdapter;
import org.eclipse.mylyn.tasks.core.TaskRepository;
+import org.eclipse.mylyn.tasks.core.context.AbstractTaskContextStore;
import org.eclipse.mylyn.tasks.ui.AbstractRepositoryConnectorUi;
import org.eclipse.mylyn.tasks.ui.AbstractTaskRepositoryLinkProvider;
import org.eclipse.mylyn.tasks.ui.TasksUi;
@@ -186,6 +185,8 @@ public class TasksUiPlugin extends AbstractUIPlugin {
// shared colors for all forms
private FormColors formColors;
+ private static AbstractTaskContextStore contextStore;
+
private final List<AbstractSearchHandler> searchHandlers = new ArrayList<AbstractSearchHandler>();
private static final boolean DEBUG_HTTPCLIENT = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.mylyn.tasks.ui/debug/httpclient")); //$NON-NLS-1$ //$NON-NLS-2$
@@ -1418,4 +1419,9 @@ public class TasksUiPlugin extends AbstractUIPlugin {
}
return identityModel;
}
+
+ public static AbstractTaskContextStore getContextStore() {
+ return contextStore;
+ }
+
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteAction.java
index d17326f6d..4d65705b3 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/DeleteAction.java
@@ -28,7 +28,6 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.dialogs.MessageDialogWithToggle;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.context.core.ContextCore;
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonUiUtil;
import org.eclipse.mylyn.internal.provisional.commons.ui.ICoreRunnable;
import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchUtil;
@@ -260,7 +259,7 @@ public class DeleteAction extends BaseSelectionListenerAction {
StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Failed to delete task data", //$NON-NLS-1$
e));
}
- ContextCore.getContextManager().deleteContext(task.getHandleIdentifier());
+ TasksUiPlugin.getContextStore().deleteContext(task);
} else if (selectedObject instanceof IRepositoryQuery) {
TasksUiInternal.getTaskList().deleteQuery((RepositoryQuery) selectedObject);
} else if (selectedObject instanceof TaskCategory) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskMigrator.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskMigrator.java
index 7f7cecf34..85bd4b65e 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskMigrator.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/editors/TaskMigrator.java
@@ -21,8 +21,6 @@ import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.core.runtime.Status;
import org.eclipse.mylyn.commons.core.StatusHandler;
-import org.eclipse.mylyn.context.core.ContextCore;
-import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.DateRange;
import org.eclipse.mylyn.internal.tasks.ui.ChangeActivityHandleOperation;
@@ -170,7 +168,7 @@ public class TaskMigrator {
// delete old task details
if (delete()) {
TasksUiInternal.getTaskList().deleteTask(oldTask);
- ContextCore.getContextManager().deleteContext(oldTask.getHandleIdentifier());
+ TasksUiPlugin.getContextStore().deleteContext(oldTask);
try {
TasksUiPlugin.getTaskDataManager().deleteTaskData(oldTask);
} catch (CoreException e) {
@@ -193,8 +191,7 @@ public class TaskMigrator {
}
// migrate context
- ContextCorePlugin.getContextStore().saveActiveContext();
- ContextCore.getContextStore().cloneContext(oldTask.getHandleIdentifier(), newTask.getHandleIdentifier());
+ TasksUiPlugin.getContextStore().cloneContext(oldTask, newTask);
// migrate task activity
ChangeActivityHandleOperation operation = new ChangeActivityHandleOperation(oldTask.getHandleIdentifier(),
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/AttachmentUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/AttachmentUtil.java
index 03ae13f0f..faf88c226 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/AttachmentUtil.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/AttachmentUtil.java
@@ -36,8 +36,6 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.net.Policy;
-import org.eclipse.mylyn.context.core.ContextCore;
-import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
import org.eclipse.mylyn.internal.tasks.core.TaskAttachment;
import org.eclipse.mylyn.internal.tasks.core.data.FileTaskAttachmentSource;
@@ -86,9 +84,9 @@ public class AttachmentUtil {
public static boolean postContext(AbstractRepositoryConnector connector, TaskRepository repository, ITask task,
String comment, TaskAttribute attribute, IProgressMonitor monitor) throws CoreException {
AbstractTaskAttachmentHandler attachmentHandler = connector.getTaskAttachmentHandler();
- ContextCorePlugin.getContextStore().saveActiveContext();
+ TasksUiPlugin.getContextStore().saveActiveContext();
- File file = ContextCorePlugin.getContextStore().getFileForContext(task.getHandleIdentifier());
+ File file = TasksUiPlugin.getContextStore().getFileForContext(repository, task);
if (attachmentHandler != null && file != null && file.exists()) {
FileTaskAttachmentSource attachment = new FileTaskAttachmentSource(file);
attachment.setDescription(CONTEXT_DESCRIPTION);
@@ -138,7 +136,9 @@ public class AttachmentUtil {
try {
context.run(true, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- File targetFile = ContextCorePlugin.getContextStore().getFileForContext(task.getHandleIdentifier());
+ TaskRepository repository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(),
+ task.getRepositoryUrl());
+ File targetFile = TasksUiPlugin.getContextStore().getFileForContext(repository, task);
try {
boolean exceptionThrown = true;
OutputStream out = new BufferedOutputStream(new FileOutputStream(targetFile));
@@ -182,8 +182,8 @@ public class AttachmentUtil {
public static boolean uploadContext(final TaskRepository repository, final ITask task, final String comment,
final IRunnableContext context) {
- ContextCorePlugin.getContextStore().saveActiveContext();
- File sourceContextFile = ContextCorePlugin.getContextStore().getFileForContext(task.getHandleIdentifier());
+ TasksUiPlugin.getContextStore().saveActiveContext();
+ File sourceContextFile = TasksUiPlugin.getContextStore().getFileForContext(repository, task);
if (!sourceContextFile.exists()) {
TasksUiInternal.displayStatus(Messages.AttachmentUtil_Mylyn_Information, new Status(IStatus.WARNING,
TasksUiPlugin.ID_PLUGIN, Messages.AttachmentUtil_The_context_is_empty));
@@ -224,7 +224,7 @@ public class AttachmentUtil {
public static boolean hasLocalContext(ITask task) {
Assert.isNotNull(task);
- return ContextCore.getContextManager().hasContext(task.getHandleIdentifier());
+ return TasksUiPlugin.getContextStore().hasContext(task);
}
public static boolean isContext(ITaskAttachment attachment) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java
index 2bde23c65..415e29cab 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/CustomTaskListDecorationDrawer.java
@@ -13,7 +13,6 @@
package org.eclipse.mylyn.internal.tasks.ui.views;
import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.mylyn.context.core.ContextCore;
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonFonts;
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.provisional.commons.ui.PlatformUiUtil;
@@ -108,7 +107,7 @@ public class CustomTaskListDecorationDrawer implements Listener {
AbstractTask task = (AbstractTask) data;
if (task.isActive()) {
activationImage = taskActive;
- } else if (ContextCore.getContextManager().hasContext(task.getHandleIdentifier())) {
+ } else if (TasksUiPlugin.getContextStore().hasContext(task)) {
activationImage = taskInactiveContext;
} else {
activationImage = taskInactive;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TableDecoratingLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TableDecoratingLabelProvider.java
index 9b621a853..de49ba16d 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TableDecoratingLabelProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TableDecoratingLabelProvider.java
@@ -15,9 +15,9 @@ import org.eclipse.jface.viewers.DecoratingLabelProvider;
import org.eclipse.jface.viewers.ILabelDecorator;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.mylyn.context.core.ContextCore;
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITaskContainer;
@@ -46,7 +46,7 @@ public class TableDecoratingLabelProvider extends DecoratingLabelProvider implem
if (task.isActive()) {
return CommonImages.getImage(TasksUiImages.CONTEXT_ACTIVE);
} else {
- if (ContextCore.getContextManager().hasContext(task.getHandleIdentifier())) {
+ if (TasksUiPlugin.getContextStore().hasContext(task)) {
return CommonImages.getImage(TasksUiImages.CONTEXT_INACTIVE);
} else {
return CommonImages.getImage(TasksUiImages.CONTEXT_INACTIVE_EMPTY);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java
index 92e9379e3..dd1b19395 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/wizards/TaskAttachmentPage.java
@@ -14,10 +14,10 @@ package org.eclipse.mylyn.tasks.ui.wizards;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.mylyn.context.core.ContextCore;
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonImages;
import org.eclipse.mylyn.internal.provisional.commons.ui.CommonTextSupport;
import org.eclipse.mylyn.internal.tasks.core.data.FileTaskAttachmentSource;
+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.editors.RichTextEditor;
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorExtensions;
import org.eclipse.mylyn.internal.tasks.ui.wizards.Messages;
@@ -205,8 +205,7 @@ public class TaskAttachmentPage extends WizardPage {
attachContextButton.setLayoutData(new GridData(SWT.DEFAULT, SWT.DEFAULT, false, false, 2, 1));
attachContextButton.setText(Messages.TaskAttachmentPage_ATTACHE_CONTEXT);
attachContextButton.setImage(CommonImages.getImage(TasksUiImages.CONTEXT_ATTACH));
- attachContextButton.setEnabled(ContextCore.getContextManager()
- .hasContext(model.getTask().getHandleIdentifier()));
+ attachContextButton.setEnabled(TasksUiPlugin.getContextStore().hasContext(model.getTask()));
/*
* Attachment file name listener, update the local attachment
diff --git a/org.eclipse.mylyn.trac.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.trac.core/META-INF/MANIFEST.MF
index 8f07b9ef9..a36ad8a4e 100644
--- a/org.eclipse.mylyn.trac.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.trac.core/META-INF/MANIFEST.MF
@@ -5,7 +5,6 @@ Bundle-SymbolicName: org.eclipse.mylyn.trac.core;singleton:=true
Bundle-Version: 3.7.0.qualifier
Bundle-Vendor: %Bundle-Vendor
Require-Bundle: org.eclipse.core.runtime,
- org.eclipse.mylyn.context.core;bundle-version="[3.0.0,4.0.0)",
org.eclipse.mylyn.tasks.core;bundle-version="[3.0.0,4.0.0)",
org.eclipse.mylyn.commons.core;bundle-version="[3.0.0,4.0.0)",
org.eclipse.mylyn.commons.net;bundle-version="[3.0.0,4.0.0)",
diff --git a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/core/TracRepositoryConnectorTest.java b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/core/TracRepositoryConnectorTest.java
index ce919e4e6..72096486f 100644
--- a/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/core/TracRepositoryConnectorTest.java
+++ b/org.eclipse.mylyn.trac.tests/src/org/eclipse/mylyn/trac/tests/core/TracRepositoryConnectorTest.java
@@ -26,9 +26,9 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.mylyn.internal.context.core.ContextCorePlugin;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.TaskTask;
+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.AttachmentUtil;
import org.eclipse.mylyn.internal.tasks.ui.wizards.EditRepositoryWizard;
import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
@@ -39,8 +39,8 @@ import org.eclipse.mylyn.internal.trac.core.client.ITracClient.Version;
import org.eclipse.mylyn.internal.trac.core.model.TracPriority;
import org.eclipse.mylyn.internal.trac.core.model.TracSearch;
import org.eclipse.mylyn.internal.trac.core.model.TracTicket;
-import org.eclipse.mylyn.internal.trac.core.model.TracVersion;
import org.eclipse.mylyn.internal.trac.core.model.TracTicket.Key;
+import org.eclipse.mylyn.internal.trac.core.model.TracVersion;
import org.eclipse.mylyn.internal.trac.ui.wizard.TracRepositorySettingsPage;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
@@ -154,7 +154,7 @@ public class TracRepositoryConnectorTest extends TestCase {
public void testContext() throws Exception {
String taskId = data.attachmentTicketId + "";
ITask task = TracTestUtil.createTask(repository, taskId);
- File sourceContextFile = ContextCorePlugin.getContextStore().getFileForContext(task.getHandleIdentifier());
+ File sourceContextFile = TasksUiPlugin.getContextStore().getFileForContext(repository, task);
sourceContextFile.createNewFile();
sourceContextFile.deleteOnExit();

Back to the top