Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Save Action
Save Action [message #332997] Tue, 18 November 2008 21:56 Go to next message
Andy is currently offline AndyFriend
Messages: 47
Registered: July 2009
Member
I have searched around this newsgroup and found parts of this answer but
not a complete one so I thought I would post this with some questions.

Basically my plugin has to work with a file that resides on a remote
server. I have already created the functionality in my plugin in Eclipse
so that my code goes out, downloads the file, and writes it to a temporary
folder locally, and opens a basic text editor on that newly downloaded
temporary file.

The text editor org.eclipse.ui.DefaultTextEditor saves the temporary file
right back to the same place on disk when it is opened and changed so that
is fine. The problem is that I just need to keep that functionality
*plus* write the file back to the server that I pulled it from whenever a
user selects "Save". I assume I need to override the save action on that
particular file to do this.

So, in my research I found the SaveAction class, but the javadoc says it
is not intended to be subclassed. I guess I am at a loss at how to
override the saving action as my first instinct would to be to extend that
class and just put in the extra code I need to go out and connect to the
server and do the second save.

Does anyone have an example of getting this done? I would be more than
happy to create an example if anyone can give me a few ideas as to how to
tackle this. Thanks.

Andy
Re: Save Action [message #333004 is a reply to message #332997] Wed, 19 November 2008 11:26 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Andy wrote:
> I have searched around this newsgroup and found parts of this answer
> but not a complete one so I thought I would post this with some
> questions.
> Basically my plugin has to work with a file that resides on a remote
> server. I have already created the functionality in my plugin in
> Eclipse so that my code goes out, downloads the file, and writes it to
> a temporary folder locally, and opens a basic text editor on that
> newly downloaded temporary file.
Did you look at EFS? If you would write your own EFS that backs the
remote server you would not have to do any tweaks to load and save.

Dani
> The text editor org.eclipse.ui.DefaultTextEditor saves the temporary
> file right back to the same place on disk when it is opened and
> changed so that is fine. The problem is that I just need to keep that
> functionality *plus* write the file back to the server that I pulled
> it from whenever a user selects "Save". I assume I need to override
> the save action on that particular file to do this.
> So, in my research I found the SaveAction class, but the javadoc says
> it is not intended to be subclassed. I guess I am at a loss at how to
> override the saving action as my first instinct would to be to extend
> that class and just put in the extra code I need to go out and connect
> to the server and do the second save.
> Does anyone have an example of getting this done? I would be more
> than happy to create an example if anyone can give me a few ideas as
> to how to tackle this. Thanks.
>
> Andy
Re: Save Action [message #333010 is a reply to message #333004] Wed, 19 November 2008 14:07 Go to previous messageGo to next message
Andy is currently offline AndyFriend
Messages: 47
Registered: July 2009
Member
From what I was looking at about EFS was that the WEBDAV support (which is
what I would need in this case) was basically non existent, hence the
approach I need to take with overriding a save action.

If anyone has an example on how to override that save action that would be
most appreciated.

Andy
Re: Save Action [message #333023 is a reply to message #333010] Wed, 19 November 2008 20:19 Go to previous message
Steve Blass is currently offline Steve BlassFriend
Messages: 276
Registered: July 2009
Senior Member
Andy wrote:
> From what I was looking at about EFS was that the WEBDAV support (which
> is what I would need in this case) was basically non existent, hence the
> approach I need to take with overriding a save action.
> If anyone has an example on how to override that save action that would
> be most appreciated.
>
> Andy
>

Remote System Explorer from the Target Management Project provides
exactly the functionality you described. Double-clicking a remote file
copies it to a local temp folder, opens it in the appropriate editor,
and then when you Save the file gets written to the temp folder and
copied back to the original location on the server. I set my homegrown
solution aside and just use the Remote Systems view from RSE now. You
might look at their source to see how they make it work.

-
Steve
Previous Topic:package explorer
Next Topic:Resource out of sync with the filesystem in multipage editor
Goto Forum:
  


Current Time: Fri Apr 19 00:14:42 GMT 2024

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

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

Back to the top