开发者

How to get the path of the Currently opened file from eclipse IDE?

I am developing a plugin. I want to know the currently opened file's path name programmatically. It would be of great help anyone could help.

Thanks开发者_如何学编程 Partha


You can use IWorkbenchPage.getActiveEditor or getEditors(), then you can ask the editors for their IEditorInput. If the editor is operating on an IFile (and there is no guarantee that it is), then you can cast IEditorInput to IFileEditorInput to get access to the file via IFileEditorInput.getFile().

Once you get IFile you can get path eaisly

References http://www.eclipse.org/forums/index.php/mv/tree/12808/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜