Custom XML content type source validation in Eclipse RCP [message #1053802] |
Tue, 07 May 2013 12:02 |
Eclipse User |
|
|
|
I am building an eclipse plugin in which I need to validate XML files "on the fly" (source validation).
I created a new content type with org.eclipse.core.runtime.xml as base type and a new editor extending org.eclipse.wst.sse.ui.StructuredTextEditor for this content type. I also contributed to the org.eclipse.wst.validation.validatorV2 to create a validator using the org.eclipse.wst.xml.core.internal.validation.eclipse.Validator to validate my XML files.
Here is my plugin.xml
<plugin>
<extension
point="org.eclipse.core.contenttype.contentTypes">
<content-type
base-type="org.eclipse.core.runtime.xml"
file-extensions="example"
id="com.example.editor.content.example"
name="Example Files"
priority="normal">
</content-type>
</extension>
<extension
point="org.eclipse.ui.editors">
<editor
class="com.example.editor.ExampleEditor"
id="com.example.editor.example"
name="Example editor">
<contentTypeBinding
contentTypeId="com.example.editor.content.example">
</contentTypeBinding>
</editor>
</extension>
<extension
id="com.example.validator.ExampleValidator"
name="Example validator"
point="org.eclipse.wst.validation.validatorV2">
<validator
build="true"
class="org.eclipse.wst.xml.core.internal.validation.eclipse.Validator"
manual="true">
<include>
<rules>
<contentType
id="com.example.editor.content.example">
</contentType>
</rules>
</include>
</validator>
</extension>
</plugin>
The manual validation (Right click -> Validate) works but the file is not validated "on the fly" (i.e while the user types or when the file is saved).
How do you implement source validation with a custom xml content type ?
|
|
|
Powered by
FUDForum. Page generated in 0.05527 seconds