当前位置: 首页>>代码示例>>Java>>正文


Java IContext类代码示例

本文整理汇总了Java中org.eclipse.help.IContext的典型用法代码示例。如果您正苦于以下问题:Java IContext类的具体用法?Java IContext怎么用?Java IContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IContext类属于org.eclipse.help包,在下文中一共展示了IContext类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getHelpUrl

import org.eclipse.help.IContext; //导入依赖的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;
}
 
开发者ID:forcedotcom,项目名称:idecore,代码行数:19,代码来源:UIUtils.java

示例2: parseHelp

import org.eclipse.help.IContext; //导入依赖的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());
}
 
开发者ID:Yakindu,项目名称:statecharts,代码行数:13,代码来源:AbstractUserHelpDocumentationProvider.java

示例3: getContext

import org.eclipse.help.IContext; //导入依赖的package包/类
public IContext getContext(Object target)
{
	if (target instanceof IParseNode)
	{
		return new JSHelpContext(editorPart, (IParseNode) target);
	}
	ISelection selection = editorPart.getSelectionProvider().getSelection();
	if (selection.isEmpty())
	{
		return null;
	}
	ITextSelection textSelection = (ITextSelection) selection;
	int offset = textSelection.getOffset();
	return new JSHelpContext(editorPart, editorPart.getASTNodeAt(offset, editorPart.getAST()));
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:16,代码来源:JSSourceEditor.java

示例4: getContext

import org.eclipse.help.IContext; //导入依赖的package包/类
public IContext getContext(Object target) {
	IContext context= HelpSystem.getContext(fId);
	if (fSelected != null && fSelected.length > 0) {
		try {
			context= new JavadocHelpContext(context, fSelected);
		} catch (JavaModelException e) {
			// since we are updating the UI with async exec it
			// can happen that the element doesn't exist anymore
			// but we are still showing it in the user interface
			if (!e.isDoesNotExist())
				JavaPlugin.log(e);
		}
	}
	return context;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:16,代码来源:JavaUIHelp.java

示例5: displayHelp

import org.eclipse.help.IContext; //导入依赖的package包/类
public static void displayHelp(String contextId, Object[] selected) throws CoreException {
	IContext context= HelpSystem.getContext(contextId);
	if (context != null) {
		if (selected != null && selected.length > 0) {
			context= new JavadocHelpContext(context, selected);
		}
		PlatformUI.getWorkbench().getHelpSystem().displayHelp(context);
	}
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:10,代码来源:JavadocHelpContext.java

示例6: displayHelp

import org.eclipse.help.IContext; //导入依赖的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);
	}
	*/
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:37,代码来源:SelfHelpDisplay.java

示例7: getContext

import org.eclipse.help.IContext; //导入依赖的package包/类
@Override
public IContext getContext(Object target) {
	return HelpSystem.getContext(id);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:5,代码来源:ContextProvider.java

示例8: JavadocHelpContext

import org.eclipse.help.IContext; //导入依赖的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

示例9: getContext

import org.eclipse.help.IContext; //导入依赖的package包/类
/**
 * Computes and returns context information for the given context id
 * for the platform's current locale.
 * 
 * @param contextId the context id, e.g. "org.my.plugin.my_id"
 * @return the context, or <code>null</code> if none
 */
public static IContext getContext(String contextId) {
	return HelpPlugin.getContextManager().getContext(contextId, Platform.getNL());
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:11,代码来源:SelfHelpSystem.java

示例10: displayContext

import org.eclipse.help.IContext; //导入依赖的package包/类
@Override
public void displayContext(IContext context, int x, int y) {
	
}
 
开发者ID:heartsome,项目名称:translationstudio8,代码行数:5,代码来源:AbstractSelfHelpUI.java


注:本文中的org.eclipse.help.IContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。