0
我正在为我在xtext中编写的DSL语言编写插件。Xtext和Plugin:获取EObject并返回写入文件的前10个字符
在我的插件,我去了所有的变量在XtextResource当前文件是这样的:
public void calculateVarsNamesList(XtextResource resource) {
EObject content = resource.getContents().get(0);
EList<EObject> ListOfEObject = content.eContents();
for (int i=0; i < ListOfEObject.size(); i++){
if (ListOfEObject.get(i) instanceof Var){
Var v = (Var) ListOfEObject.get(i);
String name = v.getName();
if (name == null){
// ***I want to get the first 10 chars of v (like it's written in the file)***
}
}}}
我怎么做我在评论中写道?谢谢!!!
非常感谢你!!!!! – RoG