Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Web Tools Project (WTP) » XML editor keyref question
XML editor keyref question [message #214282] Tue, 27 May 2008 02:45 Go to next message
Eclipse User
Originally posted by: mikrodj.hotmail.com

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?
Cheers, David.
Re: XML editor keyref question [message #214345 is a reply to message #214282] Tue, 27 May 2008 09:37 Go to previous messageGo to next message
Eclipse User
Originally posted by: dcarver.starstandard.org

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
Re: XML editor keyref question [message #214353 is a reply to message #214345] Tue, 27 May 2008 09:52 Go to previous messageGo to next message
Eclipse User
Originally posted by: mikrodj.hotmail.com

Thank you for your quick answer. Right now IŽm testing other possibility
which consist of updating dynamic the schema by a XSLT template, but the
problem I found is to let the editor know that the schema changed and it
has to load it again.

Do yo know any way to do that?

Cheers, David.
Re: XML editor keyref question [message #214362 is a reply to message #214353] Tue, 27 May 2008 11:08 Go to previous message
Eclipse User
Originally posted by: dcarver.starstandard.org

David wrote:
> Thank you for your quick answer. Right now IŽm testing other possibility
> which consist of updating dynamic the schema by a XSLT template, but the
> problem I found is to let the editor know that the schema changed and it
> has to load it again.
> Do yo know any way to do that?

You may want to look at the code that allows for a Reload of Grammars.
I believe there is a handler in the xml.ui plugin that you may be able
to call after recreating your schema with the xslt.

Dave
Previous Topic:help me in configuring struts2
Next Topic:WTP 3.0 : Extending the JavaScript Development Toolkit
Goto Forum:
  


Current Time: Wed Jul 30 21:32:07 EDT 2014

Powered by FUDForum. Page generated in 0.01779 seconds