Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Files(File in edit area)
Files [message #523122] Thu, 25 March 2010 08:46 Go to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 100
Registered: March 2010
Senior Member
Hello

I make a plug in and I need to know the open files in editing area.

how can i make this???
I know IWorkbenchPage and IWorkbenchPart en but i know as use her.

Thanks a lot

Jose

[Updated on: Thu, 25 March 2010 08:49]

Report message to a moderator

Re: Files [message #523129 is a reply to message #523122] Thu, 25 March 2010 08:58 Go to previous messageGo to next message
Oliver Vesper is currently offline Oliver VesperFriend
Messages: 42
Registered: July 2009
Member
> I make a plug in and I need to know the open files in editing area.

Maybe IWorkbenchPage.getEditorReferences() is what you're looking for?
The returning IEditorReference-array allows access to each IEditorInput
which (depending on your implementation) might tell you the name of the
file currently being edited.

HTH,
Oliver
Re: Files [message #523132 is a reply to message #523129] Thu, 25 March 2010 09:18 Go to previous message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 100
Registered: March 2010
Senior Member
Ok, Thanks a lot for yours help.

I make this but i don't know as continue because i don't find the names of files.


try{


 IWorkbench workbench = PlatformUI.getWorkbench();
        System.out.println("workbench");
        IWorkbenchWindow[] workbenchWindow=workbench.getWorkbenchWindows();
        System.out.println("workbenchWindow "+workbenchWindow.length);
        IWorkbenchPage workbenchPages[]=workbenchWindow[0].getPages();
        System.out.println("workbenchPages "+workbenchPages.length);
        IEditorPart editorPart=workbenchPages[0].getActiveEditor(); 
        if(editorPart!=null)
        System.out.println("good acces");
        IEditorInput editorInput=editorPart.getEditorInput();
       
        System.out.println( editorInput.getName());
       
        //List of editors open
                 IEditorReference editorReference[]=workbenchPages[0].getEditorReferences();
        System.out.println("editorReference[] "+editorReference.length);
        	
             }
        catch(Exception e){}

But there isan exception of NullPointer and i don't know because I get the WorkbenchPage whit one element and i get the editor activate in this page after, and when I wantn to print the name of file, it says that the editorPart is null, why??

The list of editors open is null too and I have 4 files open when i execute the class, help me please Sad Sad
Thanks a lot.

Jose

[Updated on: Thu, 25 March 2010 12:22]

Report message to a moderator

Re: Files [message #605260 is a reply to message #523129] Thu, 25 March 2010 09:18 Go to previous message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 100
Registered: March 2010
Senior Member
THANKS A LOT
Thanks a lot
:p :p :p :p :p
Previous Topic:Files
Next Topic:Binding Shortcut Key from Extension Points in a Multipage Editor
Goto Forum:
  


Current Time: Fri Apr 26 05:52:51 GMT 2024

Powered by FUDForum. Page generated in 0.03235 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top