ワークスペースを参照し、すべてのクラスのすべてのメソッドを選択するコード例があります。私の意図は、メソッドの絶対パスを出力することですが、その方法がわかりません。
みたいなものmethod.getAbsolutePath()
は存在しません。
私のコード:
IPackageFragment[] packages = javaProject.getPackageFragments();
for (IPackageFragment mypackage : packages) {
for (ICompilationUnit unit : mypackage.getCompilationUnits()) {
IType[] allTypes = unit.getAllTypes();
for (IType type : allTypes) {
IMethod[] methods = type.getMethods();
for (IMethod method : methods) {
//System.out.println(MyMethodPath);
//here is want to print the path
}
}
}
}
誰か助けてくれませんか?