Sharing DocumentProviders [message #303093] |
Mon, 08 May 2006 18:59  |
Eclipse User |
|
|
|
Hi,
A long time ago, when we first created the editors for our project, we
used the Eclipse New Plug-In Project wizard, and used the sample code it
spit out. In that code, the constructor for the sample editor creates a
new document provider--meaning each editor instance has its own document
provider.
Since that's what the sample code did, we never thought about it.
Looking at it now, though, it seems like it would make more sense to
have a single shared document provider for all documents of a given
type. (It looks like the JDT does this in CompilationUnitEditor, though
it doesn't seem to use the DocumentProviderRegistry that's supposed to
keep track of all the providers.)
What's the "correct" way to deal with this--is there supposed to be a
single document provider per file type, registered with the
DocumentProviderRegistry? Or should we do what the JDT does and create
our own shared provider? Or should we just stick with what we got from
the sample code and have one provider per editor?
Thanks,
nj
|
|
|
Re: Sharing DocumentProviders [message #303106 is a reply to message #303093] |
Tue, 09 May 2006 04:26  |
Eclipse User |
|
|
|
Originally posted by: tom_eicher.ch.ibm.com
Narciso,
The recommended way is to not create your own document provider, but
rather contribute a document setup participant to the
org.eclipse.core.filebuffers.documentSetup extension point. For an
example, see the example Java editor available from the Eclipse welcome
screen.
-tom
as long as you don't have special requirements, the
Narciso Jaramillo wrote:
> Hi,
>
> A long time ago, when we first created the editors for our project, we
> used the Eclipse New Plug-In Project wizard, and used the sample code it
> spit out. In that code, the constructor for the sample editor creates a
> new document provider--meaning each editor instance has its own document
> provider.
>
> Since that's what the sample code did, we never thought about it.
> Looking at it now, though, it seems like it would make more sense to
> have a single shared document provider for all documents of a given
> type. (It looks like the JDT does this in CompilationUnitEditor, though
> it doesn't seem to use the DocumentProviderRegistry that's supposed to
> keep track of all the providers.)
>
> What's the "correct" way to deal with this--is there supposed to be a
> single document provider per file type, registered with the
> DocumentProviderRegistry? Or should we do what the JDT does and create
> our own shared provider? Or should we just stick with what we got from
> the sample code and have one provider per editor?
>
> Thanks,
>
> nj
|
|
|
Powered by
FUDForum. Page generated in 0.03558 seconds