本文整理汇总了Java中org.eclipse.jface.text.templates.TemplateVariable.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java TemplateVariable.setValue方法的具体用法?Java TemplateVariable.setValue怎么用?Java TemplateVariable.setValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.text.templates.TemplateVariable
的用法示例。
在下文中一共展示了TemplateVariable.setValue方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: resolve
import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
variable.setUnambiguous(true);
variable.setValue(""); // $NON-NLS-1$
if (context instanceof JavaContext) {
JavaContext jc = (JavaContext) context;
List<String> params = variable.getVariableType().getParams();
if (params.size() > 0) {
for (Iterator<String> iterator = params.iterator(); iterator.hasNext(); ) {
String typeName = iterator.next();
jc.addImport(typeName);
}
}
} else {
super.resolve(variable, context);
}
}
示例2: resolve
import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
variable.setUnambiguous(true);
variable.setValue(""); // $NON-NLS-1$
if (context instanceof JavaContext) {
JavaContext jc = (JavaContext) context;
List<String> params = variable.getVariableType().getParams();
if (params.size() > 0) {
for (Iterator<String> iterator = params.iterator(); iterator.hasNext(); ) {
String qualifiedMemberName = iterator.next();
jc.addStaticImport(qualifiedMemberName);
}
}
} else {
super.resolve(variable, context);
}
}
示例3: resolve
import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
variable.setUnambiguous(true);
variable.setValue(""); //$NON-NLS-1$
if (context instanceof JavaContext) {
JavaContext jc= (JavaContext) context;
List<String> params= variable.getVariableType().getParams();
if (params.size() > 0) {
for (Iterator<String> iterator= params.iterator(); iterator.hasNext();) {
String typeName= iterator.next();
jc.addImport(typeName);
}
}
} else {
super.resolve(variable, context);
}
}
示例4: resolve
import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
variable.setUnambiguous(true);
variable.setValue(""); //$NON-NLS-1$
if (context instanceof JavaContext) {
JavaContext jc= (JavaContext) context;
List<String> params= variable.getVariableType().getParams();
if (params.size() > 0) {
for (Iterator<String> iterator= params.iterator(); iterator.hasNext();) {
String qualifiedMemberName= iterator.next();
jc.addStaticImport(qualifiedMemberName);
}
}
} else {
super.resolve(variable, context);
}
}
示例5: resolve
import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
@SuppressWarnings("unchecked")
List<String> params = (List<String>) variable.getVariableType().getParams();
variable.setValue("");
variable.setUnambiguous(this.isUnambiguous(context));
variable.setResolved(true);
if (params.size() != 1) {
return;
}
List<Integer> result = this.resolve(params, context);
if (result.get(0) != null) {
context.setVariable(variable.getName(), "" + result.get(0));
}
}
示例6: resolve
import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
@SuppressWarnings("unchecked")
List<String> params = (List<String>) variable.getVariableType().getParams();
variable.setValue("");
variable.setResolved(true);
variable.setUnambiguous(this.isUnambiguous(context));
if (params.size() != 1) {
return;
}
Integer expanded = this.resolve(params, context).get(0);
if (expanded == null) {
return;
}
char c = ' ';
if (expanded > 0) {
c = '+';
}
else {
c = '-';
expanded = -expanded;
}
char[] incDec = new char[expanded];
Arrays.fill(incDec, c);
String value = new String(incDec);
variable.setValue(value);
context.setVariable(variable.getName(), value);
}
示例7: resolve
import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
@SuppressWarnings("unchecked")
List<String> params = (List<String>) variable.getVariableType().getParams();
variable.setValue("");
variable.setResolved(true);
variable.setUnambiguous(this.isUnambiguous(context));
if (params.size() != 1) {
return;
}
Integer expanded = this.resolve(params, context).get(0);
if (expanded == null) {
return;
}
char c = ' ';
if (expanded > 0) {
c = '>';
}
else {
c = '<';
expanded = -expanded;
}
char[] shifts = new char[expanded];
Arrays.fill(shifts, c);
String value = new String(shifts);
variable.setValue(new String(shifts));
context.setVariable(variable.getName(), value);
}
示例8: resolve
import org.eclipse.jface.text.templates.TemplateVariable; //导入方法依赖的package包/类
@Override
public void resolve(TemplateVariable variable, TemplateContext context) {
@SuppressWarnings("unchecked")
List<String> params = (List<String>) variable.getVariableType().getParams();
variable.setValue("");
variable.setResolved(true);
variable.setUnambiguous(this.isUnambiguous(context));
if (params.size() != 2 && params.size() != 3) {
return;
}
Integer repeats = this.resolve(Arrays.asList(params.get(0)), context).get(0);
if (repeats == null) {
return;
}
Integer deleteSize = null;
if (params.size() == 3) {
deleteSize = this.resolve(Arrays.asList(params.get(2)), context).get(0);
}
String pattern = params.get(1);
StringBuilder result = new StringBuilder();
for (int i = 0; i < repeats; i++) {
result.append(pattern);
}
if (deleteSize != null && deleteSize > 0) {
result.delete(result.length() - deleteSize, result.length());
}
variable.setValue(result.toString());
context.setVariable(variable.getName(), result.toString());
}