Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 116386 Details for
Bug 214195
task repository linking for Eclipse.org projects via Bundle-Vendor or provider specification
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
updated patch
clipboard.txt (text/plain), 15.58 KB, created by
Steffen Pingel
on 2008-10-29 01:08:09 EDT
(
hide
)
Description:
updated patch
Filename:
MIME Type:
Creator:
Steffen Pingel
Created:
2008-10-29 01:08:09 EDT
Size:
15.58 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.mylyn.sandbox.tests >Index: src/org/eclipse/mylyn/sandbox/tests/AllSandboxTests.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.sandbox.tests/src/org/eclipse/mylyn/sandbox/tests/AllSandboxTests.java,v >retrieving revision 1.13 >diff -u -r1.13 AllSandboxTests.java >--- src/org/eclipse/mylyn/sandbox/tests/AllSandboxTests.java 7 Oct 2008 05:09:54 -0000 1.13 >+++ src/org/eclipse/mylyn/sandbox/tests/AllSandboxTests.java 29 Oct 2008 05:07:37 -0000 >@@ -32,6 +32,7 @@ > suite.addTestSuite(ActiveHierarchyTest.class); > suite.addTestSuite(ActiveSearchTest.class); > suite.addTestSuite(StatisticsReportingTest.class); >+ suite.addTestSuite(EclipseTaskRepositoryLinkProviderTest.class); > > // web connector tests > suite.addTestSuite(NamedPatternTest.class); >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.sandbox.tests/META-INF/MANIFEST.MF,v >retrieving revision 1.15 >diff -u -r1.15 MANIFEST.MF >--- META-INF/MANIFEST.MF 2 Oct 2008 02:02:42 -0000 1.15 >+++ META-INF/MANIFEST.MF 29 Oct 2008 05:07:37 -0000 >@@ -34,8 +34,10 @@ > org.eclipse.mylyn.web.tasks, > org.apache.commons.httpclient, > org.eclipse.mylyn.commons.net, >- org.eclipse.mylyn.tasks.tests;bundle-version="0.0.0" >+ org.eclipse.mylyn.tasks.tests, >+ org.eclipse.pde.core > Bundle-ActivationPolicy: lazy > Bundle-RequiredExecutionEnvironment: J2SE-1.5 > Export-Package: org.eclipse.mylyn.sandbox.tests;x-internal:=true, >+ org.eclipse.mylyn.sandbox.tests.util;x-internal:=true, > org.eclipse.mylyn.tasks.tests.web;x-internal:=true >Index: src/org/eclipse/mylyn/sandbox/tests/EclipseTaskRepositoryLinkProviderTest.java >=================================================================== >RCS file: src/org/eclipse/mylyn/sandbox/tests/EclipseTaskRepositoryLinkProviderTest.java >diff -N src/org/eclipse/mylyn/sandbox/tests/EclipseTaskRepositoryLinkProviderTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/sandbox/tests/EclipseTaskRepositoryLinkProviderTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,124 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2008 Eugene Kuleshov 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: >+ * Eugene Kuleshov - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.sandbox.tests; >+ >+import junit.framework.TestCase; >+ >+import org.eclipse.core.resources.IProject; >+import org.eclipse.mylyn.internal.tasks.ui.TasksUiPlugin; >+import org.eclipse.mylyn.sandbox.tests.util.PdeProject; >+import org.eclipse.mylyn.tasks.core.TaskRepository; >+ >+/** >+ * @author Eugene Kuleshov >+ */ >+public class EclipseTaskRepositoryLinkProviderTest extends TestCase { >+ >+ public void testEclipsePluginProject() throws Exception { >+ TaskRepository repo1 = TasksUiPlugin.getRepositoryManager().getRepository("https://bugs.eclipse.org/bugs"); >+ assertNotNull("Eclipse.org repository is not found", repo1); >+ >+ String mf = "Manifest-Version: 1.0\n" + // >+ "Bundle-ManifestVersion: 2\n" + // >+ "Bundle-Name: Mylyn PDE Tests 1\n" + // >+ "Bundle-SymbolicName: org.eclipse.mylyn.pde.tests1\n" + // >+ "Bundle-Version: 1.0.0\n" + // >+ "Bundle-Vendor: Eclipse.org\n" + // >+ "Bundle-RequiredExecutionEnvironment: J2SE-1.3\n"; >+ >+ PdeProject pdeProject = new PdeProject("eclipsePluginProject"); >+ pdeProject.createPlugin(mf); >+ >+ IProject project = pdeProject.getProject(); >+ >+ TasksUiPlugin tasksUiPlugin = TasksUiPlugin.getDefault(); >+ >+ TaskRepository repo2 = tasksUiPlugin.getRepositoryForResource(project); >+ assertEquals(repo1, repo2); >+ >+ assertFalse(tasksUiPlugin.canSetRepositoryForResource(project)); >+ >+ pdeProject.delete(); >+ } >+ >+ public void testAcmePluginProject() throws Exception { >+ TaskRepository repo1 = TasksUiPlugin.getRepositoryManager().getRepository("https://bugs.eclipse.org/bugs"); >+ assertNotNull("Eclipse.org repository is not found", repo1); >+ >+ String mf = "Manifest-Version: 1.0\n" + // >+ "Bundle-ManifestVersion: 2\n" + // >+ "Bundle-Name: Mylyn PDE Tests 2\n" + // >+ "Bundle-SymbolicName: org.eclpse.mylyn.pde.tests2\n" + // >+ "Bundle-Version: 1.0.0\n" + // >+ "Bundle-Vendor: Acme.org\n" + // >+ "Bundle-RequiredExecutionEnvironment: J2SE-1.3\n"; >+ >+ PdeProject pdeProject = new PdeProject("acmePluginProject"); >+ pdeProject.createPlugin(mf); >+ >+ TaskRepository repo2 = TasksUiPlugin.getDefault().getRepositoryForResource(pdeProject.getProject()); >+ >+ pdeProject.delete(); >+ >+ assertNull("Not expected to find repository " + repo2, repo2); >+ } >+ >+ public void testEclipseFeatureProject() throws Exception { >+ TaskRepository repo1 = TasksUiPlugin.getRepositoryManager().getRepository("https://bugs.eclipse.org/bugs"); >+ assertNotNull("Eclipse.org repository is not found", repo1); >+ >+ String feature = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + // >+ "<feature\n" + // >+ " id=\"org.eclipse.mylyn.pde.tests2_feature\"\n" + // >+ " label=\"Mylyn PDE Test Feature 2\"\n" + // >+ " version=\"2.3.0.qualifier\"\n" + // >+ " provider-name=\"Eclipse.org\">" + // >+ "</feature>"; >+ >+ PdeProject pdeProject = new PdeProject("eclipseFeatureProject"); >+ pdeProject.createFeature(feature); >+ >+ IProject project = pdeProject.getProject(); >+ >+ TasksUiPlugin tasksUiPlugin = TasksUiPlugin.getDefault(); >+ >+ TaskRepository repo2 = tasksUiPlugin.getRepositoryForResource(project); >+ assertEquals(repo1, repo2); >+ >+ assertFalse(tasksUiPlugin.canSetRepositoryForResource(project)); >+ >+ pdeProject.delete(); >+ } >+ >+ public void testAcmeFeatureProject() throws Exception { >+ TaskRepository repo1 = TasksUiPlugin.getRepositoryManager().getRepository("https://bugs.eclipse.org/bugs"); >+ assertNotNull("Eclipse.org repository is not found", repo1); >+ >+ String feature = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + // >+ "<feature\n" + // >+ " id=\"org.eclipse.mylyn.pde.tests2_feature\"\n" + // >+ " label=\"Mylyn PDE Test Feature 2\"\n" + // >+ " version=\"2.3.0.qualifier\"\n" + // >+ " provider-name=\"Acme.org\">" + // >+ "</feature>"; >+ >+ PdeProject pdeProject = new PdeProject("acmeFeatureProject"); >+ pdeProject.createFeature(feature); >+ >+ TaskRepository repo2 = TasksUiPlugin.getDefault().getRepositoryForResource(pdeProject.getProject()); >+ >+ pdeProject.delete(); >+ >+ assertNull("Not expected to find repository " + repo2, repo2); >+ } >+ >+} >Index: src/org/eclipse/mylyn/sandbox/tests/util/PdeProject.java >=================================================================== >RCS file: src/org/eclipse/mylyn/sandbox/tests/util/PdeProject.java >diff -N src/org/eclipse/mylyn/sandbox/tests/util/PdeProject.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/sandbox/tests/util/PdeProject.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,114 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2008 Eugene Kuleshov 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: >+ * Eugene Kuleshov - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.sandbox.tests.util; >+ >+import java.io.ByteArrayInputStream; >+ >+import org.eclipse.core.internal.events.BuildCommand; >+import org.eclipse.core.resources.ICommand; >+import org.eclipse.core.resources.IFile; >+import org.eclipse.core.resources.IFolder; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IProjectDescription; >+import org.eclipse.core.resources.IWorkspaceRoot; >+import org.eclipse.core.resources.IncrementalProjectBuilder; >+import org.eclipse.core.resources.ResourcesPlugin; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.jdt.core.JavaCore; >+import org.eclipse.pde.internal.core.natures.PDE; >+ >+/** >+ * @author Eugene Kuleshov >+ */ >+public class PdeProject { >+ >+ private final IProject project; >+ >+ public PdeProject(String name) throws CoreException { >+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); >+ project = root.getProject(name); >+ project.create(null); >+ project.open(null); >+ } >+ >+ public IProject getProject() { >+ return project; >+ } >+ >+ public void createPlugin(String mf) throws CoreException { >+ setPluginNature(); >+ >+ IProject project = getProject(); >+ >+ IFolder folder = project.getFolder("META-INF"); >+ if (!folder.exists()) { >+ folder.create(true, false, null); >+ } >+ >+ IFile file = folder.getFile("MANIFEST.MF"); >+ if (!file.exists()) { >+ file.create(new ByteArrayInputStream(mf.getBytes()), true, null); >+ } >+ >+ project.build(IncrementalProjectBuilder.FULL_BUILD, null); >+ } >+ >+ public void createFeature(String feature) throws CoreException { >+ setFeatureNature(); >+ >+ IProject project = getProject(); >+ >+ IFile file = project.getFile("feature.xml"); >+ if (!file.exists()) { >+ file.create(new ByteArrayInputStream(feature.getBytes()), true, null); >+ } >+ >+ project.build(IncrementalProjectBuilder.FULL_BUILD, null); >+ } >+ >+ public void setPluginNature() throws CoreException { >+ IProjectDescription description = project.getDescription(); >+ >+ description.setNatureIds(new String[] { PDE.PLUGIN_NATURE, JavaCore.NATURE_ID }); >+ >+ BuildCommand javaBuildCommand = new BuildCommand(); >+ javaBuildCommand.setBuilderName(JavaCore.BUILDER_ID); >+ >+ BuildCommand manifestBuildCommand = new BuildCommand(); >+ manifestBuildCommand.setName(PDE.MANIFEST_BUILDER_ID); >+ >+ BuildCommand schemaBuildCommand = new BuildCommand(); >+ schemaBuildCommand.setName(PDE.SCHEMA_BUILDER_ID); >+ >+ description.setBuildSpec(new ICommand[] { javaBuildCommand, manifestBuildCommand, schemaBuildCommand }); >+ >+ project.setDescription(description, null); >+ } >+ >+ public void setFeatureNature() throws CoreException { >+ IProjectDescription description = project.getDescription(); >+ >+ description.setNatureIds(new String[] { PDE.FEATURE_NATURE }); >+ >+ BuildCommand featureBuildCommand = new BuildCommand(); >+ featureBuildCommand.setName(PDE.FEATURE_BUILDER_ID); >+ >+ description.setBuildSpec(new ICommand[] { featureBuildCommand }); >+ >+ project.setDescription(description, null); >+ } >+ >+ public void delete() throws CoreException { >+ getProject().delete(true, true, null); >+ } >+ >+} >#P org.eclipse.mylyn.sandbox.ui >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.sandbox.ui/plugin.xml,v >retrieving revision 1.93 >diff -u -r1.93 plugin.xml >--- plugin.xml 17 Oct 2008 03:22:25 -0000 1.93 >+++ plugin.xml 29 Oct 2008 05:07:37 -0000 >@@ -511,5 +511,13 @@ > </objectContribution> > </extension> > --> >+ >+ <extension point="org.eclipse.mylyn.tasks.ui.projectLinkProviders"> >+ <linkProvider >+ id="org.eclipse.mylyn.sandbox.ui.eclipsePluginRepositoryLinkProvider" >+ class="org.eclipse.mylyn.internal.sandbox.ui.EclipseTaskRepositoryLinkProvider" >+ name="Eclipse.org Plugin Link" >+ order="2000"/> >+ </extension> > > </plugin> >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.mylyn/sandbox/org.eclipse.mylyn.sandbox.ui/META-INF/MANIFEST.MF,v >retrieving revision 1.218 >diff -u -r1.218 MANIFEST.MF >--- META-INF/MANIFEST.MF 2 Oct 2008 03:49:07 -0000 1.218 >+++ META-INF/MANIFEST.MF 29 Oct 2008 05:07:37 -0000 >@@ -31,7 +31,8 @@ > org.eclipse.mylyn.resources.ui;bundle-version="[3.0.0,4.0.0)", > org.eclipse.mylyn.ide.ant;bundle-version="[3.0.0,4.0.0)", > org.eclipse.mylyn.pde.ui;bundle-version="[3.0.0,4.0.0)", >- org.eclipse.core.expressions >+ org.eclipse.core.expressions, >+ org.eclipse.pde.core > Bundle-ActivationPolicy: lazy > Bundle-Vendor: Eclipse.org > Export-Package: org.eclipse.mylyn.internal.sandbox.ui;x-internal:=true, >Index: src/org/eclipse/mylyn/internal/sandbox/ui/EclipseTaskRepositoryLinkProvider.java >=================================================================== >RCS file: src/org/eclipse/mylyn/internal/sandbox/ui/EclipseTaskRepositoryLinkProvider.java >diff -N src/org/eclipse/mylyn/internal/sandbox/ui/EclipseTaskRepositoryLinkProvider.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/mylyn/internal/sandbox/ui/EclipseTaskRepositoryLinkProvider.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,66 @@ >+/******************************************************************************* >+ * Copyright (c) 2004, 2008 Eugene Kuleshov 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: >+ * Eugene Kuleshov - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.mylyn.internal.sandbox.ui; >+ >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin; >+import org.eclipse.mylyn.tasks.core.IRepositoryManager; >+import org.eclipse.mylyn.tasks.core.TaskRepository; >+import org.eclipse.mylyn.tasks.ui.AbstractTaskRepositoryLinkProvider; >+import org.eclipse.pde.core.IModel; >+import org.eclipse.pde.core.plugin.IPluginModelBase; >+import org.eclipse.pde.core.plugin.PluginRegistry; >+import org.eclipse.pde.internal.core.PDECore; >+import org.eclipse.pde.internal.core.ifeature.IFeatureModel; >+import org.eclipse.pde.internal.core.natures.PDE; >+ >+/** >+ * Task repository link provider for Eclipse.org PDE projects >+ * >+ * @author Eugene Kuleshov >+ */ >+// TODO could use extension point to declare mapping for 3rd party plugin providers >+public class EclipseTaskRepositoryLinkProvider extends AbstractTaskRepositoryLinkProvider { >+ >+ @Override >+ public TaskRepository getTaskRepository(IResource resource, IRepositoryManager repositoryManager) { >+ IProject project = resource.getProject(); >+ if (PDE.hasPluginNature(project)) { >+ IPluginModelBase pluginModel = PluginRegistry.findModel(project); >+ if (pluginModel != null) { >+ String providerName = pluginModel.getPluginBase().getProviderName(); >+ return getTaskRepository(providerName, pluginModel, repositoryManager); >+ } >+ } else if (PDE.hasFeatureNature(project)) { >+ IFeatureModel featureModel = PDECore.getDefault().getFeatureModelManager().getFeatureModel(project); >+ if (featureModel != null) { >+ String providerName = featureModel.getFeature().getProviderName(); >+ return getTaskRepository(providerName, featureModel, repositoryManager); >+ } >+ } else if (PDE.hasUpdateSiteNature(project)) { >+ // TODO could use referenced features to lookup task repository >+ } >+ return null; >+ } >+ >+ private TaskRepository getTaskRepository(String providerName, IModel model, IRepositoryManager repositoryManager) { >+ if (providerName.startsWith("%")) { >+ providerName = model.getResourceString(providerName); >+ } >+ if ("Eclipse.org".equals(providerName)) { >+ return repositoryManager.getRepository(BugzillaCorePlugin.CONNECTOR_KIND, "https://bugs.eclipse.org/bugs"); >+ } >+ return null; >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 214195
:
86061
|
86062
|
87597
|
87598
|
116385
| 116386