Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Capturing the 'Save' event
Capturing the 'Save' event [message #312589] Wed, 14 February 2007 11: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 12:29 Go to previous messageGo to next message
Dinko Ivanov is currently offline Dinko IvanovFriend
Messages: 10
Registered: July 2009
Junior Member
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 15:21 Go to previous messageGo to next message
Michael Megliola is currently offline Michael MegliolaFriend
Messages: 48
Registered: July 2009
Member
....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 19:40 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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 06: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 12:03 Go to previous messageGo to next message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 100
Registered: March 2010
Senior Member
Hello.

I need to capture event save too.

How did you make this?

Jose

[Updated on: Mon, 09 August 2010 12:04]

Report message to a moderator

Re: Capturing the 'Save' event [message #551825 is a reply to message #551737] Mon, 09 August 2010 16:42 Go to previous message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 100
Registered: March 2010
Senior Member
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: Fri Apr 26 15:34:46 GMT 2024

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

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

Back to the top