PropertyEditor [message #89652] |
Wed, 04 May 2005 10:43  |
Eclipse User |
|
|
|
Hello,
I would like to have an editor for a property of my class. Do I have to
use an override (.xmi) file as in your tutorial?
Or it is enough to say the VE in the class beaninfo to use my editor as in
my example below?
Thank you in advance
Elena
------------------------------------------------------------ -----
public PropertyDescriptor[] getPropertyDescriptors()
{
PropertyDescriptor[] props =
{
property("Test", "This is a test for my property editor") };
props[0].setPropertyEditorClass(TestEditor.class);
}
return props;
}
public static PropertyDescriptor property(String name, String description)
throws IntrospectionException
{
PropertyDescriptor p = new PropertyDescriptor(name,
ResourceProperties.class);
p.setShortDescription(description);
return p;
}
|
|
|
|
Re: PropertyEditor [message #89759 is a reply to message #89652] |
Wed, 04 May 2005 13:16  |
Eclipse User |
|
|
|
Hi Elena,
> I would like to have an editor for a property of my class. Do I have to
> use an override (.xmi) file as in your tutorial?
> Or it is enough to say the VE in the class beaninfo to use my editor as
> in my example below?
The tutorial probably doesn't make this clear enough although we do have
the paragraph:
"Some kinds of customization are not possible through the BeanInfo
mechanism because while it provides a powerful way to describe edit time
behavior and shape for a class the Visual Editor needs to be able to
export some of its innermost extension points to the creator of the Java
class, and the BeanInfo mechanism is designed to provide a portable way
of customizing a Java class that can be transported easily between
different IDEs and tools. For example, the next exercise in the
tutorial is to override the behavior that occurs when the text property
is edited to launch a dialog editor. This dialog editor will be written
using the SWT and implement Eclipse specific interfaces, so describing
it on the BeanInfo would violate the idea that BeanInfo classes are
portable (as Eclipse interfaces and the SWT are not necessarily
available to other visual design tools)."
What we should do however is make it more obvious that regular
java.beans.PropertyEditor types work, so instead of an enumerated type
done the fancy way we do we should use a getTags() property editor.
Could you please open a bugzilla and we'll update the tutorial as I
think this would make it more obvious.
Best regards,
Joe
|
|
|
Re: PropertyEditor [message #607338 is a reply to message #89652] |
Wed, 04 May 2005 11:33  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
If the editor is an Eclipse editor, then you need to use an override
file, if it is a standard Java BeanInfo editor using standard BeanInfo
API, then it can be in the BeanInfo class.
Elena wrote:
> Hello,
>
>
> I would like to have an editor for a property of my class. Do I have to
> use an override (.xmi) file as in your tutorial?
> Or it is enough to say the VE in the class beaninfo to use my editor as
> in my example below?
>
>
>
> Thank you in advance
> Elena
>
> ------------------------------------------------------------ -----
> public PropertyDescriptor[] getPropertyDescriptors()
> {
>
> PropertyDescriptor[] props =
> {
> property("Test", "This is a test for my property editor") };
> props[0].setPropertyEditorClass(TestEditor.class);
> }
> return props;
>
> }
> public static PropertyDescriptor property(String name, String
> description)
> throws IntrospectionException
> {
>
> PropertyDescriptor p = new PropertyDescriptor(name,
> ResourceProperties.class);
> p.setShortDescription(description);
> return p;
> }
>
>
--
Thanks,
Rich Kulp
|
|
|
Re: PropertyEditor [message #607340 is a reply to message #89652] |
Wed, 04 May 2005 13:16  |
Eclipse User |
|
|
|
Hi Elena,
> I would like to have an editor for a property of my class. Do I have to
> use an override (.xmi) file as in your tutorial?
> Or it is enough to say the VE in the class beaninfo to use my editor as
> in my example below?
The tutorial probably doesn't make this clear enough although we do have
the paragraph:
"Some kinds of customization are not possible through the BeanInfo
mechanism because while it provides a powerful way to describe edit time
behavior and shape for a class the Visual Editor needs to be able to
export some of its innermost extension points to the creator of the Java
class, and the BeanInfo mechanism is designed to provide a portable way
of customizing a Java class that can be transported easily between
different IDEs and tools. For example, the next exercise in the
tutorial is to override the behavior that occurs when the text property
is edited to launch a dialog editor. This dialog editor will be written
using the SWT and implement Eclipse specific interfaces, so describing
it on the BeanInfo would violate the idea that BeanInfo classes are
portable (as Eclipse interfaces and the SWT are not necessarily
available to other visual design tools)."
What we should do however is make it more obvious that regular
java.beans.PropertyEditor types work, so instead of an enumerated type
done the fancy way we do we should use a getTags() property editor.
Could you please open a bugzilla and we'll update the tutorial as I
think this would make it more obvious.
Best regards,
Joe
|
|
|
Powered by
FUDForum. Page generated in 0.26467 seconds