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 10:55 Go to next message
Eclipse Explorer is currently offline Eclipse Explorer
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 11:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26014
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.)
Re: Programmatically close a Java file? [message #1065177 is a reply to message #1065173] Mon, 24 June 2013 11:25 Go to previous messageGo to next message
Eclipse Explorer is currently offline Eclipse Explorer
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 02:46 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 26014
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.
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: Sat Aug 30 16:36:07 EDT 2014

Powered by FUDForum. Page generated in 0.02110 seconds