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 #604407] Wed, 27 January 2010 10:40 Go to next message
fwn  is currently offline fwn
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(IComm andService.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().getSe rvice(ICommandService.class);
service.addExecutionListener(executionListener);


ICommandService service = (ICommandService)editorPart.getSite().getService(ICommandSer vice.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 #604415 is a reply to message #604407] Wed, 27 January 2010 11:55 Go to previous message
fwn  is currently offline fwn
Messages: 10
Registered: January 2010
Junior Member
I just found out that it actually works with


ICommandService service = (ICommandService)editorPart.getEditorSite().getService(IComm andService.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:Listening for save events from an Editor
Next Topic:Replace default classloader for a Eclipse plugin
Goto Forum:
  


Current Time: Tue Sep 23 02:37:21 GMT 2014

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

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