Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2006-01-25 05:53:34 +0000
committermkersten2006-01-25 05:53:34 +0000
commitd16d23b44149efbe108b019fef3a51af0711ee70 (patch)
treea4742ca289c20c770700c5ac19806fb09e326b3b
parentbb264e11df5b62fcd737e057c3f0ad58b06b0b85 (diff)
downloadorg.eclipse.mylyn.tasks-d16d23b44149efbe108b019fef3a51af0711ee70.tar.gz
org.eclipse.mylyn.tasks-d16d23b44149efbe108b019fef3a51af0711ee70.tar.xz
org.eclipse.mylyn.tasks-d16d23b44149efbe108b019fef3a51af0711ee70.zip
Progress on: Bug 125095: make task/report editor extensible
https://bugs.eclipse.org/bugs/show_bug.cgi?id=125095
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryUtil.java4
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/plugin.xml5
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/actions/CreateNewBugzillaTaskAction.java4
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/AbstractBugEditor.java10
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditor.java7
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugReportEditorFactory.java115
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryCategory.java3
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java88
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditor.java4
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskHandler.java42
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaUiBridge.java13
-rw-r--r--org.eclipse.mylyn.tasks.ui/plugin.xml4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListExtensionReader.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/ITaskEditorFactory.java (renamed from org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/IContextEditorFactory.java)10
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/MylarTaskEditor.java41
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskInfoEditor.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskListUiUtil.java46
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskRepositoriesView.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/AddRepositoryAction.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/AddRepositoryTaskAction.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/DeleteAction.java14
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/DeleteTaskRepositoryAction.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/EditRepositoryPropertiesAction.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewCategoryAction.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewLocalTaskAction.java8
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewQueryAction.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/RemoveFromCategoryAction.java6
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListView.java9
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTaskListPlugin.java29
29 files changed, 291 insertions, 213 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryUtil.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryUtil.java
index e9732b757..f7f126b16 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryUtil.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryUtil.java
@@ -44,7 +44,7 @@ import org.eclipse.mylar.internal.tasklist.TaskRepositoryManager;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.tasklist.TaskRepository;
import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.PlatformUI;
/**
* @author Mik Kersten (some rewriting)
@@ -71,7 +71,7 @@ public class BugzillaRepositoryUtil {
TaskRepository repository = MylarTaskListPlugin.getRepositoryManager().getRepository(
BugzillaPlugin.REPOSITORY_KIND, repositoryUrl);
if (repository == null) {
- Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
MessageDialog.openInformation(Display.getDefault().getActiveShell(),
IBugzillaConstants.TITLE_MESSAGE_DIALOG, TaskRepositoryManager.MESSAGE_NO_REPOSITORY);
diff --git a/org.eclipse.mylyn.bugzilla.ui/plugin.xml b/org.eclipse.mylyn.bugzilla.ui/plugin.xml
index 0de55823e..7f4854009 100644
--- a/org.eclipse.mylyn.bugzilla.ui/plugin.xml
+++ b/org.eclipse.mylyn.bugzilla.ui/plugin.xml
@@ -24,6 +24,11 @@
type="bugzilla"/>
</extension>
+ <extension
+ point="org.eclipse.mylar.tasklist.editors">
+ <editorFactory class="org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugReportEditorFactory"/>
+ </extension>
+
<extension point="org.eclipse.ui.perspectiveExtensions">
<perspectiveExtension targetID="org.eclipse.jdt.ui.JavaPerspective">
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/actions/CreateNewBugzillaTaskAction.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/actions/CreateNewBugzillaTaskAction.java
index a0199a3f8..27e947339 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/actions/CreateNewBugzillaTaskAction.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/actions/CreateNewBugzillaTaskAction.java
@@ -27,7 +27,7 @@ import org.eclipse.mylar.tasklist.TaskRepository;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.PlatformUI;
/**
* @author Mik Kersten and Ken Sueda
@@ -64,7 +64,7 @@ public class CreateNewBugzillaTaskAction extends Action implements IViewActionDe
});
- Shell shell = Workbench.getInstance().getActiveWorkbenchWindow().getShell();
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
if (wizard != null && shell != null && !shell.isDisposed()) {
WizardDialog dialog = new WizardDialog(shell, wizard);
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/AbstractBugEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/AbstractBugEditor.java
index 07ed51896..7fa409ec9 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/AbstractBugEditor.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/AbstractBugEditor.java
@@ -46,8 +46,8 @@ import org.eclipse.mylar.internal.bugzilla.core.IBugzillaConstants;
import org.eclipse.mylar.internal.bugzilla.core.IBugzillaReportSelection;
import org.eclipse.mylar.internal.bugzilla.core.IOfflineBugListener.BugzillaOfflineStaus;
import org.eclipse.mylar.internal.bugzilla.ui.OfflineView;
-import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTaskEditor;
import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
+import org.eclipse.mylar.internal.tasklist.ui.MylarTaskEditor;
import org.eclipse.mylar.internal.tasklist.ui.TaskListUiUtil;
import org.eclipse.mylar.tasklist.TaskRepository;
import org.eclipse.swt.SWT;
@@ -124,7 +124,7 @@ public abstract class AbstractBugEditor extends EditorPart implements Listener {
protected AbstractBugEditorInput bugzillaInput;
- private BugzillaTaskEditor parentEditor = null;
+ private MylarTaskEditor parentEditor = null;
/**
* Style option for function <code>newLayout</code>. This will create a
@@ -1131,7 +1131,7 @@ public abstract class AbstractBugEditor extends EditorPart implements Listener {
* elements which can change).
*/
protected void setGeneralTitleText() {
- String text = "[Open in New Browser]";
+ String text = "[Open in Internal Browser]";
linkToBug.setText(text);
linkToBug.setFont(TEXT_FONT);
if (this instanceof ExistingBugEditor) {
@@ -1612,7 +1612,7 @@ public abstract class AbstractBugEditor extends EditorPart implements Listener {
attributesListeners.remove(listener);
}
- public void setParentEditor(BugzillaTaskEditor editor) {
- parentEditor = editor;
+ public void setParentEditor(MylarTaskEditor parentEditor) {
+ this.parentEditor = parentEditor;
}
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditor.java
index 203c1a5b5..8cc571df1 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditor.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/ExistingBugEditor.java
@@ -81,7 +81,6 @@ import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.internal.Workbench;
/**
* An editor used to view a bug report that exists on a server. It uses a
@@ -755,16 +754,16 @@ public class ExistingBugEditor extends AbstractBugEditor {
if (serverBug == null)
throw new Exception();
} catch (Exception e) {
- Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
- MessageDialog.openInformation(Workbench.getInstance().getActiveWorkbenchWindow().getShell(),
+ MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
"Could not open bug.", "Bug #" + bug.getId() + " could not be read from the server.");
}
});
return new Status(IStatus.OK, IBugzillaConstants.PLUGIN_ID, IStatus.OK,
"Could not get the bug report from the server.", null);
}
- Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
compareInput.setTitle("Bug #" + bug.getId());
compareInput.setLeft(bug);
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugReportEditorFactory.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugReportEditorFactory.java
new file mode 100644
index 000000000..eb738767d
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugReportEditorFactory.java
@@ -0,0 +1,115 @@
+/*******************************************************************************
+ * Copyright (c) 2004 - 2006 University Of British Columbia and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * University Of British Columbia - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylar.internal.bugzilla.ui.tasklist;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.mylar.core.MylarPlugin;
+import org.eclipse.mylar.internal.bugzilla.ui.editor.ExistingBugEditor;
+import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTask.BugReportSyncState;
+import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
+import org.eclipse.mylar.internal.tasklist.TaskRepositoryManager;
+import org.eclipse.mylar.internal.tasklist.ui.ITaskEditorFactory;
+import org.eclipse.mylar.internal.tasklist.ui.MylarTaskEditor;
+import org.eclipse.mylar.tasklist.ITask;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.part.EditorPart;
+
+/**
+ * @author Mik Kersten
+ */
+public class BugReportEditorFactory implements ITaskEditorFactory {
+
+ private static final String REPOSITORY_INFO = "Repository Report";
+
+ public void notifyEditorActivationChange(IEditorPart editor) {
+
+ }
+
+ public EditorPart createEditor(MylarTaskEditor parentEditor) {
+ ExistingBugEditor editor = new ExistingBugEditor();
+ editor.setParentEditor(parentEditor);
+ return new ExistingBugEditor();
+ }
+
+ public IEditorInput createEditorInput(ITask task) {
+ if (task instanceof BugzillaTask) {
+ BugzillaTask bugzillaTask = (BugzillaTask) task;
+// bugzillaTask.downloadReport();
+
+ boolean offline = bugzillaTask.getSyncState() == BugReportSyncState.OUTGOING
+ || bugzillaTask.getSyncState() == BugReportSyncState.CONFLICT;
+
+ try {
+ return new BugzillaTaskEditorInput(bugzillaTask, offline);
+ // GetBugzillaReportJob getBugzillaReportJob = new
+ // GetBugzillaReportJob(bugzillaTask);
+ // return getBugzillaReportJob.getEditorInput();
+ // BugzillaTaskEditorInput input = new
+ // BugzillaTaskEditorInput(bugTask, offline);
+ // try {
+ //
+ } catch (Exception e) {
+ MylarStatusHandler.fail(e, "Could not create Bugzilla editor input", true);
+ }
+ }
+ return null;
+ }
+
+ public String getTitle() {
+ return REPOSITORY_INFO;
+ }
+
+ @SuppressWarnings("unused")
+ private class GetBugzillaReportJob extends Job {
+
+ private static final String LABEL = "Download Bugzilla Report";
+
+ protected BugzillaTask bugzillaTask;
+
+ private BugzillaTaskEditorInput editorInput = null;
+
+ public GetBugzillaReportJob(BugzillaTask bugzillaTask) {
+ super(LABEL);
+ this.bugzillaTask = bugzillaTask;
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ // final BugzillaTaskEditorInput input = new
+ // BugzillaTaskEditorInput(bugTask, offline);
+ boolean offline = bugzillaTask.getSyncState() == BugReportSyncState.OUTGOING
+ || bugzillaTask.getSyncState() == BugReportSyncState.CONFLICT;
+
+ editorInput = new BugzillaTaskEditorInput(bugzillaTask, offline);
+ // openTaskEditor(input, offline);
+ return new Status(IStatus.OK, MylarPlugin.PLUGIN_ID, IStatus.OK, "", null);
+ } catch (Exception e) {
+ MylarStatusHandler.fail(e, "Unable to open Bug report: "
+ + TaskRepositoryManager.getTaskIdAsInt(bugzillaTask.getHandleIdentifier()), true);
+ }
+ return Status.CANCEL_STATUS;
+ }
+
+ public BugzillaTaskEditorInput getEditorInput() {
+ return editorInput;
+ }
+ }
+
+ public boolean canCreateEditorFor(ITask task) {
+ return task instanceof BugzillaTask;
+ }
+}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryCategory.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryCategory.java
index 8a4171bef..3c67987b6 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryCategory.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryCategory.java
@@ -43,7 +43,6 @@ import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.Workbench;
/**
* @author Shawn Minto
@@ -142,7 +141,7 @@ public class BugzillaQueryCategory implements IRepositoryQuery {
TaskRepository repository = MylarTaskListPlugin.getRepositoryManager().getRepository(
BugzillaPlugin.REPOSITORY_KIND, repositoryUrl);
if (repository == null) {
- Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
MessageDialog
.openInformation(Display.getDefault().getActiveShell(),
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java
index cbe263680..223edd7a1 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java
@@ -48,7 +48,6 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.Workbench;
/**
* @author Mik Kersten
@@ -263,7 +262,7 @@ public class BugzillaTask extends Task {
return BugzillaRepositoryUtil.getBug(getRepositoryUrl(), TaskRepositoryManager
.getTaskIdAsInt(getHandleIdentifier()));
} catch (LoginException e) {
- Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
MessageDialog
@@ -272,7 +271,7 @@ public class BugzillaTask extends Task {
}
});
} catch (IOException e) {
- Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
((ApplicationWindow) BugzillaPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow())
.setStatus("Download of bug " + TaskRepositoryManager.getTaskIdAsInt(getHandleIdentifier())
@@ -289,48 +288,16 @@ public class BugzillaTask extends Task {
// openTask(-1, offline);
// }
- /**
- * Opens this task's bug report in an editor revealing the selected comment.
- *
- * @param commentNumber
- * The comment number to reveal
- */
- public void openTask(int commentNumber, boolean offline) {
- // if (state != BugTaskState.FREE) {
- // return;
- // }
- //
- // state = BugTaskState.OPENING;
- // notifyTaskDataChange();
- OpenBugTaskJob job = new OpenBugTaskJob("Opening Bugzilla task in editor...", this, offline);
- job.schedule();
- // job.addJobChangeListener(new IJobChangeListener(){
- //
- // public void aboutToRun(IJobChangeEvent event) {
- // // don't care about this event
- // }
- //
- // public void awake(IJobChangeEvent event) {
- // // don't care about this event
- // }
- // public void done(IJobChangeEvent event) {
- // state = BugTaskState.FREE;
- // notifyTaskDataChange();
- // }
- //
- // public void running(IJobChangeEvent event) {
- // // don't care about this event
- // }
- //
- // public void scheduled(IJobChangeEvent event) {
- // // don't care about this event
- // }
- //
- // public void sleeping(IJobChangeEvent event) {
- // // don't care about this event
- // }
- // });
- }
+// /**
+// * Opens this task's bug report in an editor revealing the selected comment.
+// *
+// * @param commentNumber
+// * The comment number to reveal
+// */
+// public void openTask(int commentNumber, boolean offline) {
+// OpenBugTaskJob job = new OpenBugTaskJob("Opening Bugzilla task in editor...", this, offline);
+// job.schedule();
+// }
/**
* @return <code>true</code> if the bug report for this BugzillaTask was
@@ -351,7 +318,7 @@ public class BugzillaTask extends Task {
*/
protected void openTaskEditor(final BugzillaTaskEditorInput input, final boolean offline) {
- Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
try {
// if we can reach the server, get the latest for the bug
@@ -469,35 +436,6 @@ public class BugzillaTask extends Task {
}
}
- private class OpenBugTaskJob extends Job {
-
- protected BugzillaTask bugTask;
-
- private boolean offline;
-
- public OpenBugTaskJob(String name, BugzillaTask bugTask, boolean offline) {
- super(name);
- this.bugTask = bugTask;
- this.offline = offline;
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- boolean isLikeOffline = offline || syncState == BugReportSyncState.OUTGOING
- || syncState == BugReportSyncState.CONFLICT;
- final BugzillaTaskEditorInput input = new BugzillaTaskEditorInput(bugTask, isLikeOffline);
-
- openTaskEditor(input, offline);
- return new Status(IStatus.OK, MylarPlugin.PLUGIN_ID, IStatus.OK, "", null);
- } catch (Exception e) {
- MylarStatusHandler.fail(e, "Unable to open Bug report: "
- + TaskRepositoryManager.getTaskIdAsInt(bugTask.getHandleIdentifier()), true);
- }
- return Status.CANCEL_STATUS;
- }
- }
-
@Override
public String getToolTipText() {
if (lastRefresh == null)
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditor.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditor.java
index 190fe9a76..4f87ed384 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditor.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskEditor.java
@@ -29,7 +29,7 @@ import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
/**
@@ -272,7 +272,7 @@ public class BugzillaTaskEditor extends MylarTaskEditor {
public void makeNewPage(BugReport serverBug, String newCommentText) {
if (serverBug == null) {
- MessageDialog.openInformation(Workbench.getInstance().getActiveWorkbenchWindow().getShell(),
+ MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
"Could not open bug.", "Bug #" + offlineBug.getId()
+ " could not be read from the server. Try refreshing the bug task.");
return;
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskHandler.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskHandler.java
index a6654b321..b230860df 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskHandler.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskHandler.java
@@ -15,7 +15,6 @@ import org.eclipse.jface.action.Action;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaPlugin;
import org.eclipse.mylar.internal.bugzilla.ui.BugzillaUiPlugin;
import org.eclipse.mylar.internal.bugzilla.ui.actions.RefreshBugzillaReportsAction;
-import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
import org.eclipse.mylar.internal.tasklist.ITaskHandler;
import org.eclipse.mylar.internal.tasklist.ui.ITaskListElement;
import org.eclipse.mylar.internal.tasklist.ui.actions.CopyDescriptionAction;
@@ -27,9 +26,6 @@ import org.eclipse.mylar.internal.tasklist.ui.actions.RemoveFromCategoryAction;
import org.eclipse.mylar.internal.tasklist.ui.actions.RenameAction;
import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView;
import org.eclipse.mylar.tasklist.ITask;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
/**
* @author Mik Kersten and Ken Sueda
@@ -132,21 +128,21 @@ public class BugzillaTaskHandler implements ITaskHandler {
|| element instanceof BugzillaQueryCategory;
}
- public void taskClosed(ITask element, IWorkbenchPage page) {
- try {
- IEditorInput input = null;
- if (element instanceof BugzillaTask) {
- input = new BugzillaTaskEditorInput((BugzillaTask) element, true);
- }
- IEditorPart editor = page.findEditor(input);
-
- if (editor != null) {
- page.closeEditor(editor, false);
- }
- } catch (Exception e) {
- MylarStatusHandler.log(e, "Error while trying to close a bugzilla task");
- }
- }
+// public void taskClosed(ITask element, IWorkbenchPage page) {
+// try {
+// IEditorInput input = null;
+// if (element instanceof BugzillaTask) {
+// input = new BugzillaTaskEditorInput((BugzillaTask) element, true);
+// }
+// IEditorPart editor = page.findEditor(input);
+//
+// if (editor != null) {
+// page.closeEditor(editor, false);
+// }
+// } catch (Exception e) {
+// MylarStatusHandler.log(e, "Error while trying to close a bugzilla task");
+// }
+// }
public ITask addTaskToRegistry(ITask newTask) {
if (newTask instanceof BugzillaTask) {
@@ -229,7 +225,7 @@ public class BugzillaTaskHandler implements ITaskHandler {
// } else {
// String message = MESSAGE_CONFIRM_DELETE;
// boolean deleteConfirmed =
-// MessageDialog.openQuestion(Workbench.getInstance().getActiveWorkbenchWindow()
+// MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
// .getShell(), "Confirm delete", message);
// if (!deleteConfirmed)
// return;
@@ -244,7 +240,7 @@ public class BugzillaTaskHandler implements ITaskHandler {
// public boolean deleteElement(ITaskListElement element) {
// if (element instanceof BugzillaQueryCategory) {
// boolean deleteConfirmed =
-// MessageDialog.openQuestion(Workbench.getInstance().getActiveWorkbenchWindow()
+// MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
// .getShell(), "Confirm delete", "Delete the selected query and all contained
// tasks?");
// if (!deleteConfirmed)
@@ -254,7 +250,7 @@ public class BugzillaTaskHandler implements ITaskHandler {
// } else if (element instanceof BugzillaTask) {
// BugzillaTask task = (BugzillaTask) element;
// if (task.isActive()) {
-// MessageDialog.openError(Workbench.getInstance().getActiveWorkbenchWindow().getShell(),
+// MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
// "Delete failed",
// "Task must be deactivated in order to delete.");
// return false;
@@ -262,7 +258,7 @@ public class BugzillaTaskHandler implements ITaskHandler {
//
// // String message = task.getDeleteConfirmationMessage();
// boolean deleteConfirmed =
-// MessageDialog.openQuestion(Workbench.getInstance().getActiveWorkbenchWindow()
+// MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
// .getShell(), "Confirm delete", MESSAGE_CONFIRM_DELETE);
// if (!deleteConfirmed)
// return false;
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaUiBridge.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaUiBridge.java
index 697decdcb..cead90a78 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaUiBridge.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/BugzillaUiBridge.java
@@ -24,15 +24,15 @@ import org.eclipse.mylar.internal.bugzilla.ui.BugzillaOpenStructure;
import org.eclipse.mylar.internal.bugzilla.ui.ViewBugzillaAction;
import org.eclipse.mylar.internal.bugzilla.ui.editor.AbstractBugEditor;
import org.eclipse.mylar.internal.bugzilla.ui.editor.BugzillaOutlinePage;
-import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTask;
import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTaskEditor;
+import org.eclipse.mylar.internal.tasklist.ui.TaskListUiUtil;
import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.ui.IMylarUiBridge;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.PlatformUI;
/**
* @author Mik Kersten
@@ -64,9 +64,10 @@ public class BugzillaUiBridge implements IMylarUiBridge {
// ITask task =
// MylarTaskListPlugin.getTaskListManager().getTaskForHandle(BugTaskUtil.getHandle(bugId),
// true);
- if (task != null && task instanceof BugzillaTask) {
- BugzillaTask bugzillaTask = (BugzillaTask) task;
- bugzillaTask.openTask(commentNumer, true);
+ if (task != null) {
+ TaskListUiUtil.openEditor(task);
+// BugzillaTask bugzillaTask = (BugzillaTask) task;
+// bugzillaTask.openTask(commentNumer, true);
} else {
List<BugzillaOpenStructure> openList = new ArrayList<BugzillaOpenStructure>(1);
openList.add(new BugzillaOpenStructure(server, bugId, commentNumer));
@@ -80,7 +81,7 @@ public class BugzillaUiBridge implements IMylarUiBridge {
}
public void close(IMylarElement node) {
- IWorkbenchPage page = Workbench.getInstance().getActiveWorkbenchWindow().getActivePage();
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (page != null) {
IEditorReference[] references = page.getEditorReferences();
for (int i = 0; i < references.length; i++) {
diff --git a/org.eclipse.mylyn.tasks.ui/plugin.xml b/org.eclipse.mylyn.tasks.ui/plugin.xml
index 34845d867..0633a21e0 100644
--- a/org.eclipse.mylyn.tasks.ui/plugin.xml
+++ b/org.eclipse.mylyn.tasks.ui/plugin.xml
@@ -133,7 +133,7 @@
icon="icons/etool16/task-server.gif"
id="org.eclipse.mylar.tasklist.actions.addQuery"
menubarPath="reports"
- label="Add Existing Task"
+ label="Add Repository Task"
style="push"
tooltip="Add Repository Task">
</action>
@@ -143,7 +143,7 @@
icon="icons/etool16/category-query-new.gif"
id="org.eclipse.mylar.tasklist.actions.addQuery"
menubarPath="reports"
- label="Add Repository Query"
+ label="New Repository Query"
style="push"
tooltip="Add Repository Query">
</action>
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListExtensionReader.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListExtensionReader.java
index 47e21a4fd..aa957f66f 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListExtensionReader.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskListExtensionReader.java
@@ -20,7 +20,7 @@ import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
-import org.eclipse.mylar.internal.tasklist.ui.IContextEditorFactory;
+import org.eclipse.mylar.internal.tasklist.ui.ITaskEditorFactory;
import org.eclipse.mylar.internal.tasklist.ui.IDynamicSubMenuContributor;
import org.eclipse.mylar.tasklist.ITaskListExternalizer;
import org.eclipse.mylar.tasklist.ITaskRepositoryClient;
@@ -120,11 +120,11 @@ public class TaskListExtensionReader {
private static void readEditorFactory(IConfigurationElement element) {
try {
Object editor = element.createExecutableExtension(EDITOR_FACTORY_CLASS);
- if (editor instanceof IContextEditorFactory) {
- MylarTaskListPlugin.getDefault().addContextEditor((IContextEditorFactory) editor);
+ if (editor instanceof ITaskEditorFactory) {
+ MylarTaskListPlugin.getDefault().addContextEditor((ITaskEditorFactory) editor);
} else {
MylarStatusHandler.log("Could not load editor: " + editor.getClass().getCanonicalName()
- + " must implement " + IContextEditorFactory.class.getCanonicalName(), null);
+ + " must implement " + ITaskEditorFactory.class.getCanonicalName(), null);
}
} catch (CoreException e) {
MylarStatusHandler.log(e, "Could not load tasklist listener extension");
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/IContextEditorFactory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/ITaskEditorFactory.java
index 4cec8de85..b154f4be9 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/IContextEditorFactory.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/ITaskEditorFactory.java
@@ -11,20 +11,22 @@
package org.eclipse.mylar.internal.tasklist.ui;
-import org.eclipse.mylar.core.IMylarContext;
+import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
/**
* @author Mik Kersten
*/
-public interface IContextEditorFactory {
+public interface ITaskEditorFactory {
- public IEditorPart createEditor();
+ public IEditorPart createEditor(MylarTaskEditor parentEditor);
- public IEditorInput createEditorInput(IMylarContext context);
+ public IEditorInput createEditorInput(ITask task);
public String getTitle();
public void notifyEditorActivationChange(IEditorPart editor);
+
+ public boolean canCreateEditorFor(ITask task);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/MylarTaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/MylarTaskEditor.java
index 6e87b0638..df300fe60 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/MylarTaskEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/MylarTaskEditor.java
@@ -20,7 +20,6 @@ import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
import org.eclipse.mylar.internal.tasklist.TaskListPreferenceConstants;
import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView;
@@ -48,7 +47,7 @@ import org.eclipse.ui.part.MultiPageSelectionProvider;
*/
public class MylarTaskEditor extends MultiPageEditorPart {
- private static final String TASK_INFO_PAGE_LABEL = "Task Info";
+ private static final String TASK_INFO_PAGE_LABEL = "Overview";
private static final String ISSUE_WEB_PAGE_LABEL = "Browser";
@@ -102,28 +101,31 @@ public class MylarTaskEditor extends MultiPageEditorPart {
partListener = new TaskEditorListener();
activePage.addPartListener(partListener);
taskInfoEditor = new TaskInfoEditor();
-
+ taskInfoEditor.setParentEditor(this);
}
@Override
protected void createPages() {
try {
- int index = createTaskSummaryPage();
- if (task.getUrl().length() > 9) {
- createTaskIssueWebPage();
+ int index = 0;
+ index = createTaskSummaryPage();
+ for (ITaskEditorFactory factory : MylarTaskListPlugin.getDefault().getTaskEditors()) {
+ if (factory.canCreateEditorFor(task)) {
+ IEditorPart editor = factory.createEditor(this);
+ editorsToNotifyOnChange.add(editor);
+ index = addPage(editor, factory.createEditorInput(task));
+ setPageText(index++, factory.getTitle());
+ }
}
- for (IContextEditorFactory factory : MylarTaskListPlugin.getDefault().getContextEditors()) {
- taskInfoEditor.setParentEditor(this);
- IEditorPart editor = factory.createEditor();
- editorsToNotifyOnChange.add(editor);
- index = addPage(editor, factory.createEditorInput(MylarPlugin.getContextManager().getActiveContext()));
- setPageText(index++, factory.getTitle());
+ // HACK: check URL properly
+ if (task.getUrl().length() > 8) {
+ createBrowserPage();
}
} catch (PartInitException e) {
MylarStatusHandler.fail(e, "failed to create task editor pages", false);
}
}
-
+
public IEditorPart getActiveEditor() {
return super.getActiveEditor();
}
@@ -141,11 +143,8 @@ public class MylarTaskEditor extends MultiPageEditorPart {
return 0;
}
- /**
- * Creates page 2 of the multi-page editor, which displays the task issue
- * web page
- */
- private void createTaskIssueWebPage() {
+
+ private void createBrowserPage() {
try {
webBrowser = new Browser(getContainer(), SWT.NONE);
int index = addPage(webBrowser);
@@ -173,7 +172,7 @@ public class MylarTaskEditor extends MultiPageEditorPart {
if (webBrowser != null) {
webBrowser.setUrl(task.getUrl());
} else if (task.getUrl().length() > 9) {
- createTaskIssueWebPage();
+ createBrowserPage();
}
}
@@ -304,8 +303,8 @@ public class MylarTaskEditor extends MultiPageEditorPart {
@Override
protected void pageChange(int newPageIndex) {
- super.pageChange(newPageIndex);
- for (IContextEditorFactory factory : MylarTaskListPlugin.getDefault().getContextEditors()) {
+// super.pageChange(newPageIndex);
+ for (ITaskEditorFactory factory : MylarTaskListPlugin.getDefault().getTaskEditors()) {
for (IEditorPart editor : editorsToNotifyOnChange) {
factory.notifyEditorActivationChange(editor);
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskInfoEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskInfoEditor.java
index 5f58bc91f..c2e171d2c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskInfoEditor.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskInfoEditor.java
@@ -51,6 +51,7 @@ import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.ActionFactory;
import org.eclipse.ui.actions.RetargetAction;
import org.eclipse.ui.forms.FormColors;
@@ -60,7 +61,6 @@ import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.ScrolledForm;
import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.internal.Workbench;
import org.eclipse.ui.internal.WorkbenchImages;
import org.eclipse.ui.internal.WorkbenchMessages;
import org.eclipse.ui.part.EditorPart;
@@ -152,8 +152,8 @@ public class TaskInfoEditor extends EditorPart {
public void taskChanged(final ITask updateTask) {
if (updateTask != null && updateTask.getHandleIdentifier().equals(task.getHandleIdentifier())) {
- if (Workbench.getInstance() != null && !Workbench.getInstance().getDisplay().isDisposed()) {
- Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
+ if (PlatformUI.getWorkbench() != null && !PlatformUI.getWorkbench().getDisplay().isDisposed()) {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
if (!description.isDisposed()) {
description.setText(updateTask.getDescription());
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskListUiUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskListUiUtil.java
index fc45e3af9..ddca54de9 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskListUiUtil.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskListUiUtil.java
@@ -26,8 +26,8 @@ import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.browser.IWebBrowser;
-import org.eclipse.ui.internal.Workbench;
import org.eclipse.ui.internal.browser.WorkbenchBrowserSupport;
/**
@@ -36,8 +36,7 @@ import org.eclipse.ui.internal.browser.WorkbenchBrowserSupport;
public class TaskListUiUtil {
public static void closeEditorInActivePage(ITask task) {
- IWorkbenchPage page = MylarTaskListPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow()
- .getActivePage();
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (page == null) {
return;
}
@@ -71,18 +70,45 @@ public class TaskListUiUtil {
if (!asyncExec) {
openEditorInActivePage(editorInput, TaskListPreferenceConstants.TASK_EDITOR_ID);
} else {
- Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
openEditorInActivePage(editorInput, TaskListPreferenceConstants.TASK_EDITOR_ID);
}
});
+
+// OpenTaskEditorJob openTaskEditorJob = new OpenTaskEditorJob("Opening Task", editorInput);
+// openTaskEditorJob.schedule();
}
}
+// private static class OpenTaskEditorJob extends Job {
+//
+// private IEditorInput editorInput;
+//
+// public OpenTaskEditorJob(String name, IEditorInput editorInput) {
+// super(name);
+// this.editorInput = editorInput;
+// }
+//
+// @Override
+// protected IStatus run(IProgressMonitor monitor) {
+// try {
+// PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+// public void run() {
+// openEditorInActivePage(editorInput, TaskListPreferenceConstants.TASK_EDITOR_ID);
+// }
+// });
+// return new Status(IStatus.OK, MylarPlugin.PLUGIN_ID, IStatus.OK, "", null);
+// } catch (Exception e) {
+// MylarStatusHandler.fail(e, "Could not open task editor", true);
+// }
+// return Status.CANCEL_STATUS;
+// }
+// }
+
public static IEditorPart openEditorInActivePage(IEditorInput input, String editorId) {
try {
- final IWorkbenchPage page = MylarTaskListPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow()
- .getActivePage();
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
return page.openEditor(input, editorId);
} catch (PartInitException e) {
MylarStatusHandler.fail(e, "Open for editor failed: " + input + ", id: " + editorId, true);
@@ -92,7 +118,7 @@ public class TaskListUiUtil {
public static void openEditor(ITaskCategory category) {
final IEditorInput input = new CategoryEditorInput(category);
- Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
openEditorInActivePage(input, TaskListPreferenceConstants.CATEGORY_EDITOR_ID);
}
@@ -101,7 +127,7 @@ public class TaskListUiUtil {
public static void openUrl(String title, String tooltip, String url) {
try {
- IWebBrowser b = null;
+ IWebBrowser browser = null;
int flags = 0;
if (WorkbenchBrowserSupport.getInstance().isInternalWebBrowserAvailable()) {
flags = WorkbenchBrowserSupport.AS_EDITOR | WorkbenchBrowserSupport.LOCATION_BAR
@@ -111,9 +137,9 @@ public class TaskListUiUtil {
flags = WorkbenchBrowserSupport.AS_EXTERNAL | WorkbenchBrowserSupport.LOCATION_BAR
| WorkbenchBrowserSupport.NAVIGATION_BAR;
}
- b = WorkbenchBrowserSupport.getInstance().createBrowser(flags, "org.eclipse.mylar.tasklist." + title,
+ browser = WorkbenchBrowserSupport.getInstance().createBrowser(flags, MylarTaskListPlugin.PLUGIN_ID + title,
title, tooltip);
- b.openURL(new URL(url));
+ browser.openURL(new URL(url));
} catch (PartInitException e) {
MessageDialog.openError(Display.getDefault().getActiveShell(), "Browser init error",
"Browser could not be initiated");
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskRepositoriesView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskRepositoriesView.java
index a0b3fac04..8bfba5b76 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskRepositoriesView.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskRepositoriesView.java
@@ -33,7 +33,7 @@ import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.ViewPart;
/**
@@ -75,7 +75,7 @@ public class TaskRepositoriesView extends ViewPart {
}
public static TaskRepositoriesView getFromActivePerspective() {
- IWorkbenchPage activePage = Workbench.getInstance().getActiveWorkbenchWindow().getActivePage();
+ IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (activePage == null)
return null;
IViewPart view = activePage.findView(ID);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/AddRepositoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/AddRepositoryAction.java
index 24e729fe7..50cee6384 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/AddRepositoryAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/AddRepositoryAction.java
@@ -21,7 +21,7 @@ import org.eclipse.mylar.internal.tasklist.ui.TaskListImages;
import org.eclipse.mylar.internal.tasklist.ui.wizards.AddRepositoryWizard;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.PlatformUI;
/**
* @author Mik Kersten
@@ -43,7 +43,7 @@ public class AddRepositoryAction extends Action {
public void run() {
try {
AddRepositoryWizard wizard = new AddRepositoryWizard();
- Shell shell = Workbench.getInstance().getActiveWorkbenchWindow().getShell();
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
if (wizard != null && shell != null && !shell.isDisposed()) {
WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.create();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/AddRepositoryTaskAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/AddRepositoryTaskAction.java
index 58dd6bd8c..6b712984c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/AddRepositoryTaskAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/AddRepositoryTaskAction.java
@@ -21,7 +21,7 @@ import org.eclipse.mylar.internal.tasklist.ui.wizards.AddExistingTaskWizard;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.PlatformUI;
/**
* @author Mik Kersten
@@ -37,7 +37,7 @@ public class AddRepositoryTaskAction extends Action implements IViewActionDelega
public void run(IAction action) {
try {
AddExistingTaskWizard wizard = new AddExistingTaskWizard();
- Shell shell = Workbench.getInstance().getActiveWorkbenchWindow().getShell();
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
if (wizard != null && shell != null && !shell.isDisposed()) {
WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.create();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/DeleteAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/DeleteAction.java
index 8f5768509..11b10de8c 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/DeleteAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/DeleteAction.java
@@ -24,7 +24,7 @@ import org.eclipse.mylar.tasklist.IRepositoryQuery;
import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.WorkbenchImages;
/**
@@ -55,18 +55,18 @@ public class DeleteAction extends Action {
task = (ITask) selectedObject;
}
if (task == null) {
- MessageDialog.openError(Workbench.getInstance().getActiveWorkbenchWindow().getShell(),
+ MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
"Mylar Tasks", "No task data to delte.");
return;
}
if (task.isActive()) {
- MessageDialog.openError(Workbench.getInstance().getActiveWorkbenchWindow().getShell(),
+ MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
"Mylar Tasks", "Task must be deactivated in order to delete.");
return;
}
String message = genDeleteConfirmationMessage(task);
- boolean deleteConfirmed = MessageDialog.openQuestion(Workbench.getInstance().getActiveWorkbenchWindow()
+ boolean deleteConfirmed = MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell(), "Confirm Delete", message);
if (!deleteConfirmed) {
return;
@@ -87,13 +87,13 @@ public class DeleteAction extends Action {
// }
// view.getViewer().refresh();
} else if (selectedObject instanceof IRepositoryQuery) {
- boolean deleteConfirmed = MessageDialog.openQuestion(Workbench.getInstance().getActiveWorkbenchWindow()
+ boolean deleteConfirmed = MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell(), "Confirm delete", "Delete the selected query? Task data will not be deleted.");
if (deleteConfirmed) {
MylarTaskListPlugin.getTaskListManager().deleteQuery((IRepositoryQuery) selectedObject);
}
} else if (selectedObject instanceof TaskCategory) {
- boolean deleteConfirmed = MessageDialog.openQuestion(Workbench.getInstance().getActiveWorkbenchWindow()
+ boolean deleteConfirmed = MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell(), "Confirm Delete", "Delete the selected category and all contained tasks?");
if (!deleteConfirmed)
return;
@@ -115,7 +115,7 @@ public class DeleteAction extends Action {
MylarTaskListPlugin.getTaskListManager().deleteCategory(cat);
view.getViewer().refresh();
} else {
- MessageDialog.openError(Workbench.getInstance().getActiveWorkbenchWindow().getShell(), "Delete failed",
+ MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Delete failed",
"Nothing selected.");
return;
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/DeleteTaskRepositoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/DeleteTaskRepositoryAction.java
index 2237d9291..ade0e38cc 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/DeleteTaskRepositoryAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/DeleteTaskRepositoryAction.java
@@ -22,7 +22,7 @@ import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.tasklist.TaskRepository;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.WorkbenchImages;
/**
@@ -47,7 +47,7 @@ public class DeleteTaskRepositoryAction extends Action {
public void run() {
try {
- boolean deleteConfirmed = MessageDialog.openQuestion(Workbench.getInstance().getActiveWorkbenchWindow()
+ boolean deleteConfirmed = MessageDialog.openQuestion(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
.getShell(), "Confirm Delete", "Delete the selected task repositories?");
if (deleteConfirmed) {
IStructuredSelection selection = (IStructuredSelection) repositoriesView.getViewer().getSelection();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/EditRepositoryPropertiesAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/EditRepositoryPropertiesAction.java
index 03b12edf8..3cfdf4d1e 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/EditRepositoryPropertiesAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/EditRepositoryPropertiesAction.java
@@ -23,7 +23,7 @@ import org.eclipse.mylar.internal.tasklist.ui.wizards.EditRepositoryWizard;
import org.eclipse.mylar.tasklist.TaskRepository;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.PlatformUI;
/**
* @author Mik Kersten
@@ -49,7 +49,7 @@ public class EditRepositoryPropertiesAction extends Action {
IStructuredSelection selection = (IStructuredSelection) repositoriesView.getViewer().getSelection();
if (selection.getFirstElement() instanceof TaskRepository) {
EditRepositoryWizard wizard = new EditRepositoryWizard((TaskRepository) selection.getFirstElement());
- Shell shell = Workbench.getInstance().getActiveWorkbenchWindow().getShell();
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
if (wizard != null && shell != null && !shell.isDisposed()) {
WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.create();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewCategoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewCategoryAction.java
index e85e6ff07..691f54ed7 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewCategoryAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewCategoryAction.java
@@ -18,7 +18,7 @@ import org.eclipse.mylar.internal.tasklist.TaskCategory;
import org.eclipse.mylar.internal.tasklist.ui.TaskListImages;
import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
-import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.PlatformUI;
/**
* @author Mik Kersten and Ken Sueda
@@ -39,7 +39,7 @@ public class NewCategoryAction extends Action {
@Override
public void run() {
- InputDialog dialog = new InputDialog(Workbench.getInstance().getActiveWorkbenchWindow().getShell(),
+ InputDialog dialog = new InputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
"Enter name", "Enter a name for the Category: ", "", null);
int dialogResult = dialog.open();
if (dialogResult == Window.OK) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewLocalTaskAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewLocalTaskAction.java
index a6c0c2799..6c4289dbc 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewLocalTaskAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewLocalTaskAction.java
@@ -23,7 +23,7 @@ import org.eclipse.mylar.internal.tasklist.ui.views.TaskInputDialog;
import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView;
import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
-import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.PlatformUI;
/**
* @author Mik Kersten
@@ -36,15 +36,15 @@ public class NewLocalTaskAction extends Action {
public NewLocalTaskAction(TaskListView view) {
this.view = view;
- setText("Add Task");
- setToolTipText("Add Task");
+ setText("Add New Task");
+ setToolTipText("Add New Task");
setId(ID);
setImageDescriptor(TaskListImages.TASK_NEW);
}
@Override
public void run() {
- TaskInputDialog dialog = new TaskInputDialog(Workbench.getInstance().getActiveWorkbenchWindow().getShell());
+ TaskInputDialog dialog = new TaskInputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
int dialogResult = dialog.open();
if (dialogResult == Window.OK) {
Task newTask = new Task(MylarTaskListPlugin.getTaskListManager().genUniqueTaskHandle(), dialog
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewQueryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewQueryAction.java
index c404c1348..1546cede4 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewQueryAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewQueryAction.java
@@ -21,7 +21,7 @@ import org.eclipse.mylar.internal.tasklist.ui.wizards.NewQueryWizard;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.PlatformUI;
/**
* @author Mik Kersten
@@ -37,7 +37,7 @@ public class NewQueryAction extends Action implements IViewActionDelegate {
public void run(IAction action) {
try {
NewQueryWizard wizard = new NewQueryWizard();
- Shell shell = Workbench.getInstance().getActiveWorkbenchWindow().getShell();
+ Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
if (wizard != null && shell != null && !shell.isDisposed()) {
WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.create();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/RemoveFromCategoryAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/RemoveFromCategoryAction.java
index a714d4c6a..2a7e2cd44 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/RemoveFromCategoryAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/RemoveFromCategoryAction.java
@@ -24,7 +24,7 @@ import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.ITaskCategory;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.PlatformUI;
/**
* @author Ken Sueda
@@ -49,7 +49,7 @@ public class RemoveFromCategoryAction extends Action {
if (selectedObject instanceof ITask && !((ITask) selectedObject).isLocal()) {
ITask task = (ITask) selectedObject;
if (task.isActive()) {
- MessageDialog.openInformation(Workbench.getInstance().getActiveWorkbenchWindow().getShell(),
+ MessageDialog.openInformation(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
MylarTaskListPlugin.TITLE_DIALOG,
"Task must be deactivated in order to remove from category.");
return;
@@ -65,7 +65,7 @@ public class RemoveFromCategoryAction extends Action {
ITaskCategory cat = task.getCategory();
if (cat != null) {
String message = DeleteAction.genDeleteConfirmationMessage(task);
- boolean deleteConfirmed = MessageDialog.openQuestion(Workbench.getInstance()
+ boolean deleteConfirmed = MessageDialog.openQuestion(PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getShell(), "Confirm delete", message);
if (!deleteConfirmed)
return;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListView.java
index 0a2b5f2ad..c9def9a30 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListView.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListView.java
@@ -103,7 +103,6 @@ import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchActionConstants;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.Workbench;
import org.eclipse.ui.internal.dialogs.FilteredTree;
import org.eclipse.ui.part.DrillDownAdapter;
import org.eclipse.ui.part.PluginTransfer;
@@ -244,8 +243,8 @@ public class TaskListView extends ViewPart {
}
private void refresh(final ITaskListElement element) {
- if (Workbench.getInstance() != null && !Workbench.getInstance().getDisplay().isDisposed()) {
- Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
+ if (PlatformUI.getWorkbench() != null && !PlatformUI.getWorkbench().getDisplay().isDisposed()) {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
if (getViewer().getControl() != null && !getViewer().getControl().isDisposed()) {
if (element == null) {
@@ -395,7 +394,7 @@ public class TaskListView extends ViewPart {
public static TaskListView openInActivePerspective() {
try {
- return (TaskListView) Workbench.getInstance().getActiveWorkbenchWindow().getActivePage().showView(ID);
+ return (TaskListView) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(ID);
} catch (Exception e) {
return null;
}
@@ -1210,7 +1209,7 @@ public class TaskListView extends ViewPart {
}
public String getBugIdFromUser() {
- InputDialog dialog = new InputDialog(Workbench.getInstance().getActiveWorkbenchWindow().getShell(),
+ InputDialog dialog = new InputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
"Enter Bugzilla ID", "Enter the Bugzilla ID: ", "", null);
int dialogResult = dialog.open();
if (dialogResult == Window.OK) {
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTaskListPlugin.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTaskListPlugin.java
index 132794d1d..955d81a4a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTaskListPlugin.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTaskListPlugin.java
@@ -24,16 +24,16 @@ import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.internal.core.MylarPreferenceContstants;
import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
import org.eclipse.mylar.internal.tasklist.ITaskHandler;
-import org.eclipse.mylar.internal.tasklist.TaskListPreferenceConstants;
import org.eclipse.mylar.internal.tasklist.TaskListExtensionReader;
import org.eclipse.mylar.internal.tasklist.TaskListManager;
+import org.eclipse.mylar.internal.tasklist.TaskListPreferenceConstants;
import org.eclipse.mylar.internal.tasklist.TaskListSaveManager;
import org.eclipse.mylar.internal.tasklist.TaskListWriter;
import org.eclipse.mylar.internal.tasklist.TaskRepositoryManager;
import org.eclipse.mylar.internal.tasklist.planner.ReminderRequiredCollector;
import org.eclipse.mylar.internal.tasklist.planner.TaskReportGenerator;
-import org.eclipse.mylar.internal.tasklist.ui.IContextEditorFactory;
import org.eclipse.mylar.internal.tasklist.ui.IDynamicSubMenuContributor;
+import org.eclipse.mylar.internal.tasklist.ui.ITaskEditorFactory;
import org.eclipse.mylar.internal.tasklist.ui.ITaskHighlighter;
import org.eclipse.mylar.internal.tasklist.ui.ITaskListElement;
import org.eclipse.mylar.internal.tasklist.ui.TasksReminderDialog;
@@ -43,7 +43,6 @@ import org.eclipse.swt.events.ShellListener;
import org.eclipse.ui.IStartup;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.Workbench;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
@@ -66,7 +65,7 @@ public class MylarTaskListPlugin extends AbstractUIPlugin implements IStartup {
private List<ITaskHandler> taskHandlers = new ArrayList<ITaskHandler>(); // TODO:
- private List<IContextEditorFactory> contextEditors = new ArrayList<IContextEditorFactory>();
+ private List<ITaskEditorFactory> taskEditors = new ArrayList<ITaskEditorFactory>();
private TaskListWriter taskListWriter;
@@ -307,9 +306,9 @@ public class MylarTaskListPlugin extends AbstractUIPlugin implements IStartup {
taskListManager.addListener(CONTEXT_TASK_ACTIVITY_LISTENER);
taskListManager.addListener(taskListSaveManager);
- Workbench.getInstance().getActiveWorkbenchWindow().getShell().addShellListener(SHELL_LISTENER);
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().addShellListener(SHELL_LISTENER);
MylarPlugin.getDefault().getPluginPreferences().addPropertyChangeListener(PREFERENCE_LISTENER);
- Workbench.getInstance().getActiveWorkbenchWindow().getShell().addDisposeListener(
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().addDisposeListener(
taskListSaveManager);
restoreTaskHandlerState();
@@ -384,9 +383,9 @@ public class MylarTaskListPlugin extends AbstractUIPlugin implements IStartup {
if (MylarPlugin.getDefault() != null) {
MylarPlugin.getDefault().getPluginPreferences().removePropertyChangeListener(PREFERENCE_LISTENER);
}
- if (Workbench.getInstance() != null && Workbench.getInstance().getActiveWorkbenchWindow() != null) {
- Workbench.getInstance().getActiveWorkbenchWindow().getShell().removeShellListener(SHELL_LISTENER);
- Workbench.getInstance().getActiveWorkbenchWindow().getShell()
+ if (PlatformUI.getWorkbench() != null && PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null) {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().removeShellListener(SHELL_LISTENER);
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell()
.removeDisposeListener(taskListSaveManager);
}
} catch (Exception e) {
@@ -470,9 +469,9 @@ public class MylarTaskListPlugin extends AbstractUIPlugin implements IStartup {
parser.addCollector(new ReminderRequiredCollector());
parser.collectTasks();
if (!parser.getAllCollectedTasks().isEmpty()) {
- Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
public void run() {
- TasksReminderDialog dialog = new TasksReminderDialog(Workbench.getInstance().getDisplay()
+ TasksReminderDialog dialog = new TasksReminderDialog(PlatformUI.getWorkbench().getDisplay()
.getActiveShell(), parser.getAllCollectedTasks());
dialog.setBlockOnOpen(false);
dialog.open();
@@ -567,13 +566,13 @@ public class MylarTaskListPlugin extends AbstractUIPlugin implements IStartup {
this.highlighter = highlighter;
}
- public List<IContextEditorFactory> getContextEditors() {
- return contextEditors;
+ public List<ITaskEditorFactory> getTaskEditors() {
+ return taskEditors;
}
- public void addContextEditor(IContextEditorFactory contextEditor) {
+ public void addContextEditor(ITaskEditorFactory contextEditor) {
if (contextEditor != null)
- this.contextEditors.add(contextEditor);
+ this.taskEditors.add(contextEditor);
}
public TaskListSaveManager getTaskListSaveManager() {

Back to the top