Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » PropertyEditor
PropertyEditor [message #89652] Wed, 04 May 2005 14:43 Go to next message
Elena Demeter is currently offline Elena DemeterFriend
Messages: 152
Registered: July 2009
Senior Member
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 #89730 is a reply to message #89652] Wed, 04 May 2005 15:33 Go to previous messageGo to next message
Eclipse UserFriend
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 #89759 is a reply to message #89652] Wed, 04 May 2005 17:16 Go to previous message
Joe Winchester is currently offline Joe WinchesterFriend
Messages: 496
Registered: July 2009
Senior Member
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 15:33 Go to previous message
Eclipse UserFriend
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 17:16 Go to previous message
Joe Winchester is currently offline Joe WinchesterFriend
Messages: 496
Registered: July 2009
Senior Member
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
Previous Topic:BeanInfo
Next Topic:Project location
Goto Forum:
  


Current Time: Thu Apr 25 13:30:45 GMT 2024

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

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

Back to the top