Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » onLoad( ) and onSave( ) ??
onLoad( ) and onSave( ) ?? [message #279343] Sun, 16 January 2005 14:03 Go to next message
Eclipse UserFriend
Hi all,

Is there a way that I can retrieve the data (e.g. getDocument ) of a
TextEditor plugin when its first loaded and again BEFORE its saved?

I need to do some work whereby I filter/strip out some data when the
document is loaded and then put it back in again when its saved. I dont want
the data to be there while the user is actually editing the source code
file.

I've found the TextEditor::editorSaved( ) method, but this is raised AFTER
eclipse has committed the file to disk.

Any hints as to where I should be looking? Surely I can't be the only one
who wants to do this sort of thing?

Cheers,
Jack
Re: onLoad( ) and onSave( ) ?? [message #279354 is a reply to message #279343] Mon, 17 January 2005 05:06 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: daniel.megert.gmx.net

Jack Hoxley wrote:

>Hi all,
>
>Is there a way that I can retrieve the data (e.g. getDocument ) of a
>TextEditor plugin when its first loaded and again BEFORE its saved?
>
>I need to do some work whereby I filter/strip out some data when the
>document is loaded and then put it back in again when its saved. I dont want
>the data to be there while the user is actually editing the source code
>file.
>
>I've found the TextEditor::editorSaved( ) method, but this is raised AFTER
>eclipse has committed the file to disk.
>
>Any hints as to where I should be looking? Surely I can't be the only one
>who wants to do this sort of thing?
>
>
I see two choices here:
1) write your own IDocumentProvider
2) write your own ITextFileBuffer (this has the advantage that it can be
used without having an editor

Dani

>Cheers,
>Jack
>
>
>
>
Re: onLoad( ) and onSave( ) ?? [message #279359 is a reply to message #279354] Mon, 17 January 2005 07:28 Go to previous messageGo to next message
Eclipse UserFriend
"Daniel Megert" <daniel.megert@gmx.net> wrote in message
news:csg2mi$3i0$1@www.eclipse.org...
> I see two choices here:
> 1) write your own IDocumentProvider
> 2) write your own ITextFileBuffer (this has the advantage that it can be
> used without having an editor
>
> Dani

Thanks for the information, appreciated.

I'm not quite seeing how those two (once customized) fit into the rest of
the editor?

I presume that, at some point, I need to replace whatever default
IDocumentProvider or ITextFileBuffer is being used with my own
implementation. Unfortunately I can't see where this would be.

My editor is mostly based on the "javaeditor" example bundled with eclipse.
My document partitioning is therefore handled via the
"org.eclipse.core.filebuffers.documentSetup" extension point, do I need to
change this and/or add a new extension point and point it to my
implementation?

Any further tips would be greatly appreciated :-)

Cheers,
Jack
Re: onLoad( ) and onSave( ) ?? [message #279377 is a reply to message #279359] Mon, 17 January 2005 11:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: daniel.megert.gmx.net

Jack Hoxley wrote:

>"Daniel Megert" <daniel.megert@gmx.net> wrote in message
>news:csg2mi$3i0$1@www.eclipse.org...
>
>
>>I see two choices here:
>>1) write your own IDocumentProvider
>>2) write your own ITextFileBuffer (this has the advantage that it can be
>>used without having an editor
>>
>>Dani
>>
>>
>
>Thanks for the information, appreciated.
>
>I'm not quite seeing how those two (once customized) fit into the rest of
>the editor?
>
>I presume that, at some point, I need to replace whatever default
>IDocumentProvider or ITextFileBuffer is being used with my own
>implementation. Unfortunately I can't see where this would be.
>
>My editor is mostly based on the "javaeditor" example bundled with eclipse.
>My document partitioning is therefore handled via the
>"org.eclipse.core.filebuffers.documentSetup" extension point, do I need to
>change this and/or add a new extension point and point it to my
>implementation?
>
>Any further tips would be greatly appreciated :-)
>
>
I need some more info first:
- what kind of files do you want to open in your editor?
- would other clients except the editor also want to work with the
stripped file?
- do you also use org.eclipse.core.filebuffers.documentCreation?

Dani

>Cheers,
>Jack
>
>
>
>
Re: onLoad( ) and onSave( ) ?? [message #279417 is a reply to message #279377] Tue, 18 January 2005 08:29 Go to previous messageGo to next message
Eclipse UserFriend
"Daniel Megert" <daniel.megert@gmx.net> wrote in message
news:csgpu2$657$1@www.eclipse.org...
> I need some more info first:
> - what kind of files do you want to open in your editor?

They are simple source code files - text based only. Nothing hugely special
about them.

> - would other clients except the editor also want to work with the
> stripped file?

Not under normal conditions, a given file is assumed to be being worked on
by one user at a time on one workstation.

> - do you also use org.eclipse.core.filebuffers.documentCreation?

No, at the moment 'org.eclipse.core.filebuffers.documentSetup' is used to
get an entry point to apply partitioning. No other filebuffer/loading
extension points are used.


Thanks for the continued help :-)
Jack
Re: onLoad( ) and onSave( ) ?? [message #279449 is a reply to message #279417] Tue, 18 January 2005 10:47 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: daniel.megert.gmx.net

Jack Hoxley wrote:

>"Daniel Megert" <daniel.megert@gmx.net> wrote in message
>news:csgpu2$657$1@www.eclipse.org...
>
>
>>I need some more info first:
>>- what kind of files do you want to open in your editor?
>>
>>
>
>They are simple source code files - text based only. Nothing hugely special
>about them.
>
>
>
>>- would other clients except the editor also want to work with the
>>stripped file?
>>
>>
>
>Not under normal conditions, a given file is assumed to be being worked on
>by one user at a time on one workstation.
>
>
>
>>- do you also use org.eclipse.core.filebuffers.documentCreation?
>>
>>
>
>No, at the moment 'org.eclipse.core.filebuffers.documentSetup' is used to
>get an entry point to apply partitioning. No other filebuffer/loading
>extension points are used.
>
>
OK, then I'd implement a my own subclass of TextFileDocumentProvider.
Take a look at JDT UI's PropertiesFileDocumentProvider and how/where
it's used (also check plugin.xml ;-).

HTH
Dani

>
>Thanks for the continued help :-)
>Jack
>
>
>
>
Re: onLoad( ) and onSave( ) ?? [message #279456 is a reply to message #279449] Tue, 18 January 2005 11:28 Go to previous message
Eclipse UserFriend
"Daniel Megert" <daniel.megert@gmx.net> wrote in message
news:csjb2d$53l$1@www.eclipse.org...
> OK, then I'd implement a my own subclass of TextFileDocumentProvider.
> Take a look at JDT UI's PropertiesFileDocumentProvider and how/where
> it's used (also check plugin.xml ;-).

I'll give that a go then. Although I can't cross reference the JDT as it's
open-source. I'm not certified to look at open source Eclipse (proves to be
a interesting, if annoying, hurdle in my learning!).

Thanks very much for your help!
Jack
Previous Topic:ProjectionDocument and the LineTracker.
Next Topic:Building 3.1 I20050112-1200 for linux-gtk-ppc
Goto Forum:
  


Current Time: Sun Nov 09 18:55:26 EST 2025

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

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

Back to the top