Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » DocumentProvider for external opened files
DocumentProvider for external opened files [message #795295] Fri, 10 February 2012 09:49 Go to next message
M Dahlem is currently offline M DahlemFriend
Messages: 6
Registered: November 2011
Junior Member
Hi!

Does anyone know a way to connect own documentproviders with external files in Eclipse?

My plugin.xml looks like

<extension point="org.eclipse.ui.editors.documentProviders">
  <provider
    class="my.path.to.tbpl.documentprovider.TBPLDocumentProvider"
    extensions="tbpl"
    id="my.path.to.tbpl.documentprovider.TBPLDocumentProvider">
  </provider> 
</extension>


If I open a file (IFile/ FileEditorInput) located in the workspace all will work fine.

But if I open a file outside the workspace, the default documentprovider (TextFileDocumentProvider) is opened.

The problem is, that the DocumentProviderRegistry computes only the file extension if the input is an IFile. For IFileStore it looks only at the class name of the input.

Therefore I extended my documentprovider extensionpoint to

...
inputTypes="org.eclipse.ui.IFileEditorInput,org.eclipse.ui.ide.FileStoreEditorInput"
...


Now it will work.

But now the documentprovider is used for every file located in and outside the workspace. (That means all files, not only *.tbpl would use the documentprovider).

So my question is: is it possible to create an own EditorInput (like an IEditorInputProvider) to connect the documentProvider with? Or does anyone know how to do some stuff like this?

Or is it a bug in eclipse, that the file extensions are only used for "IFile" and not for "IFileStore"

Thanks!
Adreamus
Re: DocumentProvider for external opened files [message #800666 is a reply to message #795295] Fri, 17 February 2012 10:34 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 10.02.2012 10:49, Adreamus Mising name wrote:
> Hi!
>
> Does anyone know a way to connect own documentproviders with external
> files in Eclipse?
>
> My plugin.xml looks like
>
> <extension point="org.eclipse.ui.editors.documentProviders">
> <provider
> class="my.path.to.tbpl.documentprovider.TBPLDocumentProvider"
> extensions="tbpl"
> id="my.path.to.tbpl.documentprovider.TBPLDocumentProvider">
> </provider> </extension>
>
> If I open a file (IFile/ FileEditorInput) located in the workspace all
> will work fine.
>
> But if I open a file outside the workspace, the default
> documentprovider (TextFileDocumentProvider) is opened.
>
> The problem is, that the DocumentProviderRegistry computes only the
> file extension if the input is an IFile. For IFileStore it looks only
> at the class name of the input.
>
> Therefore I extended my documentprovider extensionpoint to
>
> ..
> inputTypes="org.eclipse.ui.IFileEditorInput,org.eclipse.ui.ide.FileStoreEditorInput"
>
> ..
>
> Now it will work.
>
> But now the documentprovider is used for every file located in and
> outside the workspace. (That means all files, not only *.tbpl would
> use the documentprovider).
>
> So my question is: is it possible to create an own EditorInput (like
> an IEditorInputProvider) to connect the documentProvider with? Or does
> anyone know how to do some stuff like this?
The easiest is to set your document provider inside your editor
constructor by calling
org.eclipse.ui.texteditor.AbstractTextEditor.setDocumentProvider(IDocumentProvider).

Dani
>
> Or is it a bug in eclipse, that the file extensions are only used for
> "IFile" and not for "IFileStore"
>
> Thanks!
> Adreamus
Re: DocumentProvider for external opened files [message #800823 is a reply to message #800666] Fri, 17 February 2012 14:55 Go to previous messageGo to next message
M Dahlem is currently offline M DahlemFriend
Messages: 6
Registered: November 2011
Junior Member
but that is not possible, because I use the document provider with given editors (css/html/ text...) and not with an created one.
Re: DocumentProvider for external opened files [message #800881 is a reply to message #800823] Fri, 17 February 2012 16:20 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 17.02.2012 15:55, M Dahlem wrote:
> but that is not possible, because I use the document provider with
> given editors (css/html/ text...) and not with an created one.
Well, I guess you should not try to fiddle with the document provider of
existing editors.

Dani
Previous Topic:icon decoration order for content type
Next Topic:Eclipse on small devices
Goto Forum:
  


Current Time: Fri Apr 19 19:47:42 GMT 2024

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

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

Back to the top