diff options
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks')
19 files changed, 191 insertions, 171 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaHit.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaHit.java index f7af99ef1..2e7a28de4 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaHit.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaHit.java @@ -11,7 +11,7 @@ package org.eclipse.mylar.tasks; -import org.eclipse.mylar.bugzilla.BugzillaImages; +import org.eclipse.mylar.bugzilla.core.BugzillaImages; import org.eclipse.mylar.bugzilla.core.BugzillaRepository; import org.eclipse.mylar.ui.MylarImages; import org.eclipse.swt.graphics.Image; diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaQueryCategory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaQueryCategory.java index 2858c3236..7a7259a0e 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaQueryCategory.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaQueryCategory.java @@ -22,9 +22,9 @@ import org.eclipse.core.runtime.NullProgressMonitor; import org.eclipse.core.runtime.Status; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.mylar.bugzilla.BugzillaPlugin; -import org.eclipse.mylar.bugzilla.IBugzillaConstants; -import org.eclipse.mylar.bugzilla.search.BugzillaSearchHit; +import org.eclipse.mylar.bugzilla.core.BugzillaPlugin; +import org.eclipse.mylar.bugzilla.core.IBugzillaConstants; +import org.eclipse.mylar.bugzilla.core.search.BugzillaSearchHit; import org.eclipse.mylar.tasks.bugzilla.search.BugzillaCategorySearchOperation; import org.eclipse.mylar.tasks.bugzilla.search.BugzillaResultCollector; import org.eclipse.mylar.tasks.bugzilla.search.BugzillaCategorySearchOperation.ICategorySearchListener; @@ -152,4 +152,13 @@ public class BugzillaQueryCategory extends AbstractCategory { this.url = url; } + public String getPriority() { + String highestPriority = "P5"; + for (BugzillaHit hit : hits) { + if (highestPriority.compareTo(hit.getPriority()) > 0) { + highestPriority = hit.getPriority(); + } + } + return highestPriority; + } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaTask.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaTask.java index 37db23c1b..bd5cc65d4 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaTask.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/BugzillaTask.java @@ -28,11 +28,11 @@ import org.eclipse.core.runtime.jobs.IJobChangeListener; import org.eclipse.core.runtime.jobs.ISchedulingRule; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.mylar.bugzilla.BugzillaPlugin; import org.eclipse.mylar.bugzilla.core.BugReport; +import org.eclipse.mylar.bugzilla.core.BugzillaPlugin; import org.eclipse.mylar.bugzilla.core.BugzillaRepository; import org.eclipse.mylar.bugzilla.core.IBugzillaBug; -import org.eclipse.mylar.bugzilla.offlineReports.OfflineReportsFile; +import org.eclipse.mylar.bugzilla.core.offline.OfflineReportsFile; import org.eclipse.mylar.bugzilla.ui.OfflineView; import org.eclipse.mylar.core.MylarPlugin; import org.eclipse.mylar.tasks.ui.BugzillaTaskEditorInput; diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/MylarTasksPlugin.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/MylarTasksPlugin.java index 3483dd815..b3d2e10b5 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/MylarTasksPlugin.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/MylarTasksPlugin.java @@ -11,7 +11,6 @@ package org.eclipse.mylar.tasks; import java.io.File; -import java.util.ArrayList; import java.util.List; import java.util.MissingResourceException; import java.util.ResourceBundle; @@ -55,11 +54,7 @@ public class MylarTasksPlugin extends AbstractUIPlugin implements IStartup { public static final String TASK_ID = "org.eclipse.mylar.tasks.userid"; public static final String DEFAULT_TASK_LIST_FILE = "tasklist" + FILE_EXTENSION; public static final String TASK_EDITOR_ID = "org.eclipse.mylar.tasks.ui.taskEditor"; - public static final String SHOW_P1_MODE = "org.eclipse.mylar.tasks.show.p1"; - public static final String SHOW_P2_MODE = "org.eclipse.mylar.tasks.show.p2"; - public static final String SHOW_P3_MODE = "org.eclipse.mylar.tasks.show.p3"; - public static final String SHOW_P4_MODE = "org.eclipse.mylar.tasks.show.p4"; - public static final String SHOW_P5_MODE = "org.eclipse.mylar.tasks.show.p5"; + public static final String SELECTED_PRIORITY = "org.eclipse.mylar.tasks.filter.priority"; public static final String FILTER_COMPLETE_MODE = "org.eclipse.mylar.tasks.filter.complete"; public static final String FILTER_INCOMPLETE_MODE = "org.eclipse.mylar.tasks.filter.incomplete"; @@ -70,7 +65,7 @@ public class MylarTasksPlugin extends AbstractUIPlugin implements IStartup { INTERNAL_BROWSER, EXTERNAL_BROWSER; } - public enum Priority_Level { + public enum PriorityLevel { P1, P2, P3, @@ -85,10 +80,10 @@ public class MylarTasksPlugin extends AbstractUIPlugin implements IStartup { case P3: return "P3"; case P4: return "P4"; case P5: return "P5"; - default: return "null"; + default: return "P5"; } } - public static Priority_Level fromString(String string) { + public static PriorityLevel fromString(String string) { if (string == null) return null; if (string.equals("P1")) return P1; if (string.equals("P2")) return P2; @@ -223,11 +218,12 @@ public class MylarTasksPlugin extends AbstractUIPlugin implements IStartup { @Override protected void initializeDefaultPreferences(IPreferenceStore store) { - store.setDefault(SHOW_P1_MODE, true); - store.setDefault(SHOW_P2_MODE, true); - store.setDefault(SHOW_P3_MODE, true); - store.setDefault(SHOW_P4_MODE, true); - store.setDefault(SHOW_P5_MODE, true); +// store.setDefault(SHOW_P1_MODE, true); +// store.setDefault(SHOW_P2_MODE, true); +// store.setDefault(SHOW_P3_MODE, true); +// store.setDefault(SHOW_P4_MODE, true); +// store.setDefault(SHOW_P5_MODE, true); + store.setDefault(SELECTED_PRIORITY, "P5"); store.setDefault(MylarPlugin.CLOSE_EDITORS, true); store.setDefault(REFRESH_QUERIES, false); store.setDefault(REPORT_OPEN_EDITOR, true); @@ -308,53 +304,17 @@ public class MylarTasksPlugin extends AbstractUIPlugin implements IStartup { return MylarPlugin.getDefault().getPreferenceStore(); } - public static void setPriorityLevel(Priority_Level pl, boolean showPriority) { - String key = ""; - switch(pl) { - case P1: key = SHOW_P1_MODE; break; - case P2: key = SHOW_P2_MODE; break; - case P3: key = SHOW_P3_MODE; break; - case P4: key = SHOW_P4_MODE; break; - case P5: key = SHOW_P5_MODE; break; - default: key = SHOW_P1_MODE; break; - } - getPrefs().setValue(key, showPriority); + public static void setPriorityLevel(PriorityLevel pl) { + getPrefs().setValue(SELECTED_PRIORITY, pl.toString()); } - public static boolean getPriorityLevel(Priority_Level pl) { - String key = ""; - switch(pl) { - case P1: key = SHOW_P1_MODE; break; - case P2: key = SHOW_P2_MODE; break; - case P3: key = SHOW_P3_MODE; break; - case P4: key = SHOW_P4_MODE; break; - case P5: key = SHOW_P5_MODE; break; - default: key = SHOW_P1_MODE; break; - } - if(getPrefs().contains(key)) { - return getPrefs().getBoolean(key); + public static String getPriorityLevel() { + if(getPrefs().contains(SELECTED_PRIORITY)) { + return getPrefs().getString(SELECTED_PRIORITY); } else { - return true; + return PriorityLevel.P5.toString(); } } - public static List<Priority_Level> getPriorityLevels() { - List<Priority_Level> levels = new ArrayList<Priority_Level>(); - if (getPriorityLevel(Priority_Level.P1)) { - levels.add(Priority_Level.P1); - } - if (getPriorityLevel(Priority_Level.P2)) { - levels.add(Priority_Level.P2); - } - if (getPriorityLevel(Priority_Level.P3)) { - levels.add(Priority_Level.P3); - } - if (getPriorityLevel(Priority_Level.P4)) { - levels.add(Priority_Level.P4); - } - if (getPriorityLevel(Priority_Level.P5)) { - levels.add(Priority_Level.P5); - } - return levels; - } + public void setFilterCompleteMode(boolean isFilterOn) { getPrefs().setValue(FILTER_COMPLETE_MODE, isFilterOn); } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskCategory.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskCategory.java index 5562381d1..50f69f9c1 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskCategory.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/TaskCategory.java @@ -38,6 +38,17 @@ public class TaskCategory extends AbstractCategory implements Serializable { return MylarImages.getImage(MylarImages.CATEGORY); } + + public String getPriority() { + String highestPriority = "P5"; + for (ITask task : tasks) { + if (highestPriority.compareTo(task.getPriority()) > 0) { + highestPriority = task.getPriority(); + } + } + return highestPriority; + } + public void addTask(ITask task) { if(task instanceof BugzillaTask){ BugzillaTask bugTask = MylarTasksPlugin.getTaskListManager().getTaskList().getFromBugzillaTaskRegistry(task.getHandle()); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaCacheFile.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaCacheFile.java index 7da0be56e..706e9ecf0 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaCacheFile.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaCacheFile.java @@ -20,7 +20,7 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.mylar.bugzilla.BugzillaPlugin; +import org.eclipse.mylar.bugzilla.core.BugzillaPlugin; import org.eclipse.mylar.bugzilla.core.IBugzillaBug; /** diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaReportNode.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaReportNode.java index 6ac4c26a5..9552f5f21 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaReportNode.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaReportNode.java @@ -22,7 +22,7 @@ import javax.security.auth.login.LoginException; import org.eclipse.mylar.bugzilla.core.BugReport; import org.eclipse.mylar.bugzilla.core.BugzillaRepository; -import org.eclipse.mylar.bugzilla.search.BugzillaSearchHit; +import org.eclipse.mylar.bugzilla.core.search.BugzillaSearchHit; /** diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaStructureBridge.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaStructureBridge.java index b3b62224d..812d455f5 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaStructureBridge.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/BugzillaStructureBridge.java @@ -27,7 +27,7 @@ import org.eclipse.core.runtime.Platform; import org.eclipse.mylar.bugzilla.core.BugReport; import org.eclipse.mylar.bugzilla.core.BugzillaRepository; import org.eclipse.mylar.bugzilla.core.IBugzillaBug; -import org.eclipse.mylar.bugzilla.search.BugzillaSearchHit; +import org.eclipse.mylar.bugzilla.core.search.BugzillaSearchHit; import org.eclipse.mylar.bugzilla.ui.editor.AbstractBugEditor; import org.eclipse.mylar.bugzilla.ui.outline.BugzillaOutlineNode; import org.eclipse.mylar.bugzilla.ui.outline.BugzillaReportSelection; diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/Util.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/Util.java index fb26f0500..1eb287c9c 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/Util.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/Util.java @@ -24,9 +24,9 @@ import org.eclipse.jdt.core.IJavaElement; import org.eclipse.jdt.core.IMember; import org.eclipse.jdt.core.IType; import org.eclipse.jface.preference.IPreferenceStore; -import org.eclipse.mylar.bugzilla.BugzillaPlugin; -import org.eclipse.mylar.bugzilla.BugzillaPreferences; -import org.eclipse.mylar.bugzilla.IBugzillaConstants; +import org.eclipse.mylar.bugzilla.core.BugzillaPlugin; +import org.eclipse.mylar.bugzilla.core.BugzillaPreferences; +import org.eclipse.mylar.bugzilla.core.IBugzillaConstants; import org.eclipse.mylar.core.model.InterestComparator; import org.eclipse.mylar.tasks.bugzilla.search.BugzillaMylarSearchOperation; diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaCategorySearchOperation.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaCategorySearchOperation.java index 5fd74e240..ea144c0e8 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaCategorySearchOperation.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaCategorySearchOperation.java @@ -21,9 +21,9 @@ import javax.security.auth.login.LoginException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.mylar.bugzilla.search.BugzillaSearchEngine; -import org.eclipse.mylar.bugzilla.search.BugzillaSearchQuery; -import org.eclipse.mylar.bugzilla.search.IBugzillaSearchOperation; +import org.eclipse.mylar.bugzilla.core.search.BugzillaSearchEngine; +import org.eclipse.mylar.bugzilla.core.search.BugzillaSearchQuery; +import org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchOperation; import org.eclipse.mylar.core.MylarPlugin; import org.eclipse.ui.actions.WorkspaceModifyOperation; @@ -110,7 +110,7 @@ public class BugzillaCategorySearchOperation extends WorkspaceModifyOperation } /** - * @see org.eclipse.mylar.bugzilla.search.IBugzillaSearchOperation#getStatus() + * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchOperation#getStatus() */ public IStatus getStatus() throws LoginException { // if a LoginException was thrown while trying to search, throw this diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearchJob.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearchJob.java index 209d17434..d6900c5c2 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearchJob.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearchJob.java @@ -21,8 +21,8 @@ import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.mylar.bugzilla.BugzillaPlugin; -import org.eclipse.mylar.bugzilla.IBugzillaConstants; +import org.eclipse.mylar.bugzilla.core.BugzillaPlugin; +import org.eclipse.mylar.bugzilla.core.IBugzillaConstants; import org.eclipse.mylar.tasks.bugzilla.BugzillaMylarBridge; import org.eclipse.ui.PlatformUI; diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearchOperation.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearchOperation.java index f1396a849..4ab4e16c5 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearchOperation.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaMylarSearchOperation.java @@ -29,10 +29,10 @@ import org.eclipse.jdt.core.IType; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.mylar.bugzilla.core.BugReport; import org.eclipse.mylar.bugzilla.core.Comment; -import org.eclipse.mylar.bugzilla.search.BugzillaSearchEngine; -import org.eclipse.mylar.bugzilla.search.BugzillaSearchHit; -import org.eclipse.mylar.bugzilla.search.BugzillaSearchQuery; -import org.eclipse.mylar.bugzilla.search.IBugzillaSearchOperation; +import org.eclipse.mylar.bugzilla.core.search.BugzillaSearchEngine; +import org.eclipse.mylar.bugzilla.core.search.BugzillaSearchHit; +import org.eclipse.mylar.bugzilla.core.search.BugzillaSearchQuery; +import org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchOperation; import org.eclipse.mylar.core.MylarPlugin; import org.eclipse.mylar.tasks.BugzillaTask; import org.eclipse.mylar.tasks.ITask; @@ -458,7 +458,7 @@ public class BugzillaMylarSearchOperation extends WorkspaceModifyOperation } /** - * @see org.eclipse.mylar.bugzilla.search.IBugzillaSearchOperation#getStatus() + * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchOperation#getStatus() */ public IStatus getStatus() throws LoginException { // if a LoginException was thrown while trying to search, throw this @@ -469,7 +469,7 @@ public class BugzillaMylarSearchOperation extends WorkspaceModifyOperation } /** - * @see org.eclipse.mylar.bugzilla.search.IBugzillaSearchOperation#getImageDescriptor() + * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchOperation#getImageDescriptor() */ public ImageDescriptor getImageDescriptor() { return null; @@ -494,14 +494,14 @@ public class BugzillaMylarSearchOperation extends WorkspaceModifyOperation } /** - * @see org.eclipse.mylar.bugzilla.search.IBugzillaSearchOperation#getQuery() + * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchOperation#getQuery() */ public BugzillaSearchQuery getQuery() { return query; } /** - * @see org.eclipse.mylar.bugzilla.search.IBugzillaSearchOperation#setQuery(org.eclipse.mylar.bugzilla.search.BugzillaSearchQuery) + * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchOperation#setQuery(org.eclipse.mylar.bugzilla.core.search.BugzillaSearchQuery) */ public void setQuery(BugzillaSearchQuery newQuery) { this.query = newQuery; diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaResultCollector.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaResultCollector.java index 3bbc47c2b..8325771ec 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaResultCollector.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/bugzilla/search/BugzillaResultCollector.java @@ -19,9 +19,9 @@ import java.util.List; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.mylar.bugzilla.search.BugzillaSearchHit; -import org.eclipse.mylar.bugzilla.search.IBugzillaSearchOperation; -import org.eclipse.mylar.bugzilla.search.IBugzillaSearchResultCollector; +import org.eclipse.mylar.bugzilla.core.search.BugzillaSearchHit; +import org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchOperation; +import org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchResultCollector; /** @@ -55,7 +55,7 @@ public class BugzillaResultCollector implements IBugzillaSearchResultCollector { private static final String MATCHES = "Bugzilla Mylar search - {0} matches"; /** - * @see org.eclipse.mylar.bugzilla.search.IBugzillaSearchResultCollector#aboutToStart() + * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchResultCollector#aboutToStart() */ public void aboutToStart(int startMatchCount) throws CoreException { // initiailize the number of matches @@ -66,7 +66,7 @@ public class BugzillaResultCollector implements IBugzillaSearchResultCollector { } /** - * @see org.eclipse.mylar.bugzilla.search.IBugzillaSearchResultCollector#accept(org.eclipse.mylar.bugzilla.search.BugzillaSearchHit) + * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchResultCollector#accept(org.eclipse.mylar.bugzilla.core.search.BugzillaSearchHit) */ public void accept(BugzillaSearchHit hit) throws CoreException { // add the result to the list of results @@ -87,7 +87,7 @@ public class BugzillaResultCollector implements IBugzillaSearchResultCollector { } /** - * @see org.eclipse.mylar.bugzilla.search.IBugzillaSearchResultCollector#done() + * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchResultCollector#done() */ public void done() { if (getProgressMonitor() != null) { @@ -104,28 +104,28 @@ public class BugzillaResultCollector implements IBugzillaSearchResultCollector { } /** - * @see org.eclipse.mylar.bugzilla.search.IBugzillaSearchResultCollector#getProgressMonitor() + * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchResultCollector#getProgressMonitor() */ public IProgressMonitor getProgressMonitor() { return monitor; } /** - * @see org.eclipse.mylar.bugzilla.search.IBugzillaSearchResultCollector#setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) + * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchResultCollector#setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) */ public void setProgressMonitor(IProgressMonitor monitor) { this.monitor = monitor; } /** - * @see org.eclipse.mylar.bugzilla.search.IBugzillaSearchResultCollector#setOperation(org.eclipse.mylar.bugzilla.search.BugzillaSearchOperation) + * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchResultCollector#setOperation(org.eclipse.mylar.bugzilla.core.search.BugzillaSearchOperation) */ public void setOperation(IBugzillaSearchOperation operation) { this.operation = operation; } /** - * @see org.eclipse.mylar.bugzilla.search.IBugzillaSearchResultCollector#getOperation() + * @see org.eclipse.mylar.bugzilla.core.search.IBugzillaSearchResultCollector#getOperation() */ public IBugzillaSearchOperation getOperation() { return operation; diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/BugzillaTaskEditor.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/BugzillaTaskEditor.java index bc450ce42..66de9939e 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/BugzillaTaskEditor.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/BugzillaTaskEditor.java @@ -16,8 +16,8 @@ package org.eclipse.mylar.tasks.ui; import org.eclipse.core.resources.IMarker; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.mylar.bugzilla.IBugzillaAttributeListener; import org.eclipse.mylar.bugzilla.core.BugReport; +import org.eclipse.mylar.bugzilla.core.IBugzillaAttributeListener; import org.eclipse.mylar.bugzilla.ui.editor.AbstractBugEditor; import org.eclipse.mylar.bugzilla.ui.editor.ExistingBugEditor; import org.eclipse.mylar.bugzilla.ui.editor.ExistingBugEditorInput; diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ClearContextAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ClearContextAction.java index 458f1ad56..3537a371d 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ClearContextAction.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/actions/ClearContextAction.java @@ -39,18 +39,19 @@ public class ClearContextAction extends Action { setId(ID); setImageDescriptor(MylarImages.ERASE_TASKSCAPE); } + @Override public void run() { // MylarPlugin.getDefault().actionObserved(this); Object selectedObject = ((IStructuredSelection)this.view.getViewer().getSelection()).getFirstElement(); if (selectedObject != null && selectedObject instanceof ITask) { - ITask task = (ITask) selectedObject; - if (task.isActive()) { - MessageDialog.openError(Workbench.getInstance() - .getActiveWorkbenchWindow().getShell(), "Clear context failed", - "Task must be deactivated before clearing task context."); - return; - } +// ITask task = (ITask) selectedObject; +// if (task.isActive()) { +// MessageDialog.openError(Workbench.getInstance() +// .getActiveWorkbenchWindow().getShell(), "Clear context failed", +// "Task must be deactivated before clearing task context."); +// return; +// } boolean deleteConfirmed = MessageDialog.openQuestion( Workbench.getInstance().getActiveWorkbenchWindow().getShell(), "Confirm clear context", diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/BugzillaQueryDialog.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/BugzillaQueryDialog.java index 3ce476e95..3cc3e4762 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/BugzillaQueryDialog.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/BugzillaQueryDialog.java @@ -18,9 +18,9 @@ import org.eclipse.jface.dialogs.IInputValidator; import org.eclipse.jface.dialogs.InputDialog; import org.eclipse.jface.operation.IRunnableContext; import org.eclipse.jface.viewers.ISelection; -import org.eclipse.mylar.bugzilla.saveQuery.GetQueryDialog; -import org.eclipse.mylar.bugzilla.saveQuery.SaveQueryDialog; -import org.eclipse.mylar.bugzilla.search.BugzillaSearchPage; +import org.eclipse.mylar.bugzilla.core.search.BugzillaSearchPage; +import org.eclipse.mylar.bugzilla.ui.query.GetQueryDialog; +import org.eclipse.mylar.bugzilla.ui.query.SaveQueryDialog; import org.eclipse.search.ui.ISearchPageContainer; import org.eclipse.swt.SWT; import org.eclipse.swt.events.SelectionAdapter; diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListLabelProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListLabelProvider.java index 756788d93..19c6325a3 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListLabelProvider.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListLabelProvider.java @@ -47,6 +47,9 @@ public class TaskListLabelProvider extends LabelProvider implements ITableLabelP case 1: return ""; case 2: + if (element instanceof AbstractCategory) { + return ""; + } return element.getPriority(); case 3: return element.getDescription(true); diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListView.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListView.java index 0bb2693df..e04efcbc4 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListView.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/ui/views/TaskListView.java @@ -60,7 +60,6 @@ import org.eclipse.mylar.tasks.ITaskListElement; import org.eclipse.mylar.tasks.MylarTasksPlugin; import org.eclipse.mylar.tasks.Task; import org.eclipse.mylar.tasks.TaskCategory; -import org.eclipse.mylar.tasks.MylarTasksPlugin.Priority_Level; import org.eclipse.mylar.tasks.ui.BugzillaTaskEditorInput; import org.eclipse.mylar.tasks.ui.TaskEditorInput; import org.eclipse.mylar.tasks.ui.actions.ClearContextAction; @@ -157,7 +156,7 @@ public class TaskListView extends ViewPart { public static final String tableSortIdentifier = "org.eclipse.mylar.tasks.ui.views.tasklist.sortIndex"; private int sortIndex = 2; - private String[] PRIORITY_LEVELS = { "P1", "P2", "P3", "P4", "P5" }; + private static String[] PRIORITY_LEVELS = { "P1", "P2", "P3", "P4", "P5" }; private final class PriorityDropDownAction extends Action implements IMenuCreator { private Menu dropDownMenu = null; @@ -199,17 +198,12 @@ public class TaskListView extends ViewPart { Action P1 = new Action(PRIORITY_LEVELS[0], AS_CHECK_BOX) { @Override public void run() { - MylarTasksPlugin.setPriorityLevel(MylarTasksPlugin.Priority_Level.P1, isChecked()); - if (isChecked()) { - priorityFilter.displayPriority(PRIORITY_LEVELS[0]); - } else { - priorityFilter.hidePriority(PRIORITY_LEVELS[0]); - } + MylarTasksPlugin.setPriorityLevel(MylarTasksPlugin.PriorityLevel.P1); + priorityFilter.displayPrioritiesAbove(PRIORITY_LEVELS[0]); viewer.refresh(); } }; P1.setEnabled(true); - P1.setChecked(MylarTasksPlugin.getPriorityLevel(MylarTasksPlugin.Priority_Level.P1)); P1.setToolTipText(PRIORITY_LEVELS[0]); ActionContributionItem item= new ActionContributionItem(P1); item.fill(dropDownMenu, -1); @@ -217,17 +211,12 @@ public class TaskListView extends ViewPart { Action P2 = new Action(PRIORITY_LEVELS[1], AS_CHECK_BOX) { @Override public void run() { - MylarTasksPlugin.setPriorityLevel(MylarTasksPlugin.Priority_Level.P2, isChecked()); - if (isChecked()) { - priorityFilter.displayPriority(PRIORITY_LEVELS[1]); - } else { - priorityFilter.hidePriority(PRIORITY_LEVELS[1]); - } + MylarTasksPlugin.setPriorityLevel(MylarTasksPlugin.PriorityLevel.P2); + priorityFilter.displayPrioritiesAbove(PRIORITY_LEVELS[1]); viewer.refresh(); } }; - P2.setEnabled(true); - P2.setChecked(MylarTasksPlugin.getPriorityLevel(MylarTasksPlugin.Priority_Level.P2)); + P2.setEnabled(true); P2.setToolTipText(PRIORITY_LEVELS[1]); item= new ActionContributionItem(P2); item.fill(dropDownMenu, -1); @@ -235,17 +224,12 @@ public class TaskListView extends ViewPart { Action P3 = new Action(PRIORITY_LEVELS[2], AS_CHECK_BOX) { @Override public void run() { - MylarTasksPlugin.setPriorityLevel(MylarTasksPlugin.Priority_Level.P3, isChecked()); - if (isChecked()) { - priorityFilter.displayPriority(PRIORITY_LEVELS[2]); - } else { - priorityFilter.hidePriority(PRIORITY_LEVELS[2]); - } + MylarTasksPlugin.setPriorityLevel(MylarTasksPlugin.PriorityLevel.P3); + priorityFilter.displayPrioritiesAbove(PRIORITY_LEVELS[2]); viewer.refresh(); } }; - P3.setEnabled(true); - P3.setChecked(MylarTasksPlugin.getPriorityLevel(MylarTasksPlugin.Priority_Level.P3)); + P3.setEnabled(true); P3.setToolTipText(PRIORITY_LEVELS[2]); item= new ActionContributionItem(P3); item.fill(dropDownMenu, -1); @@ -253,17 +237,12 @@ public class TaskListView extends ViewPart { Action P4 = new Action(PRIORITY_LEVELS[3], AS_CHECK_BOX) { @Override public void run() { - MylarTasksPlugin.setPriorityLevel(MylarTasksPlugin.Priority_Level.P4, isChecked()); - if (isChecked()) { - priorityFilter.displayPriority(PRIORITY_LEVELS[3]); - } else { - priorityFilter.hidePriority(PRIORITY_LEVELS[3]); - } + MylarTasksPlugin.setPriorityLevel(MylarTasksPlugin.PriorityLevel.P4); + priorityFilter.displayPrioritiesAbove(PRIORITY_LEVELS[3]); viewer.refresh(); } }; - P4.setEnabled(true); - P4.setChecked(MylarTasksPlugin.getPriorityLevel(MylarTasksPlugin.Priority_Level.P4)); + P4.setEnabled(true); P4.setToolTipText(PRIORITY_LEVELS[3]); item= new ActionContributionItem(P4); item.fill(dropDownMenu, -1); @@ -271,20 +250,38 @@ public class TaskListView extends ViewPart { Action P5 = new Action(PRIORITY_LEVELS[4], AS_CHECK_BOX) { @Override public void run() { - MylarTasksPlugin.setPriorityLevel(MylarTasksPlugin.Priority_Level.P5, isChecked()); - if (isChecked()) { - priorityFilter.displayPriority(PRIORITY_LEVELS[4]); - } else { - priorityFilter.hidePriority(PRIORITY_LEVELS[4]); - } + MylarTasksPlugin.setPriorityLevel(MylarTasksPlugin.PriorityLevel.P5); + priorityFilter.displayPrioritiesAbove(PRIORITY_LEVELS[4]); viewer.refresh(); } }; P5.setEnabled(true); - P5.setChecked(MylarTasksPlugin.getPriorityLevel(MylarTasksPlugin.Priority_Level.P5)); P5.setToolTipText(PRIORITY_LEVELS[4]); item= new ActionContributionItem(P5); - item.fill(dropDownMenu, -1); + item.fill(dropDownMenu, -1); + + String priority = MylarTasksPlugin.getPriorityLevel(); + if (priority.equals(PRIORITY_LEVELS[0])) { + P1.setChecked(true); + } else if (priority.equals(PRIORITY_LEVELS[1])) { + P1.setChecked(true); + P2.setChecked(true); + } else if (priority.equals(PRIORITY_LEVELS[2])) { + P1.setChecked(true); + P2.setChecked(true); + P3.setChecked(true); + } else if (priority.equals(PRIORITY_LEVELS[3])) { + P1.setChecked(true); + P2.setChecked(true); + P3.setChecked(true); + P4.setChecked(true); + } else if (priority.equals(PRIORITY_LEVELS[4])) { + P1.setChecked(true); + P2.setChecked(true); + P3.setChecked(true); + P4.setChecked(true); + P5.setChecked(true); + } } public void run() { this.setChecked(isChecked()); @@ -321,19 +318,36 @@ public class TaskListView extends ViewPart { }; public class PriorityFilter extends ViewerFilter { - // list of priorities that will be shown in the tasklistview private List<String> priorities = new ArrayList<String>(); - public PriorityFilter() { - for (Priority_Level level : MylarTasksPlugin.getPriorityLevels()) { - displayPriority(level.toString()); - } + public PriorityFilter() { + displayPrioritiesAbove(MylarTasksPlugin.getPriorityLevel()); } - public void displayPriority(String p) { - if (!priorities.contains(p)) { - priorities.add(p); - } + public void displayPrioritiesAbove(String p) { + priorities.clear(); + if (p.equals(PRIORITY_LEVELS[0])) { + priorities.add(PRIORITY_LEVELS[0]); + } + if (p.equals(PRIORITY_LEVELS[1])) { + priorities.add(PRIORITY_LEVELS[0]); + priorities.add(PRIORITY_LEVELS[1]); + } else if (p.equals(PRIORITY_LEVELS[2])) { + priorities.add(PRIORITY_LEVELS[0]); + priorities.add(PRIORITY_LEVELS[1]); + priorities.add(PRIORITY_LEVELS[2]); + } else if (p.equals(PRIORITY_LEVELS[3])) { + priorities.add(PRIORITY_LEVELS[0]); + priorities.add(PRIORITY_LEVELS[1]); + priorities.add(PRIORITY_LEVELS[2]); + priorities.add(PRIORITY_LEVELS[3]); + } else if (p.equals(PRIORITY_LEVELS[4])) { + priorities.add(PRIORITY_LEVELS[0]); + priorities.add(PRIORITY_LEVELS[1]); + priorities.add(PRIORITY_LEVELS[2]); + priorities.add(PRIORITY_LEVELS[3]); + priorities.add(PRIORITY_LEVELS[4]); + } } public void hidePriority(String p) { @@ -341,23 +355,25 @@ public class TaskListView extends ViewPart { } @Override public boolean select(Viewer viewer, Object parentElement, Object element) { - if (element instanceof ITaskListElement && !(element instanceof AbstractCategory)) { + if (element instanceof ITaskListElement) { ITaskListElement task = (ITaskListElement) element; if (priorities.size() == PRIORITY_LEVELS.length) { return true; } else { - for (String filter : priorities) { - if (task.getPriority().equals(filter)) { - return true; - } - } - return false; + return checkTask(task); } } else { return true; - } + } + } + private boolean checkTask(ITaskListElement task) { + for (String filter : priorities) { + if (task.getPriority().equals(filter)) { + return true; + } + } + return false; } - }; class TaskListContentProvider implements IStructuredContentProvider, ITreeContentProvider { @@ -590,7 +606,8 @@ public class TaskListView extends ViewPart { public int compare(Viewer compareViewer, Object o1, Object o2) { if (o1 instanceof AbstractCategory) { if (o2 instanceof AbstractCategory) { - return 0; + return ((AbstractCategory)o1).getDescription(false).compareTo( + ((AbstractCategory)o2).getDescription(false)); } else { return -1; } @@ -696,7 +713,7 @@ public class TaskListView extends ViewPart { } viewer.refresh(); } - + /** * This is a callback that will allow us * to create the viewer and initialize it. @@ -847,7 +864,7 @@ public class TaskListView extends ViewPart { MylarTasksPlugin.getTaskListManager().getTaskList().addToBugzillaTaskRegistry(bt); } viewer.setSelection(null); - viewer.refresh(); + viewer.refresh(); return true; } } diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/XmlUtil.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/XmlUtil.java index 0ac234ab8..541532f5c 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/XmlUtil.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/tasks/util/XmlUtil.java @@ -89,7 +89,11 @@ public class XmlUtil { } } for (ITask task : tlist.getRootTasks()) { - writeTask(task, doc, root); + try { + writeTask(task, doc, root); + }catch (Exception e) { + MylarPlugin.log(e, e.getMessage()); + } } doc.appendChild(root); writeDOMtoFile(doc, outFile); @@ -100,7 +104,12 @@ public class XmlUtil { Element node = doc.createElement("BugzillaTaskRegistry"); for (BugzillaTask t : bugzillaTaskRegistry.values()) { - writeTask(t, doc, node); + try { + writeTask(t, doc, node); + } catch (Exception e) { + MylarPlugin.log(e, e.getMessage()); + } + } parent.appendChild(node); } @@ -236,7 +245,12 @@ public class XmlUtil { node.setAttribute("Name", cat.getDescription(false)); for (ITask t : cat.getChildren()) { - writeTask(t, doc, node); + try { + writeTask(t, doc, node); + } catch (Exception e) { + MylarPlugin.log(e, e.getMessage()); + } + } parent.appendChild(node); } @@ -268,8 +282,13 @@ public class XmlUtil { if (task instanceof BugzillaTask) { BugzillaTask bt = (BugzillaTask) task; node.setAttribute("Bugzilla", "true"); - node.setAttribute("LastDate", new Long(bt.getLastRefreshTime() - .getTime()).toString()); + if (bt.getLastRefresh() != null) { + node.setAttribute("LastDate", new Long(bt.getLastRefreshTime() + .getTime()).toString()); + } else { + node.setAttribute("LastDate", new Long(new Date().getTime()).toString()); + } + if (bt.isDirty()) { node.setAttribute("Dirty", "true"); } else { |