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 /org.eclipse.mylyn.tasks.ui
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
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui')
-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
8 files changed, 24 insertions, 25 deletions
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

Back to the top