Problems invoking a custom validator [message #202484] |
Wed, 17 October 2007 03:57  |
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 11:58  |
Eclipse User |
|
|
|
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
>
>
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.05268 seconds