Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » FileEditorInput works only on IFile?
FileEditorInput works only on IFile? [message #18485] Mon, 28 April 2003 01:57 Go to next message
Eclipse UserFriend
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 #18517 is a reply to message #18485] Mon, 28 April 2003 07:35 Go to previous messageGo to next message
Christian Sell is currently offline Christian SellFriend
Messages: 77
Registered: July 2009
Member
sounds like this goes squarely against eclipses philosophy. The
"internal" package name already indicates you are treading on prohibited
ground.

My guess is you will have to create a temporary resource, and copy that
out to the external location.

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, 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 Go to previous messageGo to next message
Eclipse UserFriend
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 Go to previous message
Eclipse UserFriend
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
>
Previous Topic:display problem in WizardDialog
Next Topic:shared launch configuration
Goto Forum:
  


Current Time: Wed Feb 05 17:59:42 GMT 2025

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

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

Back to the top