Skip to main content



      Home
Home » Archived » Sapphire » Possible types' labels
Possible types' labels [message #762615] Thu, 08 December 2011 06:52 Go to next message
Eclipse UserFriend
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 10:18 Go to previous messageGo to next message
Eclipse UserFriend
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 10:24 Go to previous messageGo to next message
Eclipse UserFriend
Like a charm.
Thanks Konstantin.
Re: Possible types' labels [message #765233 is a reply to message #762751] Tue, 13 December 2011 12:13 Go to previous messageGo to next message
Eclipse UserFriend
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 17:22 Go to previous messageGo to next message
Eclipse UserFriend
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 17:23] by Moderator

Re: Possible types' labels [message #765868 is a reply to message #765350] Wed, 14 December 2011 15:08 Go to previous messageGo to next message
Eclipse UserFriend
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 16:17 Go to previous messageGo to next message
Eclipse UserFriend
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 04:34 Go to previous message
Eclipse UserFriend
Yep, cheers.
Previous Topic:Recursive editor parts
Next Topic:Editing transient properties via a property editor
Goto Forum:
  


Current Time: Tue May 13 04:57:31 EDT 2025

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

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

Back to the top