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


Java TemplateBuffer.getVariables方法代码示例

本文整理汇总了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();
	}
 
开发者ID:curiosag,项目名称:ftc,代码行数:12,代码来源:TweakedTemplateProposal.java

示例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;
}
 
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:11,代码来源:StubUtility.java

示例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;
}
 
开发者ID:eclipse,项目名称:che,代码行数:11,代码来源:StubUtility.java

示例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();
  }
 
开发者ID:eclipse,项目名称:che,代码行数:12,代码来源:TemplateProposal.java

示例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();
}
 
开发者ID:apicloudcom,项目名称:APICloud-Studio,代码行数:14,代码来源:SnippetTemplateProposal.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:11,代码来源:StubUtility.java

示例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();
	}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:12,代码来源:TemplateProposal.java

示例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;
}
 
开发者ID:trylimits,项目名称:Eclipse-Postfix-Code-Completion,代码行数:29,代码来源:JavaStatementPostfixContext.java


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