Ohanes Dadian
Ohanes Dadian

Reputation: 635

Eclipse RCP - Launch editor from file menu

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?

Upvotes: 1

Views: 782

Answers (1)

Chris Dennett
Chris Dennett

Reputation: 22741

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.

Upvotes: 2

Related Questions