title: Eclipse plugin with custom validation
body: <p>I'm new to Eclipse plugin development, but I've been able to cobble together a plugin that defines a content type and a corresponding editor. I've gotten custom content assist going, so I know the editor is coming up okay.</p>
  
  <p>My problem is that I need to create some custom validation for files of this content type, and I've found scant information. The only example I could find that has Java code is here: <a href="http://www.eclipse.org/webtools/wst/components/sse/tutorials/source-validation.html" rel="nofollow noreferrer">http://www.eclipse.org/webtools/wst/components/sse/tutorials/source-validation.html</a> .</p>
  
  <p>Unfortunately, copying this technique yields no results. My validator class is never even invoked.</p>
  
  <p>Here are the relevant parts of my <code>plugin.xml</code>:</p>
  
  <pre class="lang-xml prettyprint-override"><code>        &lt;extension point="org.eclipse.core.contenttype.contentTypes"&gt;
          &lt;content-type base-type="org.eclipse.core.runtime.xml"
              file-extensions="xml"
              id="com.palantir.eclipse.kite.contenttype.kite"
              name="Kite File"
              priority="normal"&gt;
  
              &lt;describer class="org.eclipse.core.runtime.content.XMLRootElementContentDescriber"&gt;
                  &lt;parameter name="element" value="kite"&gt;&lt;/parameter&gt;
              &lt;/describer&gt;
          &lt;/content-type&gt;
      &lt;/extension&gt;
  
  
         &lt;extension point="org.eclipse.ui.editors"&gt;
        &lt;editor name="Kite XML Editor"
              icon="icons/smalllogo.gif"
              contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
              class="com.palantir.eclipse.kite.plugin.editor.KiteXmlEditor"
              id="com.palantir.eclipse.kite.plugin.editor.KiteXmlEditor"&gt;
            &lt;contentTypeBinding contentTypeId="com.palantir.eclipse.kite.contenttype.kite"&gt;
            &lt;/contentTypeBinding&gt;
        &lt;/editor&gt;
     &lt;/extension&gt;
  
         &lt;extension point="org.eclipse.wst.sse.ui.sourcevalidation"&gt;
        &lt;validator scope="total"
                   class="com.palantir.eclipse.kite.plugin.validator.KiteValidator"
                   id="com.palantir.eclipse.kite.plugin.validator.KiteValidator"&gt;
           &lt;contentTypeIdentifier id="com.palantir.eclipse.kite.contenttype.kite"&gt;
              &lt;partitionType id="org.eclipse.wst.sse.ST_DEFAULT" /&gt;
           &lt;/contentTypeIdentifier&gt;
        &lt;/validator&gt;
     &lt;/extension&gt;
  </code></pre>
  
  <p>And the validator file:</p>
  
  <pre class="lang-java prettyprint-override"><code>
  package com.palantir.eclipse.kite.plugin.validator;
  
  import org.eclipse.jface.text.IDocument;
  import org.eclipse.jface.text.IRegion;
  import org.eclipse.wst.sse.ui.internal.reconcile.validator.ISourceValidator;
  import org.eclipse.wst.validation.internal.provisional.core.IReporter;
  import org.eclipse.wst.validation.internal.provisional.core.IValidationContext;
  import org.eclipse.wst.validation.internal.provisional.core.IValidator;
  
  public class KiteValidator implements ISourceValidator, IValidator {
      public KiteValidator() {
          System.out.println("Initialized KiteValidator");
      }
  
      public void cleanup(IReporter reporter) {
          System.out.println("Inside KiteValidator");
      }
  
      public void validate(IValidationContext context, IReporter reporter) {
          System.out.println("Inside KiteValidator");
      }
  
      public void connect(IDocument document) {
          System.out.println("Inside KiteValidator");
      }
  
      public void disconnect(IDocument document) {
          System.out.println("Inside KiteValidator");
      }
  
      public void validate(IRegion region, IValidationContext context, IReporter reporter) {
          System.out.println("Inside KiteValidator");
      }
  }
  </code></pre>