summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2013-04-21 20:11:31 (EDT)
committerGerrit Code Review @ Eclipse.org2013-04-21 22:42:03 (EDT)
commit14187a12a8a4ba0b18ff3eb8fd726c3fedf1c4a6 (patch)
tree5b599bd4b8077b59b04c3029305daa3a4b025e95
parent81db1b68923db48643bf25c4cc75b9581938f429 (diff)
downloadorg.eclipse.mylyn.tasks-14187a12a8a4ba0b18ff3eb8fd726c3fedf1c4a6.zip
org.eclipse.mylyn.tasks-14187a12a8a4ba0b18ff3eb8fd726c3fedf1c4a6.tar.gz
org.eclipse.mylyn.tasks-14187a12a8a4ba0b18ff3eb8fd726c3fedf1c4a6.tar.bz2
387710: [api] task category property should be APIrefs/changes/87/12087/2
Change-Id: I460afb96bb37f84dddfd3b8d48fc58f47891f382 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=387710
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryMigrator.java5
-rw-r--r--org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java3
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IRepositoryConstants.java28
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryManager.java11
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java46
-rw-r--r--org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/TaskRepositoryTest.java14
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/LocalRepositoryMigrator.java5
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskRepositoriesNavigatorContentProvider.java5
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracRepositoryMigrator.java5
-rw-r--r--org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracRepositorySettingsPage.java4
10 files changed, 96 insertions, 30 deletions
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryMigrator.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryMigrator.java
index 0172bce..1f31898 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryMigrator.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositoryMigrator.java
@@ -12,7 +12,6 @@
package org.eclipse.mylyn.internal.bugzilla.ui.tasklist;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
-import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants;
import org.eclipse.mylyn.internal.tasks.ui.editors.TaskEditorExtensions;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryMigrator;
import org.eclipse.mylyn.tasks.core.TaskRepository;
@@ -31,8 +30,8 @@ public class BugzillaRepositoryMigrator extends AbstractRepositoryMigrator {
@Override
public boolean migrateRepository(TaskRepository repository) {
boolean migrated = false;
- if (repository.getProperty(IRepositoryConstants.PROPERTY_CATEGORY) == null) {
- repository.setProperty(IRepositoryConstants.PROPERTY_CATEGORY, IRepositoryConstants.CATEGORY_BUGS);
+ if (repository.getCategory() == null) {
+ repository.setCategory(TaskRepository.CATEGORY_BUGS);
migrated = true;
}
// FIXME the Eclipse.org Bugzilla URL should not be hard coded here
diff --git a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java
index 228f20c..eabb201 100644
--- a/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java
+++ b/org.eclipse.mylyn.bugzilla.ui/src/org/eclipse/mylyn/internal/bugzilla/ui/tasklist/BugzillaRepositorySettingsPage.java
@@ -39,7 +39,6 @@ import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaStatus;
import org.eclipse.mylyn.internal.bugzilla.core.IBugzillaConstants;
import org.eclipse.mylyn.internal.bugzilla.core.RepositoryConfiguration;
-import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants;
import org.eclipse.mylyn.internal.tasks.core.RepositoryTemplateManager;
import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin;
import org.eclipse.mylyn.internal.tasks.ui.util.TasksUiInternal;
@@ -664,7 +663,7 @@ public class BugzillaRepositorySettingsPage extends AbstractRepositorySettingsPa
private void applyToInternal(final TaskRepository repository) {
super.applyTo(repository);
- repository.setProperty(IRepositoryConstants.PROPERTY_CATEGORY, IRepositoryConstants.CATEGORY_BUGS);
+ repository.setCategory(TaskRepository.CATEGORY_BUGS);
repository.setProperty(IBugzillaConstants.REPOSITORY_SETTING_SHORT_LOGIN,
String.valueOf(cleanQAContact.getSelection()));
repository.setProperty(IBugzillaConstants.BUGZILLA_LANGUAGE_SETTING, languageSettingCombo.getText());
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IRepositoryConstants.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IRepositoryConstants.java
index 92e101e..14948b3 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IRepositoryConstants.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/IRepositoryConstants.java
@@ -11,6 +11,8 @@
package org.eclipse.mylyn.internal.tasks.core;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+
/**
* @author Mik Kersten
* @since 2.0
@@ -39,13 +41,25 @@ public interface IRepositoryConstants {
public static final String KIND_UNKNOWN = "<unknown>"; //$NON-NLS-1$
- public static final String CATEGORY_TASKS = "org.eclipse.mylyn.category.tasks"; //$NON-NLS-1$
-
- public static final String CATEGORY_BUGS = "org.eclipse.mylyn.category.bugs"; //$NON-NLS-1$
-
- public static final String CATEGORY_BUILD = "org.eclipse.mylyn.category.build"; //$NON-NLS-1$
-
- public static final String CATEGORY_REVIEW = "org.eclipse.mylyn.category.review"; //$NON-NLS-1$
+ /**
+ * @deprecated Use {@link TaskRepository#CATEGORY_TASKS} instead
+ */
+ public static final String CATEGORY_TASKS = TaskRepository.CATEGORY_TASKS; //$NON-NLS-1$
+
+ /**
+ * @deprecated Use {@link TaskRepository#CATEGORY_BUGS} instead
+ */
+ public static final String CATEGORY_BUGS = TaskRepository.CATEGORY_BUGS; //$NON-NLS-1$
+
+ /**
+ * @deprecated Use {@link TaskRepository#CATEGORY_BUILD} instead
+ */
+ public static final String CATEGORY_BUILD = TaskRepository.CATEGORY_BUILD; //$NON-NLS-1$
+
+ /**
+ * @deprecated Use {@link TaskRepository#CATEGORY_REVIEW} instead
+ */
+ public static final String CATEGORY_REVIEW = TaskRepository.CATEGORY_REVIEW; //$NON-NLS-1$
public static final String CATEGORY_OTHER = "org.eclipse.mylyn.category.other"; //$NON-NLS-1$
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryManager.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryManager.java
index 7c28b3c..e8cd3d6 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryManager.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/TaskRepositoryManager.java
@@ -85,13 +85,13 @@ public class TaskRepositoryManager implements IRepositoryManager {
public TaskRepositoryManager() {
this.migrators = Collections.emptyList();
- Category catTasks = new Category(IRepositoryConstants.CATEGORY_TASKS, "Tasks", 0); //$NON-NLS-1$
+ Category catTasks = new Category(TaskRepository.CATEGORY_TASKS, "Tasks", 0); //$NON-NLS-1$
repositoryCategories.put(catTasks.getId(), catTasks);
- Category catBugs = new Category(IRepositoryConstants.CATEGORY_BUGS, "Bugs", 100); //$NON-NLS-1$
+ Category catBugs = new Category(TaskRepository.CATEGORY_BUGS, "Bugs", 100); //$NON-NLS-1$
repositoryCategories.put(catBugs.getId(), catBugs);
- Category catBuild = new Category(IRepositoryConstants.CATEGORY_BUILD, "Builds", 200); //$NON-NLS-1$
+ Category catBuild = new Category(TaskRepository.CATEGORY_BUILD, "Builds", 200); //$NON-NLS-1$
repositoryCategories.put(catBuild.getId(), catBuild);
- Category catReview = new Category(IRepositoryConstants.CATEGORY_REVIEW, "Reviews", 300); //$NON-NLS-1$
+ Category catReview = new Category(TaskRepository.CATEGORY_REVIEW, "Reviews", 300); //$NON-NLS-1$
repositoryCategories.put(catReview.getId(), catReview);
Category catOther = new Category(IRepositoryConstants.CATEGORY_OTHER, "Other", 400); //$NON-NLS-1$
repositoryCategories.put(catOther.getId(), catOther);
@@ -518,8 +518,7 @@ public class TaskRepositoryManager implements IRepositoryManager {
}
public Category getCategory(TaskRepository repository) {
- String categoryId = repository.getProperty(IRepositoryConstants.PROPERTY_CATEGORY);
- return getCategory(categoryId);
+ return getCategory(repository.getCategory());
}
public void initialize(List<AbstractRepositoryMigrator> repositoryMigrators) {
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java
index 7fa69f3..3cc5f42 100644
--- a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/tasks/core/TaskRepository.java
@@ -147,6 +147,38 @@ public final class TaskRepository extends PlatformObject {
public static final String OFFLINE = "org.eclipse.mylyn.tasklist.repositories.offline"; //$NON-NLS-1$
+ /**
+ * Category for repositories that manage tasks.
+ *
+ * @see #setCategory(String)
+ * @since 3.9
+ */
+ public static final String CATEGORY_TASKS = "org.eclipse.mylyn.category.tasks"; //$NON-NLS-1$
+
+ /**
+ * Category for repositories that manage bugs.
+ *
+ * @see #setCategory(String)
+ * @since 3.9
+ */
+ public static final String CATEGORY_BUGS = "org.eclipse.mylyn.category.bugs"; //$NON-NLS-1$
+
+ /**
+ * Category for repositories that manage builds.
+ *
+ * @see #setCategory(String)
+ * @since 3.9
+ */
+ public static final String CATEGORY_BUILD = "org.eclipse.mylyn.category.build"; //$NON-NLS-1$
+
+ /**
+ * Category for repositories that manage reviews.
+ *
+ * @see #setCategory(String)
+ * @since 3.9
+ */
+ public static final String CATEGORY_REVIEW = "org.eclipse.mylyn.category.review"; //$NON-NLS-1$
+
// HACK: Lock used to work around race condition in
// Platform.add/get/flushAuthorizationInfo()
private static final Object LOCK = new Object();
@@ -938,4 +970,18 @@ public final class TaskRepository extends PlatformObject {
return "true".equals(getProperty(CREATED_FROM_TEMPLATE)); //$NON-NLS-1$
}
+ /**
+ * @since 3.9
+ */
+ public String getCategory() {
+ return getProperty(IRepositoryConstants.PROPERTY_CATEGORY);
+ }
+
+ /**
+ * @since 3.9
+ */
+ public void setCategory(String category) {
+ setProperty(IRepositoryConstants.PROPERTY_CATEGORY, category);
+ }
+
}
diff --git a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/TaskRepositoryTest.java b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/TaskRepositoryTest.java
index 259e3bc..bc82fde 100644
--- a/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/TaskRepositoryTest.java
+++ b/org.eclipse.mylyn.tasks.tests/src/org/eclipse/mylyn/tasks/tests/core/TaskRepositoryTest.java
@@ -79,4 +79,18 @@ public class TaskRepositoryTest extends TestCase {
}
assertTrue(caughtException);
}
+
+ public void testGetCategory() {
+ assertNull(taskRepository.getCategory());
+ }
+
+ public void testSetCategory() {
+ taskRepository.setCategory(TaskRepository.CATEGORY_TASKS);
+ assertEquals(TaskRepository.CATEGORY_TASKS, taskRepository.getCategory());
+ taskRepository.setCategory("any");
+ assertEquals("any", taskRepository.getCategory());
+ taskRepository.setCategory(null);
+ assertEquals(null, taskRepository.getCategory());
+ }
+
}
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/LocalRepositoryMigrator.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/LocalRepositoryMigrator.java
index 85af859..03ba0af 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/LocalRepositoryMigrator.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/LocalRepositoryMigrator.java
@@ -11,7 +11,6 @@
package org.eclipse.mylyn.internal.tasks.ui;
-import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants;
import org.eclipse.mylyn.internal.tasks.core.LocalRepositoryConnector;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryMigrator;
import org.eclipse.mylyn.tasks.core.TaskRepository;
@@ -29,8 +28,8 @@ public class LocalRepositoryMigrator extends AbstractRepositoryMigrator {
@Override
public boolean migrateRepository(TaskRepository repository) {
- if (repository.getProperty(IRepositoryConstants.PROPERTY_CATEGORY) == null) {
- repository.setProperty(IRepositoryConstants.PROPERTY_CATEGORY, IRepositoryConstants.CATEGORY_TASKS);
+ if (repository.getCategory() == null) {
+ repository.setCategory(TaskRepository.CATEGORY_TASKS);
return true;
}
return false;
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskRepositoriesNavigatorContentProvider.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskRepositoriesNavigatorContentProvider.java
index 42756a6..d9f2e19 100644
--- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskRepositoriesNavigatorContentProvider.java
+++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/TaskRepositoriesNavigatorContentProvider.java
@@ -19,7 +19,6 @@ import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.mylyn.commons.repositories.core.RepositoryCategory;
import org.eclipse.mylyn.internal.tasks.core.IRepositoryChangeListener;
-import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryAdapter;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryChangeEvent;
import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryDelta;
@@ -101,7 +100,7 @@ public class TaskRepositoriesNavigatorContentProvider implements ITreeContentPro
} else if (RepositoryCategory.ID_CATEGORY_OTHER.equals(category.getId())) {
Set<Object> items = new HashSet<Object>();
for (TaskRepository repository : repositories) {
- if (repository.getProperty(IRepositoryConstants.PROPERTY_CATEGORY) == null) {
+ if (repository.getCategory() == null) {
items.add(repository);
}
}
@@ -109,7 +108,7 @@ public class TaskRepositoriesNavigatorContentProvider implements ITreeContentPro
} else {
Set<Object> items = new HashSet<Object>();
for (TaskRepository repository : repositories) {
- if (category.getId().equals(repository.getProperty(IRepositoryConstants.PROPERTY_CATEGORY))) {
+ if (category.getId().equals(repository.getCategory())) {
items.add(repository);
}
}
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracRepositoryMigrator.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracRepositoryMigrator.java
index 2a68540..091f583 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracRepositoryMigrator.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/TracRepositoryMigrator.java
@@ -11,7 +11,6 @@
package org.eclipse.mylyn.internal.trac.ui;
-import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants;
import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
import org.eclipse.mylyn.tasks.core.AbstractRepositoryMigrator;
import org.eclipse.mylyn.tasks.core.TaskRepository;
@@ -28,8 +27,8 @@ public class TracRepositoryMigrator extends AbstractRepositoryMigrator {
@Override
public boolean migrateRepository(TaskRepository repository) {
- if (repository.getProperty(IRepositoryConstants.PROPERTY_CATEGORY) == null) {
- repository.setProperty(IRepositoryConstants.PROPERTY_CATEGORY, IRepositoryConstants.CATEGORY_BUGS);
+ if (repository.getCategory() == null) {
+ repository.setCategory(TaskRepository.CATEGORY_BUGS);
return true;
}
return false;
diff --git a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracRepositorySettingsPage.java b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracRepositorySettingsPage.java
index a326525..f5b544d 100644
--- a/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracRepositorySettingsPage.java
+++ b/org.eclipse.mylyn.trac.ui/src/org/eclipse/mylyn/internal/trac/ui/wizard/TracRepositorySettingsPage.java
@@ -23,7 +23,6 @@ import org.eclipse.mylyn.commons.core.StatusHandler;
import org.eclipse.mylyn.commons.net.AbstractWebLocation;
import org.eclipse.mylyn.commons.net.AuthenticationCredentials;
import org.eclipse.mylyn.commons.net.AuthenticationType;
-import org.eclipse.mylyn.internal.tasks.core.IRepositoryConstants;
import org.eclipse.mylyn.internal.trac.core.TracClientFactory;
import org.eclipse.mylyn.internal.trac.core.TracCorePlugin;
import org.eclipse.mylyn.internal.trac.core.client.ITracClient;
@@ -158,11 +157,10 @@ public class TracRepositorySettingsPage extends AbstractRepositorySettingsPage {
super.applyValidatorResult(validator);
}
- @SuppressWarnings("restriction")
@Override
public void applyTo(TaskRepository repository) {
super.applyTo(repository);
- repository.setProperty(IRepositoryConstants.PROPERTY_CATEGORY, IRepositoryConstants.CATEGORY_BUGS);
+ repository.setCategory(TaskRepository.CATEGORY_BUGS);
}
// public for testing