Skip to main content



      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
Eclipse UserFriend

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: Wed Mar 19 12:04:30 EDT 2025

Powered by FUDForum. Page generated in 0.05527 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top