Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Custom XML content type source validation in Eclipse RCP
Custom XML content type source validation in Eclipse RCP [message #1053802] Tue, 07 May 2013 12:02
Arthur b is currently offline Arthur b
Messages: 1
Registered: May 2013
Junior Member

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 ?
Previous Topic:e4: add view with secondary ID
Next Topic:SWT Browser : HTML content selection use case
Goto Forum:
  


Current Time: Mon Jul 28 10:22:31 EDT 2014

Powered by FUDForum. Page generated in 0.01705 seconds