Hi Jean-Francois,

You can implement a "describer" class which can check based on the content.

[image: image.png]

For example, check
the org.eclipse.core.runtime.content.XMLRootElementContentDescriber2 class.
PDE uses it to identify its content types.

Example from the PDE core plugin.xml
<content-type
            base-type="org.eclipse.core.runtime.xml"
            id="org.eclipse.pde.categoryManifest"
            name="%categoryManifestName"
            priority="high">
         <describer

 class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber">
            <parameter
                  name="element"
                  value="site">
            </parameter>
         </describer>
      </content-type>

I hope this helps,

Best regards, Lars


On Mon, Feb 21, 2022 at 12:50 PM Jean-Francois Maury <jma...@redhat.com>
wrote:

> Hello,
>
> I'm working on an LSP based editor for Qute files (Quarkus related
> templating engine).
> The binding for editor is based on the content type but so I need to
> define a content type for Qute files.
> Quarkus team said that a file is a Qute file should be based on context
> (eg Quarkus project) or content.
> I can't find a way to assign a content type based on content or content
> but only on file name.
> Is there a way to dynamically compute the content type or do you have any
> suggestions ?
>
> Thanks
>
>
> --
>
> Jeff Maury
>
> Manager, DevTools
>
> Red Hat EMEA <https://www.redhat.com>
>
> jma...@redhat.com
> @RedHat <https://twitter.com/redhat>   Red Hat
> <https://www.linkedin.com/company/red-hat>  Red Hat
> <https://www.facebook.com/RedHatInc>
> <https://www.redhat.com>
> <https://redhat.com/summit>
> _______________________________________________
> platform-dev mailing list
> platform-dev@eclipse.org
> To unsubscribe from this list, visit
> https://www.eclipse.org/mailman/listinfo/platform-dev
>


-- 
Eclipse Platform project co-lead
CEO vogella GmbH

Haindaalwisch 17a, 22395 Hamburg
Amtsgericht Hamburg: HRB 127058
Geschäftsführer: Lars Vogel, Jennifer Nerlich de Vogel
USt-IdNr.: DE284122352
Fax (040) 5247 6322, Email: lars.vo...@vogella.com, Web:
http://www.vogella.com
_______________________________________________
platform-dev mailing list
platform-dev@eclipse.org
To unsubscribe from this list, visit 
https://www.eclipse.org/mailman/listinfo/platform-dev

Reply via email to