Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2012-10-06 02:56:23 +0000
committerSteffen Pingel2013-09-26 19:45:58 +0000
commitb25ac21444f9250945fa89c2a9bb20cb8c8d67b6 (patch)
tree83ddfbc36c084485080e714b5f22838aa25edbbd /org.eclipse.mylyn.bugzilla.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.bugzilla.core')
-rw-r--r--org.eclipse.mylyn.bugzilla.core/plugin.properties3
-rw-r--r--org.eclipse.mylyn.bugzilla.core/plugin.xml28
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryMigrator.java45
-rw-r--r--org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskListMigrator.java73
4 files changed, 139 insertions, 10 deletions
diff --git a/org.eclipse.mylyn.bugzilla.core/plugin.properties b/org.eclipse.mylyn.bugzilla.core/plugin.properties
index c5952f978..89e3bca72 100644
--- a/org.eclipse.mylyn.bugzilla.core/plugin.properties
+++ b/org.eclipse.mylyn.bugzilla.core/plugin.properties
@@ -11,3 +11,6 @@
#Properties file for org.eclipse.mylyn.bugzilla.core
Bundle-Vendor = Eclipse Mylyn
Bundle-Name = Mylyn Bugzilla Connector Core
+
+bugzilla.repository.name=Bugzilla Repository
+BugzillaRepositoryConnector.name=Bugzilla Repository Connector
diff --git a/org.eclipse.mylyn.bugzilla.core/plugin.xml b/org.eclipse.mylyn.bugzilla.core/plugin.xml
index 4e1d101ca..3f62193f6 100644
--- a/org.eclipse.mylyn.bugzilla.core/plugin.xml
+++ b/org.eclipse.mylyn.bugzilla.core/plugin.xml
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?><!--
+<?eclipse version="3.0"?>
+<!--
Copyright (c) 2009 Tasktop Technologies and others.
All rights reserved. This program and the accompanying materials
are made available under the terms of the Eclipse Public License v1.0
@@ -9,15 +10,22 @@
Contributors:
Tasktop Technologies - initial API and implementation
-->
-
<plugin>
<extension-point id="languages" name="languages" schema="schema/languages.exsd"/>
-<!--<extension
- point="org.eclipse.mylyn.tasks.ui.duplicateDetectors">
- <detector
- class="org.eclipse.mylyn.internal.bugzilla.core.BugzillaStackTraceDuplicateDetector"
- kind="bugzilla"
- name="Stack Trace">
- </detector>
- </extension>-->
+
+ <extension
+ id="org.eclipse.mylyn.bugzilla.repository"
+ name="%bugzilla.repository.name"
+ point="org.eclipse.mylyn.tasks.core.repositories">
+
+ <connectorCore
+ id="bugzilla"
+ class="org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector"
+ name="%BugzillaRepositoryConnector.name"/>
+
+ <taskListMigrator
+ class="org.eclipse.mylyn.internal.bugzilla.core.BugzillaTaskListMigrator"/>
+ <repositoryMigrator
+ class="org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryMigrator"/>
+ </extension>
</plugin>
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryMigrator.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryMigrator.java
new file mode 100644
index 000000000..47864ee96
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaRepositoryMigrator.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2010 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.bugzilla.core;
+
+import org.eclipse.mylyn.tasks.core.AbstractRepositoryMigrator;
+import org.eclipse.mylyn.tasks.core.TaskRepository;
+
+/**
+ * @author Robert Elves
+ */
+public class BugzillaRepositoryMigrator extends AbstractRepositoryMigrator {
+
+ public static final String REPOSITORY_PROPERTY_AVATAR_SUPPORT = "avatarSupport"; //$NON-NLS-1$
+
+ @Override
+ public String getConnectorKind() {
+ return BugzillaCorePlugin.CONNECTOR_KIND;
+ }
+
+ @Override
+ public boolean migrateRepository(TaskRepository repository) {
+ boolean migrated = false;
+ if (repository.getCategory() == null) {
+ repository.setCategory(TaskRepository.CATEGORY_BUGS);
+ migrated = true;
+ }
+ // FIXME the Eclipse.org Bugzilla URL should not be hard coded here
+ if (repository.getProperty(REPOSITORY_PROPERTY_AVATAR_SUPPORT) == null
+ && "https://bugs.eclipse.org/bugs".equals(repository.getRepositoryUrl())) { //$NON-NLS-1$
+ repository.setProperty(REPOSITORY_PROPERTY_AVATAR_SUPPORT, Boolean.TRUE.toString());
+ migrated = true;
+ }
+ return migrated;
+ }
+
+}
diff --git a/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskListMigrator.java b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskListMigrator.java
new file mode 100644
index 000000000..a5c386030
--- /dev/null
+++ b/org.eclipse.mylyn.bugzilla.core/src/org/eclipse/mylyn/internal/bugzilla/core/BugzillaTaskListMigrator.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2008 Tasktop Technologies 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:
+ * Tasktop Technologies - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.mylyn.internal.bugzilla.core;
+
+import java.util.HashSet;
+import java.util.Set;
+
+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 Rob Elves
+ */
+public class BugzillaTaskListMigrator extends AbstractTaskListMigrator {
+
+ private static final String TAG_BUGZILLA_REPORT = "BugzillaReport"; //$NON-NLS-1$
+
+ private static final String KEY_SEVERITY = "bugzilla.severity"; //$NON-NLS-1$
+
+ private static final String KEY_PRODUCT = "bugzilla.product"; //$NON-NLS-1$
+
+ @Override
+ public String getConnectorKind() {
+ return BugzillaCorePlugin.CONNECTOR_KIND;
+ }
+
+ @Override
+ public Set<String> getQueryElementNames() {
+ Set<String> names = new HashSet<String>();
+ names.add(IBugzillaConstants.TAG_BUGZILLA_QUERY);
+ names.add(IBugzillaConstants.TAG_BUGZILLA_CUSTOM_QUERY);
+ return names;
+ }
+
+ @Override
+ public String getTaskElementName() {
+ return TAG_BUGZILLA_REPORT;
+ }
+
+ @Override
+ public void migrateQuery(IRepositoryQuery query, Element element) {
+ if (element.getNodeName().equals(IBugzillaConstants.TAG_BUGZILLA_CUSTOM_QUERY)) {
+ query.setAttribute(IBugzillaConstants.ATTRIBUTE_BUGZILLA_QUERY_CUSTOM, Boolean.TRUE.toString());
+ }
+ }
+
+ @Override
+ public void migrateTask(ITask task, Element element) {
+ if (element.hasAttribute(KEY_SEVERITY)) {
+ task.setAttribute(BugzillaAttribute.BUG_SEVERITY.getKey(),
+ element.getAttribute(BugzillaAttribute.BUG_SEVERITY.getKey()));
+ }
+ if (element.hasAttribute(KEY_PRODUCT)) {
+ task.setAttribute(BugzillaAttribute.PRODUCT.getKey(),
+ element.getAttribute(BugzillaAttribute.PRODUCT.getKey()));
+ }
+ if (element.hasAttribute(KEY_LAST_MOD_DATE)) {
+ task.setAttribute(BugzillaAttribute.DELTA_TS.getKey(), element.getAttribute(KEY_LAST_MOD_DATE));
+ }
+ }
+
+}

Back to the top