0

I've been trying to mimic the plugin.xml editor in my own Eclipse plug-in. I want a graphical editor for a custom file type. The same way in which PDE has a specific form/editor to open plugin.xml.

From what I understand I can implement a text Editor and link a file type to open in a particular editor. To add a graphical aspect I can make a Form.

What I don't understand is how to link this Form to my custom file type.

Araf
  • 353
  • 5
  • 11
  • Maybe this could be helpful, there is a similar question: https://stackoverflow.com/questions/15877123/eclipse-rcp-programmatically-associate-file-type-with-editor . – DrKaoliN Jul 22 '16 at 12:27

2 Answers2

2

You can use FormEditor for this (org.eclipse.ui.forms.editor.FormEditor). This extends the more basic MultiPageEditorPart.

FormEditor supports multiple pages, these can be form based using the FormPage class, or based on an ordinary text editor, or even just an arbitary set of SWT controls. So this allows you to have a arrangement like the plugin.xml editor (which is a FormEditor).

greg-449
  • 109,219
  • 232
  • 102
  • 145
1

I would try adding the following two entries in your plugin.xml file:

Firstly, add a contentType plugin extension, where you specify the file extension:

enter image description here

Then, as you said, you need to implement the editor. Add an editors plugin, in which you implement your editor. Don't forget to enable the default option:

enter image description here

After that, add a new contentTypeBinding subnode to the edior. There you need to use the id of the content type:

enter image description here

Also, do not forget to add the view in your perspective.

enter image description here

P.S. I have tested this just now with a simple TextEditor, and it should work:

enter image description here

DrKaoliN
  • 1,346
  • 4
  • 25
  • 39
  • Thanks for the answer, but I was looking for implementing a graphical editor. Found out that using `MultiPageEditorPart` instead of `TextEditor` will do the trick. – Araf Jul 22 '16 at 18:54