Created
August 5, 2010 22:13
-
-
Save jvanzyl/510483 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void run(IAction action) { | |
IFile file; | |
// If I am in the POM editor I want to get hold of the IFile that is currently | |
// in the buffer | |
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); | |
if ( window != null ) | |
{ | |
IWorkbenchPage page = window.getActivePage(); | |
if ( page != null ) | |
{ | |
IEditorPart editor = page.getActiveEditor(); | |
if ( editor != null ) | |
{ | |
IEditorInput input = editor.getEditorInput(); | |
if ( input instanceof IFileEditorInput ) | |
{ | |
IFileEditorInput fileInput = (IFileEditorInput) input; | |
file = fileInput.getFile(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment