File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Beginner: Very simple Plug in" Watch "Beginner: Very simple Plug in" New topic
Author

Beginner: Very simple Plug in

Vanessa Sampaio
Greenhorn

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();
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

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


Edward Smith
 
 
subject: Beginner: Very simple Plug in
 
Similar Threads
Connecting to CVS Repository from an Eclipse Plugin
trying ot read a line but instead reading a file
converting java.io.File to org.eclipse.core.resources.IFile
How to modify a file in an Eclipse plugin?
ClassCastException