File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes IDEs, Version Control and other tools and the fly likes Beginner: Very simple Plug in Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Beginner: Very simple Plug in" Watch "Beginner: Very simple Plug in" New topic

Beginner: Very simple Plug in

Vanessa Sampaio

Joined: Sep 06, 2011
Posts: 1
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();

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???
Ted Smyth
Ranch Hand

Joined: May 28, 2008
Posts: 73
Probably need to move this to the "IDEs, Version Control and other tools" forum.

Edward Smith
I agree. Here's the link:
subject: Beginner: Very simple Plug in
It's not a secret anymore!