本文整理汇总了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;
}
示例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;
}
示例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$
}