Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsDisplaying custom property in SWT Designer
https://www.eclipse.org/forums/index.php/mv/msg/177567/564512/#msg_564512
Originally posted by: viswanathan_s.hcl.in
Hi,
I am in the assignment of creating a custom control using custom composite
feature in the SWT designer.
I need to display a string property in the Property grid for which the
value could be any from a set of values that are to be determined at
runtime from the XML Schema.
If it could have been determined already I would prefer associating them
using a Enum variable so that it display the list of items in a combo
control in the Propery grid against my property.
Since the list of values are undetermined at design time how do I proceed
with this? Is there anything that can do for getting the list of values in
the property grid for my property.
I saw the similar kind in .NET where a new class is derived from an
existing class and some methods are overridden to associate the State
property to a set of values.
NET Code Sample
-----------------
Public Class StatesList : Inherits System.ComponentModel.StringConverter
Private _State As String
'''
<TypeConverter(GetType(StatesList)), _
CategoryAttribute("Custom List"), DefaultValueAttribute(""), _
DescriptionAttribute("Select a state from the list")> _
Public Property State() As String
Get
Return _State
End Get
Set(ByVal Value As String)
_State = Value
End Set
End Property
Public Overloads Overrides Function _
GetStandardValues(ByVal context As _
System.ComponentModel.ITypeDescriptorContext) _
As System.ComponentModel.TypeConverter.StandardValuesCollection
Return New StandardValuesCollection(_States)
End Function
It would be great if you could provide me a solution.