Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormkersten2006-01-24 21:10:26 -0500
committermkersten2006-01-24 21:10:26 -0500
commit1b4b5852583cdbb0b8cf592768f8281347df39e8 (patch)
tree923ddef72c26056cd4ecf4e981d6f84766e2c873
parent5688d7479bf404f400ce9aee0f4968ba5fb811b4 (diff)
downloadorg.eclipse.mylyn.tasks-1b4b5852583cdbb0b8cf592768f8281347df39e8.tar.gz
org.eclipse.mylyn.tasks-1b4b5852583cdbb0b8cf592768f8281347df39e8.tar.xz
org.eclipse.mylyn.tasks-1b4b5852583cdbb0b8cf592768f8281347df39e8.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.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUITools.java28
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/editor/AbstractBugEditor.java4
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/AddBugzillaQueryWizard.java22
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryCategory.java6
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryDialog.java5
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaQueryCategory.java10
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTask.java41
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java14
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskHandler.java193
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskRepositoryClient.java44
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java5
-rw-r--r--org.eclipse.mylyn.help.ui/doc/new.html4
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/ui/actions/OpenCorrespondingTaskAction.java4
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListUiTest.java11
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ITaskHandler.java5
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/Task.java75
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskCategory.java29
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/OpenTaskEditorAction.java12
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerEditorPart.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskInfoEditor.java1
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskListUiUtil.java124
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/DeleteAction.java48
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/NewLocalTaskAction.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/OpenTaskEditorAction.java62
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/OpenTaskListElementAction.java72
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/TaskDeactivateAction.java10
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/preferences/MylarTaskListPreferencePage.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListDropAdapter.java4
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListView.java54
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskRepositoryClient.java2
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/MylarTaskListPlugin.java14
31 files changed, 473 insertions, 440 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUITools.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUITools.java
index f414e6617..4406a6f2d 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUITools.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/BugzillaUITools.java
@@ -11,8 +11,6 @@
package org.eclipse.mylar.internal.bugzilla.ui;
import java.io.IOException;
-import java.net.MalformedURLException;
-import java.net.URL;
import javax.security.auth.login.LoginException;
@@ -33,13 +31,10 @@ import org.eclipse.search.internal.ui.SearchMessages;
import org.eclipse.search.internal.ui.SearchPlugin;
import org.eclipse.search.internal.ui.util.ExceptionHandler;
import org.eclipse.search.ui.NewSearchUI;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.browser.IWebBrowser;
-import org.eclipse.ui.internal.browser.WorkbenchBrowserSupport;
public class BugzillaUITools {
@@ -225,27 +220,4 @@ public class BugzillaUITools {
}
}
- public static void openUrl(String title, String tooltip, String url) {
- try {
- IWebBrowser b = null;
- int flags = 0;
- if (WorkbenchBrowserSupport.getInstance().isInternalWebBrowserAvailable()) {
- flags = WorkbenchBrowserSupport.AS_EDITOR | WorkbenchBrowserSupport.LOCATION_BAR
- | WorkbenchBrowserSupport.NAVIGATION_BAR;
-
- } else {
- flags = WorkbenchBrowserSupport.AS_EXTERNAL | WorkbenchBrowserSupport.LOCATION_BAR
- | WorkbenchBrowserSupport.NAVIGATION_BAR;
- }
- b = WorkbenchBrowserSupport.getInstance().createBrowser(flags, "org.eclipse.mylar.tasklist." + title,
- title, tooltip);
- b.openURL(new URL(url));
- } catch (PartInitException e) {
- MessageDialog.openError(Display.getDefault().getActiveShell(), "Browser init error",
- "Browser could not be initiated");
- } catch (MalformedURLException e) {
- MessageDialog.openError(Display.getDefault().getActiveShell(), "URL not found", "URL Could not be opened");
- }
- }
-
}
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 daaabd16d..07ed51896 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
@@ -45,10 +45,10 @@ import org.eclipse.mylar.internal.bugzilla.core.IBugzillaAttributeListener;
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.BugzillaUITools;
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.TaskListUiUtil;
import org.eclipse.mylar.tasklist.TaskRepository;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CLabel;
@@ -1146,7 +1146,7 @@ public abstract class AbstractBugEditor extends EditorPart implements Listener {
}
public void mouseDown(MouseEvent e) {
- BugzillaUITools.openUrl(getTitle(), getTitleToolTip(), BugzillaRepositoryUtil
+ TaskListUiUtil.openUrl(getTitle(), getTitleToolTip(), BugzillaRepositoryUtil
.getBugUrlWithoutLogin(bugzillaInput.getBug().getRepository(), bugzillaInput.getBug()
.getId()));
if (e.stateMask == SWT.MOD3) {
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/AddBugzillaQueryWizard.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/AddBugzillaQueryWizard.java
index e0242a4c8..c212c7ab9 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/AddBugzillaQueryWizard.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/AddBugzillaQueryWizard.java
@@ -45,15 +45,21 @@ public class AddBugzillaQueryWizard extends Wizard {
@Override
public boolean performFinish() {
queryPage.getQueryDialog().okPressed();
- final BugzillaQueryCategory queryCategory;
+ final BugzillaQueryCategory queryCategory = new BugzillaQueryCategory(
+ repository.getUrl().toExternalForm(),
+ queryPage.getQueryDialog().getUrl(),
+ queryPage.getQueryDialog().getName(),
+ queryPage.getQueryDialog().getMaxHits());
if (!queryPage.getQueryDialog().isCustom()) {
- queryCategory = new BugzillaQueryCategory(repository.getUrl().toExternalForm(), queryPage.getQueryDialog()
- .getUrl(), queryPage.getQueryDialog().getName(), queryPage.getQueryDialog().getMaxHits());
- } else {
- queryCategory = new BugzillaCustomQueryCategory(repository.getUrl().toExternalForm(), queryPage
- .getQueryDialog().getName(), queryPage.getQueryDialog().getUrl(), queryPage.getQueryDialog()
- .getMaxHits());
- }
+ queryCategory.setCustomQuery(true);
+ }
+// else {
+// queryCategory = new BugzillaCustomQueryCategory(
+// repository.getUrl().toExternalForm(),
+// queryPage.getQueryDialog().getName(),
+// queryPage.getQueryDialog().getUrl(),
+// queryPage.getQueryDialog().getMaxHits());
+// }
MylarTaskListPlugin.getTaskListManager().addQuery(queryCategory);
boolean offline = MylarTaskListPlugin.getPrefs().getBoolean(TaskListPreferenceConstants.WORK_OFFLINE);
if (!offline) {
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryCategory.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryCategory.java
index e7a782bfe..d37db511e 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryCategory.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryCategory.java
@@ -13,10 +13,12 @@ package org.eclipse.mylar.internal.bugzilla.ui.tasklist;
/**
* @author Mik Kersten
+ *
+ * TODO: remove
*/
public class BugzillaCustomQueryCategory extends BugzillaQueryCategory {
- public BugzillaCustomQueryCategory(String repositoryUrl, String description, String maxHits, String queryString) {
- super(repositoryUrl, maxHits, description, queryString);
+ public BugzillaCustomQueryCategory(String repositoryUrl, String maxHits, String description, String queryString) {
+ super(repositoryUrl, queryString, description, maxHits);
}
}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryDialog.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryDialog.java
index e91d75e66..db6b28ad4 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryDialog.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaCustomQueryDialog.java
@@ -20,6 +20,11 @@ import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
+/**
+ *
+ * @author Shawn Minto
+ * @author Mik Kersten (some hardening of prototype)
+ */
public class BugzillaCustomQueryDialog extends Dialog {
private String url;
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 4973aaeab..8a4171bef 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
@@ -55,6 +55,8 @@ public class BugzillaQueryCategory implements IRepositoryQuery {
private String queryUrl;
+ private boolean customQuery = false;
+
private int maxHits;
private List<IQueryHit> hits = new ArrayList<IQueryHit>();
@@ -304,4 +306,12 @@ public class BugzillaQueryCategory implements IRepositoryQuery {
public void setRepositoryUrl(String repositoryUrl) {
this.repositoryUrl = repositoryUrl;
}
+
+ public boolean isCustomQuery() {
+ return customQuery;
+ }
+
+ public void setCustomQuery(boolean customQuery) {
+ this.customQuery = customQuery;
+ }
}
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 2fe751afb..cbe263680 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
@@ -284,10 +284,10 @@ public class BugzillaTask extends Task {
return null;
}
- @Override
- public void openTaskInEditor(boolean offline) {
- openTask(-1, offline);
- }
+// @Override
+// public void openTaskInEditor(boolean offline) {
+// openTask(-1, offline);
+// }
/**
* Opens this task's bug report in an editor revealing the selected comment.
@@ -354,22 +354,19 @@ public class BugzillaTask extends Task {
Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
public void run() {
try {
- MylarTaskListPlugin.ReportOpenMode mode = MylarTaskListPlugin.getDefault().getReportMode();
- if (mode == MylarTaskListPlugin.ReportOpenMode.EDITOR) {
- // if we can reach the server, get the latest for the
- // bug
- if (!isBugDownloaded() && offline) {
- MessageDialog.openInformation(null, "Unable to open bug",
- "Unable to open the selected bugzilla task since you are currently offline");
- return;
- } else if (!isBugDownloaded() && syncState != BugReportSyncState.OUTGOING
- && syncState != BugReportSyncState.CONFLICT) {
- input.getBugTask().downloadReport();
- input.setOfflineBug(input.getBugTask().getBugReport());
- } else if (syncState == BugReportSyncState.OUTGOING || syncState == BugReportSyncState.CONFLICT) {
- input.setOfflineBug(bugReport);
- }
+ // if we can reach the server, get the latest for the bug
+ if (!isBugDownloaded() && offline) {
+ MessageDialog.openInformation(null, "Unable to open bug",
+ "Unable to open the selected bugzilla task since you are currently offline");
+ return;
+ } else if (!isBugDownloaded() && syncState != BugReportSyncState.OUTGOING
+ && syncState != BugReportSyncState.CONFLICT) {
+ input.getBugTask().downloadReport();
+ input.setOfflineBug(input.getBugTask().getBugReport());
+ } else if (syncState == BugReportSyncState.OUTGOING || syncState == BugReportSyncState.CONFLICT) {
+ input.setOfflineBug(bugReport);
}
+
// get the active workbench page
IWorkbenchPage page = MylarTaskListPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow()
.getActivePage();
@@ -377,12 +374,6 @@ public class BugzillaTask extends Task {
return;
page.openEditor(input, BUGZILLA_EDITOR_ID);
- // else if (mode ==
- // MylarTaskListPlugin.ReportOpenMode.INTERNAL_BROWSER) {
- // String title = "Bug #" +
- // BugzillaTask.getBugId(getHandle());
- // BugzillaUITools.openUrl(title, title, getBugUrl());
- // }
if (syncState == BugReportSyncState.INCOMMING) {
syncState = BugReportSyncState.OK;
Display.getDefault().asyncExec(new Runnable() {
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java
index 2887bcf83..01842c96e 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskExternalizer.java
@@ -124,11 +124,17 @@ public class BugzillaTaskExternalizer extends DelegatingLocalTaskExternalizer {
Element element = (Element) node;
IRepositoryQuery cat = null;
if (node.getNodeName().equals(TAG_BUGZILLA_CUSTOM_QUERY)) {
- cat = new BugzillaCustomQueryCategory(element.getAttribute(REPOSITORY_URL), element.getAttribute(NAME),
- element.getAttribute(QUERY_STRING), element.getAttribute(MAX_HITS));
+ cat = new BugzillaCustomQueryCategory(
+ element.getAttribute(REPOSITORY_URL),
+ element.getAttribute(QUERY_STRING),
+ element.getAttribute(NAME),
+ element.getAttribute(MAX_HITS));
} else if (node.getNodeName().equals(TAG_BUGZILLA_QUERY)) {
- cat = new BugzillaQueryCategory(element.getAttribute(REPOSITORY_URL), element.getAttribute(QUERY_STRING),
- element.getAttribute(NAME), element.getAttribute(MAX_HITS));
+ cat = new BugzillaQueryCategory(
+ element.getAttribute(REPOSITORY_URL),
+ element.getAttribute(QUERY_STRING),
+ element.getAttribute(NAME),
+ element.getAttribute(MAX_HITS));
}
if (cat != null) {
tlist.internalAddQuery(cat);
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 47a5567a5..a6654b321 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
@@ -11,35 +11,22 @@
package org.eclipse.mylar.internal.bugzilla.ui.tasklist;
-import java.util.ArrayList;
-import java.util.List;
-
import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaPlugin;
-import org.eclipse.mylar.internal.bugzilla.ui.BugzillaOpenStructure;
-import org.eclipse.mylar.internal.bugzilla.ui.BugzillaUITools;
import org.eclipse.mylar.internal.bugzilla.ui.BugzillaUiPlugin;
-import org.eclipse.mylar.internal.bugzilla.ui.ViewBugzillaAction;
import org.eclipse.mylar.internal.bugzilla.ui.actions.RefreshBugzillaReportsAction;
-import org.eclipse.mylar.internal.bugzilla.ui.actions.SynchronizeReportsAction;
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.TaskRepositoryManager;
import org.eclipse.mylar.internal.tasklist.ui.ITaskListElement;
import org.eclipse.mylar.internal.tasklist.ui.actions.CopyDescriptionAction;
import org.eclipse.mylar.internal.tasklist.ui.actions.DeleteAction;
import org.eclipse.mylar.internal.tasklist.ui.actions.GoIntoAction;
-import org.eclipse.mylar.internal.tasklist.ui.actions.OpenTaskEditorAction;
import org.eclipse.mylar.internal.tasklist.ui.actions.OpenTaskInExternalBrowserAction;
+import org.eclipse.mylar.internal.tasklist.ui.actions.OpenTaskListElementAction;
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.mylar.tasklist.MylarTaskListPlugin;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
@@ -51,92 +38,94 @@ import org.eclipse.ui.IWorkbenchPage;
*/
public class BugzillaTaskHandler implements ITaskHandler {
- public void itemOpened(ITaskListElement element) {
-
- boolean offline = MylarTaskListPlugin.getPrefs().getBoolean(TaskListPreferenceConstants.WORK_OFFLINE);
-
- if (element instanceof BugzillaTask) {
- BugzillaTask bugzillaTask = (BugzillaTask) element;
- MylarTaskListPlugin.ReportOpenMode mode = MylarTaskListPlugin.getDefault().getReportMode();
- if (mode == MylarTaskListPlugin.ReportOpenMode.EDITOR) {
- bugzillaTask.openTaskInEditor(offline);
- } else if (mode == MylarTaskListPlugin.ReportOpenMode.INTERNAL_BROWSER) {
- if (offline) {
- MessageDialog.openInformation(null, "Unable to open bug",
- "Unable to open the selected bugzilla task since you are currently offline");
- return;
- }
- String title = "Bug #" + TaskRepositoryManager.getTaskIdAsInt(bugzillaTask.getHandleIdentifier());
- BugzillaUITools.openUrl(title, title, bugzillaTask.getUrl());
- } else {
- // not supported
- }
- } else if (element instanceof BugzillaCustomQueryCategory) {
- BugzillaCustomQueryCategory queryCategory = (BugzillaCustomQueryCategory) element;
- BugzillaCustomQueryDialog sqd = new BugzillaCustomQueryDialog(Display.getCurrent().getActiveShell(),
- queryCategory.getQueryUrl(), queryCategory.getDescription(), queryCategory.getMaxHits() + "");
- if (sqd.open() == Dialog.OK) {
- queryCategory.setDescription(sqd.getName());
- queryCategory.setQueryUrl(sqd.getUrl());
- int maxHits = -1;
- try {
- maxHits = Integer.parseInt(sqd.getMaxHits());
- } catch (Exception e) {
- }
- queryCategory.setMaxHits(maxHits);
-
- new SynchronizeReportsAction(queryCategory).run();
- }
- } else if (element instanceof BugzillaQueryCategory) {
- BugzillaQueryCategory queryCategory = (BugzillaQueryCategory) element;
- BugzillaQueryDialog queryDialog = new BugzillaQueryDialog(Display.getCurrent().getActiveShell(),
- queryCategory.getRepositoryUrl(), queryCategory.getQueryUrl(), queryCategory.getDescription(),
- queryCategory.getMaxHits() + "");
- if (queryDialog.open() == Dialog.OK) {
- queryCategory.setDescription(queryDialog.getName());
- queryCategory.setQueryUrl(queryDialog.getUrl());
- queryCategory.setRepositoryUrl(queryDialog.getRepository().getUrl().toExternalForm());
- int maxHits = -1;
- try {
- maxHits = Integer.parseInt(queryDialog.getMaxHits());
- } catch (Exception e) {
- }
- queryCategory.setMaxHits(maxHits);
-
- new SynchronizeReportsAction(queryCategory).run();
- }
- } else if (element instanceof BugzillaQueryHit) {
- BugzillaQueryHit hit = (BugzillaQueryHit) element;
- MylarTaskListPlugin.ReportOpenMode mode = MylarTaskListPlugin.getDefault().getReportMode();
- if (mode == MylarTaskListPlugin.ReportOpenMode.EDITOR) {
- if (hit.getCorrespondingTask() != null) {
- hit.getCorrespondingTask().openTaskInEditor(offline);
- } else {
- if (offline) {
- MessageDialog.openInformation(null, "Unable to open bug",
- "Unable to open the selected bugzilla report since you are currently offline");
- return;
- }
- BugzillaOpenStructure open = new BugzillaOpenStructure(((BugzillaQueryHit) element)
- .getRepositoryUrl(), ((BugzillaQueryHit) element).getId(), -1);
- List<BugzillaOpenStructure> selectedBugs = new ArrayList<BugzillaOpenStructure>();
- selectedBugs.add(open);
- ViewBugzillaAction viewBugs = new ViewBugzillaAction("Display bugs in editor", selectedBugs);
- viewBugs.schedule();
- }
- } else if (mode == MylarTaskListPlugin.ReportOpenMode.INTERNAL_BROWSER) {
- if (offline) {
- MessageDialog.openInformation(null, "Unable to open bug",
- "Unable to open the selected bugzilla report since you are currently offline");
- return;
- }
- String title = "Bug #" + TaskRepositoryManager.getTaskIdAsInt(hit.getHandleIdentifier());
- BugzillaUITools.openUrl(title, title, hit.getBugUrl());
- } else {
- // not supported
- }
- }
- }
+// public void itemOpened(ITaskListElement element) {
+//
+// boolean offline = MylarTaskListPlugin.getPrefs().getBoolean(TaskListPreferenceConstants.WORK_OFFLINE);
+//
+// if (element instanceof BugzillaTask) {
+// BugzillaTask bugzillaTask = (BugzillaTask) element;
+// TaskListUiUtil.openEditor(bugzillaTask);
+// MylarTaskListPlugin.ReportOpenMode mode = MylarTaskListPlugin.getDefault().getReportMode();
+// if (mode == MylarTaskListPlugin.ReportOpenMode.EDITOR) {
+// bugzillaTask.openTaskInEditor(offline);
+// } else if (mode == MylarTaskListPlugin.ReportOpenMode.INTERNAL_BROWSER) {
+// if (offline) {
+// MessageDialog.openInformation(null, "Unable to open bug",
+// "Unable to open the selected bugzilla task since you are currently offline");
+// return;
+// }
+// String title = "Bug #" + TaskRepositoryManager.getTaskIdAsInt(bugzillaTask.getHandleIdentifier());
+// TaskListUiUtil.openUrl(title, title, bugzillaTask.getUrl());
+// } else {
+// // not supported
+// }
+// } else if (element instanceof BugzillaCustomQueryCategory) {
+// BugzillaCustomQueryCategory queryCategory = (BugzillaCustomQueryCategory) element;
+// BugzillaCustomQueryDialog sqd = new BugzillaCustomQueryDialog(Display.getCurrent().getActiveShell(),
+// queryCategory.getQueryUrl(), queryCategory.getDescription(), queryCategory.getMaxHits() + "");
+// if (sqd.open() == Dialog.OK) {
+// queryCategory.setDescription(sqd.getName());
+// queryCategory.setQueryUrl(sqd.getUrl());
+// int maxHits = -1;
+// try {
+// maxHits = Integer.parseInt(sqd.getMaxHits());
+// } catch (Exception e) {
+// }
+// queryCategory.setMaxHits(maxHits);
+//
+// new SynchronizeReportsAction(queryCategory).run();
+// }
+// } else if (element instanceof BugzillaQueryCategory) {
+// BugzillaQueryCategory queryCategory = (BugzillaQueryCategory) element;
+// BugzillaQueryDialog queryDialog = new BugzillaQueryDialog(Display.getCurrent().getActiveShell(),
+// queryCategory.getRepositoryUrl(), queryCategory.getQueryUrl(), queryCategory.getDescription(),
+// queryCategory.getMaxHits() + "");
+// if (queryDialog.open() == Dialog.OK) {
+// queryCategory.setDescription(queryDialog.getName());
+// queryCategory.setQueryUrl(queryDialog.getUrl());
+// queryCategory.setRepositoryUrl(queryDialog.getRepository().getUrl().toExternalForm());
+// int maxHits = -1;
+// try {
+// maxHits = Integer.parseInt(queryDialog.getMaxHits());
+// } catch (Exception e) {
+// }
+// queryCategory.setMaxHits(maxHits);
+//
+// new SynchronizeReportsAction(queryCategory).run();
+// }
+// } else if (element instanceof BugzillaQueryHit) {
+// BugzillaQueryHit hit = (BugzillaQueryHit) element;
+// MylarTaskListPlugin.ReportOpenMode mode = MylarTaskListPlugin.getDefault().getReportMode();
+// if (mode == MylarTaskListPlugin.ReportOpenMode.EDITOR) {
+// if (hit.getCorrespondingTask() != null) {
+// hit.getCorrespondingTask().openTaskInEditor(offline);
+// } else {
+// if (offline) {
+// MessageDialog.openInformation(null, "Unable to open bug",
+// "Unable to open the selected bugzilla report since you are currently offline");
+// return;
+// }
+// BugzillaOpenStructure open = new BugzillaOpenStructure(((BugzillaQueryHit) element)
+// .getRepositoryUrl(), ((BugzillaQueryHit) element).getId(), -1);
+// List<BugzillaOpenStructure> selectedBugs = new ArrayList<BugzillaOpenStructure>();
+// selectedBugs.add(open);
+// ViewBugzillaAction viewBugs = new ViewBugzillaAction("Display bugs in editor", selectedBugs);
+// viewBugs.schedule();
+// }
+// }
+// else if (mode == MylarTaskListPlugin.ReportOpenMode.INTERNAL_BROWSER) {
+// if (offline) {
+// MessageDialog.openInformation(null, "Unable to open bug",
+// "Unable to open the selected bugzilla report since you are currently offline");
+// return;
+// }
+// String title = "Bug #" + TaskRepositoryManager.getTaskIdAsInt(hit.getHandleIdentifier());
+// TaskListUiUtil.openUrl(title, title, hit.getBugUrl());
+// } else {
+// // not supported
+// }
+// }
+// }
public boolean acceptsItem(ITaskListElement element) {
return element instanceof BugzillaTask || element instanceof BugzillaQueryHit
@@ -198,14 +187,14 @@ public class BugzillaTaskHandler implements ITaskHandler {
return false;
}
} else if (action instanceof DeleteAction || action instanceof CopyDescriptionAction
- || action instanceof OpenTaskEditorAction || action instanceof RemoveFromCategoryAction) {
+ || action instanceof OpenTaskListElementAction || action instanceof RemoveFromCategoryAction) {
return true;
} else {
return false;
}
} else if (element instanceof BugzillaQueryCategory) {
if (action instanceof DeleteAction || action instanceof CopyDescriptionAction
- || action instanceof OpenTaskEditorAction || action instanceof RenameAction) {
+ || action instanceof OpenTaskListElementAction || action instanceof RenameAction) {
return true;
} else if (action instanceof GoIntoAction) {
BugzillaQueryCategory cat = (BugzillaQueryCategory) element;
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskRepositoryClient.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskRepositoryClient.java
index 5872aa9c7..8ac60eeb7 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskRepositoryClient.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaTaskRepositoryClient.java
@@ -11,19 +11,23 @@
package org.eclipse.mylar.internal.bugzilla.ui.tasklist;
+import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaPlugin;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositorySettingsPage;
+import org.eclipse.mylar.internal.bugzilla.ui.actions.SynchronizeReportsAction;
import org.eclipse.mylar.internal.tasklist.ITaskHandler;
import org.eclipse.mylar.internal.tasklist.TaskRepositoryManager;
import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView;
import org.eclipse.mylar.internal.tasklist.ui.wizards.AbstractAddExistingTaskWizard;
import org.eclipse.mylar.internal.tasklist.ui.wizards.AbstractRepositorySettingsPage;
import org.eclipse.mylar.internal.tasklist.ui.wizards.ExistingTaskWizardPage;
+import org.eclipse.mylar.tasklist.IRepositoryQuery;
import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.ITaskRepositoryClient;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.mylar.tasklist.TaskRepository;
+import org.eclipse.swt.widgets.Display;
/**
* @author Mik Kersten
@@ -102,4 +106,42 @@ public class BugzillaTaskRepositoryClient implements ITaskRepositoryClient {
}
};
}
-}
+
+ public void openEditQueryDialog(IRepositoryQuery query) {
+ if (query instanceof BugzillaCustomQueryCategory) {
+ BugzillaCustomQueryCategory queryCategory = (BugzillaCustomQueryCategory) query;
+ BugzillaCustomQueryDialog sqd = new BugzillaCustomQueryDialog(Display.getCurrent().getActiveShell(),
+ queryCategory.getQueryUrl(), queryCategory.getDescription(), queryCategory.getMaxHits() + "");
+ if (sqd.open() == Dialog.OK) {
+ queryCategory.setDescription(sqd.getName());
+ queryCategory.setQueryUrl(sqd.getUrl());
+ int maxHits = -1;
+ try {
+ maxHits = Integer.parseInt(sqd.getMaxHits());
+ } catch (Exception e) {
+ }
+ queryCategory.setMaxHits(maxHits);
+
+ new SynchronizeReportsAction(queryCategory).run();
+ }
+ } else if (query instanceof BugzillaQueryCategory) {
+ BugzillaQueryCategory queryCategory = (BugzillaQueryCategory) query;
+ BugzillaQueryDialog queryDialog = new BugzillaQueryDialog(Display.getCurrent().getActiveShell(),
+ queryCategory.getRepositoryUrl(), queryCategory.getQueryUrl(), queryCategory.getDescription(),
+ queryCategory.getMaxHits() + "");
+ if (queryDialog.open() == Dialog.OK) {
+ queryCategory.setDescription(queryDialog.getName());
+ queryCategory.setQueryUrl(queryDialog.getUrl());
+ queryCategory.setRepositoryUrl(queryDialog.getRepository().getUrl().toExternalForm());
+ int maxHits = -1;
+ try {
+ maxHits = Integer.parseInt(queryDialog.getMaxHits());
+ } catch (Exception e) {
+ }
+ queryCategory.setMaxHits(maxHits);
+
+ new SynchronizeReportsAction(queryCategory).run();
+ }
+ }
+ }
+}
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java
index 74bba2e30..e68ca19d1 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/wizard/NewBugzillaReportWizard.java
@@ -20,6 +20,7 @@ import org.eclipse.mylar.internal.bugzilla.ui.tasklist.BugzillaTask;
import org.eclipse.mylar.internal.tasklist.ITaskHandler;
import org.eclipse.mylar.internal.tasklist.TaskCategory;
import org.eclipse.mylar.internal.tasklist.TaskRepositoryManager;
+import org.eclipse.mylar.internal.tasklist.ui.TaskListUiUtil;
import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView;
import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
@@ -124,7 +125,9 @@ public class NewBugzillaReportWizard extends AbstractBugWizard {
MylarTaskListPlugin.getTaskListManager().moveToRoot(newTask);
}
BugzillaUiPlugin.getDefault().getBugzillaTaskListManager().addToBugzillaTaskRegistry((BugzillaTask) newTask);
- newTask.openTaskInEditor(false);
+
+// newTask.openTaskInEditor(false);
+ TaskListUiUtil.openEditor(newTask);
if (!newTask.isBugDownloaded())
newTask.scheduleDownloadReport();
diff --git a/org.eclipse.mylyn.help.ui/doc/new.html b/org.eclipse.mylyn.help.ui/doc/new.html
index 5f40fc191..a47cbb122 100644
--- a/org.eclipse.mylyn.help.ui/doc/new.html
+++ b/org.eclipse.mylyn.help.ui/doc/new.html
@@ -39,7 +39,9 @@ highlighted&nbsp; </span></p>
<p align="right"><b>Active folding improvements (3.2 only)</b></p>
</td>
<td valign="top" width="70%">
- Faster, etc, no more jumping around.</td>
+ Faster, etc, no more jumping around.&nbsp; No more custom folding
+ provider, which means that folding will work with additional 3.2 API
+ based folding providers.</td>
</tr>
<tr>
<td colspan="2">
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/ui/actions/OpenCorrespondingTaskAction.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/ui/actions/OpenCorrespondingTaskAction.java
index 7ebcd43d6..71501e92c 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/ui/actions/OpenCorrespondingTaskAction.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/bugs/ui/actions/OpenCorrespondingTaskAction.java
@@ -17,9 +17,9 @@ import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.mylar.internal.bugs.java.OpenBugzillaReportJob;
import org.eclipse.mylar.internal.bugzilla.core.BugzillaRepositoryUtil;
-import org.eclipse.mylar.internal.bugzilla.ui.BugzillaUITools;
import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
import org.eclipse.mylar.internal.ide.team.MylarContextChangeSet;
+import org.eclipse.mylar.internal.tasklist.ui.TaskListUiUtil;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.internal.ccvs.core.client.listeners.LogEntry;
import org.eclipse.team.internal.ui.synchronize.ChangeSetDiffNode;
@@ -72,7 +72,7 @@ public class OpenCorrespondingTaskAction implements IViewActionDelegate {
}
resolved = true;
} else if (url != null) {
- BugzillaUITools.openUrl("Web Browser", "Web Browser", url);
+ TaskListUiUtil.openUrl("Web Browser", "Web Browser", url);
resolved = true;
}
}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListUiTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListUiTest.java
index 2f2120676..0361688c6 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListUiTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasklist/tests/TaskListUiTest.java
@@ -20,6 +20,7 @@ import org.eclipse.mylar.internal.tasklist.Task;
import org.eclipse.mylar.internal.tasklist.TaskCategory;
import org.eclipse.mylar.internal.tasklist.TaskListManager;
import org.eclipse.mylar.internal.tasklist.TaskPriorityFilter;
+import org.eclipse.mylar.internal.tasklist.ui.TaskListUiUtil;
import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView;
import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.ITaskActivityListener;
@@ -197,10 +198,12 @@ public class TaskListUiTest extends TestCase {
numListenersBefore = listeners.size();
// open a task in editor
- cat1task1.setForceSyncOpen(true);
- cat1task1.openTaskInEditor(false);
- cat1task2.setForceSyncOpen(true);
- cat1task2.openTaskInEditor(false);
+// cat1task1.setForceSyncOpen(true);
+ TaskListUiUtil.openEditor(cat1task1, false);
+// cat1task1.openTaskInEditor(false);
+// cat1task2.setForceSyncOpen(true);
+// cat1task2.openTaskInEditor(false);
+ TaskListUiUtil.openEditor(cat1task2, false);
listeners = manager.getListeners();
numListenersDuring = listeners.size();
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ITaskHandler.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ITaskHandler.java
index 2b0502b12..b948b7ad2 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ITaskHandler.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ITaskHandler.java
@@ -14,7 +14,6 @@ import org.eclipse.jface.action.Action;
import org.eclipse.mylar.internal.tasklist.ui.ITaskListElement;
import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView;
import org.eclipse.mylar.tasklist.ITask;
-import org.eclipse.ui.IWorkbenchPage;
/**
* TODO: usage should be refactored to TaskListManager
@@ -23,9 +22,9 @@ import org.eclipse.ui.IWorkbenchPage;
*/
public interface ITaskHandler {
- public abstract void itemOpened(ITaskListElement element);
+// public abstract void itemOpened(ITaskListElement element);
- public abstract void taskClosed(ITask element, IWorkbenchPage page);
+// public abstract void taskClosed(ITask element, IWorkbenchPage page);
public abstract boolean acceptsItem(ITaskListElement element);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/Task.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/Task.java
index 02527106c..0ff14716e 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/Task.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/Task.java
@@ -19,17 +19,11 @@ import java.util.List;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
-import org.eclipse.mylar.internal.tasklist.ui.TaskEditorInput;
import org.eclipse.mylar.internal.tasklist.ui.TaskListImages;
import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.ITaskCategory;
-import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.internal.Workbench;
/**
* @author Mik Kersten
@@ -95,11 +89,6 @@ public class Task implements ITask {
private List<ITask> children = new ArrayList<ITask>();
- /**
- * For testing
- */
- private boolean forceSyncOpen;
-
@Override
public String toString() {
return description;
@@ -139,55 +128,7 @@ public class Task implements ITask {
public boolean isActive() {
return active;
}
-
- public void openTaskInEditor(boolean offline) {
- if (forceSyncOpen) {
- openTaskEditor();
- } else {
- Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
- public void run() {
- openTaskEditor();
- }
- });
- }
- }
-
- @Deprecated
- protected void openTaskEditor() {
-
- // get the active page so that we can reuse it
- IWorkbenchPage page = MylarTaskListPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow()
- .getActivePage();
-
- if (page == null) {
- return;
- }
-
- IEditorInput input = new TaskEditorInput(this);
- try {
- page.openEditor(input, TaskListPreferenceConstants.TASK_EDITOR_ID);
- } catch (PartInitException ex) {
- MylarStatusHandler.log(ex, "open failed");
- }
- }
-
-// /**
-// * Refreshes the tasklist viewer.
-// *
-// * TODO: shouldn't be coupled to the TaskListView
-// */
-// public void notifyTaskDataChange() {
-// final Task task = this;
-// if (Workbench.getInstance() != null && !Workbench.getInstance().getDisplay().isDisposed()) {
-// Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
-// public void run() {
-// if (TaskListView.getDefault() != null)
-// TaskListView.getDefault().notifyTaskDataChanged(task);
-// }
-// });
-// }
-// }
-
+
public String getToolTipText() {
return getDescription();
}
@@ -466,14 +407,6 @@ public class Task implements ITask {
return false;
}
- // public String getRepositoryUrl() {
- // return repositoryUrl;
- // }
- //
- // public void setRepositoryUrl(String repositoryUrl) {
- // this.repositoryUrl = repositoryUrl;
- // }
-
public TaskStatus getStatus() {
if (isCompleted()) {
return TaskStatus.COMPLETED;
@@ -482,10 +415,4 @@ public class Task implements ITask {
}
}
- /**
- * For testing TODO: move
- */
- public void setForceSyncOpen(boolean forceSyncOpen) {
- this.forceSyncOpen = forceSyncOpen;
- }
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskCategory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskCategory.java
index 742f927c6..99c011f32 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskCategory.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/TaskCategory.java
@@ -17,18 +17,12 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
-import org.eclipse.mylar.internal.tasklist.ui.CategoryEditorInput;
import org.eclipse.mylar.internal.tasklist.ui.TaskListImages;
import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.ITaskCategory;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.internal.Workbench;
/**
* @author Mik Kersten
@@ -174,29 +168,6 @@ public class TaskCategory implements ITaskCategory, Serializable {
return getDescription();
}
- public void openCategoryInEditor(boolean offline) {
- Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
- public void run() {
- openCategory();
- }
- });
- }
-
- public void openCategory() {
- IWorkbenchPage page = MylarTaskListPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow()
- .getActivePage();
- if (page == null) {
- return;
- }
-
- IEditorInput input = new CategoryEditorInput(this);
- try {
- page.openEditor(input, TaskListPreferenceConstants.CATEGORY_EDITOR_ID);
- } catch (PartInitException ex) {
- MylarStatusHandler.log(ex, "open failed");
- }
- }
-
public String toString() {
return getDescription();
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/OpenTaskEditorAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/OpenTaskEditorAction.java
index f93fc8fb3..bd440b79a 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/OpenTaskEditorAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/OpenTaskEditorAction.java
@@ -15,7 +15,8 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.mylar.internal.tasklist.Task;
+import org.eclipse.mylar.internal.tasklist.ui.TaskListUiUtil;
+import org.eclipse.mylar.tasklist.ITask;
/**
* @author Mik Kersten
@@ -41,9 +42,12 @@ public class OpenTaskEditorAction extends Action {
@Override
public void run() {
ISelection selection = viewer.getSelection();
- Object obj = ((IStructuredSelection) selection).getFirstElement();
- if (obj instanceof Task) {
- ((Task) obj).openTaskInEditor(false);
+ Object object = ((IStructuredSelection) selection).getFirstElement();
+ if (object instanceof ITask) {
+ TaskListUiUtil.openEditor((ITask)object);
}
+// if (obj instanceof Task) {
+// ((Task) obj).openTaskInEditor(false);
+// }
}
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerEditorPart.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerEditorPart.java
index afbc8a449..c7db82880 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerEditorPart.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/planner/ui/TaskPlannerEditorPart.java
@@ -639,11 +639,11 @@ public class TaskPlannerEditorPart extends EditorPart {
totalEstimatedHoursLabel.setText(LABEL_ESTIMATED + total + " hours");
}
- // public class OpenTaskEditorAction extends Action {
+ // public class OpenTaskListElementAction extends Action {
//
// private TableViewer viewer;
//
- // public OpenTaskEditorAction(TableViewer viewer) {
+ // public OpenTaskListElementAction(TableViewer viewer) {
// this.viewer = viewer;
// }
//
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 94eedbb9b..5f58bc91f 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
@@ -236,7 +236,6 @@ public class TaskInfoEditor extends EditorPart {
// refreshTaskListView(task);
MylarTaskListPlugin.getTaskListManager().notifyTaskChanged(task);
- MylarTaskListPlugin.getTaskListManager().notifyTaskChanged(task);
markDirty(false);
}
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
new file mode 100644
index 000000000..fc45e3af9
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/TaskListUiUtil.java
@@ -0,0 +1,124 @@
+/*******************************************************************************
+ * 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.tasklist.ui;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
+import org.eclipse.mylar.internal.tasklist.TaskListPreferenceConstants;
+import org.eclipse.mylar.tasklist.IQueryHit;
+import org.eclipse.mylar.tasklist.ITask;
+import org.eclipse.mylar.tasklist.ITaskCategory;
+import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.browser.IWebBrowser;
+import org.eclipse.ui.internal.Workbench;
+import org.eclipse.ui.internal.browser.WorkbenchBrowserSupport;
+
+/**
+ * @author Mik Kersten
+ */
+public class TaskListUiUtil {
+
+ public static void closeEditorInActivePage(ITask task) {
+ IWorkbenchPage page = MylarTaskListPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow()
+ .getActivePage();
+ if (page == null) {
+ return;
+ }
+ IEditorInput input = new TaskEditorInput(task);
+ IEditorPart editor = page.findEditor(input);
+ if (editor != null) {
+ page.closeEditor(editor, false);
+ }
+ }
+
+ public static void openEditor(final IQueryHit hit) {
+ ITask task = hit.getOrCreateCorrespondingTask();
+ if (task != null) {
+ openEditor(task);
+ } else {
+ MessageDialog.openInformation(null, MylarTaskListPlugin.TITLE_DIALOG,
+ "Could not create task for query hit: " + hit);
+ }
+ }
+
+ public static void openEditor(final ITask task) {
+ openEditor(task, true);
+ }
+
+ /**
+ * Set asyncExec true for testing purposes.
+ */
+ public static void openEditor(final ITask task, boolean asyncExec) {
+
+ final IEditorInput editorInput = new TaskEditorInput(task);
+ if (!asyncExec) {
+ openEditorInActivePage(editorInput, TaskListPreferenceConstants.TASK_EDITOR_ID);
+ } else {
+ Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ openEditorInActivePage(editorInput, TaskListPreferenceConstants.TASK_EDITOR_ID);
+ }
+ });
+ }
+ }
+
+ public static IEditorPart openEditorInActivePage(IEditorInput input, String editorId) {
+ try {
+ final IWorkbenchPage page = MylarTaskListPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow()
+ .getActivePage();
+ return page.openEditor(input, editorId);
+ } catch (PartInitException e) {
+ MylarStatusHandler.fail(e, "Open for editor failed: " + input + ", id: " + editorId, true);
+ }
+ return null;
+ }
+
+ public static void openEditor(ITaskCategory category) {
+ final IEditorInput input = new CategoryEditorInput(category);
+ Workbench.getInstance().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ openEditorInActivePage(input, TaskListPreferenceConstants.CATEGORY_EDITOR_ID);
+ }
+ });
+ }
+
+ public static void openUrl(String title, String tooltip, String url) {
+ try {
+ IWebBrowser b = null;
+ int flags = 0;
+ if (WorkbenchBrowserSupport.getInstance().isInternalWebBrowserAvailable()) {
+ flags = WorkbenchBrowserSupport.AS_EDITOR | WorkbenchBrowserSupport.LOCATION_BAR
+ | WorkbenchBrowserSupport.NAVIGATION_BAR;
+
+ } else {
+ flags = WorkbenchBrowserSupport.AS_EXTERNAL | WorkbenchBrowserSupport.LOCATION_BAR
+ | WorkbenchBrowserSupport.NAVIGATION_BAR;
+ }
+ b = WorkbenchBrowserSupport.getInstance().createBrowser(flags, "org.eclipse.mylar.tasklist." + title,
+ title, tooltip);
+ b.openURL(new URL(url));
+ } catch (PartInitException e) {
+ MessageDialog.openError(Display.getDefault().getActiveShell(), "Browser init error",
+ "Browser could not be initiated");
+ } catch (MalformedURLException e) {
+ MessageDialog.openError(Display.getDefault().getActiveShell(), "URL not found", "URL Could not be opened");
+ }
+ }
+}
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 722219f42..8f5768509 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
@@ -16,15 +16,14 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.mylar.core.MylarPlugin;
-import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
import org.eclipse.mylar.internal.tasklist.TaskCategory;
+import org.eclipse.mylar.internal.tasklist.ui.TaskListUiUtil;
import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView;
import org.eclipse.mylar.tasklist.IQueryHit;
-import org.eclipse.mylar.tasklist.ITask;
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.IWorkbenchPage;
import org.eclipse.ui.internal.Workbench;
import org.eclipse.ui.internal.WorkbenchImages;
@@ -75,18 +74,18 @@ public class DeleteAction extends Action {
MylarTaskListPlugin.getTaskListManager().deleteTask(task);
MylarPlugin.getContextManager().contextDeleted(task.getHandleIdentifier());
- IWorkbenchPage page = MylarTaskListPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow()
- .getActivePage();
-
- if (page == null) {
- return;
- }
- try {
- view.closeTaskEditors(task, page);
- } catch (Exception e) {
- MylarStatusHandler.log(e, "closing editors failed");
- }
- view.getViewer().refresh();
+ TaskListUiUtil.closeEditorInActivePage(task);
+// IWorkbenchPage page = MylarTaskListPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow()
+// .getActivePage();
+// if (page == null) {
+// return;
+// }
+// try {
+// view.closeTaskEditors(task, page);
+// } catch (Exception e) {
+// MylarStatusHandler.log(e, "closing editors failed");
+// }
+// view.getViewer().refresh();
} else if (selectedObject instanceof IRepositoryQuery) {
boolean deleteConfirmed = MessageDialog.openQuestion(Workbench.getInstance().getActiveWorkbenchWindow()
.getShell(), "Confirm delete", "Delete the selected query? Task data will not be deleted.");
@@ -102,15 +101,16 @@ public class DeleteAction extends Action {
TaskCategory cat = (TaskCategory) selectedObject;
for (ITask task : cat.getChildren()) {
MylarPlugin.getContextManager().contextDeleted(task.getHandleIdentifier());
- IWorkbenchPage page = MylarTaskListPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow()
- .getActivePage();
- if (page != null) {
- try {
- this.view.closeTaskEditors(task, page);
- } catch (Exception e) {
- MylarStatusHandler.log(e, " deletion failed");
- }
- }
+ TaskListUiUtil.closeEditorInActivePage(task);
+// IWorkbenchPage page = MylarTaskListPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow()
+// .getActivePage();
+// if (page != null) {
+// try {
+// this.view.closeTaskEditors(task, page);
+// } catch (Exception e) {
+// MylarStatusHandler.log(e, " deletion failed");
+// }
+// }
}
MylarTaskListPlugin.getTaskListManager().deleteCategory(cat);
view.getViewer().refresh();
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 d7b56c57a..a6c0c2799 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
@@ -18,6 +18,7 @@ import org.eclipse.jface.window.Window;
import org.eclipse.mylar.internal.tasklist.Task;
import org.eclipse.mylar.internal.tasklist.TaskCategory;
import org.eclipse.mylar.internal.tasklist.ui.TaskListImages;
+import org.eclipse.mylar.internal.tasklist.ui.TaskListUiUtil;
import org.eclipse.mylar.internal.tasklist.ui.views.TaskInputDialog;
import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView;
import org.eclipse.mylar.tasklist.ITask;
@@ -72,7 +73,8 @@ public class NewLocalTaskAction extends Action {
} else {
MylarTaskListPlugin.getTaskListManager().moveToRoot(newTask);
}
- newTask.openTaskInEditor(false);
+ TaskListUiUtil.openEditor(newTask);
+// newTask.openTaskInEditor(false);
view.getViewer().setSelection(new StructuredSelection(newTask));
view.getViewer().refresh();
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/OpenTaskEditorAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/OpenTaskEditorAction.java
deleted file mode 100644
index 3f2c56c06..000000000
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/OpenTaskEditorAction.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * 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.tasklist.ui.actions;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.mylar.internal.tasklist.ITaskHandler;
-import org.eclipse.mylar.internal.tasklist.Task;
-import org.eclipse.mylar.internal.tasklist.TaskCategory;
-import org.eclipse.mylar.internal.tasklist.ui.ITaskListElement;
-import org.eclipse.mylar.internal.tasklist.ui.views.TaskListView;
-import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
-
-/**
- * @author Mik Kersten and Ken Sueda
- */
-public class OpenTaskEditorAction extends Action {
-
- public static final String ID = "org.eclipse.mylar.tasklist.actions.open";
-
- private final TaskListView view;
-
- /**
- * @param view
- */
- public OpenTaskEditorAction(TaskListView view) {
- this.view = view;
- setText("Open");
- setToolTipText("Open TaskList Element");
- setId(ID);
- }
-
- @Override
- public void run() {
- ISelection selection = this.view.getViewer().getSelection();
- Object obj = ((IStructuredSelection) selection).getFirstElement();
- if (obj instanceof ITaskListElement) {
- ITaskListElement element = (ITaskListElement) obj;
- ITaskHandler taskHandler = MylarTaskListPlugin.getDefault().getHandlerForElement(element);
- if (taskHandler != null) {
- taskHandler.itemOpened(element);
- } else {
- if (element instanceof Task) {
- ((Task) element).openTaskInEditor(false);
- } else if (element instanceof TaskCategory) {
- ((TaskCategory) element).openCategoryInEditor(false);
- }
- }
- }
- this.view.getViewer().refresh(obj);
- }
-}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/OpenTaskListElementAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/OpenTaskListElementAction.java
new file mode 100644
index 000000000..c0bb23493
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/OpenTaskListElementAction.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * 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.tasklist.ui.actions;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredViewer;
+import org.eclipse.mylar.internal.tasklist.ui.TaskListUiUtil;
+import org.eclipse.mylar.tasklist.IQueryHit;
+import org.eclipse.mylar.tasklist.IRepositoryQuery;
+import org.eclipse.mylar.tasklist.ITask;
+import org.eclipse.mylar.tasklist.ITaskCategory;
+
+/**
+ * @author Mik Kersten
+ */
+public class OpenTaskListElementAction extends Action {
+
+ public static final String ID = "org.eclipse.mylar.tasklist.actions.open";
+
+ private final StructuredViewer viewer;
+
+ /**
+ * @param view
+ */
+ public OpenTaskListElementAction(StructuredViewer view) {
+ this.viewer = view;
+ setText("Open");
+ setToolTipText("Open Task List Element");
+ setId(ID);
+ }
+
+ @Override
+ public void run() {
+ ISelection selection = viewer.getSelection();
+ Object element = ((IStructuredSelection) selection).getFirstElement();
+ if (element instanceof ITask) {
+ TaskListUiUtil.openEditor((ITask)element);
+ } else if (element instanceof IQueryHit) {
+ TaskListUiUtil.openEditor((IQueryHit)element);
+ } else if (element instanceof ITaskCategory) {
+ TaskListUiUtil.openEditor((ITaskCategory)element);
+ } else if (element instanceof IRepositoryQuery) {
+
+ }
+
+// if (obj instanceof ITaskListElement) {
+// ITaskListElement element = (ITaskListElement) obj;
+// ITaskHandler taskHandler = MylarTaskListPlugin.getDefault().getHandlerForElement(element);
+// if (taskHandler != null) {
+// taskHandler.itemOpened(element);
+// } else {
+// if (element instanceof ITask) {
+// ((Task) element).openTaskInEditor(false);
+// } else if (element instanceof ITaskCategory) {
+// ((TaskCategory) element).openCategoryInEditor(false);
+// }
+// }
+// }
+// this.view.getViewer().refresh(obj);
+ }
+}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/TaskDeactivateAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/TaskDeactivateAction.java
index 786b7f036..dd0889ec9 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/TaskDeactivateAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/actions/TaskDeactivateAction.java
@@ -15,10 +15,10 @@ import org.eclipse.jface.action.Action;
import org.eclipse.mylar.core.MylarPlugin;
import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
import org.eclipse.mylar.internal.tasklist.ui.TaskListImages;
+import org.eclipse.mylar.internal.tasklist.ui.TaskListUiUtil;
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.IWorkbenchPage;
/**
* @author Mik Kersten
@@ -35,15 +35,13 @@ public class TaskDeactivateAction extends Action {
public void run(ITask task) {
MylarPlugin.getContextManager().actionObserved(this, Boolean.FALSE.toString());
- IWorkbenchPage page = MylarTaskListPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow()
- .getActivePage();
- if (page == null)
- return;
+
try {
if (task != null) {
MylarTaskListPlugin.getTaskListManager().deactivateTask(task);
TaskListView.getDefault().getViewer().refresh();
- TaskListView.getDefault().closeTaskEditors(task, page);
+ TaskListUiUtil.closeEditorInActivePage(task);
+// TaskListView.getDefault().closeTaskEditors(task, page);
}
} catch (Exception e) {
MylarStatusHandler.log(e, " Closing task editor on task deactivation failed");
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/preferences/MylarTaskListPreferencePage.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/preferences/MylarTaskListPreferencePage.java
index 670ed9681..515d10a14 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/preferences/MylarTaskListPreferencePage.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/preferences/MylarTaskListPreferencePage.java
@@ -92,7 +92,7 @@ public class MylarTaskListPreferencePage extends PreferencePage implements IWork
container.setLayout(new GridLayout(2, false));
container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- container.setText("Open Bug Reports With");
+ container.setText("Open Repository Tasks With");
reportEditor = new Button(container, SWT.RADIO);
reportEditor.setText("Bug editor");
reportEditor.setSelection(getPreferenceStore().getBoolean(TaskListPreferenceConstants.REPORT_OPEN_EDITOR));
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListDropAdapter.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListDropAdapter.java
index 85ba1ff75..6e23cf3dd 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListDropAdapter.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasklist/ui/views/TaskListDropAdapter.java
@@ -24,6 +24,7 @@ import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
import org.eclipse.mylar.internal.tasklist.Task;
import org.eclipse.mylar.internal.tasklist.TaskCategory;
import org.eclipse.mylar.internal.tasklist.ui.ITaskListElement;
+import org.eclipse.mylar.internal.tasklist.ui.TaskListUiUtil;
import org.eclipse.mylar.tasklist.IQueryHit;
import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
@@ -147,7 +148,8 @@ public class TaskListDropAdapter extends ViewerDropAdapter {
newTask.setPriority(MylarTaskListPlugin.PriorityLevel.P3.toString());
newTask.setUrl(url);
- newTask.openTaskInEditor(true);
+ TaskListUiUtil.openEditor(newTask);
+// newTask.openTaskInEditor(true);
return true;
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 2bb315de5..0a2b5f2ad 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
@@ -11,13 +11,10 @@
package org.eclipse.mylar.internal.tasklist.ui.views;
-import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
-import javax.security.auth.login.LoginException;
-
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IMenuCreator;
@@ -48,14 +45,12 @@ import org.eclipse.jface.window.Window;
import org.eclipse.mylar.internal.core.dt.MylarWebRef;
import org.eclipse.mylar.internal.core.util.MylarStatusHandler;
import org.eclipse.mylar.internal.tasklist.ITaskHandler;
-import org.eclipse.mylar.internal.tasklist.Task;
import org.eclipse.mylar.internal.tasklist.TaskCategory;
import org.eclipse.mylar.internal.tasklist.TaskPriorityFilter;
import org.eclipse.mylar.internal.tasklist.ui.AbstractTaskFilter;
import org.eclipse.mylar.internal.tasklist.ui.IDynamicSubMenuContributor;
import org.eclipse.mylar.internal.tasklist.ui.ITaskListElement;
import org.eclipse.mylar.internal.tasklist.ui.TaskCompleteFilter;
-import org.eclipse.mylar.internal.tasklist.ui.TaskEditorInput;
import org.eclipse.mylar.internal.tasklist.ui.TaskListImages;
import org.eclipse.mylar.internal.tasklist.ui.TaskListPatternFilter;
import org.eclipse.mylar.internal.tasklist.ui.actions.CollapseAllAction;
@@ -70,8 +65,8 @@ import org.eclipse.mylar.internal.tasklist.ui.actions.MarkTaskIncompleteAction;
import org.eclipse.mylar.internal.tasklist.ui.actions.NewCategoryAction;
import org.eclipse.mylar.internal.tasklist.ui.actions.NewLocalTaskAction;
import org.eclipse.mylar.internal.tasklist.ui.actions.NextTaskDropDownAction;
-import org.eclipse.mylar.internal.tasklist.ui.actions.OpenTaskEditorAction;
import org.eclipse.mylar.internal.tasklist.ui.actions.OpenTaskInExternalBrowserAction;
+import org.eclipse.mylar.internal.tasklist.ui.actions.OpenTaskListElementAction;
import org.eclipse.mylar.internal.tasklist.ui.actions.PreviousTaskDropDownAction;
import org.eclipse.mylar.internal.tasklist.ui.actions.RemoveFromCategoryAction;
import org.eclipse.mylar.internal.tasklist.ui.actions.RenameAction;
@@ -79,10 +74,10 @@ import org.eclipse.mylar.internal.tasklist.ui.actions.TaskActivateAction;
import org.eclipse.mylar.internal.tasklist.ui.actions.TaskDeactivateAction;
import org.eclipse.mylar.internal.tasklist.ui.actions.WorkOfflineAction;
import org.eclipse.mylar.tasklist.IQueryHit;
+import org.eclipse.mylar.tasklist.IRepositoryQuery;
import org.eclipse.mylar.tasklist.ITask;
import org.eclipse.mylar.tasklist.ITaskActivityListener;
import org.eclipse.mylar.tasklist.ITaskCategory;
-import org.eclipse.mylar.tasklist.IRepositoryQuery;
import org.eclipse.mylar.tasklist.MylarTaskListPlugin;
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DND;
@@ -101,14 +96,11 @@ import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.TreeItem;
import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.internal.Workbench;
@@ -151,7 +143,7 @@ public class TaskListView extends ViewPart {
private CopyDescriptionAction copyDescriptionAction;
- private OpenTaskEditorAction openTaskEditor;
+ private OpenTaskListElementAction openTaskEditor;
private OpenTaskInExternalBrowserAction openUrlInExternal;
@@ -241,7 +233,7 @@ public class TaskListView extends ViewPart {
refresh(null);
}
}
-
+
public void tasklistRead() {
refresh(null);
}
@@ -262,12 +254,12 @@ public class TaskListView extends ViewPart {
getViewer().getControl().setRedraw(true);
} else {
getViewer().refresh(element, true);
- }
+ }
}
}
});
}
- }
+ }
};
private final class PriorityDropDownAction extends Action implements IMenuCreator {
@@ -1076,7 +1068,7 @@ public class TaskListView extends ViewPart {
action.setEnabled(true);
} else if (action instanceof NewLocalTaskAction) {
action.setEnabled(false);
- } else if (action instanceof OpenTaskEditorAction) {
+ } else if (action instanceof OpenTaskListElementAction) {
action.setEnabled(true);
} else if (action instanceof CopyDescriptionAction) {
action.setEnabled(true);
@@ -1105,7 +1097,7 @@ public class TaskListView extends ViewPart {
} else {
action.setEnabled(false);
}
- } else if (action instanceof OpenTaskEditorAction) {
+ } else if (action instanceof OpenTaskListElementAction) {
action.setEnabled(true);
} else if (action instanceof CopyDescriptionAction) {
action.setEnabled(true);
@@ -1141,7 +1133,7 @@ public class TaskListView extends ViewPart {
autoClose = new ManageEditorsAction();
markIncompleteAction = new MarkTaskCompleteAction(this);
markCompleteAction = new MarkTaskIncompleteAction(this);
- openTaskEditor = new OpenTaskEditorAction(this);
+ openTaskEditor = new OpenTaskListElementAction(this.getViewer());
openUrlInExternal = new OpenTaskInExternalBrowserAction();
filterCompleteTask = new FilterCompletedTasksAction(this);
filterOnPriority = new PriorityDropDownAction();
@@ -1197,21 +1189,6 @@ public class TaskListView extends ViewPart {
// return false;
}
- public void closeTaskEditors(ITask task, IWorkbenchPage page) throws LoginException, IOException {
- ITaskHandler taskHandler = MylarTaskListPlugin.getDefault().getHandlerForElement(task);
- if (taskHandler != null) {
- taskHandler.taskClosed(task, page);
- } else if (task instanceof Task) {
- IEditorInput input = new TaskEditorInput((Task) task);
-
- IEditorPart editor = page.findEditor(input);
-
- if (editor != null) {
- page.closeEditor(editor, false);
- }
- }
- }
-
private void hookOpenAction() {
getViewer().addDoubleClickListener(new IDoubleClickListener() {
public void doubleClick(DoubleClickEvent event) {
@@ -1243,12 +1220,13 @@ public class TaskListView extends ViewPart {
}
}
-// public void notifyTaskDataChanged(ITask task) {
-// if (getViewer().getTree() != null && !getViewer().getTree().isDisposed()) {
-// getViewer().refresh();
-// expandToActiveTasks();
-// }
-// }
+ // public void notifyTaskDataChanged(ITask task) {
+ // if (getViewer().getTree() != null && !getViewer().getTree().isDisposed())
+ // {
+ // getViewer().refresh();
+ // expandToActiveTasks();
+ // }
+ // }
public static TaskListView getDefault() {
return INSTANCE;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskRepositoryClient.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskRepositoryClient.java
index 045ff1c69..f94eb2d88 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskRepositoryClient.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasklist/ITaskRepositoryClient.java
@@ -38,5 +38,7 @@ public interface ITaskRepositoryClient {
public abstract IWizard getQueryWizard(TaskRepository repository);
+ public abstract void openEditQueryDialog(IRepositoryQuery query);
+
public abstract IWizard getAddExistingTaskWizard(TaskRepository repository);
}
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 47a2dc1d9..132794d1d 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
@@ -517,20 +517,6 @@ public class MylarTaskListPlugin extends AbstractUIPlugin implements IStartup {
}
}
- /**
- * TODO: remove
- */
- public ReportOpenMode getReportMode() {
- return ReportOpenMode.EDITOR;
- // if (getPrefs().getBoolean(REPORT_OPEN_EDITOR)) {
- // return ReportOpenMode.EDITOR;
- // } else if (getPrefs().getBoolean(REPORT_OPEN_INTERNAL)) {
- // return ReportOpenMode.INTERNAL_BROWSER;
- // } else {
- // return ReportOpenMode.EXTERNAL_BROWSER;
- // }
- }
-
public List<ITaskHandler> getTaskHandlers() {
return taskHandlers;
}

Back to the top