View | Details | Raw Unified | Return to bug 399098 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/JREContainer.java (-11 / +25 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
2
 * Copyright (c) 2000, 2013 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 15-20 Link Here
15
import java.util.ArrayList;
15
import java.util.ArrayList;
16
import java.util.HashMap;
16
import java.util.HashMap;
17
import java.util.Iterator;
17
import java.util.Iterator;
18
import java.util.LinkedList;
18
import java.util.List;
19
import java.util.List;
19
import java.util.Map;
20
import java.util.Map;
20
21
Lines 317-332 Link Here
317
				if (rootPath.isEmpty()) {
318
				if (rootPath.isEmpty()) {
318
					rootPath = null;
319
					rootPath = null;
319
				}
320
				}
320
				URL javadocLocation = libs[i].getJavadocLocation();
321
				// construct the classpath attributes for this library location
321
				if (overrideJavaDoc && javadocLocation == null) {
322
				IClasspathAttribute[] attributes = JREContainer.buildClasspathAttributes(vm, libs[i], overrideJavaDoc);
322
					javadocLocation = vm.getJavadocLocation();
323
				}
324
				IClasspathAttribute[] attributes = null;
325
				if (javadocLocation == null) {
326
					attributes = new IClasspathAttribute[0];
327
				} else {
328
					attributes = new IClasspathAttribute[]{JavaCore.newClasspathAttribute(IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, javadocLocation.toExternalForm())};
329
				}
330
				IAccessRule[] libRules = null;
323
				IAccessRule[] libRules = null;
331
				if (rules != null) {
324
				if (rules != null) {
332
					libRules = rules[i];
325
					libRules = rules[i];
Lines 343-348 Link Here
343
		return cpEntries;		
336
		return cpEntries;		
344
	}
337
	}
345
338
339
	private static IClasspathAttribute[] buildClasspathAttributes(final IVMInstall vm, final LibraryLocation lib, final boolean overrideJavaDoc) {
340
	
341
		List<IClasspathAttribute> classpathAttributes = new LinkedList<IClasspathAttribute>();
342
		// process the javadoc location
343
		URL javadocLocation = lib.getJavadocLocation();
344
		if (overrideJavaDoc && javadocLocation == null) {
345
			javadocLocation = vm.getJavadocLocation();
346
		}
347
		if(javadocLocation != null) {
348
			IClasspathAttribute javadocCPAttribute = JavaCore.newClasspathAttribute(IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, javadocLocation.toExternalForm());
349
			classpathAttributes.add(javadocCPAttribute);
350
		}
351
		// process the index location
352
		URL indexLocation = lib.getIndexLocation();
353
		if(indexLocation != null) {
354
			IClasspathAttribute indexCPLocation = JavaCore.newClasspathAttribute(IClasspathAttribute.INDEX_LOCATION_ATTRIBUTE_NAME, indexLocation.toExternalForm());
355
			classpathAttributes.add(indexCPLocation);
356
		}
357
		return classpathAttributes.toArray(new IClasspathAttribute[classpathAttributes.size()]);
358
	}
359
	
346
	/**
360
	/**
347
	 * Constructs a JRE classpath container on the given VM install
361
	 * Constructs a JRE classpath container on the given VM install
348
	 * 
362
	 * 
(-)a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/internal/launching/VMDefinitionsContainer.java (-7 / +24 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2012 IBM Corporation and others.
2
 * Copyright (c) 2000, 2013 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 382-396 Link Here
382
			Element element = doc.createElement("libraryLocation");  //$NON-NLS-1$
382
			Element element = doc.createElement("libraryLocation");  //$NON-NLS-1$
383
			element.setAttribute("jreJar", locations[i].getSystemLibraryPath().toString()); //$NON-NLS-1$
383
			element.setAttribute("jreJar", locations[i].getSystemLibraryPath().toString()); //$NON-NLS-1$
384
			element.setAttribute("jreSrc", locations[i].getSystemLibrarySourcePath().toString()); //$NON-NLS-1$
384
			element.setAttribute("jreSrc", locations[i].getSystemLibrarySourcePath().toString()); //$NON-NLS-1$
385
385
			
386
			IPath packageRootPath = locations[i].getPackageRootPath();
386
			IPath packageRootPath = locations[i].getPackageRootPath();
387
            if (packageRootPath != null) {
387
            if (packageRootPath != null) {
388
                element.setAttribute("pkgRoot", packageRootPath.toString()); //$NON-NLS-1$
388
                element.setAttribute("pkgRoot", packageRootPath.toString()); //$NON-NLS-1$
389
            }
389
            }
390
            
390
            
391
			URL url= locations[i].getJavadocLocation();
391
			URL javadocURL= locations[i].getJavadocLocation();
392
			if (url != null) {
392
			if (javadocURL != null) {
393
				element.setAttribute("jreJavadoc", url.toExternalForm()); //$NON-NLS-1$
393
				element.setAttribute("jreJavadoc", javadocURL.toExternalForm()); //$NON-NLS-1$
394
			}
395
			URL indexURL = locations[i].getIndexLocation();
396
			if(indexURL != null) {
397
				element.setAttribute("jreIndex", indexURL.toExternalForm()); //$NON-NLS-1$
394
			}
398
			}
395
			root.appendChild(element);
399
			root.appendChild(element);
396
		}
400
		}
Lines 628-633 Link Here
628
		String jreSrc= libLocationElement.getAttribute("jreSrc"); //$NON-NLS-1$
632
		String jreSrc= libLocationElement.getAttribute("jreSrc"); //$NON-NLS-1$
629
		String pkgRoot= libLocationElement.getAttribute("pkgRoot"); //$NON-NLS-1$
633
		String pkgRoot= libLocationElement.getAttribute("pkgRoot"); //$NON-NLS-1$
630
		String jreJavadoc= libLocationElement.getAttribute("jreJavadoc"); //$NON-NLS-1$
634
		String jreJavadoc= libLocationElement.getAttribute("jreJavadoc"); //$NON-NLS-1$
635
		String jreIndex= libLocationElement.getAttribute("jreIndex"); //$NON-NLS-1$
636
		// javadoc URL
631
		URL javadocURL= null;
637
		URL javadocURL= null;
632
		if (jreJavadoc.length() == 0) {
638
		if (jreJavadoc.length() == 0) {
633
			jreJavadoc= null;
639
			jreJavadoc= null;
Lines 635-645 Link Here
635
			try {
641
			try {
636
				javadocURL= new URL(jreJavadoc);
642
				javadocURL= new URL(jreJavadoc);
637
			} catch (MalformedURLException e) {
643
			} catch (MalformedURLException e) {
638
				LaunchingPlugin.log("Library location element is specified incorrectly.");  //$NON-NLS-1$
644
				LaunchingPlugin.log("Library location javadoc element is specified incorrectly.");  //$NON-NLS-1$
639
			}
645
			}
640
		}
646
		}
647
		// index URL
648
		URL indexURL= null;
649
		if (jreIndex.length() == 0) {
650
			jreIndex= null;
651
		} else {
652
			try {
653
				indexURL= new URL(jreIndex);
654
			} catch (MalformedURLException e) {
655
				LaunchingPlugin.log("Library location jre index element is specified incorrectly.");  //$NON-NLS-1$
656
			}
657
		}		
641
		if (jreJar != null && jreSrc != null && pkgRoot != null) {
658
		if (jreJar != null && jreSrc != null && pkgRoot != null) {
642
			return new LibraryLocation(new Path(jreJar), new Path(jreSrc), new Path(pkgRoot), javadocURL);
659
			return new LibraryLocation(new Path(jreJar), new Path(jreSrc), new Path(pkgRoot), javadocURL, indexURL);
643
		}
660
		}
644
		LaunchingPlugin.log("Library location element is specified incorrectly.");  //$NON-NLS-1$
661
		LaunchingPlugin.log("Library location element is specified incorrectly.");  //$NON-NLS-1$
645
		return null;
662
		return null;
(-)a/org.eclipse.jdt.launching/launching/org/eclipse/jdt/launching/LibraryLocation.java (-7 / +50 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
2
 * Copyright (c) 2000, 2013 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 28-33 Link Here
28
	private IPath fSystemLibrarySource;
28
	private IPath fSystemLibrarySource;
29
	private IPath fPackageRootPath;
29
	private IPath fPackageRootPath;
30
	private URL fJavadocLocation;
30
	private URL fJavadocLocation;
31
	private URL fIndexLocation;
31
	
32
	
32
	/**
33
	/**
33
	 * Creates a new library location.
34
	 * Creates a new library location.
Lines 64-78 Link Here
64
	 * @since 3.1
65
	 * @since 3.1
65
	 */	
66
	 */	
66
	public LibraryLocation(IPath libraryPath, IPath sourcePath, IPath packageRoot, URL javadocLocation) {
67
	public LibraryLocation(IPath libraryPath, IPath sourcePath, IPath packageRoot, URL javadocLocation) {
67
		if (libraryPath == null)
68
		this(libraryPath, sourcePath, packageRoot, javadocLocation, null);
68
			throw new IllegalArgumentException(LaunchingMessages.libraryLocation_assert_libraryNotNull); 
69
	}		
69
70
71
	/**
72
	 * Creates a new library location.
73
	 * 
74
	 * @param libraryPath	The location of the JAR containing java.lang.Object
75
	 * 					Must not be <code>null</code>.
76
	 * @param sourcePath	The location of the zip file containing the sources for <code>library</code>
77
	 * 					Must not be <code>null</code> (Use Path.EMPTY instead)
78
	 * @param packageRoot The path inside the <code>source</code> zip file where packages names
79
	 * 					  begin. If the source for java.lang.Object source is found at 
80
	 * 					  "src/java/lang/Object.java" in the zip file, the 
81
	 * 					  packageRoot should be "src"
82
	 * 					  Must not be <code>null</code>. (Use Path.EMPTY or IPath.ROOT)
83
	 * @param javadocLocation The location of the javadoc for <code>library</code>
84
	 * @param indexLocation The location of the index for <code>library</code>
85
	 * @throws IllegalArgumentException If the library path is <code>null</code>.
86
	 * @since 3.7
87
	 */
88
	public LibraryLocation(IPath libraryPath, IPath sourcePath, IPath packageRoot, URL javadocLocation, URL indexLocation) {
89
		if (libraryPath == null) {
90
			throw new IllegalArgumentException(LaunchingMessages.libraryLocation_assert_libraryNotNull); 
91
		}
70
		fSystemLibrary= libraryPath;
92
		fSystemLibrary= libraryPath;
71
		fSystemLibrarySource= sourcePath;
93
		fSystemLibrarySource= sourcePath;
72
		fPackageRootPath= packageRoot;
94
		fPackageRootPath= packageRoot;
73
		fJavadocLocation= javadocLocation;
95
		fJavadocLocation= javadocLocation;
74
	}		
96
		fIndexLocation = indexLocation;
75
		
97
	}
98
	
76
	/**
99
	/**
77
	 * Returns the JRE library jar location.
100
	 * Returns the JRE library jar location.
78
	 * 
101
	 * 
Lines 103-114 Link Here
103
	/**
126
	/**
104
	 * Returns the Javadoc location associated with this Library location.
127
	 * Returns the Javadoc location associated with this Library location.
105
	 * 
128
	 * 
106
	 * @return a url pointing to the Javadoc location associated with
129
	 * @return a {@link URL} pointing to the Javadoc location associated with
107
	 * 	this Library location, or <code>null</code> if none
130
	 * 	this Library location, or <code>null</code> if none
108
	 * @since 3.1
131
	 * @since 3.1
109
	 */
132
	 */
110
	public URL getJavadocLocation() {
133
	public URL getJavadocLocation() {
111
		return fJavadocLocation;
134
		return fJavadocLocation;
135
	}
136
	
137
	/**
138
	 * Returns the index location associated with this library location.
139
	 * 
140
	 * @return a {@link URL} pointing to the index location associated with
141
	 * 	this Library location, or <code>null</code> if none
142
	 * @since 3.7
143
	 */
144
	public URL getIndexLocation() {
145
		return fIndexLocation;
112
	}
146
	}
113
	
147
	
114
	/* (non-Javadoc)
148
	/* (non-Javadoc)
Lines 171-174 Link Here
171
		fSystemLibrarySource = source;
205
		fSystemLibrarySource = source;
172
	}
206
	}
173
207
174
}
208
	/**
209
	 * Sets the index location to the given {@link URL}.
210
	 * 
211
	 * @param indexLoc
212
	 * @since 3.7
213
	 */
214
	public void setIndexLocation(URL indexLoc) {
215
		fIndexLocation = indexLoc;
216
	}
217
}

Return to bug 399098