Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
org.eclipse.jdt.core.IField IField field = IType.createField(contents, null, true, null);
フィールドの行番号を取得するには?
以下のコードを使用して、ASTNode の行番号を取得できます。
ASTNode node = compilationUnit.findDeclaringNode(field.getKey()); int lineNumber = compilationUnit.getLineNumber(node.getStartPosition()) - 1;
これは、バインディングが解決されている場合にのみ機能することに注意してください。
詳細については、以下のリンクを参照してください。
Eclipse ASTNode をソース コードの行番号に
FieldDeclaration から IField - FieldDeclaration から IBinding を取得する