當前位置: 首頁>>代碼示例>>Java>>正文


Java JavaUI.getJavadocLocation方法代碼示例

本文整理匯總了Java中org.eclipse.jdt.ui.JavaUI.getJavadocLocation方法的典型用法代碼示例。如果您正苦於以下問題:Java JavaUI.getJavadocLocation方法的具體用法?Java JavaUI.getJavadocLocation怎麽用?Java JavaUI.getJavadocLocation使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jdt.ui.JavaUI的用法示例。


在下文中一共展示了JavaUI.getJavadocLocation方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getBaseURL

import org.eclipse.jdt.ui.JavaUI; //導入方法依賴的package包/類
/**
 * Returns the location of the Javadoc.
 * 
 * @param element whose Javadoc location has to be found
 * @param isBinary <code>true</code> if the Java element is from a binary container
 * @return the location URL of the Javadoc or <code>null</code> if the location cannot be found
 * @throws JavaModelException thrown when the Java element cannot be accessed
 * @since 3.9
 */
public static String getBaseURL(IJavaElement element, boolean isBinary) throws JavaModelException {
	if (isBinary) {
		// Source attachment usually does not include Javadoc resources
		// => Always use the Javadoc location as base:
		URL baseURL= JavaUI.getJavadocLocation(element, false);
		if (baseURL != null) {
			if (baseURL.getProtocol().equals(JAR_PROTOCOL)) {
				// It's a JarURLConnection, which is not known to the browser widget.
				// Let's start the help web server:
				URL baseURL2= PlatformUI.getWorkbench().getHelpSystem().resolve(baseURL.toExternalForm(), true);
				if (baseURL2 != null) { // can be null if org.eclipse.help.ui is not available
					baseURL= baseURL2;
				}
			}
			return baseURL.toExternalForm();
		}
	} else {
		IResource resource= element.getResource();
		if (resource != null) {
			/*
			 * Too bad: Browser widget knows nothing about EFS and custom URL handlers,
			 * so IResource#getLocationURI() does not work in all cases.
			 * We only support the local file system for now.
			 * A solution could be https://bugs.eclipse.org/bugs/show_bug.cgi?id=149022 .
			 */
			IPath location= resource.getLocation();
			if (location != null)
				return location.toFile().toURI().toString();
		}
	}
	return null;
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:42,代碼來源:JavaDocLocations.java

示例2: getBaseURL

import org.eclipse.jdt.ui.JavaUI; //導入方法依賴的package包/類
public static String getBaseURL(IMember member) throws JavaModelException {
	if (member.isBinary()) {
		// Source attachment usually does not include Javadoc resources
		// => Always use the Javadoc location as base:
		URL baseURL= JavaUI.getJavadocLocation(member, false);
		if (baseURL != null) {
			if (baseURL.getProtocol().equals(JAR_PROTOCOL)) {
				// It's a JarURLConnection, which is not known to the browser widget.
				// Let's start the help web server:
				URL baseURL2= PlatformUI.getWorkbench().getHelpSystem().resolve(baseURL.toExternalForm(), true);
				if (baseURL2 != null) { // can be null if org.eclipse.help.ui is not available
					baseURL= baseURL2;
				}
			}
			return baseURL.toExternalForm();
		}
	} else {
		IResource resource= member.getResource();
		if (resource != null) {
			/*
			 * Too bad: Browser widget knows nothing about EFS and custom URL handlers,
			 * so IResource#getLocationURI() does not work in all cases.
			 * We only support the local file system for now.
			 * A solution could be https://bugs.eclipse.org/bugs/show_bug.cgi?id=149022 .
			 */
			IPath location= resource.getLocation();
			if (location != null)
				return location.toFile().toURI().toASCIIString();
		}
	}
	return null;
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion-Juno38,代碼行數:33,代碼來源:JavaDocLocations.java

示例3: JavadocHelpContext

import org.eclipse.jdt.ui.JavaUI; //導入方法依賴的package包/類
public JavadocHelpContext(IContext context, Object[] elements) throws JavaModelException {
	Assert.isNotNull(elements);
	if (context instanceof IContext2)
		fTitle= ((IContext2)context).getTitle();

	List<IHelpResource> helpResources= new ArrayList<IHelpResource>();

	String javadocSummary= null;
	for (int i= 0; i < elements.length; i++) {
		if (elements[i] instanceof IJavaElement) {
			IJavaElement element= (IJavaElement) elements[i];
			// if element isn't on the build path skip it
			if (!ActionUtil.isOnBuildPath(element))
				continue;

			// Create Javadoc summary
			if (BUG_85721_FIXED) {
				if (javadocSummary == null) {
					javadocSummary= retrieveText(element);
					if (javadocSummary != null) {
						String elementLabel= JavaElementLabels.getTextLabel(element, JavaElementLabels.ALL_DEFAULT);

						// FIXME: needs to be NLSed once the code becomes active
						javadocSummary= "<b>Javadoc for " + elementLabel + ":</b><br>" + javadocSummary;   //$NON-NLS-1$//$NON-NLS-2$
					}
				} else {
					javadocSummary= ""; // no Javadoc summary for multiple selection //$NON-NLS-1$
				}
			}

			URL url= JavaUI.getJavadocLocation(element, true);
			if (url == null || doesNotExist(url)) {
				IPackageFragmentRoot root= JavaModelUtil.getPackageFragmentRoot(element);
				if (root != null) {
					url= JavaUI.getJavadocBaseLocation(element);
					if (root.getKind() == IPackageFragmentRoot.K_SOURCE) {
						element= element.getJavaProject();
					} else {
						element= root;
					}
					url= JavaUI.getJavadocLocation(element, false);
				}
			}
			if (url != null) {
				IHelpResource javaResource= new JavaUIHelpResource(element, getURLString(url));
				helpResources.add(javaResource);
			}
		}
	}

	// Add static help topics
	if (context != null) {
		IHelpResource[] resources= context.getRelatedTopics();
		if (resources != null) {
			for (int j= 0; j < resources.length; j++) {
				helpResources.add(resources[j]);
			}
		}
	}

	fHelpResources= helpResources.toArray(new IHelpResource[helpResources.size()]);

	if (context != null)
		fText= context.getText();

	if (BUG_85721_FIXED) {
		if (javadocSummary != null && javadocSummary.length() > 0) {
			if (fText != null)
				fText= context.getText() + "<br><br>" + javadocSummary; //$NON-NLS-1$
			else
				fText= javadocSummary;
		}
	}

	if (fText == null)
		fText= "";  //$NON-NLS-1$

}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:79,代碼來源:JavadocHelpContext.java


注:本文中的org.eclipse.jdt.ui.JavaUI.getJavadocLocation方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。