Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Listening for save events from an Editor
Listening for save events from an Editor [message #510351] Wed, 27 January 2010 10:40 Go to next message
fwn  is currently offline fwn Friend
Messages: 10
Registered: January 2010
Junior Member
Hi all,

In my application I use the XML Editor provided by the Web tools Platform (org.eclipse.wst.xml.ui.internal.tabletree.XMLMultiPageEdito rPart) to work with XML Files.
Now I would like to listen for the events thrown when the editor saves his contents to a file. Acording to what I have found on the web so far IExectionlisteners can be used to do this, so I implemented a listener and tried to add him to the Editor with the following code:

ICommandService service = (ICommandService)editorPart.getEditorSite().getService(ICommandService.class);
service.addExecutionListener(executionListener);


However this does not work, the Listener won't catch any events thrown by the Editor. I also tried the following two other methods to get the Commandservice, without success:

ICommandService service = (ICommandService)Activator.getDefault().getWorkbench().getService(ICommandService.class);
service.addExecutionListener(executionListener);

ICommandService service = (ICommandService)editorPart.getSite().getService(ICommandService.class);
service.addExecutionListener(executionListener);


The Editor does save its changes to the file correctly, so that is not the Problem. Any idea what I'm doing wrong here?
Re: Listening for save events from an Editor [message #510376 is a reply to message #510351] Wed, 27 January 2010 11:55 Go to previous message
fwn  is currently offline fwn Friend
Messages: 10
Registered: January 2010
Junior Member
I just found out that it actually works with

ICommandService service = (ICommandService)editorPart.getEditorSite().getService(ICommandService.class);


if the File is saved using either the save button or that keyboard shortcut, but not if I exit a changed File and then save it in the resulting popup menu.
I Wonder if that is a bug.
Previous Topic:"org.eclipse.test.coretestapplication" could not be found in the registry
Next Topic:Listening for save events from an Editor
Goto Forum:
  


Current Time: Fri Apr 26 11:34:15 GMT 2024

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

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

Back to the top