Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sapphire » Custom Part Creation
Custom Part Creation [message #711551] Sat, 06 August 2011 09:34 Go to next message
Kamesh Sampath is currently offline Kamesh Sampath
Messages: 213
Registered: July 2009
Senior Member
Hello,

Can anyone tell me how to create a custom part, I have a requirement where
I need to create a Custom Property editor which by default needs to provide
me couple labels and text controls like below

LABEL 1 : TEXT-FIELD-ONE
LABEL 2 : TEXT-FIELD-TWO

Ultimately when I save/persist the value text-field-one and text-field-two
value will be merged together as single value for the property field.

The reason for me going with content assist is that I need the two - fields
to be created automatically and in one of the fields I want to provide the
Java Content Assist feature.

Please correct me if my approach is wrong and is there any better approach
for my requirement.

~Kamesh
Re: Custom Part Creation [message #713611 is a reply to message #711551] Mon, 08 August 2011 16:46 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 942
Registered: July 2009
Senior Member
You can implement your own property editor by extending PropertyEditorRenderer and PropertyEditorRendererFactory classes, and then specifying that your implementation should be used like so...

<property-editor>
    <property>MyProperty</property>
    <hint>
        <name>factory</name>
        <value>MyCustomPropertyEditorFactory</value>  <!-- subject to import directives -->
    </hint>
</property-editor>


Writing a new property editor isn't easy. See various existing implementations of PropertyEditorRenderer in the framework to gauge the scope of the effort.

I think a better way to achieve this result would be to do the merging/parsing at the model level. Create two separate properties and then create custom XML binding instead of using the declarative variety. See @CustomXmlValueBinding and XmlValueBindingImpl.

- Konstantin
Re: Custom Part Creation [message #714082 is a reply to message #713611] Tue, 09 August 2011 18:50 Go to previous message
Kamesh Sampath is currently offline Kamesh Sampath
Messages: 213
Registered: July 2009
Senior Member
yeah i felt that difficulty ... will try your suggestion
Previous Topic:Content Assist
Next Topic:Overriding Sapphire Actions
Goto Forum:
  


Current Time: Sat Oct 25 12:43:12 GMT 2014

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

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