本文整理汇总了Java中org.eclipse.jface.text.templates.TemplateBuffer.getVariables方法的典型用法代码示例。如果您正苦于以下问题:Java TemplateBuffer.getVariables方法的具体用法?Java TemplateBuffer.getVariables怎么用?Java TemplateBuffer.getVariables使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.text.templates.TemplateBuffer
的用法示例。
在下文中一共展示了TemplateBuffer.getVariables方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCaretOffset
import org.eclipse.jface.text.templates.TemplateBuffer; //导入方法依赖的package包/类
private int getCaretOffset(TemplateBuffer buffer) {
TemplateVariable[] variables = buffer.getVariables();
for (int i = 0; i != variables.length; i++) {
TemplateVariable variable = variables[i];
if (variable.getType().equals(GlobalTemplateVariables.Cursor.NAME))
return variable.getOffsets()[0];
}
return buffer.getString().length();
}
示例2: findVariable
import org.eclipse.jface.text.templates.TemplateBuffer; //导入方法依赖的package包/类
private static TemplateVariable findVariable(TemplateBuffer buffer, String variable) {
TemplateVariable[] positions = buffer.getVariables();
for (int i = 0; i < positions.length; i++) {
TemplateVariable curr = positions[i];
if (variable.equals(curr.getType())) {
return curr;
}
}
return null;
}
示例3: findVariable
import org.eclipse.jface.text.templates.TemplateBuffer; //导入方法依赖的package包/类
private static TemplateVariable findVariable(TemplateBuffer buffer, String variable) {
TemplateVariable[] positions = buffer.getVariables();
for (int i = 0; i < positions.length; i++) {
TemplateVariable curr = positions[i];
if (variable.equals(curr.getType())) {
return curr;
}
}
return null;
}
示例4: getCaretOffset
import org.eclipse.jface.text.templates.TemplateBuffer; //导入方法依赖的package包/类
private int getCaretOffset(TemplateBuffer buffer) {
TemplateVariable[] variables = buffer.getVariables();
for (int i = 0; i != variables.length; i++) {
TemplateVariable variable = variables[i];
if (variable.getType().equals(GlobalTemplateVariables.Cursor.NAME))
return variable.getOffsets()[0];
}
return buffer.getString().length();
}
示例5: getCaretOffset
import org.eclipse.jface.text.templates.TemplateBuffer; //导入方法依赖的package包/类
private int getCaretOffset(TemplateBuffer buffer)
{
TemplateVariable[] variables = buffer.getVariables();
for (int i = 0; i != variables.length; i++)
{
TemplateVariable variable = variables[i];
if (variable.getType().equals(GlobalTemplateVariables.Cursor.NAME))
return variable.getOffsets()[0];
}
return buffer.getString().length();
}
示例6: findVariable
import org.eclipse.jface.text.templates.TemplateBuffer; //导入方法依赖的package包/类
private static TemplateVariable findVariable(TemplateBuffer buffer, String variable) {
TemplateVariable[] positions= buffer.getVariables();
for (int i= 0; i < positions.length; i++) {
TemplateVariable curr= positions[i];
if (variable.equals(curr.getType())) {
return curr;
}
}
return null;
}
示例7: getCaretOffset
import org.eclipse.jface.text.templates.TemplateBuffer; //导入方法依赖的package包/类
private int getCaretOffset(TemplateBuffer buffer) {
TemplateVariable[] variables= buffer.getVariables();
for (int i= 0; i != variables.length; i++) {
TemplateVariable variable= variables[i];
if (variable.getType().equals(GlobalTemplateVariables.Cursor.NAME))
return variable.getOffsets()[0];
}
return buffer.getString().length();
}
示例8: evaluate
import org.eclipse.jface.text.templates.TemplateBuffer; //导入方法依赖的package包/类
@Override
public TemplateBuffer evaluate(Template template)
throws BadLocationException, TemplateException {
TemplateBuffer result = super.evaluate(template);
// After the template buffer has been created we are able to add out of range offsets
// This is not possible beforehand as it will result in an exception!
for (TemplateVariable tv : result.getVariables()) {
int[] outOfRangeOffsets = this.getVariableOutOfRangeOffsets(tv);
if (outOfRangeOffsets != null && outOfRangeOffsets.length > 0) {
int[] offsets = tv.getOffsets();
int[] newOffsets = new int[outOfRangeOffsets.length + offsets.length];
System.arraycopy(offsets, 0, newOffsets, 0, offsets.length);
for (int i = 0; i < outOfRangeOffsets.length; i++) {
newOffsets[i + offsets.length] = outOfRangeOffsets[i]; // - getAffectedSourceRegion().getOffset();
}
tv.setOffsets(newOffsets);
}
}
return result;
}