(DLTK ベースの) Eclipse プラグイン内から、特定のエディターに関連付けられているファイル拡張子をプログラムで取得しようとしています。その理由は、エディターに関連付けられているファイルのみをインデックス付けしたいためであり、ユーザーは Eclipse 設定を介して任意のファイル拡張子をエディターに関連付けることができるため、拡張子のハードコーディングを避ける必要があります。
コード例:
public boolean isValidPluginFile(ISourceModule sourceModule) {
// currently:
if (sourceModule.getUnderlyingResource().getFileExtension().equals("twig")) {
return true;
}
return false;
// what i would need instead (pseudocode):
List extensions = Somehow.Retrieve.AssociatedExtensionsFor('MyEditorID');
for (String extension : extensions) {
if (sourceModule.getUnderlyingResource().getFileExtension().equals(extension)) {
return true;
}
}
return false;
}