views:

30

answers:

1

I am creating an Eclipse plug-in for it to support a new language. The problem I have is with the content type/file association and its respective editor.

The language has no base in Java or XML and let's say its extension is '.xyz'

From what I understood of research online, I would need to create a new Content Type with file extension '.xyz'. But all the information I have found online has related to either associating a new extension with java (for java syntax highlighting) or creating a new type of file which can be a variant of XML, hence having a lot of details about the describer.
Basically, I am confused about the content describer, am I also to create a new describer for a new language? And what base-type would I give for a language not related to XML or JAVA at all?

Also, since I will be adding my own syntax highlighting, would I need to create my own editor or can I just open such a file in the pre-set editorArea (editors).

The package I am looking at for content types is org.eclipse.core.contenttype.contentTypes.

+2  A: 

Note: this (new language support, custom syntax highlighting, ...) is the kind of feature provided with XText.

Xtext - Language Development Framework

With Xtext you can easily create your own programming languages and domain-specific languages (DSLs).
The framework supports the development of language infrastructures including compilers and interpreters as well as full blown Eclipse-based IDE integration.

XText custom editor example

Since the sources are available, you might have a lots of clues to illustrate the usage of the packages you are currently looking.

VonC
And this would apply even if the compiler and interpreter is already written and I only need to create the IDE (the GUI for the xyz language programmers, to be precise) which then connects to the compiler and interpreter?
nEm
@nEm: I am not sure: XText bases all its generated classes on a grammar of your language, so I don't know if you can switch those for your own classes. But my point was: in term of editor and syntax highlighting, you have lots of practical implementation examples in this XText plugin. So even if you don't use it directly, you can at least take some ideas from it.
VonC
Yup got it! Thanks, I'll look into it. Definitely some good direction to start with.
nEm