Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteffen Pingel2014-03-25 10:29:45 -0400
committerSteffen Pingel2014-03-26 05:22:34 -0400
commitc88adbabaed4aba155426669690fa4a8297ab8d9 (patch)
treeb8df4ea56e5a9125ffad0b4c42962fa0c21bec76 /org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal
parent604234eb263e3bf3981a715500d36e5d7be293be (diff)
downloadorg.eclipse.mylyn.tasks-c88adbabaed4aba155426669690fa4a8297ab8d9.tar.gz
org.eclipse.mylyn.tasks-c88adbabaed4aba155426669690fa4a8297ab8d9.tar.xz
org.eclipse.mylyn.tasks-c88adbabaed4aba155426669690fa4a8297ab8d9.zip
316253: move connector extension loading into core
Change-Id: Iba3b445736d552825e095a3e35ace3a304af4e86 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=316253
Diffstat (limited to 'org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal')
-rw-r--r--org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/util/RepositoryConnectorLoader.java63
1 files changed, 63 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/util/RepositoryConnectorLoader.java b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/util/RepositoryConnectorLoader.java
new file mode 100644
index 000000000..e51bc41e1
--- /dev/null
+++ b/org.eclipse.mylyn.tasks.core/src/org/eclipse/mylyn/internal/tasks/core/util/RepositoryConnectorLoader.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2014 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.tasks.core.util;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.mylyn.internal.tasks.core.RepositoryTemplateManager;
+import org.eclipse.mylyn.internal.tasks.core.TaskRepositoryManager;
+import org.eclipse.mylyn.internal.tasks.core.externalization.TaskListExternalizer;
+import org.eclipse.mylyn.tasks.core.spi.RepositoryConnectorDescriptor;
+
+public class RepositoryConnectorLoader {
+
+ private static final String EXTENSION_REPOSITORIES = "org.eclipse.mylyn.tasks.ui.repositories"; //$NON-NLS-1$
+
+ /**
+ * Plug-in ids of connector extensions that failed to load.
+ */
+ private final ContributorBlackList blackList = new ContributorBlackList();
+
+ private final Set<RepositoryConnectorDescriptor> descriptors = new HashSet<RepositoryConnectorDescriptor>();
+
+ public ContributorBlackList getBlackList() {
+ return blackList;
+ }
+
+ public void registerConnectors(TaskRepositoryManager repositoryManager, TaskListExternalizer taskListExternalizer) {
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+
+ // NOTE: has to be read first, consider improving
+ RepositoryConnectorExtensionReader reader = new RepositoryConnectorExtensionReader(taskListExternalizer,
+ repositoryManager);
+ // load core extension point
+ reader.loadConnectorsFromRepositoriesExtension();
+ // load legacy ui extension point
+ reader.loadConnectors(registry.getExtensionPoint(EXTENSION_REPOSITORIES));
+ // load connectors contributed at runtime
+ reader.loadConnectorsFromContributors();
+ reader.registerConnectors();
+ descriptors.addAll(reader.getDescriptors());
+ blackList.merge(reader.getBlackList());
+ }
+
+ public void registerTemplates(TaskRepositoryManager repositoryManager,
+ RepositoryTemplateManager repositoryTemplateManager) {
+ RepositoryTemplateExtensionReader templateExtensionReader = new RepositoryTemplateExtensionReader(
+ repositoryManager, repositoryTemplateManager);
+ templateExtensionReader.loadExtensions(blackList);
+ }
+
+}

Back to the top