Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Commercial » Displaying custom property in SWT Designer
Displaying custom property in SWT Designer [message #564512] Tue, 23 October 2007 14:53
Eclipse UserFriend
Originally posted by:


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

Return _State
End Get
Set(ByVal Value As String)
_State = Value
End Set
End Property

Dim _States As String() = New String() {"Alabama", "Alaska",_
"Arizona", "Arkansas", _
"California", "Colorado", "Connecticut", "Delaware",_
"Florida", "Georgia", _
"Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", _
"Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts",
"Michigan", "Minnesota", "Mississippi", "Missouri", "Montana",
"Nebraska", "Nevada", "New Hampshire", _
"New Jersey", "New Mexico", _
"New York", "North Carolina", "North Dakota",_
"Ohio", "Oklahoma", _
"Oregon", "Pennsylvania", "Rhode Island", "South Carolina", _
"South Dakota", "Tennessee", "Texas", "Utah",_
"Vermont", "Virginia",_
"Washington", "West Virginia", "Wisconsin", "Wyoming"}

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.

Previous Topic:Eclipse RCP training in greater China
Next Topic:Displaying custom property in SWT Designer
Goto Forum:

Current Time: Thu Apr 26 09:55:15 GMT 2018

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

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