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 211916 Details for
Bug 363733
Provide possibility to enhance RequiredPluginsClasspathContainer to deal with Equinox-AdapterHooks
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
extension point and impl
patch.txt (text/plain), 9.41 KB, created by
Thomas Schindl
on 2012-03-01 17:08:13 EST
(
hide
)
Description:
extension point and impl
Filename:
MIME Type:
Creator:
Thomas Schindl
Created:
2012-03-01 17:08:13 EST
Size:
9.41 KB
patch
obsolete
>diff --git a/ui/org.eclipse.pde.core/plugin.xml b/ui/org.eclipse.pde.core/plugin.xml >index 6d540a5..71adf38 100644 >--- a/ui/org.eclipse.pde.core/plugin.xml >+++ b/ui/org.eclipse.pde.core/plugin.xml >@@ -17,6 +17,7 @@ > <extension-point id="targets" name="%expoint.target.name" schema="schema/targets.exsd"/> > <extension-point id="targetLocations" name="%expoint.targetlocation.name" schema="schema/targetLocations.exsd"/> > <extension-point id="bundleClasspathResolvers" name="%expoint.bundleClasspathResolvers.name" schema="schema/bundleClasspathResolvers.exsd"/> >+ <extension-point id="pluginClasspathContributor" name="pluginClasspathContributor" schema="schema/pluginClasspathContributor.exsd"/> > > <extension > point="org.eclipse.jdt.core.classpathVariableInitializer"> >diff --git a/ui/org.eclipse.pde.core/schema/pluginClasspathContributor.exsd b/ui/org.eclipse.pde.core/schema/pluginClasspathContributor.exsd >new file mode 100644 >index 0000000..2ce8bf7 >--- /dev/null >+++ b/ui/org.eclipse.pde.core/schema/pluginClasspathContributor.exsd >@@ -0,0 +1,102 @@ >+<?xml version='1.0' encoding='UTF-8'?> >+<!-- Schema file written by PDE --> >+<schema targetNamespace="org.eclipse.pde.core" xmlns="http://www.w3.org/2001/XMLSchema"> >+<annotation> >+ <appInfo> >+ <meta.schema plugin="org.eclipse.pde.core" id="pluginClasspathContributor" name="pluginClasspathContributor"/> >+ </appInfo> >+ <documentation> >+ [Enter description of this extension point.] >+ </documentation> >+ </annotation> >+ >+ <element name="extension"> >+ <annotation> >+ <appInfo> >+ <meta.element /> >+ </appInfo> >+ </annotation> >+ <complexType> >+ <sequence> >+ <element ref="contribtor" minOccurs="0" maxOccurs="unbounded"/> >+ </sequence> >+ <attribute name="point" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="id" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ </annotation> >+ </attribute> >+ <attribute name="name" type="string"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appInfo> >+ <meta.attribute translatable="true"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <element name="contribtor"> >+ <complexType> >+ <attribute name="class" type="string" use="required"> >+ <annotation> >+ <documentation> >+ >+ </documentation> >+ <appInfo> >+ <meta.attribute kind="java" basedOn=":org.eclipse.pde.core.IClasspathContributor"/> >+ </appInfo> >+ </annotation> >+ </attribute> >+ </complexType> >+ </element> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="since"/> >+ </appInfo> >+ <documentation> >+ [Enter the first release in which this extension point appears.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="examples"/> >+ </appInfo> >+ <documentation> >+ [Enter extension point usage example here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="apiinfo"/> >+ </appInfo> >+ <documentation> >+ [Enter API information here.] >+ </documentation> >+ </annotation> >+ >+ <annotation> >+ <appInfo> >+ <meta.section type="implementation"/> >+ </appInfo> >+ <documentation> >+ [Enter information about supplied implementation of this extension point.] >+ </documentation> >+ </annotation> >+ >+ >+</schema> >diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/core/IClasspathContributor.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/core/IClasspathContributor.java >new file mode 100644 >index 0000000..0424f0f >--- /dev/null >+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/core/IClasspathContributor.java >@@ -0,0 +1,53 @@ >+/******************************************************************************* >+ * Copyright (c) 2012 BestSolution Systemhaus GmbH 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: >+ * Tom Schindl<tom.schindl@bestsolution.at> - initial contribution >+ *******************************************************************************/ >+package org.eclipse.pde.core; >+ >+import org.eclipse.core.runtime.IPath; >+import org.eclipse.jdt.core.IClasspathAttribute; >+import org.eclipse.osgi.service.resolver.BundleDescription; >+import org.eclipse.pde.internal.core.RequiredPluginsClasspathContainer; >+ >+/** >+ * Allows extension points to contribute classpath entries to the {@link RequiredPluginsClasspathContainer} >+ */ >+public interface IClasspathContributor { >+ /** >+ * Contribution to a classpath >+ */ >+ public static class Contribution { >+ public final IPath jarLocation; >+ public final IPath javaDocLocation; >+ public final IPath sourceLocation; >+ public final IClasspathAttribute[] attributes; >+ >+ public Contribution(IPath jarLocation, IPath javaDocLocation, IPath sourceLocation, IClasspathAttribute[] attributes) { >+ super(); >+ this.jarLocation = jarLocation; >+ this.javaDocLocation = javaDocLocation; >+ this.sourceLocation = sourceLocation; >+ this.attributes = attributes; >+ } >+ } >+ >+ /** >+ * Retrieve the contributions for a bundle >+ * @param desc the bundle description >+ * @return contributions, must not be <code>null</code> >+ */ >+ public Contribution[] getContributions(BundleDescription desc); >+ >+ /** >+ * Check if a contribution for this bundles classpath will be made >+ * @param desc the bundle description >+ * @return <code>true</code> is a contribution will be made >+ */ >+ public boolean isActiveFor(BundleDescription desc); >+} >diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/RequiredPluginsClasspathContainer.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/RequiredPluginsClasspathContainer.java >index 3a8bd60..4223a9b 100644 >--- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/RequiredPluginsClasspathContainer.java >+++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/RequiredPluginsClasspathContainer.java >@@ -16,6 +16,8 @@ > import org.eclipse.core.runtime.*; > import org.eclipse.jdt.core.*; > import org.eclipse.osgi.service.resolver.*; >+import org.eclipse.pde.core.IClasspathContributor; >+import org.eclipse.pde.core.IClasspathContributor.Contribution; > import org.eclipse.pde.core.build.IBuild; > import org.eclipse.pde.core.build.IBuildEntry; > import org.eclipse.pde.core.plugin.IPluginModelBase; >@@ -36,6 +38,8 @@ > DEBUG = PDECore.getDefault().isDebugging() && "true".equals(Platform.getDebugOption("org.eclipse.pde.core/classpath")); //$NON-NLS-1$ //$NON-NLS-2$ > } > >+ private IClasspathContributor[] contributors = new IClasspathContributor[0]; >+ > /** > * Constructor for RequiredPluginsClasspathContainer. > */ >@@ -46,6 +50,19 @@ > public RequiredPluginsClasspathContainer(IPluginModelBase model, IBuild build) { > fModel = model; > fBuild = build; >+ >+ List list = new ArrayList(); >+ IExtensionRegistry registry = Platform.getExtensionRegistry(); >+ IConfigurationElement[] elements = registry.getConfigurationElementsFor("org.eclipse.pde.core.pluginClasspathContributor"); //$NON-NLS-1$ >+ for (int i = 0; i < elements.length; i++) { >+ try { >+ list.add(elements[i].createExecutableExtension("class")); //$NON-NLS-1$ >+ } catch (CoreException e) { >+ PDECore.log(e.getStatus()); >+ } >+ } >+ contributors = new IClasspathContributor[list.size()]; >+ list.toArray(contributors); > } > > /* >@@ -250,6 +267,34 @@ > return false; > IResource resource = model.getUnderlyingResource(); > Rule[] rules = useInclusions ? getInclusions(map, model) : null; >+ >+ for (int i = 0; i < contributors.length; i++) { >+ IClasspathContributor cp = contributors[i]; >+ if (cp.isActiveFor(desc)) { >+ Contribution[] cts = cp.getContributions(desc); >+ for (int j = 0; j < cts.length; j++) { >+ Contribution c = cts[j]; >+ IClasspathAttribute[] attributes = new IClasspathAttribute[0]; >+ >+ if (c.attributes == null) { >+ if (c.javaDocLocation != null) { >+ attributes = new IClasspathAttribute[] {JavaCore.newClasspathAttribute(IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, c.javaDocLocation.toFile().toURI().toString())}; >+ } >+ } else { >+ if (c.javaDocLocation != null) { >+ attributes = new IClasspathAttribute[c.attributes.length + 1]; >+ attributes[attributes.length - 1] = JavaCore.newClasspathAttribute(IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, c.javaDocLocation.toFile().toURI().toString()); >+ } else { >+ attributes = new IClasspathAttribute[c.attributes.length]; >+ } >+ System.arraycopy(c.attributes, 0, attributes, 0, c.attributes.length); >+ } >+ >+ addLibraryEntry(c.jarLocation, c.sourceLocation, rules, attributes, entries); >+ } >+ } >+ } >+ > if (resource != null) { > addProjectEntry(resource.getProject(), rules, entries); > } else {
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 363733
:
206972
|
206973
|
206974
|
211916
|
224848
|
224849