FileEditorInput works only on IFile? [message #18485] |
Mon, 28 April 2003 01:57 |
Eclipse User |
|
|
|
Originally posted by: karutla.hotmail.com
Hello All,
I am working on writing a plugin that requires me to edit a file that is
outside the workspace directory. I see that the editor extensions only work
with IFile interface, which I think represents a resource inside workspace
directory. So here are my questions.
Is there a way to create eclipse File Object
(org.eclipse.core.internal.resources.File) for a file that is outside the
workspace directory?
Is there a way to create a FileEditorInput
(org.eclipse.ui.part.FileEditorInput) which takes java.io.File Object?
I suggestions/directions would be greatly appreciated.
Thanks
-Keerthi
|
|
|
|
Re: FileEditorInput works only on IFile? [message #18557 is a reply to message #18485] |
Mon, 28 April 2003 10:09 |
Eclipse User |
|
|
|
Originally posted by: daniel.megert.gmx.net
Keerthi Arutla wrote:
> Hello All,
>
> I am working on writing a plugin that requires me to edit a file that is
> outside the workspace directory. I see that the editor extensions only
> work
> with IFile interface,
>
Eclipse APIs are targeted for resources that are inside the workspace.
> which I think represents a resource inside workspace
> directory.
correct
> So here are my questions.
>
> Is there a way to create eclipse File Object
> (org.eclipse.core.internal.resources.File) for a file that is outside the
> workspace directory?
>
no
> Is there a way to create a FileEditorInput
> (org.eclipse.ui.part.FileEditorInput) which takes java.io.File Object?
>
no
>
> I suggestions/directions would be greatly appreciated.
>
write your own IStorageEditorInput implementation
HTH
Dani
|
|
|
Re: FileEditorInput works only on IFile? [message #20061 is a reply to message #18557] |
Mon, 28 April 2003 16:08 |
Eclipse User |
|
|
|
Originally posted by: bob.objfac.com
"Daniel Megert" <daniel.megert@gmx.net> wrote in message
news:b8iuk5$gdp$2@rogue.oti.com...
>
> > So here are my questions.
> >
> > Is there a way to create eclipse File Object
> > (org.eclipse.core.internal.resources.File) for a file that is outside
the
> > workspace directory?
> >
> no
Well, actually, there is You can create a linked resource.
> > Is there a way to create a FileEditorInput
> > (org.eclipse.ui.part.FileEditorInput) which takes java.io.File Object?
> >
> no
Not as phrased, but file.createLink() will return an IFile, from which you
can create a FileEditorInput.
An excellent example of how to use this is in the filedrag plug-in. You can
download the plug-in and the source from
http://sourceforge.net/projects/sunshade. See FileDragPlugin.java.
> > I suggestions/directions would be greatly appreciated.
> >
> write your own IStorageEditorInput implementation
Not sure why people are so in love with that solution (which, of course,
nobody ever gets around to implementing). In order to participate in
standard views like PackageExplorer, be searchable, etc. an object under
edit needs to be an IResource. The IStorageEditorInput way would get you an
open editor, period. Furthermore, IStorageEditorInput is not editable by
design. So you really need a subclass that extends it to allow editing. Then
you need a DocumentProvider that knows how to deal with the subclass. (And
subclassing FileDocumentProvider is no fun.) Even if I had the code to do
this, I wouldn't want to use it.
Bob
> HTH
> Dani
>
|
|
|
Powered by
FUDForum. Page generated in 0.03102 seconds