本文整理汇总了Java中org.eclipse.help.IContext2类的典型用法代码示例。如果您正苦于以下问题:Java IContext2类的具体用法?Java IContext2怎么用?Java IContext2使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IContext2类属于org.eclipse.help包,在下文中一共展示了IContext2类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: JavadocHelpContext
import org.eclipse.help.IContext2; //导入依赖的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$
}