Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2012-10-05 22:56:23 -0400
committerSteffen Pingel2013-09-26 15:45:58 -0400
commitb25ac21444f9250945fa89c2a9bb20cb8c8d67b6 (patch)
tree83ddfbc36c084485080e714b5f22838aa25edbbd /org.eclipse.mylyn.trac.core
parentd4245c3b3223e8fbae7927a5acc0cc8401690448 (diff)
downloadorg.eclipse.mylyn.tasks-b25ac21444f9250945fa89c2a9bb20cb8c8d67b6.tar.gz
org.eclipse.mylyn.tasks-b25ac21444f9250945fa89c2a9bb20cb8c8d67b6.tar.xz
org.eclipse.mylyn.tasks-b25ac21444f9250945fa89c2a9bb20cb8c8d67b6.zip
386117: [api] declare repository connector extensions in tasks.core
Change-Id: I9eafa88b5731e9aaf1d46bd0f91e1b3c51f4f129 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=386117
Diffstat (limited to 'org.eclipse.mylyn.trac.core')
-rw-r--r--org.eclipse.mylyn.trac.core/build.properties3
-rw-r--r--org.eclipse.mylyn.trac.core/plugin.properties3
-rw-r--r--org.eclipse.mylyn.trac.core/plugin.xml29
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryMigrator.java36
-rw-r--r--org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskListMigrator.java69
5 files changed, 139 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.trac.core/build.properties b/org.eclipse.mylyn.trac.core/build.properties
index bc40384f7..5c5874d11 100644
--- a/org.eclipse.mylyn.trac.core/build.properties
+++ b/org.eclipse.mylyn.trac.core/build.properties
@@ -11,5 +11,6 @@ output.. = bin/
bin.includes = META-INF/,\
.,\
about.html,\
- plugin.properties
+ plugin.properties,\
+ plugin.xml
src.includes = about.html
diff --git a/org.eclipse.mylyn.trac.core/plugin.properties b/org.eclipse.mylyn.trac.core/plugin.properties
index c4229eb75..f50d53281 100644
--- a/org.eclipse.mylyn.trac.core/plugin.properties
+++ b/org.eclipse.mylyn.trac.core/plugin.properties
@@ -11,3 +11,6 @@
#Properties file for org.eclipse.mylyn.trac.core
Bundle-Vendor = Eclipse Mylyn
Bundle-Name = Mylyn Trac Connector Core
+
+repository.name = Trac Repository
+TracRepositoryConnector.name = Trac Connector Core
diff --git a/org.eclipse.mylyn.trac.core/plugin.xml b/org.eclipse.mylyn.trac.core/plugin.xml
new file mode 100644
index 000000000..d3790e5fe
--- /dev/null
+++ b/org.eclipse.mylyn.trac.core/plugin.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ id="org.eclipse.mylyn.trac.repository"
+ name="%repository.name"
+ point="org.eclipse.mylyn.tasks.ui.repositories">
+ <connectorCore
+ class="org.eclipse.mylyn.internal.trac.core.TracRepositoryConnector"
+ id="trac"
+ name="%TracRepositoryConnector.name"/>
+ <taskListMigrator
+ class="org.eclipse.mylyn.internal.trac.core.TracTaskListMigrator">
+ </taskListMigrator>
+ <repositoryMigrator
+ class="org.eclipse.mylyn.internal.trac.core.TracRepositoryMigrator">
+ </repositoryMigrator>
+ </extension>
+ <extension
+ point="org.eclipse.mylyn.tasks.core.templates">
+ <repository
+ addAutomatically="false"
+ anonymous="true"
+ label="Edgewall"
+ repositoryKind="trac"
+ urlRepository="http://trac.edgewall.org"
+ version="TRAC_0_9"/>
+ </extension>
+</plugin>
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryMigrator.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryMigrator.java
new file mode 100644
index 000000000..ff8c9d0a1
--- /dev/null
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracRepositoryMigrator.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Steffen Pingel 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:
+ * Steffen Pingel - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.trac.core;
+
+import org.eclipse.mylyn.tasks.core.AbstractRepositoryMigrator;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+
+/**
+ * @author Steffen Pingel
+ */
+public class TracRepositoryMigrator extends AbstractRepositoryMigrator {
+
+ @Override
+ public String getConnectorKind() {
+ return TracCorePlugin.CONNECTOR_KIND;
+ }
+
+ @Override
+ public boolean migrateRepository(TaskRepository repository) {
+ if (repository.getCategory() == null) {
+ repository.setCategory(TaskRepository.CATEGORY_BUGS);
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskListMigrator.java b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskListMigrator.java
new file mode 100644
index 000000000..4e85d0166
--- /dev/null
+++ b/org.eclipse.mylyn.trac.core/src/org/eclipse/mylyn/internal/trac/core/TracTaskListMigrator.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2006, 2008 Steffen Pingel 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:
+ * Steffen Pingel - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.trac.core;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.mylyn.internal.trac.core.util.TracUtil;
+import org.eclipse.mylyn.tasks.core.AbstractTaskListMigrator;
+import org.eclipse.mylyn.tasks.core.IRepositoryQuery;
+import org.eclipse.mylyn.tasks.core.ITask;
+import org.w3c.dom.Element;
+
+/**
+ * @author Steffen Pingel
+ */
+public class TracTaskListMigrator extends AbstractTaskListMigrator {
+
+ private static final String KEY_TRAC = "Trac"; //$NON-NLS-1$
+
+ private static final String KEY_TRAC_TASK = KEY_TRAC + KEY_TASK;
+
+ private static final String KEY_TRAC_QUERY = KEY_TRAC + KEY_QUERY;
+
+ private static final String KEY_SUPPORTS_SUBTASKS = "SupportsSubtasks"; //$NON-NLS-1$
+
+ @Override
+ public String getConnectorKind() {
+ return TracCorePlugin.CONNECTOR_KIND;
+ }
+
+ @Override
+ public String getTaskElementName() {
+ return KEY_TRAC_TASK;
+ }
+
+ @Override
+ public Set<String> getQueryElementNames() {
+ Set<String> names = new HashSet<String>();
+ names.add(KEY_TRAC_QUERY);
+ return names;
+ }
+
+ @Override
+ public void migrateQuery(IRepositoryQuery query, Element element) {
+ // nothing to do
+ }
+
+ @Override
+ public void migrateTask(ITask task, Element element) {
+ String lastModDate = element.getAttribute(KEY_LAST_MOD_DATE);
+ task.setModificationDate(TracUtil.parseDate(lastModDate));
+ task.setAttribute(TracRepositoryConnector.TASK_KEY_UPDATE_DATE, lastModDate);
+ if (element.hasAttribute(KEY_SUPPORTS_SUBTASKS)) {
+ task.setAttribute(TracRepositoryConnector.TASK_KEY_SUPPORTS_SUBTASKS,
+ Boolean.valueOf(element.getAttribute(KEY_SUPPORTS_SUBTASKS)).toString());
+ }
+ }
+
+}

Back to the top