Java Code Examples for org.eclipse.jdt.ui.JavaUI#getLibraryJavadocLocation()

The following examples show how to use org.eclipse.jdt.ui.JavaUI#getLibraryJavadocLocation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BuildPathDialogAccess.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Shows the UI for configuring a javadoc location attribute of the classpath entry. <code>null</code> is returned
 * if the user cancels the dialog. The dialog does not apply any changes.
 *
 * @param shell The parent shell for the dialog.
 * @param initialEntry The entry to edit. The kind of the classpath entry must be either
 * <code>IClasspathEntry.CPE_LIBRARY</code> or <code>IClasspathEntry.CPE_VARIABLE</code>.
 * @return Returns the resulting classpath entry containing a potentially modified javadoc location attribute
 * The resulting entry can be used to replace the original entry on the classpath.
 * Note that the dialog does not make any changes on the passed entry nor on the classpath that
 * contains it.
 *
 * @since 3.1
 */
public static IClasspathEntry configureJavadocLocation(Shell shell, IClasspathEntry initialEntry) {
	if (initialEntry == null) {
		throw new IllegalArgumentException();
	}
	int entryKind= initialEntry.getEntryKind();
	if (entryKind != IClasspathEntry.CPE_LIBRARY && entryKind != IClasspathEntry.CPE_VARIABLE) {
		throw new IllegalArgumentException();
	}

	URL location= JavaUI.getLibraryJavadocLocation(initialEntry);
	JavadocLocationDialog dialog=  new JavadocLocationDialog(shell, BasicElementLabels.getPathLabel(initialEntry.getPath(), false), location);
	if (dialog.open() == Window.OK) {
		CPListElement element= CPListElement.createFromExisting(initialEntry, null);
		URL res= dialog.getResult();
		element.setAttribute(CPListElement.JAVADOC, res != null ? res.toExternalForm() : null);
		return element.getClasspathEntry();
	}
	return null;
}
 
Example 2
Source File: JavadocLinkRef.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public URL getURL() {
	if (isProjectRef()) {
		return JavaUI.getProjectJavadocLocation(fProject);
	} else {
		return JavaUI.getLibraryJavadocLocation(fClasspathEntry);
	}
}