本文整理汇总了Java中org.eclipse.help.IHelpResource类的典型用法代码示例。如果您正苦于以下问题:Java IHelpResource类的具体用法?Java IHelpResource怎么用?Java IHelpResource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IHelpResource类属于org.eclipse.help包,在下文中一共展示了IHelpResource类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHelpUrl
import org.eclipse.help.IHelpResource; //导入依赖的package包/类
public static String getHelpUrl(String contextId) {
if (contextId != null) {
if (contextId.lastIndexOf(Constants.DOT) == -1) {
contextId = Constants.DOCUMENTATION_PLUGIN_PREFIX + Constants.DOT + contextId;
}
IContext c = HelpSystem.getContext(contextId);
if (c != null) {
IHelpResource[] topics = c.getRelatedTopics();
if (!Utils.isEmpty(topics)) {
return topics[0].getHref();
}
}
}
return null;
}
示例2: parseHelp
import org.eclipse.help.IHelpResource; //导入依赖的package包/类
private String parseHelp(String contextId) throws Exception {
ContextFileProvider provider = new ContextFileProvider();
IContext context = provider.getContext(contextId, Locale.getDefault()
.toString());
IHelpResource[] relatedTopics = context.getRelatedTopics();
Assert.isTrue(relatedTopics != null);
// We assume that there is only one topic registered
IHelpResource helpResource = relatedTopics[0];
String href = helpResource.getHref().substring(1);
URL url = new URL("platform:/plugin/" + href);
return convertStreamToString(url.openConnection().getInputStream());
}
示例3: getRelatedTopics
import org.eclipse.help.IHelpResource; //导入依赖的package包/类
public IHelpResource[] getRelatedTopics()
{
Collection<PropertyElement> properties = getActiveProperty();
if (!CollectionsUtil.isEmpty(properties))
{
Set<IHelpResource> refs = new HashSet<IHelpResource>();
for (PropertyElement pe : properties)
{
for (SinceElement se : pe.getSinceList())
{
String version = se.getVersion();
if ("DOM 0".equals(version))
{
refs.add(new JSDOMHelpResource(0));
}
else if ("HTML DOM Level 2".equals(version))
{
refs.add(new JSDOMHelpResource(2));
}
else if ("HTML DOM Level 3".equals(version))
{
refs.add(new JSDOMHelpResource(3));
}
else if ("DOM5 HTML".equals(version))
{
refs.add(new JSDOMHelpResource(5));
}
}
return refs.toArray(new IHelpResource[refs.size()]);
}
}
return null;
}
示例4: displayHelp
import org.eclipse.help.IHelpResource; //导入依赖的package包/类
/**
* Display help for the a given topic and related topics.
*
* @param context
* context for which related topics will be displayed
* @param topic
* related topic to be selected
*/
public void displayHelp(IContext context, IHelpResource topic,
boolean forceExternal) {
if (context == null || topic == null || topic.getHref() == null)
return;
String topicURL = getTopicURL(topic.getHref());
displayHelpResource(topicURL, false);
/*
* links tab removed 11/2007, Bug 120947
if (getNoframesURL(topicURL) == null) {
try {
String url = "tab=links" //$NON-NLS-1$
+ "&contextId=" //$NON-NLS-1$
+ URLEncoder.encode(getContextID(context), "UTF-8") //$NON-NLS-1$
+ "&topic=" //$NON-NLS-1$
+ URLEncoder.encode(topicURL, "UTF-8"); //$NON-NLS-1$
displayHelpURL(url, forceExternal);
} catch (UnsupportedEncodingException uee) {
}
} else if (topicURL.startsWith("jar:file:")) { //$NON-NLS-1$
// topic from a jar to display without frames
displayHelpURL(
getBaseURL() + "nftopic/" + getNoframesURL(topicURL), true); //$NON-NLS-1$
} else {
displayHelpURL(getNoframesURL(topicURL), true);
}
*/
}
示例5: getCategory
import org.eclipse.help.IHelpResource; //导入依赖的package包/类
public String getCategory(IHelpResource topic)
{
// TODO Auto-generated method stub
return null;
}
示例6: JavadocHelpContext
import org.eclipse.help.IHelpResource; //导入依赖的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$
}
示例7: getRelatedTopics
import org.eclipse.help.IHelpResource; //导入依赖的package包/类
public IHelpResource[] getRelatedTopics() {
return fHelpResources;
}
示例8: getCategory
import org.eclipse.help.IHelpResource; //导入依赖的package包/类
public String getCategory(IHelpResource topic) {
if (topic instanceof JavaUIHelpResource)
return JavaUIMessages.JavaUIHelpContext_javaHelpCategory_label;
return null;
}