Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrelves2009-03-10 14:27:38 -0400
committerrelves2009-03-10 14:27:38 -0400
commitda9105e4cb7aabd61d62f24a017676cd6efcbda8 (patch)
tree4c721e98fbb9b097e9a8b8cf643e97c0abc06656
parentc32e026aebe9e1d6783b4c00fbb5ec1ea9e3d7ce (diff)
downloadorg.eclipse.mylyn.tasks-da9105e4cb7aabd61d62f24a017676cd6efcbda8.tar.gz
org.eclipse.mylyn.tasks-da9105e4cb7aabd61d62f24a017676cd6efcbda8.tar.xz
org.eclipse.mylyn.tasks-da9105e4cb7aabd61d62f24a017676cd6efcbda8.zip
NEW - bug 267896: TaskList: new task drop-down does not respect canCreateTask
https://bugs.eclipse.org/bugs/show_bug.cgi?id=267896
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java9
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskAction.java24
2 files changed, 16 insertions, 17 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java
index 2f5bd3db1..944ac42c5 100644
--- a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryConnector.java
@@ -445,15 +445,6 @@ public class BugzillaRepositoryConnector extends AbstractRepositoryConnector {
return false;
}
- public static int getBugId(String taskId) throws CoreException {
- try {
- return Integer.parseInt(taskId);
- } catch (NumberFormatException e) {
- throw new CoreException(new Status(IStatus.ERROR, BugzillaCorePlugin.ID_PLUGIN, 0, "Invalid bug id: " //$NON-NLS-1$
- + taskId, e));
- }
- }
-
public static void addLanguageSetting(BugzillaLanguageSettings language) {
if (!languages.contains(language)) {
BugzillaRepositoryConnector.languages.add(language);
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskAction.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskAction.java
index 447a291b2..41345ee23 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskAction.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/actions/NewTaskAction.java
@@ -26,10 +26,12 @@ import org.eclipse.jface.action.Separator;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.mylyn.internal.commons.ui.TaskListImageDescriptor;
+import org.eclipse.mylyn.internal.tasks.core.ITaskRepositoryFilter;
import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
import org.eclipse.mylyn.internal.tasks.core.RepositoryQuery;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.views.TaskRepositoriesSorter;
+import org.eclipse.mylyn.tasks.core.AbstractRepositoryConnector;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.ui.TasksUi;
import org.eclipse.mylyn.tasks.ui.TasksUiImages;
@@ -154,21 +156,16 @@ public class NewTaskAction extends BaseSelectionListenerAction implements IMenuC
String connectorKind = ((RepositoryQuery) iterable_element).getConnectorKind();
TaskRepository repository = TasksUi.getRepositoryManager().getRepository(connectorKind,
repositoryUrl);
- if (repository != null && !repository.isOffline()
- && !repository.getConnectorKind().equals(LocalRepositoryConnector.CONNECTOR_KIND)) {
- includedRepositories.add(repository);
- }
+ markForInclusion(includedRepositories, repository);
}
}
}
if (includedRepositories.isEmpty()) {
+ // No repositories were added from working sets so show all
for (TaskRepository repository : TasksUi.getRepositoryManager().getAllRepositories()) {
- if (repository != null && !repository.isOffline()
- && !repository.getConnectorKind().equals(LocalRepositoryConnector.CONNECTOR_KIND)) {
- includedRepositories.add(repository);
- }
+ markForInclusion(includedRepositories, repository);
}
}
@@ -194,6 +191,17 @@ public class NewTaskAction extends BaseSelectionListenerAction implements IMenuC
new Separator(IWorkbenchActionConstants.MB_ADDITIONS);
}
+ private void markForInclusion(Set<TaskRepository> includedRepositories, TaskRepository repository) {
+ if (repository != null && !repository.getConnectorKind().equals(LocalRepositoryConnector.CONNECTOR_KIND)) {
+ AbstractRepositoryConnector connector = TasksUi.getRepositoryConnector(repository.getConnectorKind());
+ if (connector != null) {
+ if (ITaskRepositoryFilter.CAN_CREATE_NEW_TASK.accept(repository, connector)) {
+ includedRepositories.add(repository);
+ }
+ }
+ }
+ }
+
private RepositorySelectionAction addRepositoryAction(TaskRepository repository) {
if (repository == null) {
return null;

Back to the top