Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Beginner: Very simple Plug in

 
Vanessa Sampaio
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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???
 
Ted Smyth
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably need to move this to the "IDEs, Version Control and other tools" forum.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic