Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Programmatically close a Java file?
Programmatically close a Java file? [message #1065168] Mon, 24 June 2013 14:55 Go to next message
Eclipse Explorer is currently offline Eclipse ExplorerFriend
Messages: 18
Registered: February 2013
Junior Member
When several java files are open in the Java editor and a user deletes one of these files in the Package Explorer, "Eclipse" removes the deleted java file from the java editor. How can I do this programmatically?

Thank you for your help.

(P.S. I posted a similar question the Newcomers forum. I hope that it is not too redundant to ask again here.)
Re: Programmatically close a Java file? [message #1065173 is a reply to message #1065168] Mon, 24 June 2013 15:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
Do you want an editor you've implemented yourself to behave this way?
It's generally done by using a workspace listener in your editor:

ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener,
IResourceChangeEvent.POST_CHANGE);



On 24/06/2013 4:55 PM, Eclipse Explorer wrote:
> When several java files are open in the Java editor and a user deletes
> one of these files in the Package Explorer, "Eclipse" removes the
> deleted java file from the java editor. How can I do this
> programmatically?
>
> Thank you for your help.
>
> (P.S. I posted a similar question the Newcomers forum. I hope that it
> is not too redundant to ask again here.)


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Programmatically close a Java file? [message #1065177 is a reply to message #1065173] Mon, 24 June 2013 15:25 Go to previous messageGo to next message
Eclipse Explorer is currently offline Eclipse ExplorerFriend
Messages: 18
Registered: February 2013
Junior Member
Hi Ed,

Yes, I've extended org.eclipse.ui.editors.text.TextEditor.

Thank you for your help.
Re: Programmatically close a Java file? [message #1065257 is a reply to message #1065177] Tue, 25 June 2013 06:46 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33142
Registered: July 2009
Senior Member
In EMF's generated editors we use a listener. You could look at the
source code:

http://git.eclipse.org/c/emf/org.eclipse.emf.git/tree/plugins/org.eclipse.emf.ecore.editor/src/org/eclipse/emf/ecore/presentation/EcoreEditor.java


On 24/06/2013 5:25 PM, Eclipse Explorer wrote:
> Hi Ed,
>
> Yes, I've extended org.eclipse.ui.editors.text.TextEditor.
>
> Thank you for your help.


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Getting compilation errors for a project over JDT markers produces wrong result initially
Next Topic:Java Content Assist in a Wizard
Goto Forum:
  


Current Time: Fri Apr 26 10:05:48 GMT 2024

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

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

Back to the top