When i am selecting a file in the project explorer, it should allow me to open my editor instead it shows text editor.How can we handle this programmatically in eclipse plugin development ?
regards Mathan
When i am selecting a file in the project explorer, it should allow me to open my editor instead it shows text editor.How can we handle this programmatically in eclipse plugin development ?
regards Mathan
Any plugin that contributes an editor to the workbench can associate an extension the editor understands in their plugin.xml.
The extensions attribute describes the file types that the editor understands. (You could also specify filenames if you need to be more specific.)
I believe this is enough to make your editor open when you click a file of your extension. (at least be preferred the first time you open the file. i.e. eclipse will prefer the last used editor for that file that session).
Window - Preferences - General - Editors - File Associations
Their you can select which editor is open, for the different file endings.
When you want to do this with a self implemented editor you have to implement the extension poin for editors
org.eclipse.ui.editors
The field "extensions" defines which file ending is associated to the editor
Using the file extension method is preferred because that's easy. However if you can't do that, then the only alternative I know of is to provide an action provider in the Common Navigator configuration.
You will need to subclass CommonActionProvider and in the fillContextMenu() method you can look at the resource and then decide to have your own Open action (for your editor) or add the standard Open action.