[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [m2e-dev] Why does the m2e editor register itself for all XML Documents?
|
I just checked eclipse documentation [1] and did not find any mentioning
neither of StructuredTextViewerConfigurationXML nor of
org.eclipse.wst.sse.ui.editorConfiguration. So the first step seems to
find relevant documentation and/or source references that explain
expected PomStructuredTextViewConfiguration behaviour. I am not
comfortable making any changes to m2e code without clear understanding
of API contract.
[1] http://help.eclipse.org/indigo/index.jsp
--
Regards,
Igor
On 12-06-09 12:52 PM, Tom Schindl wrote:
[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:
Hi,
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.
Tom