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


Java TemplateContextType.resolvers方法代码示例

本文整理汇总了Java中org.eclipse.jface.text.templates.TemplateContextType.resolvers方法的典型用法代码示例。如果您正苦于以下问题:Java TemplateContextType.resolvers方法的具体用法?Java TemplateContextType.resolvers怎么用?Java TemplateContextType.resolvers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.jface.text.templates.TemplateContextType的用法示例。


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

示例1: getHoverInfo

import org.eclipse.jface.text.templates.TemplateContextType; //导入方法依赖的package包/类
public String getHoverInfo(ITextViewer textViewer, IRegion subject) {
	try {
		IDocument doc= textViewer.getDocument();
		int offset= subject.getOffset();
		if (offset >= 2 && "${".equals(doc.get(offset-2, 2))) { //$NON-NLS-1$
			String varName= doc.get(offset, subject.getLength());
			TemplateContextType contextType= fProcessor.getContextType();
			if (contextType != null) {
				Iterator iter= contextType.resolvers();
				while (iter.hasNext()) {
					TemplateVariableResolver var= (TemplateVariableResolver) iter.next();
					if (varName.equals(var.getType())) {
						return var.getDescription();
					}
				}
			}
		}				
	} catch (BadLocationException e) {
	}
	return null;
}
 
开发者ID:angelozerr,项目名称:typescript.java,代码行数:22,代码来源:CodeTemplateSourceViewerConfiguration.java

示例2: getHoverInfo

import org.eclipse.jface.text.templates.TemplateContextType; //导入方法依赖的package包/类
public String getHoverInfo(ITextViewer textViewer, IRegion subject) {
	try {
		IDocument doc= textViewer.getDocument();
		int offset= subject.getOffset();
		if (offset >= 2 && "${".equals(doc.get(offset-2, 2))) { //$NON-NLS-1$
			String varName= doc.get(offset, subject.getLength());
			TemplateContextType contextType= fProcessor.getContextType();
			if (contextType != null) {
				Iterator<TemplateVariableResolver> iter= contextType.resolvers();
				while (iter.hasNext()) {
					TemplateVariableResolver var= iter.next();
					if (varName.equals(var.getType())) {
						return var.getDescription();
					}
				}
			}
		}
	} catch (BadLocationException e) {
	}
	return null;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:22,代码来源:CodeTemplateSourceViewerConfiguration.java

示例3: registerJavaContext

import org.eclipse.jface.text.templates.TemplateContextType; //导入方法依赖的package包/类
/**
 * Registers the given Java template context.
 *
 * @param registry the template context type registry
 * @param id the context type id
 * @param parent the parent context type
 * @since 3.4
 */
private static void registerJavaContext(
    ContributionContextTypeRegistry registry, String id, TemplateContextType parent) {
  TemplateContextType contextType = registry.getContextType(id);
  Iterator<TemplateVariableResolver> iter = parent.resolvers();
  while (iter.hasNext()) contextType.addResolver(iter.next());
}
 
开发者ID:eclipse,项目名称:che,代码行数:15,代码来源:JavaPlugin.java

示例4: registerJavaContext

import org.eclipse.jface.text.templates.TemplateContextType; //导入方法依赖的package包/类
/**
 * Registers the given Java template context.
 *
 * @param registry the template context type registry
 * @param id the context type id
 * @param parent the parent context type
 * @since 3.4
 */
private static void registerJavaContext(ContributionContextTypeRegistry registry, String id, TemplateContextType parent) {
	TemplateContextType contextType= registry.getContextType(id);
	Iterator<TemplateVariableResolver> iter= parent.resolvers();
	while (iter.hasNext())
		contextType.addResolver(iter.next());
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:15,代码来源:JavaPlugin.java


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