Search code examples
eclipseeclipse-pde

org.eclipse.core.contenttype: Could not create content describer


I'm working on a custom editor and for that I want to define a custom content-type that can be opened by my editor.

My content-type is a xml with a specific namespace and root element. But everytime I start my Eclipse it fails to create the content-type:

!ENTRY org.eclipse.core.contenttype 4 0 2018-07-12 12:35:01.911 !MESSAGE Could not create content describer for fooeditor.foofile. Content type has been disabled.

My plugin.xml:

<extension
         point="org.eclipse.core.contenttype.contentTypes">

 <content-type
       base-type="org.eclipse.core.runtime.xml"
       default-charset="UTF-8"
       describer="org.eclipse.core.runtime.content.XMLRootElementContentDescriber2"
       file-extensions="xml"
       id="foofile"
       name="FOO File"
       priority="high">
         <describer
               class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber2"
               plugin="org.eclipse.core.runtime_3.13.0.v20170207-1030">
            <parameter
                  name="element"
                  value="{http://www.foo.com}foo">
            </parameter>
         </describer>
      </content-type>
   </extension>

I'm trying to figure this out for the past week and have no idea why this is not working. Any help is appreciated.


Solution

  • Don't use both the describer attribute and <describer - use one or the other.

    Your value for the describer plugin is wrong. The plugin id is just org.eclipse.core.runtime

    So use:

    <extension
             point="org.eclipse.core.contenttype.contentTypes">
    
     <content-type
           base-type="org.eclipse.core.runtime.xml"
           default-charset="UTF-8"
           file-extensions="xml"
           id="foofile"
           name="FOO File"
           priority="high">
             <describer
                   class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber2"
                   plugin="org.eclipse.core.runtime">
                <parameter
                      name="element"
                      value="{http://www.foo.com}foo">
                </parameter>
             </describer>
          </content-type>
       </extension>