Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Sapphire » Possible types' labels
Possible types' labels [message #762615] Thu, 08 December 2011 11:52 Go to next message
Roded Bahat is currently offline Roded BahatFriend
Messages: 152
Registered: August 2011
Senior Member
Hi,
I have the following property defined:
// *** Value ***
@Required
@Label(standard = "Value")
@Type (	base = IValue.class,
        possible = { 
            IXSDConstant.class,
            IXSDChoice.class
        }
    )
@XmlElementBinding ( 
    mappings = {
        @XmlElementBinding.Mapping( element = "constant", type = IXSDConstant.class ),
        @XmlElementBinding.Mapping( element = "choice", type = IXSDChoice.class )
    }
)
ElementProperty PROP_VALUE = new ElementProperty(TYPE, "Value");
ModelElementHandle<IValue> getValue();


And a node factory under the parent element which contains a case for both possible type.
When running the application and right clicking the parent element in order to add a "Value" node under it, the possible types options show as the class names (i.e. "I X S D Constant" and "I X S D Choice").
Where exactly should I set the label so that the possible types will show as labels and not class names?
Thanks,
Roded
Re: Possible types' labels [message #762748 is a reply to message #762615] Thu, 08 December 2011 15:18 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
You can use @Label at the class level on your IXSDConstant and IXSDChoice classes.

- Konstantin
Re: Possible types' labels [message #762751 is a reply to message #762748] Thu, 08 December 2011 15:24 Go to previous messageGo to next message
Roded Bahat is currently offline Roded BahatFriend
Messages: 152
Registered: August 2011
Senior Member
Like a charm.
Thanks Konstantin.
Re: Possible types' labels [message #765233 is a reply to message #762751] Tue, 13 December 2011 17:13 Go to previous messageGo to next message
Roded Bahat is currently offline Roded BahatFriend
Messages: 152
Registered: August 2011
Senior Member
Revisiting this..
Why not use the node factory case's label?
I have a case where I allow 2 children of type IValue under a node so I include the relevant node factory twice.
Problem is, that when adding the nodes, there's not telling the difference between them..
Re: Possible types' labels [message #765350 is a reply to message #765233] Tue, 13 December 2011 22:22 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
Quote:
Why not use the node factory case's label?


That label is for the instance of the node and typically uses an expr with references to properties in a given element instance. The add action label references the element type.

Quote:
I have a case where I allow 2 children of type IValue under a node so I include the relevant node factory twice.
Problem is, that when adding the nodes, there's not telling the difference between them..


In cases where mixing multiple factories / list properties directly under a single node is confusing, intermediary nodes can be used to establish context...

Instead of...

root
   x
   y
   z


use...

root
   list 1
      x
      y
   list 2
      z

[Updated on: Tue, 13 December 2011 22:23]

Report message to a moderator

Re: Possible types' labels [message #765868 is a reply to message #765350] Wed, 14 December 2011 20:08 Go to previous messageGo to next message
Roded Bahat is currently offline Roded BahatFriend
Messages: 152
Registered: August 2011
Senior Member
That makes sense.
Thanks.

Though I still don't quite understand the purpose of that label though, what do you mean by the node instance?
Re: Possible types' labels [message #765896 is a reply to message #765868] Wed, 14 December 2011 21:17 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
If you look at the contacts sample, the node factory case label is this:

${ Name == null ? "<contact>" : Name }


That's an expr that references properties of the model element behind the node. So the type of what you are adding is "contact" (add action is labeled "add contact"), but the node label is going to be "bob", "jane", etc.

Clear as mud?

- Konstantin
Re: Possible types' labels [message #766150 is a reply to message #765896] Thu, 15 December 2011 09:34 Go to previous message
Roded Bahat is currently offline Roded BahatFriend
Messages: 152
Registered: August 2011
Senior Member
Yep, cheers.
Previous Topic:Recursive editor parts
Next Topic:Editing transient properties via a property editor
Goto Forum:
  


Current Time: Thu Mar 28 17:45:26 GMT 2024

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

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

Back to the top