Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » Strings in PropertyEditorSupport
Strings in PropertyEditorSupport [message #144341] Wed, 02 April 2008 12:07 Go to next message
Eclipse User
Originally posted by: eli_lato.hotmail.com

I have a simple String property named x.
I call xPropertyDescriptor.setPropertyEditorClass(XEditor.class);

XEditor is:

public class XEditor extends PropertyEditorSupport {
private static final String[] CHOICES = {"a", "b", "c"};

public String[] getTags() {
return CHOICES;
}
public String getJavaInitializationString() {
return (String)getValue();
}
}

The combo opens fine. But when I choose a,
VE generates
o.setX(a);
instead of
o.setX("a");
This doesn't compile particularly well.

How do I make it return a String?

Also, what is getJavaInitializationString?
The JavaDocs aren't helpful.
Is there more thorough documentation anywhere?

Thanks,
Eli
Re: Strings in PropertyEditorSupport [message #144361 is a reply to message #144341] Wed, 02 April 2008 18:02 Go to previous messageGo to next message
Eclipse User
Originally posted by: richkulp.us.NO_SPAM.ibm.com

The javainitializationString has to be the exact syntax of java that you
want to be in the set property statement. So if you return just "a" then
it means the variable a. If you wanted the string "a" then you need to
return "\"a\"".

Being the exact java syntax means you can do expressions and not just a
string, e.g. "\"A\"+Integer.MIN_VALUE" would be turned into

setX("A"+Integer.MIN_VALUE)

--
Thanks,
Rich Kulp
Re: Strings in PropertyEditorSupport [message #144397 is a reply to message #144361] Thu, 03 April 2008 12:23 Go to previous message
Eclipse User
Originally posted by: eli_lato.hotmail.com

Bingo!
Thanks,
Eli
Re: Strings in PropertyEditorSupport [message #617026 is a reply to message #144341] Wed, 02 April 2008 18:02 Go to previous message
Eclipse User
Originally posted by: richkulp.us.NO_SPAM.ibm.com

The javainitializationString has to be the exact syntax of java that you
want to be in the set property statement. So if you return just "a" then
it means the variable a. If you wanted the string "a" then you need to
return "\"a\"".

Being the exact java syntax means you can do expressions and not just a
string, e.g. "\"A\"+Integer.MIN_VALUE" would be turned into

setX("A"+Integer.MIN_VALUE)

--
Thanks,
Rich Kulp
Re: Strings in PropertyEditorSupport [message #617030 is a reply to message #144361] Thu, 03 April 2008 12:23 Go to previous message
Eli Lato is currently offline Eli Lato
Messages: 35
Registered: July 2009
Member
Bingo!
Thanks,
Eli
Previous Topic:Match values instance name - component name
Next Topic:Pallet control in VE
Goto Forum:
  


Current Time: Fri Apr 18 10:10:57 EDT 2014

Powered by FUDForum. Page generated in 0.01643 seconds