Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » Problems invoking a custom validator
Problems invoking a custom validator [message #202484] Wed, 17 October 2007 07:57 Go to next message
Eclipse User
Originally posted by: uh5d.rz.uni-karlsruhe.de

I created a plugin which registers a new content type, modelhandler and
adapter factory.
Basically what I intended is to let a mdl2e file be treatened like a xml
file:


<extension point="org.eclipse.core.runtime.contentTypes">
<content-type
file-extensions="mdl2e"
priority="low"
name="MDL2e Content Type"
id="mdl2esource"
base-type="org.eclipse.core.runtime.xml"
default-charset="UTF-8">
<describer
class=" org.eclipse.core.runtime.content.XMLRootElementContentDescri ber ">
<parameter
name="element"
value="mdl2esheet"
/>
</describer>
</content-type>
</extension>

<extension point="org.eclipse.wst.sse.core.modelHandler">
<modelHandler
default="false"
class="iswarmide.ModelHandlerForMDL2E"
associatedContentTypeId="iswarmide.mdl2esource"
id="mdl2esourcehandler">
</modelHandler>
</extension>

<extension point="org.eclipse.wst.sse.ui.adapterFactoryDescription">
<adapterFactoryDescription
class="iswarmide.AdapterFactoryProviderForMDL2E"/>
</extension>

Until here everything worked out fine... a *.mdl2e file gets marked as an
xml file in the project explorer just like I wished and
it also gets (syntax)highlighted like a normal xml file.

I then added a custom validator:

<extension
id="mdl2eValidator"
name="MDL2EValidator"
point="org.eclipse.wst.validation.validator">
<validator>
<filter
objectClass="org.eclipse.core.resources.IFile"
caseSensitive="false"
nameFilter="*.mdl2e">
</filter>
<contentTypeBinding contentTypeId="iswarmide.mdl2esource"/>
<helper
class="org.eclipse.wst.xml.core.internal.validation.core.Helper "/>
<run
async="true"
class="iswarmide.MDL2EValidator"
enabled="true"
fullBuild="true"
incremental="true"
/>
</validator>
</extension>

Now, when i open a mdl2e file the xml-editors pops up. However, instead of
my MDL2EValidator the standart
org.eclipse.wst.xml.core.internal.validation.eclipse.Validat or gets invoked.
Strangely the MDL2EValidator gets invoked when i manually go on the file in
the project explorer and click on "validate".

How can I achieve, that my MDL2EValidator gets automatically invoked when i
change something in the editor and not just by manually clicking
"validate"???


Regards

A.Gallus
Re: Problems invoking a custom validator [message #202729 is a reply to message #202484] Fri, 19 October 2007 15:58 Go to previous message
kiril mitov is currently offline kiril mitov
Messages: 69
Registered: July 2009
Member
Hi A.Gallus,
Have you looked at the extension point
org.eclipse.wst.sse.ui.sourcevalidation.
You can also take a look at the how the validation is done in jsp files -
check the org.eclipse.jst.jsp.ui project as a starting point.

Best Regards,
Kiril

"A. Gallus" <uh5d@rz.uni-karlsruhe.de> wrote in message
news:ff4fa1$f19$1@build.eclipse.org...
>I created a plugin which registers a new content type, modelhandler and
>adapter factory.
> Basically what I intended is to let a mdl2e file be treatened like a xml
> file:
>
>
> <extension point="org.eclipse.core.runtime.contentTypes">
> <content-type
> file-extensions="mdl2e"
> priority="low"
> name="MDL2e Content Type"
> id="mdl2esource"
> base-type="org.eclipse.core.runtime.xml"
> default-charset="UTF-8">
> <describer
> class=" org.eclipse.core.runtime.content.XMLRootElementContentDescri ber ">
> <parameter
> name="element"
> value="mdl2esheet"
> />
> </describer>
> </content-type>
> </extension>
>
> <extension point="org.eclipse.wst.sse.core.modelHandler">
> <modelHandler
> default="false"
> class="iswarmide.ModelHandlerForMDL2E"
> associatedContentTypeId="iswarmide.mdl2esource"
> id="mdl2esourcehandler">
> </modelHandler>
> </extension>
>
> <extension point="org.eclipse.wst.sse.ui.adapterFactoryDescription">
> <adapterFactoryDescription
> class="iswarmide.AdapterFactoryProviderForMDL2E"/>
> </extension>
>
> Until here everything worked out fine... a *.mdl2e file gets marked as an
> xml file in the project explorer just like I wished and
> it also gets (syntax)highlighted like a normal xml file.
>
> I then added a custom validator:
>
> <extension
> id="mdl2eValidator"
> name="MDL2EValidator"
> point="org.eclipse.wst.validation.validator">
> <validator>
> <filter
> objectClass="org.eclipse.core.resources.IFile"
> caseSensitive="false"
> nameFilter="*.mdl2e">
> </filter>
> <contentTypeBinding contentTypeId="iswarmide.mdl2esource"/>
> <helper
> class="org.eclipse.wst.xml.core.internal.validation.core.Helper "/>
> <run
> async="true"
> class="iswarmide.MDL2EValidator"
> enabled="true"
> fullBuild="true"
> incremental="true"
> />
> </validator>
> </extension>
>
> Now, when i open a mdl2e file the xml-editors pops up. However, instead of
> my MDL2EValidator the standart
> org.eclipse.wst.xml.core.internal.validation.eclipse.Validat or gets
> invoked.
> Strangely the MDL2EValidator gets invoked when i manually go on the file
> in the project explorer and click on "validate".
>
> How can I achieve, that my MDL2EValidator gets automatically invoked when
> i change something in the editor and not just by manually clicking
> "validate"???
>
>
> Regards
>
> A.Gallus
>
>
>
>
>
Previous Topic:Refreshing org.eclipse.jst.j2ee.model.ModelProviderManager?
Next Topic:jface error
Goto Forum:
  


Current Time: Thu Sep 18 05:42:13 GMT 2014

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

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