Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[wtp-dev] Why does the m2e editor register itself for all XML Documents?

[Resending because m2e mailing list was wrong]

I'm including wtp because I'm not sure about my findings because I'm a
newbie in the WTP/WST area. So here we go:


What's the reason the POM-Editor is registering itself not only to
pomfile content types but also for org.eclipse.wst.xml.core.xmlsource
and org.eclipse.core.runtime.xml?

You plugin.xml looks like this:

> <extension point="org.eclipse.wst.sse.ui.editorConfiguration">
>     <sourceViewerConfiguration
>         class="org.eclipse.m2e.editor.xml.PomStructuredTextViewConfiguration"
>         target="org.eclipse.m2e.core.pomFile, org.eclipse.wst.xml.core.xmlsource, org.eclipse.core.runtime.xml"/>
>     <contentOutlineConfiguration
>         class="org.eclipse.m2e.editor.xml.PomContentOutlineConfiguration"
>         target="org.eclipse.m2e.core.pomFile, org.eclipse.wst.xml.core.xmlsource, org.eclipse.core.runtime.xml"/>
>     <provisionalConfiguration
>         type="org.eclipse.jface.text.quickassist.IQuickAssistProcessor"
>         class="org.eclipse.m2e.editor.xml.PomQuickAssistProcessor"
>         target="org.eclipse.m2e.core.pomFile"/>
>   </extension>

It looks like if another plugin (e.g. in my case e(fx)clipse) only
registers a proposalComputer and a documentationTextHover they are not
consulted anymore.

The problem I think is that PomStructuredTextViewConfiguration is too
greedy because when looking at your code you have:

> @Override
>   public IContentAssistProcessor[] getContentAssistProcessors(ISourceViewer sourceViewer, String partitionType) {
>     if(partitionType == IStructuredPartitions.DEFAULT_PARTITION || partitionType == IXMLPartitions.XML_DEFAULT) {
>       return new IContentAssistProcessor[] {new PomContentAssistProcessor(sourceViewer)};
>     }
>     return super.getContentAssistProcessors(sourceViewer, partitionType);
>   }
>   @Override
>   public ITextHover getTextHover(ISourceViewer sourceViewer, String contentType, int stateMask) {
> //    return super.getTextHover(sourceViewer, contentType, stateMask);
>     return new PomTextHover(sourceViewer, contentType, stateMask);
>   }

If you register yourself as a StructuredTextViewerConfigurationXML (even
for contenttypes different to org.eclipse.m2e.core.pomFile) you should
check if the file you are currently seeing is really a POM file.

I've now fixed the problem for my users but I'm quite sure you probably
break other users as well but nobody yet tracked down the problem to m2e.

So if you agree with me I'll file a bugzilla but first I wanted to know
if this multi target registration has had a reason.


B e s t S o l u t i o n . a t                        EDV Systemhaus GmbH
tom schindl                 geschäftsführer/CEO
eduard-bodem-gasse 5-7/1   A-6020 innsbruck     fax      ++43 512 935833                      phone    ++43 512 935834

Back to the top