summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2012-09-07 18:14:31 (EDT)
committer Steffen Pingel2012-09-10 13:57:43 (EDT)
commit8194bd04a0dac31f977fbe5d48029c3cf098b99b (patch)
treef09dbc03815eb0999368eda5f334137b3d371c6c
parent68d3bf8c09357d5965be2074e134cfce92386276 (diff)
downloadorg.eclipse.mylyn.tasks-8194bd04a0dac31f977fbe5d48029c3cf098b99b.zip
org.eclipse.mylyn.tasks-8194bd04a0dac31f977fbe5d48029c3cf098b99b.tar.gz
org.eclipse.mylyn.tasks-8194bd04a0dac31f977fbe5d48029c3cf098b99b.tar.bz2
386535: Opening local task fails when "Web Browser" is chosen
for task editing in preferences Change-Id: I9e8b23c20d28f3a87687d87037279dda6499979a Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=386535
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TasksUiUtilTest.java27
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/util/TasksUiInternal.java2
2 files changed, 28 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TasksUiUtilTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TasksUiUtilTest.java
index 0287896..375a146 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TasksUiUtilTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/TasksUiUtilTest.java
@@ -21,10 +21,13 @@ import org.eclipse.mylyn.commons.workbench.browser.BrowserUtil;
import org.eclipse.mylyn.internal.tasks.core.AbstractTask;
import org.eclipse.mylyn.internal.tasks.core.TaskCategory;
import org.eclipse.mylyn.internal.tasks.core.TaskList;
+import org.eclipse.mylyn.internal.tasks.ui.ITasksUiPreferenceConstants;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
+import org.eclipse.mylyn.tasks.core.ITask;
import org.eclipse.mylyn.tasks.core.ITask.PriorityLevel;
import org.eclipse.mylyn.tasks.ui.TasksUiUtil;
+import org.eclipse.mylyn.tasks.ui.editors.TaskEditor;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
@@ -33,6 +36,7 @@ import org.eclipse.ui.internal.browser.WebBrowserEditorInput;
/**
* @author Shawn Minto
+ * @author Steffen Pingel
*/
public class TasksUiUtilTest extends TestCase {
@@ -184,4 +188,27 @@ public class TasksUiUtilTest extends TestCase {
assertTrue((style & BrowserUtil.NO_RICH_EDITOR) == 0);
}
+ public void testOpenLocalTask() {
+ ITask localTask = TasksUiInternal.createNewLocalTask("summary");
+ TasksUiUtil.openTask(localTask);
+ assertEquals(1, activePage.getEditorReferences().length);
+ IEditorPart editor = activePage.getEditorReferences()[0].getEditor(true);
+ assertEquals(TaskEditor.class, editor.getClass());
+ }
+
+ public void testOpenLocalTaskWebBrowserDefault() {
+ ITask localTask = TasksUiInternal.createNewLocalTask("summary");
+ try {
+ TasksUiPlugin.getDefault()
+ .getPreferenceStore()
+ .setValue(ITasksUiPreferenceConstants.EDITOR_TASKS_RICH, false);
+ TasksUiUtil.openTask(localTask);
+ assertEquals(1, activePage.getEditorReferences().length);
+ IEditorPart editor = activePage.getEditorReferences()[0].getEditor(true);
+ assertEquals(TaskEditor.class, editor.getClass());
+ } finally {
+ TasksUiPlugin.getDefault().getPreferenceStore().setToDefault(ITasksUiPreferenceConstants.EDITOR_TASKS_RICH);
+ }
+ }
+
} \ No newline at end of file
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 f31be1a..a1cbe68 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
@@ -906,7 +906,7 @@ public class TasksUiInternal {
boolean openWithBrowser = !TasksUiPlugin.getDefault()
.getPreferenceStore()
.getBoolean(ITasksUiPreferenceConstants.EDITOR_TASKS_RICH);
- if (openWithBrowser) {
+ if (openWithBrowser && !(task instanceof LocalTask)) {
TasksUiUtil.openWithBrowser(taskRepository, task);
return new TaskOpenEvent(taskRepository, task, taskId, null, true);
} else {