Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2009-02-21 00:19:28 +0000
committerspingel2009-02-21 00:19:28 +0000
commit22b12e4425c7b6c8034524e1a0cbb3294c20acb4 (patch)
tree915cbcb7bf6cb1dfc81e4f57f003fea3a4209907
parentf83c9cacbd5648b3ec3e03775820afa395a5a62c (diff)
downloadorg.eclipse.mylyn.tasks-22b12e4425c7b6c8034524e1a0cbb3294c20acb4.tar.gz
org.eclipse.mylyn.tasks-22b12e4425c7b6c8034524e1a0cbb3294c20acb4.tar.xz
org.eclipse.mylyn.tasks-22b12e4425c7b6c8034524e1a0cbb3294c20acb4.zip
REOPENED - bug 189312: streamline local task editor ui
https://bugs.eclipse.org/bugs/show_bug.cgi?id=189312
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java45
1 files changed, 34 insertions, 11 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java
index 8c2de9128..915af919a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/editors/AbstractTaskEditorPage.java
@@ -132,6 +132,8 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.FilteredTree;
import org.eclipse.ui.forms.IFormPart;
@@ -238,6 +240,17 @@ public abstract class AbstractTaskEditorPage extends TaskFormPage implements ISe
if (active) {
TasksUi.getTaskActivityManager().deactivateTask(oldTask);
}
+
+ boolean editorIsActive = false;
+ IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
+ if (window != null) {
+ IWorkbenchPage activePage = window.getActivePage();
+ if (activePage != null) {
+ if (activePage.getActiveEditor() == getTaskEditor()) {
+ editorIsActive = true;
+ }
+ }
+ }
close();
// delete old task details
@@ -253,7 +266,12 @@ public abstract class AbstractTaskEditorPage extends TaskFormPage implements ISe
if (active) {
TasksUi.getTaskActivityManager().activateTask(newTask);
}
- TasksUiInternal.openTaskInBackground(newTask, false);
+
+ if (editorIsActive) {
+ TasksUiUtil.openTask(newTask);
+ } else {
+ TasksUiInternal.openTaskInBackground(newTask, false);
+ }
}
public void run() {
@@ -506,18 +524,23 @@ public abstract class AbstractTaskEditorPage extends TaskFormPage implements ISe
}
public void close() {
- Display activeDisplay = getSite().getShell().getDisplay();
- activeDisplay.asyncExec(new Runnable() {
- public void run() {
- if (getSite() != null && getSite().getPage() != null && !getManagedForm().getForm().isDisposed()) {
- if (getTaskEditor() != null) {
- getSite().getPage().closeEditor(getTaskEditor(), false);
- } else {
- getSite().getPage().closeEditor(AbstractTaskEditorPage.this, false);
+ if (Display.getCurrent() != null) {
+ getSite().getPage().closeEditor(getTaskEditor(), false);
+ } else {
+ // TODO consider removing asyncExec()
+ Display activeDisplay = getSite().getShell().getDisplay();
+ activeDisplay.asyncExec(new Runnable() {
+ public void run() {
+ if (getSite() != null && getSite().getPage() != null && !getManagedForm().getForm().isDisposed()) {
+ if (getTaskEditor() != null) {
+ getSite().getPage().closeEditor(getTaskEditor(), false);
+ } else {
+ getSite().getPage().closeEditor(AbstractTaskEditorPage.this, false);
+ }
}
}
- }
- });
+ });
+ }
}
protected AttributeEditorFactory createAttributeEditorFactory() {

Back to the top