Lines 16-21
import org.eclipse.core.resources.*;
Link Here
|
16 |
import org.eclipse.core.runtime.*; |
16 |
import org.eclipse.core.runtime.*; |
17 |
import org.eclipse.jdt.core.*; |
17 |
import org.eclipse.jdt.core.*; |
18 |
import org.eclipse.osgi.service.resolver.*; |
18 |
import org.eclipse.osgi.service.resolver.*; |
|
|
19 |
import org.eclipse.pde.core.IClasspathContributor; |
20 |
import org.eclipse.pde.core.IClasspathContributor.Contribution; |
19 |
import org.eclipse.pde.core.build.IBuild; |
21 |
import org.eclipse.pde.core.build.IBuild; |
20 |
import org.eclipse.pde.core.build.IBuildEntry; |
22 |
import org.eclipse.pde.core.build.IBuildEntry; |
21 |
import org.eclipse.pde.core.plugin.IPluginModelBase; |
23 |
import org.eclipse.pde.core.plugin.IPluginModelBase; |
Lines 32-37
public class RequiredPluginsClasspathContainer extends PDEClasspathContainer imp
Link Here
|
32 |
|
34 |
|
33 |
private IClasspathEntry[] fEntries = null; |
35 |
private IClasspathEntry[] fEntries = null; |
34 |
|
36 |
|
|
|
37 |
private IClasspathContributor[] fClasspathContributors = null; |
38 |
|
35 |
static { |
39 |
static { |
36 |
DEBUG = PDECore.getDefault().isDebugging() && "true".equals(Platform.getDebugOption("org.eclipse.pde.core/classpath")); //$NON-NLS-1$ //$NON-NLS-2$ |
40 |
DEBUG = PDECore.getDefault().isDebugging() && "true".equals(Platform.getDebugOption("org.eclipse.pde.core/classpath")); //$NON-NLS-1$ //$NON-NLS-2$ |
37 |
} |
41 |
} |
Lines 46-51
public class RequiredPluginsClasspathContainer extends PDEClasspathContainer imp
Link Here
|
46 |
public RequiredPluginsClasspathContainer(IPluginModelBase model, IBuild build) { |
50 |
public RequiredPluginsClasspathContainer(IPluginModelBase model, IBuild build) { |
47 |
fModel = model; |
51 |
fModel = model; |
48 |
fBuild = build; |
52 |
fBuild = build; |
|
|
53 |
|
54 |
List<IClasspathContributor> list = new ArrayList<IClasspathContributor>(); |
55 |
IExtensionRegistry registry = Platform.getExtensionRegistry(); |
56 |
IConfigurationElement[] elements = registry.getConfigurationElementsFor("org.eclipse.pde.core.pluginClasspathContributors"); //$NON-NLS-1$ |
57 |
for (int i = 0; i < elements.length; i++) { |
58 |
try { |
59 |
list.add((IClasspathContributor) elements[i].createExecutableExtension("class")); //$NON-NLS-1$ |
60 |
} catch (CoreException e) { |
61 |
PDECore.log(e.getStatus()); |
62 |
} |
63 |
} |
64 |
fClasspathContributors = new IClasspathContributor[list.size()]; |
65 |
list.toArray(fClasspathContributors); |
49 |
} |
66 |
} |
50 |
|
67 |
|
51 |
/* |
68 |
/* |
Lines 111-116
public class RequiredPluginsClasspathContainer extends PDEClasspathContainer imp
Link Here
|
111 |
// to avoid cycles, e.g. when a bundle imports a package it exports |
128 |
// to avoid cycles, e.g. when a bundle imports a package it exports |
112 |
added.add(desc); |
129 |
added.add(desc); |
113 |
|
130 |
|
|
|
131 |
for (IClasspathContributor cc : fClasspathContributors) { |
132 |
List<Contribution> contribs = cc.getHostBundleContributions(desc); |
133 |
if (contribs == null || contribs.isEmpty()) { |
134 |
continue; |
135 |
} |
136 |
|
137 |
for (Contribution c : contribs) { |
138 |
if (c.jarLocation == null) { |
139 |
continue; |
140 |
} |
141 |
Rule[] rs = new Rule[c.rules != null ? c.rules.length : 0]; |
142 |
for (int i = 0; i < rs.length; i++) { |
143 |
Rule r = new Rule(); |
144 |
r.path = c.rules[i].path; |
145 |
r.discouraged = c.rules[i].discouraged; |
146 |
System.err.println(r.path); |
147 |
rs[i] = r; |
148 |
} |
149 |
|
150 |
IClasspathAttribute[] attr = null; |
151 |
if (c.javaDocLocation != null) { |
152 |
if (c.attributes != null) { |
153 |
attr = new IClasspathAttribute[c.attributes.length + 1]; |
154 |
System.arraycopy(c.attributes, 0, attr, 0, c.attributes.length); |
155 |
} else { |
156 |
attr = new IClasspathAttribute[1]; |
157 |
} |
158 |
attr[attr.length - 1] = JavaCore.newClasspathAttribute(IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, c.javaDocLocation); |
159 |
} else { |
160 |
attr = c.attributes; |
161 |
} |
162 |
|
163 |
addLibraryEntry(c.jarLocation, c.sourceLocation, rs, attr, entries); |
164 |
} |
165 |
} |
166 |
|
114 |
HostSpecification host = desc.getHost(); |
167 |
HostSpecification host = desc.getHost(); |
115 |
if (host != null) { |
168 |
if (host != null) { |
116 |
addHostPlugin(host, added, map, entries); |
169 |
addHostPlugin(host, added, map, entries); |
Lines 248-255
public class RequiredPluginsClasspathContainer extends PDEClasspathContainer imp
Link Here
|
248 |
IPluginModelBase model = PluginRegistry.findModel(desc); |
301 |
IPluginModelBase model = PluginRegistry.findModel(desc); |
249 |
if (model == null || !model.isEnabled()) |
302 |
if (model == null || !model.isEnabled()) |
250 |
return false; |
303 |
return false; |
|
|
304 |
|
251 |
IResource resource = model.getUnderlyingResource(); |
305 |
IResource resource = model.getUnderlyingResource(); |
252 |
Rule[] rules = useInclusions ? getInclusions(map, model) : null; |
306 |
Rule[] rules = useInclusions ? getInclusions(map, model) : null; |
|
|
307 |
|
308 |
for (IClasspathContributor cp : fClasspathContributors) { |
309 |
List<Contribution> contribs = cp.getReferencedBundleContributions(desc); |
310 |
if (contribs == null || contribs.isEmpty()) { |
311 |
continue; |
312 |
} |
313 |
|
314 |
for (Contribution c : contribs) { |
315 |
IClasspathAttribute[] attributes = new IClasspathAttribute[0]; |
316 |
if (c.jarLocation == null) { |
317 |
continue; |
318 |
} |
319 |
|
320 |
if (c.attributes == null) { |
321 |
if (c.javaDocLocation != null) { |
322 |
attributes = new IClasspathAttribute[] {JavaCore.newClasspathAttribute(IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, c.javaDocLocation)}; |
323 |
} |
324 |
} else { |
325 |
if (c.javaDocLocation != null) { |
326 |
attributes = new IClasspathAttribute[c.attributes.length + 1]; |
327 |
attributes[attributes.length - 1] = JavaCore.newClasspathAttribute(IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, c.javaDocLocation); |
328 |
} else { |
329 |
attributes = new IClasspathAttribute[c.attributes.length]; |
330 |
} |
331 |
System.arraycopy(c.attributes, 0, attributes, 0, c.attributes.length); |
332 |
} |
333 |
|
334 |
addLibraryEntry(c.jarLocation, c.sourceLocation, rules, attributes, entries); |
335 |
} |
336 |
} |
337 |
|
253 |
if (resource != null) { |
338 |
if (resource != null) { |
254 |
addProjectEntry(resource.getProject(), rules, entries); |
339 |
addProjectEntry(resource.getProject(), rules, entries); |
255 |
} else { |
340 |
} else { |