Hello all!!
I am trying to do a very simple plug in, which detects the active window in eclipse and then gives back the file path. I have no experience so this is the code I come out with:
public class filePath extends ViewPart {
public static void main(
String args[]) {
IFile file;
file = (IFile) (PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorInput());
IPath s = file.getFullPath();
String p = s.toString();
System.out.println(p);
}
it gives me this error: Workbench has not been created yet.
I have tryed to initialize the workbench but dont know if this is the right way.
Any tips???