views:

183

answers:

1

What would be the best approach to launch an editor from the file menu(File>New). Should I encase the editor inside a view and launch the view from a command?

+1  A: 

If you want an editor without a file, the best approach would be to go through the normal wizard creation stuff, but instead of creating a real file, use a virtual input instead. These might both be relevant to your interests: http://wiki.eclipse.org/FAQ_How_do_I_open_an_editor_on_a_file_in_the_workspace%3F and http://wiki.eclipse.org/FAQ_How_do_I_open_an_editor_programmatically%3F and http://wiki.eclipse.org/FAQ_How_do_I_open_an_editor_on_something_that_is_not_a_file%3F. I did see something ages ago which was about creating totally virtual inputs. If I see it, I'll edit the post. Otherwise, it should be as simple as creating a subclass of org.eclipse.ui.IEditorInput and then not pointing it at any resource, but using it to create the editor.

Chris Dennett
Thank you for your response. I will look into it and report back my results.
Ohanes Dadian
Will opening a graphical editor (using GraphicalEditor super class) be any different?
Ohanes Dadian
I don't think so, it still uses init(IEditorSite site, IEditorInput input), so it isn't forcing any type of input onto the developer (i.e., IFileEditorInput)
Chris Dennett