Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ToggleTaskActivationAction.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/Messages.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java37
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/messages.properties1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java3
5 files changed, 34 insertions, 15 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ToggleTaskActivationAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ToggleTaskActivationAction.java
index a4840a1aa..05ca9995f 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ToggleTaskActivationAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/ToggleTaskActivationAction.java
@@ -60,10 +60,10 @@ public class ToggleTaskActivationAction extends Action implements ITaskActivatio
@Override
public void run() {
- if (!task.isActive()) {
- TasksUiInternal.activateTaskThroughCommand(task);
+ if (task.isActive()) {
+ TasksUiInternal.deactivateTaskThroughCommand(task);
} else {
- TasksUi.getTaskActivityManager().deactivateTask(task);
+ TasksUiInternal.activateTaskThroughCommand(task);
}
update();
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/Messages.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/Messages.java
index 7b98b0e65..a4d1c66ca 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/Messages.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/Messages.java
@@ -97,6 +97,8 @@ public class Messages extends NLS {
public static String TasksUiInternal_Activate_Task;
+ public static String TasksUiInternal_Deactivate_Task;
+
public static String TasksUiInternal_Failed_to_open_task;
public static String TasksUiInternal_No_repository_found;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java
index 26257f4eb..da4bc875f 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java
@@ -88,11 +88,11 @@ import org.eclipse.mylyn.tasks.core.IRepositoryElement;
import org.eclipse.mylyn.tasks.core.IRepositoryManager;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
import org.eclipse.mylyn.tasks.core.ITask;
+import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
+import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
import org.eclipse.mylyn.tasks.core.ITaskMapping;
import org.eclipse.mylyn.tasks.core.RepositoryStatus;
import org.eclipse.mylyn.tasks.core.TaskRepository;
-import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
-import org.eclipse.mylyn.tasks.core.ITask.SynchronizationState;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskAttachmentSource;
import org.eclipse.mylyn.tasks.core.data.AbstractTaskDataHandler;
import org.eclipse.mylyn.tasks.core.data.ITaskDataWorkingCopy;
@@ -862,8 +862,9 @@ public class TasksUiInternal {
if (window != null) {
TaskRepository taskRepository = TasksUi.getRepositoryManager().getRepository(task.getConnectorKind(),
task.getRepositoryUrl());
- boolean openWithBrowser = !TasksUiPlugin.getDefault().getPreferenceStore().getBoolean(
- ITasksUiPreferenceConstants.EDITOR_TASKS_RICH);
+ boolean openWithBrowser = !TasksUiPlugin.getDefault()
+ .getPreferenceStore()
+ .getBoolean(ITasksUiPreferenceConstants.EDITOR_TASKS_RICH);
if (openWithBrowser) {
TasksUiUtil.openWithBrowser(taskRepository, task);
return new TaskOpenEvent(taskRepository, task, taskId, null, true);
@@ -1194,15 +1195,21 @@ public class TasksUiInternal {
TasksUiInternal.displayStatus(title, new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
"Command execution failed", e)); //$NON-NLS-1$
} catch (NotDefinedException e) {
- TasksUiInternal.displayStatus(title, new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- NLS.bind("The command with the id ''{0}'' is not defined.", commandId), e)); //$NON-NLS-1$
+ TasksUiInternal.displayStatus(
+ title,
+ new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, NLS.bind(
+ "The command with the id ''{0}'' is not defined.", commandId), e)); //$NON-NLS-1$
} catch (NotHandledException e) {
- TasksUiInternal.displayStatus(title, new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN,
- NLS.bind("The command with the id ''{0}'' is not bound.", commandId), e)); //$NON-NLS-1$
+ TasksUiInternal.displayStatus(
+ title,
+ new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, NLS.bind(
+ "The command with the id ''{0}'' is not bound.", commandId), e)); //$NON-NLS-1$
}
} else {
- TasksUiInternal.displayStatus(title, new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, NLS.bind(
- "The command with the id ''{0}'' does not exist.", commandId))); //$NON-NLS-1$
+ TasksUiInternal.displayStatus(
+ title,
+ new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, NLS.bind(
+ "The command with the id ''{0}'' does not exist.", commandId))); //$NON-NLS-1$
}
} else {
TasksUiInternal.displayStatus(
@@ -1235,6 +1242,16 @@ public class TasksUiInternal {
}
}
+ public static void deactivateTaskThroughCommand(ITask task) {
+ try {
+ TasksUiInternal.executeCommand(PlatformUI.getWorkbench(),
+ "org.eclipse.mylyn.tasks.ui.command.deactivateSelectedTask", Messages.TasksUiInternal_Deactivate_Task, task, null); //$NON-NLS-1$
+ } catch (NotEnabledException e) {
+ StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, NLS.bind(
+ "Failed to activate task ''{0}''.", task.getSummary()), e)); //$NON-NLS-1$
+ }
+ }
+
public static long getActiveTime(ITask task) {
if (MonitorUiPlugin.getDefault().isActivityTrackingEnabled()) {
return TasksUiPlugin.getTaskActivityManager().getElapsedTime(task);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/messages.properties b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/messages.properties
index 864a839ce..fcc077c2a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/messages.properties
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/messages.properties
@@ -49,6 +49,7 @@ TasksUiInternal__minutes_=\ minutes
TasksUiInternal__second=\ second
TasksUiInternal__seconds=\ seconds
TasksUiInternal_Activate_Task=Activate Task
+TasksUiInternal_Deactivate_Task=Deactivate Task
TasksUiInternal_Failed_to_open_task=Failed to Open Task
TasksUiInternal_No_repository_found=No repository found for task. Please create repository in Task Repositories view.
TasksUiInternal_Rename_Category_Message=New &Name:
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java
index 5ac3c20ed..df59e4484 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskListCellModifier.java
@@ -24,7 +24,6 @@ import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
import org.eclipse.mylyn.tasks.core.IRepositoryElement;
import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
-import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.TreeItem;
@@ -127,7 +126,7 @@ class TaskListCellModifier implements ICellModifier {
}
if (task.isActive()) {
- TasksUi.getTaskActivityManager().deactivateTask(task);
+ TasksUiInternal.deactivateTaskThroughCommand(task);
} else {
TasksUiInternal.activateTaskThroughCommand(task);
}

Back to the top