Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Capturing the 'Save' event
Capturing the 'Save' event [message #312589] Wed, 14 February 2007 06:04 Go to next message
Eclipse UserFriend
Originally posted by: rashmi_h_r.rediffmail.com

Hi All,
I want to capture the 'save action' in my eclipse plugin. Every time a
file is saved, by doing a Ctrl-S or a File-Save, I want to capture that,
compile my code and then generate a xml data file for that class. I have
looked in to IElementStateListener and IResourceChangeListener , But both
deal with the state change and not save event. But I want to do the post
save event only when the users press the ‘Save’ controls. Any help in this
regard is greatly appreciated.

Thank You and Best Regards,
Rashmi H.R
Re: Capturing the 'Save' event [message #312591 is a reply to message #312589] Wed, 14 February 2007 07:29 Go to previous messageGo to next message
Eclipse UserFriend
Hi Rashmi,
Have you considered contributing own builder? Your problem fits the idea
of eclipse builders.
There is more info on builders here:
http://www.eclipse.org/articles/Article-Builders/builders.ht ml
Best Regards,
Dinko
Re: Capturing the 'Save' event [message #312597 is a reply to message #312589] Wed, 14 February 2007 10:21 Go to previous messageGo to next message
Eclipse UserFriend
....if you decide you do not need a full-blown builder:

I handle something similar by listening for resource changes then
visiting the resource delta; the change events are typed; a file
save would fire IResourceChangeEvent.POST_CHANGE (and the resource
delta.getKind() would be IResourceDelta.CHANGED).


so my resource change listener has:

public void resourceChanged(IResourceChangeEvent event) {

switch (event.getType()) {

...

case IResourceChangeEvent.POST_CHANGE:
event.getDelta().accept(this);
break;

...
}


and;

public boolean visit(IResourceDelta delta) throws CoreException {

if (resource.getType() == IResource.FILE &&
delta.getKind() == IResourceDelta.CHANGED)

...somebody changed a file...

}

Rashmi H.R wrote:
> Hi All,
> I want to capture the 'save action' in my eclipse plugin. Every time a
> file is saved, by doing a Ctrl-S or a File-Save, I want to capture that,
> compile my code and then generate a xml data file for that class. I have
> looked in to IElementStateListener and IResourceChangeListener , But
> both deal with the state change and not save event. But I want to do the
> post save event only when the users press the �Save� controls. Any help
> in this regard is greatly appreciated.
>
> Thank You and Best Regards,
> Rashmi H.R
>
>
Re: Capturing the 'Save' event [message #312623 is a reply to message #312589] Wed, 14 February 2007 14:40 Go to previous messageGo to next message
Eclipse UserFriend
There are the save commands, like org.eclipse.ui.file.save ... you could
add a listener to the ICommandService. In 3.2, any time the command is
executed you'll be notified ... but that only includes the keybinding,
not clicking the menu or tool item.

In 3.3 it will include all 3 modes.

Later,
PW
Re: Capturing the 'Save' event [message #312780 is a reply to message #312623] Tue, 20 February 2007 01:24 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rashmi_h_r.rediffmail.com

Hi All,
Thank you all for the replies. I was able to get the 'Save Action' event
through the IResourceListener and the IResourceDeltaVisitor.
Thanks Again,
Best Regards,
Rashmi H.R
Re: Capturing the 'Save' event [message #551737 is a reply to message #312780] Mon, 09 August 2010 08:03 Go to previous messageGo to next message
Eclipse UserFriend
Hello.

I need to capture event save too.

How did you make this?

Jose

[Updated on: Mon, 09 August 2010 08:04] by Moderator

Re: Capturing the 'Save' event [message #551825 is a reply to message #551737] Mon, 09 August 2010 12:42 Go to previous message
Eclipse UserFriend
This question is answers.

Thanks a lot and I sorro for the unutil post
Previous Topic:Caused by: java.lang.NoClassDefFoundError: junit/framework/TestListener
Next Topic:Common Navigator and IMArker
Goto Forum:
  


Current Time: Sun Aug 31 18:25:09 EDT 2025

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

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

Back to the top