Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2006-12-22 16:34:39 -0500
committermkersten2006-12-22 16:34:39 -0500
commit77b5ca9a730215acc9b3a59c46d367abdebfb733 (patch)
treeced038e89049c383c3f501184ec1a96460b45ebe
parent7dba508373a4480e67a38bbe10a459a0e22a818c (diff)
downloadorg.eclipse.mylyn.tasks-77b5ca9a730215acc9b3a59c46d367abdebfb733.tar.gz
org.eclipse.mylyn.tasks-77b5ca9a730215acc9b3a59c46d367abdebfb733.tar.xz
org.eclipse.mylyn.tasks-77b5ca9a730215acc9b3a59c46d367abdebfb733.zip
RESOLVED - bug 165362: Switching from and then back to task editor should preserve focus
https://bugs.eclipse.org/bugs/show_bug.cgi?id=165362
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java10
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java11
2 files changed, 18 insertions, 3 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java
index 4062b77d8..332065ba2 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/TasksUiUtil.java
@@ -251,7 +251,7 @@ public class TasksUiUtil {
/**
* Set asyncExec false for testing purposes.
*/
- public static void openEditor(final ITask task, boolean asyncExec, boolean newTask) {
+ public static void openEditor(final ITask task, boolean asyncExec, final boolean newTask) {
final IEditorInput editorInput = new TaskEditorInput(task, newTask);
@@ -261,7 +261,11 @@ public class TasksUiUtil {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
IWorkbenchPage page = window.getActivePage();
- openEditor(editorInput, TaskListPreferenceConstants.TASK_EDITOR_ID, page);
+ IEditorPart part = openEditor(editorInput, TaskListPreferenceConstants.TASK_EDITOR_ID, page);
+ if (newTask && part instanceof TaskEditor) {
+ TaskEditor taskEditor = (TaskEditor)part;
+ taskEditor.focusDescription();
+ }
}
}
});
@@ -273,7 +277,7 @@ public class TasksUiUtil {
}
}
}
-
+
public static IEditorPart openEditor(IEditorInput input, String editorId, IWorkbenchPage page) {
try {
return page.openEditor(input, editorId);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
index 9ce5aa9c0..baba5ad87 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/TaskEditor.java
@@ -298,6 +298,17 @@ public class TaskEditor extends FormEditor {
// }
// }
+ public void focusDescription() {
+ if (this.getActivePage() > -1 && this.getActivePage() != browserPageIndex) {
+ IFormPage page = this.getPages()[this.getActivePage()];
+ if (page != null) {
+ page.setFocus();
+ }
+ } else if (this.getActivePage() == browserPageIndex && webBrowser != null) {
+ webBrowser.setFocus();
+ }
+ }
+
public Browser getWebBrowser() {
return webBrowser;
}

Back to the top