[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.webtools] Re: XML editor keyref question

David Gomez wrote:

Hello everybody, I have a question about keys and keys references in eclipse XML editor. I have the follow elements defined on my schema
<xsd:key name="property-name-is-key">
<xsd:selector xpath="*/class/*/*"/>
<xsd:field xpath="@name"/>
</xsd:key>


<xsd:keyref name="property-name-referencing-by-method" refer="property-name-is-key"> <xsd:selector xpath="*/methods/*/class-property"/>
<xsd:field xpath="@property-name-ref"/>
</xsd:keyref>


<xsd:element name="notified-property">
<xsd:complexType>
<xsd:attribute name="property-name-ref" type="xsd:string" use="required">
</xsd:attribute>
</xsd:complexType>
</xsd:element>

I would like that when I'm editing a element of type notified-property under the selector */methods/*/class-property the editor show a combobox with attributes "names" under elements "*/class/*/*" according to the keyref restriction and helping me out to fill the attribute.
Is there any way to do it?

You'll need to extend the XMLContentAssistProcessor class, and possibly override the element completion methods, so that it looks up the values that correspond to your key and keyref values. You may also need to add a sourceviewer configuration that tells it to use your content assist processor as well as the default content assist processor.


Dave