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/
精彩评论