|
Re: Where do I put code for opening files? Editor or Action? [message #464977 is a reply to message #464968] |
Wed, 21 March 2007 11:48 |
Eclipse User |
|
|
|
Originally posted by: lamont_gilbert.rigidsoftware.com
On Wed, 21 Mar 2007 10:41:52 +0000, Paul Illingworth wrote:
> Hello,
>
> I am having problems working out where I should be putting some code.
>
> I am opening a file which I then process before opening my editor. This
> can take quite some time so I have an open file action that does this in
> the background and when complete opens the editor. If for some reason it
> fails I can inform the user and not open the editor.
>
> When I use the recently opened files menu or when the user opens the
> application and the editor state is restored then the editor is created
> and I now have to load the file and process it in the editor init()
> method. If anything goes wrong I am left with an editor that has an
> error message in it - not what I want.
>
> Any help would be appreciated.
>
> Paul I.
I think the architecture wants you to open the file in the action. Then
feed it to the editor as an IEDitorInput. That way you are not already
opening the editor when you decide you can't open it because the file is
corrupt.
At the same time, IEditorInputs are supposed to be light weight.
IEditorInputs can be held by the architecture to support the recently
opened file menu I think. So I am not sure the preferred or proper way.
I open the file within my editor, and if it fails, I have a background job
that will close my editor after it opens. I get a stupid window flash,
but its the best I can do...
|
|
|
|
Powered by
FUDForum. Page generated in 0.03145 seconds