本文整理汇总了Java中org.eclipse.jface.text.templates.TemplateVariable.setValues方法的典型用法代码示例。如果您正苦于以下问题:Java TemplateVariable.setValues方法的具体用法?Java TemplateVariable.setValues怎么用?Java TemplateVariable.setValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.text.templates.TemplateVariable
的用法示例。
在下文中一共展示了TemplateVariable.setValues方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolve
import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void resolve(TemplateVariable variable, TemplateContext context)
{
if (!variable.getVariableType().getParams().isEmpty())
{
String[] values = (String[]) variable.getVariableType().getParams().toArray(new String[0]);
variable.setValues(values);
variable.setUnambiguous(false);
variable.setResolved(true);
}
else
{
super.resolve(variable, context);
setEvaluationString(variable.getName());
}
}
示例2: resolve
import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext templateContext) {
XtextTemplateContext castedContext = (XtextTemplateContext) templateContext;
List<String> names = resolveValues(variable, castedContext);
String[] bindings = names.toArray(new String[names.size()]);
if (bindings.length != 0)
variable.setValues(bindings);
if (bindings.length > 1)
variable.setUnambiguous(false);
else
variable.setUnambiguous(isUnambiguous(castedContext));
variable.setResolved(true);
}
示例3: resolve
import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
List params = variable.getVariableType().getParams();
String[] bindings = new String[params.size()];
for (int i = 0; i < params.size(); i++) {
bindings[i] = params.get(i).toString();
}
if (bindings.length != 0)
variable.setValues(bindings);
variable.setResolved(true);
}
示例4: resolve
import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void resolve(TemplateVariable variable, TemplateContext context)
{
if (context instanceof DocumentSnippetTemplateContext)
{
DocumentSnippetTemplateContext documentSnippetTemplateContext = (DocumentSnippetTemplateContext) context;
Template template = documentSnippetTemplateContext.getTemplate();
if (template instanceof SnippetTemplate)
{
SnippetTemplate snippetTemplate = (SnippetTemplate) template;
CommandElement snippet = snippetTemplate.getCommandElement();
Map<String, String> environment = snippet.getEnvironment();
String name = variable.getName();
String value = environment.get(name);
if (value == null)
{
if (!variable.getVariableType().getParams().isEmpty())
{
String[] values = (String[]) variable.getVariableType().getParams().toArray(new String[0]);
variable.setValues(values);
variable.setUnambiguous(false);
}
else
{
super.resolve(variable, context);
}
}
else
{
variable.setValues(new String[] { value });
}
variable.setResolved(true);
}
}
}