Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » XML Schema Definition (XSD) » Displaying selected content from XSD file
Displaying selected content from XSD file [message #488957] Wed, 30 September 2009 20:55 Go to next message
Marcin Cylke is currently offline Marcin CylkeFriend
Messages: 61
Registered: July 2009
Member
Hello

I'm trying to create a custom XSD editor using XSDEditor class as a basis. I'd like to have a TreeView, as provided by XSDEditor, but I don't want to show all the elements of the Xsd Schema in the TreeView.

I found out, that I need to overload getChildrenFeatures of some of the ItemProviders, like XSDElementDeclarationItemProvider.

This seems pretty stright forward, but I'm stuck with finding the correct sequence of ItemProviders that I need to overload. How can I deduce it?

Or perhaps you could suggest me some other solution to my problem?

Regards
Marcin
Re: Displaying selected content from XSD file [message #489007 is a reply to message #488957] Thu, 01 October 2009 08:31 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Marcin,

Comments below.

Marcin Cylke wrote:
> Hello
>
> I'm trying to create a custom XSD editor using XSDEditor class as a
> basis. I'd like to have a TreeView, as provided by XSDEditor, but I
> don't want to show all the elements of the Xsd Schema in the TreeView.
>
> I found out, that I need to overload getChildrenFeatures of some of
> the ItemProviders, like XSDElementDeclarationItemProvider.
>
> This seems pretty stright forward, but I'm stuck with finding the
> correct sequence of ItemProviders that I need to overload. How can I
> deduce it?
There's a one to one mapping for the type of object displayed in a tree
node and the item provider for that type of object. You could set a
breakpoint in XSDEditor.setSelection to see what type of object is in
the selected node...
> Or perhaps you could suggest me some other solution to my problem?
>
> Regards
> Marcin


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Displaying selected content from XSD file [message #489203 is a reply to message #489007] Thu, 01 October 2009 20:01 Go to previous messageGo to next message
Marcin Cylke is currently offline Marcin CylkeFriend
Messages: 61
Registered: July 2009
Member
Hi,

I've debugged the selection, and it turns out it is actually an XSDSchemaImpl object. So I've tried to investigate XsdSchemaItemProvider, but have problems.

That class' getChildrenFeatures has this code in it:

childrenFeatures.add(xsdPackage.getXSDSchema_Contents());

getXSDSchema_Contents() in turn returns 8th structural feature.

This leaves me with a childrenFeature list of size = 1 - only one EReference object with name contents. How does that hide all the possible objects that can fit in a XSD file?

I assume that at some point XSDPackage.createPackageContents() is called, but than again, how can I safely trim this code to remove XSDAnnotation from its childrenFeatures collection??

Just can get the things that are going on in getChildrenFeatures for XSDSchema.

Any help appreciated Smile
Marcin
Re: Displaying selected content from XSD file [message #489291 is a reply to message #489203] Fri, 02 October 2009 09:07 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Marcin,

Comments below.

Marcin Cylke wrote:
> Hi,
> I've debugged the selection, and it turns out it is actually an
> XSDSchemaImpl object. So I've tried to investigate
> XsdSchemaItemProvider, but have problems.
>
> That class' getChildrenFeatures has this code in it:
>
> childrenFeatures.add(xsdPackage.getXSDSchema_Contents());
>
> getXSDSchema_Contents() in turn returns 8th structural feature.
>
> This leaves me with a childrenFeature list of size = 1 - only one
> EReference object with name contents. How does that hide all the
> possible objects that can fit in a XSD file?
It seems to me the diagrams in the Javadoc for the XSD package would
answer this. This is the one containment reference for all the physical
contents of the root <xsd:schema> element...
>
> I assume that at some point XSDPackage.createPackageContents() is
> called, but than again, how can I safely trim this code to remove
> XSDAnnotation from its childrenFeatures collection??
If you want filter, you'll need to modify the getChildren method. Note
that Eclipse views, like tree views directly support filtering, so you
might want to take that approach instead.
>
> Just can get the things that are going on in getChildrenFeatures for
> XSDSchema.
>
> Any help appreciated :)
> Marcin


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Displaying selected content from XSD file [message #604381 is a reply to message #488957] Thu, 01 October 2009 08:31 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Marcin,

Comments below.

Marcin Cylke wrote:
> Hello
>
> I'm trying to create a custom XSD editor using XSDEditor class as a
> basis. I'd like to have a TreeView, as provided by XSDEditor, but I
> don't want to show all the elements of the Xsd Schema in the TreeView.
>
> I found out, that I need to overload getChildrenFeatures of some of
> the ItemProviders, like XSDElementDeclarationItemProvider.
>
> This seems pretty stright forward, but I'm stuck with finding the
> correct sequence of ItemProviders that I need to overload. How can I
> deduce it?
There's a one to one mapping for the type of object displayed in a tree
node and the item provider for that type of object. You could set a
breakpoint in XSDEditor.setSelection to see what type of object is in
the selected node...
> Or perhaps you could suggest me some other solution to my problem?
>
> Regards
> Marcin


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Displaying selected content from XSD file [message #604384 is a reply to message #489007] Thu, 01 October 2009 20:01 Go to previous message
Marcin Cylke is currently offline Marcin CylkeFriend
Messages: 61
Registered: July 2009
Member
Hi,

I've debugged the selection, and it turns out it is actually an XSDSchemaImpl object. So I've tried to investigate XsdSchemaItemProvider, but have problems.

That class' getChildrenFeatures has this code in it:

childrenFeatures.add(xsdPackage.getXSDSchema_Contents());

getXSDSchema_Contents() in turn returns 8th structural feature.

This leaves me with a childrenFeature list of size = 1 - only one EReference object with name contents. How does that hide all the possible objects that can fit in a XSD file?

I assume that at some point XSDPackage.createPackageContents() is called, but than again, how can I safely trim this code to remove XSDAnnotation from its childrenFeatures collection??

Just can get the things that are going on in getChildrenFeatures for XSDSchema.

Any help appreciated :)
Marcin
Re: Displaying selected content from XSD file [message #604388 is a reply to message #489203] Fri, 02 October 2009 09:07 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Marcin,

Comments below.

Marcin Cylke wrote:
> Hi,
> I've debugged the selection, and it turns out it is actually an
> XSDSchemaImpl object. So I've tried to investigate
> XsdSchemaItemProvider, but have problems.
>
> That class' getChildrenFeatures has this code in it:
>
> childrenFeatures.add(xsdPackage.getXSDSchema_Contents());
>
> getXSDSchema_Contents() in turn returns 8th structural feature.
>
> This leaves me with a childrenFeature list of size = 1 - only one
> EReference object with name contents. How does that hide all the
> possible objects that can fit in a XSD file?
It seems to me the diagrams in the Javadoc for the XSD package would
answer this. This is the one containment reference for all the physical
contents of the root <xsd:schema> element...
>
> I assume that at some point XSDPackage.createPackageContents() is
> called, but than again, how can I safely trim this code to remove
> XSDAnnotation from its childrenFeatures collection??
If you want filter, you'll need to modify the getChildren method. Note
that Eclipse views, like tree views directly support filtering, so you
might want to take that approach instead.
>
> Just can get the things that are going on in getChildrenFeatures for
> XSDSchema.
>
> Any help appreciated :)
> Marcin


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Displaying selected content from XSD file
Next Topic:Resolving XSD includes
Goto Forum:
  


Current Time: Fri Mar 29 14:48:09 GMT 2024

Powered by FUDForum. Page generated in 0.03376 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top