Thursday, April 28, 2011

Dynamic access of EClipse workbench resources

Access active editor from Eclipse workbench :
IEditorPart editor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();

Acquire the Ifile in the avtice editor accessed above:
IFile ifile = (IFile) editor.getEditorInput().getAdapter(IFile.class);

Access File from the Ifile accessed above:
File file = ifile.getLocation().toFile();

No comments:

Post a Comment