[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform] Re: cannot be cast to org.eclipse.ui.ide.FileStoreEditorInput

Create a new file and open non existing file are different things. If you 
open file which doesn't exixt (someone deleted it) this is an exceptional 
situation and you have to notify user. Creating a new file is regular 
procedure, you have to create new editor, that's it. What I found in eclipse 
sources (Java editor probably) is creating special implementation of 
IEditorInput which is not connected to any file. Is it a supposed way to 
create new editor?

Thank you,
  Andrey

"Prakash G.R." <grprakash@xxxxxxxxx> wrote in message 
news:gfdu71$e2d$1@xxxxxxxxxxxxxxxxxxxx
>I tried opening an editor on a non-existing file. It works fine
>
> IFileStore store = EFS.getLocalFileSystem().getStore(new 
> Path("C:\\NoSuchFile.txt"));
> IDE.openEditor(activePage, new FileStoreEditorInput(store), 
> "org.eclipse.ui.DefaultTextEditor");
>
>    So probably the issue would be in your editor. Probably in the place 
> where you create your model from the file (setInput?), check whether the 
> file exists and if not, create an empty model.
>
> - Prakash
> -- 
>
> http://blog.eclipse-tips.com
>
>