Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » VE code generation customization, palette, beanInfo questions
VE code generation customization, palette, beanInfo questions [message #107921] Fri, 23 September 2005 18:21 Go to next message
Eclipse UserFriend
Originally posted by: adrian.cheerful.com

Hi,

I have a few questions on extending the VE:
1. Is it possible to customize the code generation behavior when a control
is dropped (not just for changing attribute)? For example, I would like to
open a wizard when my control is dropped, and add custom code so instead of
just:

if (instance == null)
instance = new MyControl();
return instance;

I want:

if (instance == null) {
instance = new MyControl();
instance.init();
}
return instance;

2. My control appears on the palette when the user adds my library to the
project. Is there a way to reverse this process, so it appears on the
palette by default, and when the user uses it the library is added?

3. The tutorial mentions that I can have beanInfo in other jars/packages.
Can you provide an example on how I can "hook" the BeanInfo class to the
actual class?

4. Any way to specify tooltips for properties view, and the Palette entry?

Thank you for your time!
Adrian
Re: VE code generation customization, palette, beanInfo questions [message #107968 is a reply to message #107921] Fri, 23 September 2005 20:09 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Adrian Pang wrote:
>
> 2. My control appears on the palette when the user adds my library to the
> project. Is there a way to reverse this process, so it appears on the
> palette by default, and when the user uses it the library is added?
No there isn't. It has been discussed before but I personally have a
problem with that concept. The palette would get extremely cluttered
with everyone who wants to do this, not just you. One thought was that
we have a palette customization dialog instead. In that dialog it will
show all of them that are available and the user can then select which
ones to be on the palette for the project. And then when they select it
the classpath will be updated to include it. Would that be satisfactory?

>
> 3. The tutorial mentions that I can have beanInfo in other jars/packages.
> Can you provide an example on how I can "hook" the BeanInfo class to the
> actual class?
>
Are you talking about
http://eclipse.org/articles/Article-VE-Custom-Widget/customw idget.html

If you are, then you are right, it doesn't show it. You need to specify
it in the plugin xml. The ve examples is such an example. Though we
haven't tested it lately. It may not be complete, but in general you
would add to your plugin.xml:

<extension
point="org.eclipse.jem.beaninfo.registrations">
<registration
container="org.eclipse.ve.examples.JavaExample">
<beaninfo
path="/org.eclipse.ve.examples/vm/javaexamplebeaninfo.jar">
<searchpath
package="org.eclipse.ve.examples.java.beaninfo">
</searchpath>
</beaninfo>
<override
package="org.eclipse.ve.examples.java.vm"
path="overrides/org/eclipse/ve/examples/java/vm">
</override>
</registration>
</extension>

You would need to have your plugin project have another jar being built
too, which is the beaninfo jar.

> 4. Any way to specify tooltips for properties view, and the Palette entry?

For properties view, no. The properties viewer doesn't allow it.

For the palette entry, if you define the "entryShortDescription"
property in the palette xmi entry then it will show up.
>
> Thank you for your time!
> Adrian
>
>

--
Thanks,
Rich Kulp
Re: VE code generation customization, palette, beanInfo questions [message #108009 is a reply to message #107968] Fri, 23 September 2005 21:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: adrian.cheerful.com

[snip]

> > 2. My control appears on the palette when the user adds my library to
the
> > project. Is there a way to reverse this process, so it appears on the
> > palette by default, and when the user uses it the library is added?
> No there isn't. It has been discussed before but I personally have a
> problem with that concept. The palette would get extremely cluttered
> with everyone who wants to do this, not just you. One thought was that
> we have a palette customization dialog instead. In that dialog it will
> show all of them that are available and the user can then select which
> ones to be on the palette for the project. And then when they select it
> the classpath will be updated to include it. Would that be satisfactory?

I think that would be great. Personally, I think it is best that you can
specify which palette items you want to see once, and everytime you use the
same workspace you get the items you commonly use in your application. If
we leave the mechanism the view the way it is right now, I think it will be
more difficult as the users will just get many items in the classpath dialog
to choose from and it would be difficult for users to find what they need.
>
> >
> > 3. The tutorial mentions that I can have beanInfo in other
jars/packages.
> > Can you provide an example on how I can "hook" the BeanInfo class to the
> > actual class?
> >
> Are you talking about
> http://eclipse.org/articles/Article-VE-Custom-Widget/customw idget.html
>
Yes, and thanks for your help... it's exactly what I am looking for.

Thanks for your time!
Adrian
Re: VE code generation customization, palette, beanInfo questions [message #108023 is a reply to message #107921] Sat, 24 September 2005 07:55 Go to previous message
Eclipse UserFriend
Originally posted by: no.ddress.here

In article <dh1h42$6tg$1@news.eclipse.org>, adrian@cheerful.com says...
> Hi,
>
> I have a few questions on extending the VE:
> 1. Is it possible to customize the code generation behavior when a control
> is dropped (not just for changing attribute)? For example, I would like to
> open a wizard when my control is dropped,

In general, this can be done by implementing a "isDesignTime()" check in
the constructor of your control to run your Wizard.

> and add custom code

If the Wizard is implemented as a standard bean customizer, just have it
call a suitable property setter to insert a "instance.setInit(true);"
statement in your code to do any needed initialization on execution.

Actually, you can use a PropertyEditor#getJavaInitializationString() in
the BeanInfo to fully define the form of the code inserted by the
customizer.

The tricky part is getting VE to run the bean customizer automatically
from a call from a control's constructor. Not sure if/how VE supports
this.

The alternative, which is known to work in VE and other builders, is to
implement the customizer on the underlying container and have it,
through its Wizard flow, programmatically add your control(s) to the
container and concurrently manage their configuration.
Re: VE code generation customization, palette, beanInfo questions [message #610857 is a reply to message #107921] Fri, 23 September 2005 20:09 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Adrian Pang wrote:
>
> 2. My control appears on the palette when the user adds my library to the
> project. Is there a way to reverse this process, so it appears on the
> palette by default, and when the user uses it the library is added?
No there isn't. It has been discussed before but I personally have a
problem with that concept. The palette would get extremely cluttered
with everyone who wants to do this, not just you. One thought was that
we have a palette customization dialog instead. In that dialog it will
show all of them that are available and the user can then select which
ones to be on the palette for the project. And then when they select it
the classpath will be updated to include it. Would that be satisfactory?

>
> 3. The tutorial mentions that I can have beanInfo in other jars/packages.
> Can you provide an example on how I can "hook" the BeanInfo class to the
> actual class?
>
Are you talking about
http://eclipse.org/articles/Article-VE-Custom-Widget/customw idget.html

If you are, then you are right, it doesn't show it. You need to specify
it in the plugin xml. The ve examples is such an example. Though we
haven't tested it lately. It may not be complete, but in general you
would add to your plugin.xml:

<extension
point="org.eclipse.jem.beaninfo.registrations">
<registration
container="org.eclipse.ve.examples.JavaExample">
<beaninfo
path="/org.eclipse.ve.examples/vm/javaexamplebeaninfo.jar">
<searchpath
package="org.eclipse.ve.examples.java.beaninfo">
</searchpath>
</beaninfo>
<override
package="org.eclipse.ve.examples.java.vm"
path="overrides/org/eclipse/ve/examples/java/vm">
</override>
</registration>
</extension>

You would need to have your plugin project have another jar being built
too, which is the beaninfo jar.

> 4. Any way to specify tooltips for properties view, and the Palette entry?

For properties view, no. The properties viewer doesn't allow it.

For the palette entry, if you define the "entryShortDescription"
property in the palette xmi entry then it will show up.
>
> Thank you for your time!
> Adrian
>
>

--
Thanks,
Rich Kulp
Re: VE code generation customization, palette, beanInfo questions [message #610860 is a reply to message #107968] Fri, 23 September 2005 21:44 Go to previous message
Adrian Pang is currently offline Adrian PangFriend
Messages: 10
Registered: July 2009
Junior Member
[snip]

> > 2. My control appears on the palette when the user adds my library to
the
> > project. Is there a way to reverse this process, so it appears on the
> > palette by default, and when the user uses it the library is added?
> No there isn't. It has been discussed before but I personally have a
> problem with that concept. The palette would get extremely cluttered
> with everyone who wants to do this, not just you. One thought was that
> we have a palette customization dialog instead. In that dialog it will
> show all of them that are available and the user can then select which
> ones to be on the palette for the project. And then when they select it
> the classpath will be updated to include it. Would that be satisfactory?

I think that would be great. Personally, I think it is best that you can
specify which palette items you want to see once, and everytime you use the
same workspace you get the items you commonly use in your application. If
we leave the mechanism the view the way it is right now, I think it will be
more difficult as the users will just get many items in the classpath dialog
to choose from and it would be difficult for users to find what they need.
>
> >
> > 3. The tutorial mentions that I can have beanInfo in other
jars/packages.
> > Can you provide an example on how I can "hook" the BeanInfo class to the
> > actual class?
> >
> Are you talking about
> http://eclipse.org/articles/Article-VE-Custom-Widget/customw idget.html
>
Yes, and thanks for your help... it's exactly what I am looking for.

Thanks for your time!
Adrian
Re: VE code generation customization, palette, beanInfo questions [message #610861 is a reply to message #107921] Sat, 24 September 2005 07:55 Go to previous message
Gerald Rosenberg is currently offline Gerald RosenbergFriend
Messages: 106
Registered: July 2009
Senior Member
In article <dh1h42$6tg$1@news.eclipse.org>, adrian@cheerful.com says...
> Hi,
>
> I have a few questions on extending the VE:
> 1. Is it possible to customize the code generation behavior when a control
> is dropped (not just for changing attribute)? For example, I would like to
> open a wizard when my control is dropped,

In general, this can be done by implementing a "isDesignTime()" check in
the constructor of your control to run your Wizard.

> and add custom code

If the Wizard is implemented as a standard bean customizer, just have it
call a suitable property setter to insert a "instance.setInit(true);"
statement in your code to do any needed initialization on execution.

Actually, you can use a PropertyEditor#getJavaInitializationString() in
the BeanInfo to fully define the form of the code inserted by the
customizer.

The tricky part is getting VE to run the bean customizer automatically
from a call from a control's constructor. Not sure if/how VE supports
this.

The alternative, which is known to work in VE and other builders, is to
implement the customizer on the underlying container and have it,
through its Wizard flow, programmatically add your control(s) to the
container and concurrently manage their configuration.
Previous Topic:why can't I add a JApplet inside another container?
Next Topic:Dragging JLabels on JPanels afterwards
Goto Forum:
  


Current Time: Wed Apr 24 16:48:24 GMT 2024

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

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

Back to the top