Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2011-08-28 17:58:12 -0400
committerSteffen Pingel2011-08-28 17:58:12 -0400
commit10f5d7510ce301f41ea71f1ff7db9a05375708d6 (patch)
treef0890f3c88d588eb44e096e9b6d6eff9b69ea939 /org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal
parentb30ead21543b16e9e1822dd182fc39734a3d196d (diff)
downloadorg.eclipse.mylyn.tasks-10f5d7510ce301f41ea71f1ff7db9a05375708d6.tar.gz
org.eclipse.mylyn.tasks-10f5d7510ce301f41ea71f1ff7db9a05375708d6.tar.xz
org.eclipse.mylyn.tasks-10f5d7510ce301f41ea71f1ff7db9a05375708d6.zip
REOPENED - bug 351100: fix failing tests for Mylyn 3.7
https://bugs.eclipse.org/bugs/show_bug.cgi?id=351100
Diffstat (limited to 'org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/context/DefaultTaskContextStore.java52
1 files changed, 44 insertions, 8 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/context/DefaultTaskContextStore.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/context/DefaultTaskContextStore.java
index 386ddfb4c..882362e98 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/context/DefaultTaskContextStore.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/context/DefaultTaskContextStore.java
@@ -12,7 +12,13 @@
package org.eclipse.mylyn.internal.tasks.core.context;
import java.io.File;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.mylyn.commons.core.StatusHandler;
+import org.eclipse.mylyn.internal.tasks.core.ITasksCoreConstants;
import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.context.AbstractTaskContextStore;
@@ -21,37 +27,67 @@ import org.eclipse.mylyn.tasks.core.context.AbstractTaskContextStore;
*/
public class DefaultTaskContextStore extends AbstractTaskContextStore {
+ public static final String CONTEXT_FILENAME_ENCODING = "UTF-8"; //$NON-NLS-1$
+
+ public static final String CONTEXT_FILE_EXTENSION = ".xml.zip"; //$NON-NLS-1$
+
+ private File contextDirectory;
+
@Override
- public boolean hasContext(ITask task) {
- return false;
+ public void cloneContext(ITask sourceTask, ITask destinationTask) {
+ // ignore
}
@Override
- public void cloneContext(ITask sourceTask, ITask destinationTask) {
+ public void deleteContext(ITask task) {
+ File file = getFileForContext(task);
+ if (file.exists()) {
+ file.delete();
+ }
+ }
+
+ public File getContextDirectory() {
+ return contextDirectory;
}
@Override
public File getFileForContext(ITask task) {
+ String handleIdentifier = task.getHandleIdentifier();
+ String encoded;
+ try {
+ encoded = URLEncoder.encode(handleIdentifier, CONTEXT_FILENAME_ENCODING);
+ File contextDirectory = getContextDirectory();
+ File contextFile = new File(contextDirectory, encoded + CONTEXT_FILE_EXTENSION);
+ return contextFile;
+ } catch (UnsupportedEncodingException e) {
+ StatusHandler.log(new Status(IStatus.ERROR, ITasksCoreConstants.ID_PLUGIN,
+ "Could not determine path for context", e)); //$NON-NLS-1$
+ }
return null;
}
@Override
- public void deleteContext(ITask oldTask) {
+ public boolean hasContext(ITask task) {
+ File file = getFileForContext(task);
+ return file.exists();
}
+ /**
+ * @since 3.7
+ */
@Override
- public void saveActiveContext() {
+ public void refactorRepositoryUrl(String oldRepositoryUrl, String newRepositoryUrl) {
// ignore
}
@Override
- public void refactorRepositoryUrl(String oldRepositoryUrl, String newRepositoryUrl) {
+ public void saveActiveContext() {
// ignore
}
@Override
- public void setContextDirectory(File contextStoreDir) {
- // ignore
+ public synchronized void setContextDirectory(File directory) {
+ this.contextDirectory = directory;
}
}

Back to the top