Can't get BeanInfo file to work [message #136248] |
Mon, 05 March 2007 22:53 |
Eclipse User |
|
|
|
Originally posted by: shawtor.shaw.ca
I went through the SWT Custom Widget tutorial on
http://www.eclipse.org/articles/Article-VE-Custom-Widget/cus tomwidget.html#Runtime_jar
and I was able to get the BeanInfo file to work no matter where I put the
BeanInfo file (same package, different package, in a Jar, in a different
Jar, etc).
I did the same thing with my SWING plugin, but the BeanInfo file did not
work accordingly. Here are the scenarios:
********
Scenario 1
********
Project Name: SwingProject
Package: MyCodes
Files inside MyCodes: abc.java and abcBeanInfo.java
I exported MyCodes to file1.jar, ran the eclipse application, import
file1.jar and the BeanInfo file worked.
********
Scenario 2
********
Project Name: SwingProject
Packages: MyCodes, MyBeanInfo
File inside MyCodes: abc.java
File inside MyBeanInfo: abcBeanInfo.java
I exported MyCodes to file1.jar and MyBeanInfo to file2.jar (both file1.jar
and file2.jar are at the root of SwingProject). I added the following lines
to plugin.xml
<extension point="org.eclipse.jem.beaninfo.registrations">
<registration container="CORRECT CONTAINER NAME">
<beaninfo path="file2.jar">
<searchpath package="MyBeanInfo" />
</beaninfo>
</registration>
</extension>
I just did the same thing as what I did in the SWT Custom Widget tutiroal
(and it worked for me there). Again I ran the eclipse application, import
file1.jar but the BeanInfo file did not work.
|
|
|
Re: Can't get BeanInfo file to work [message #136251 is a reply to message #136248] |
Tue, 06 March 2007 14:20 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
The beaninfo needs to be inside a package when inside a jar. Classes
from default packages often aren't loadable when in a jar (I don't know
the exact criteria). They need to be in a package. That means you need
to put both classes (the main class and the beaninfo class) in two
different packages and change the extension point to include the search
path to the beaninfo package.
--
Thanks,
Rich Kulp
|
|
|
Re: Can't get BeanInfo file to work [message #136256 is a reply to message #136251] |
Tue, 06 March 2007 18:46 |
Eclipse User |
|
|
|
Originally posted by: shawtor.shaw.ca
I did that from the beginning but it did not work.
Both my main class and the beaninfo class were in two different packages and
exported to two different jar files. I have also change the extension point
to include the search path to the beaninfo package.
Project Name: SwingProject
Packages: MyCodes, MyBeanInfo
File inside MyCodes: abc.java
File inside MyBeanInfo: abcBeanInfo.java
I exported MyCodes to file1.jar and MyBeanInfo to file2.jar (both file1.jar
and file2.jar are at the root of SwingProject). I added the following lines
to plugin.xml
<extension point="org.eclipse.jem.beaninfo.registrations">
<registration container="CORRECT CONTAINER NAME">
<beaninfo path="file2.jar">
<searchpath package="MyBeanInfo" />
</beaninfo>
</registration>
</extension>
It worked for me in the SWT custom widget tutorial but it didn't work for my
SWING plugin.
"Rich Kulp" <richkulp@us.NO_SPAM.ibm.com> wrote in message
news:esjtb2$bo8$1@utils.eclipse.org...
> The beaninfo needs to be inside a package when inside a jar. Classes from
> default packages often aren't loadable when in a jar (I don't know the
> exact criteria). They need to be in a package. That means you need to put
> both classes (the main class and the beaninfo class) in two different
> packages and change the extension point to include the search path to the
> beaninfo package.
>
> --
> Thanks,
> Rich Kulp
|
|
|
Re: Can't get BeanInfo file to work [message #136277 is a reply to message #136256] |
Thu, 08 March 2007 00:04 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
Is this during development? If it is, then there are problems because
the beaninfo jar must exist in the project at development time to work.
--
Thanks,
Rich Kulp
|
|
|
Re: Can't get BeanInfo file to work [message #136365 is a reply to message #136277] |
Mon, 12 March 2007 17:56 |
Eclipse User |
|
|
|
Originally posted by: shawtor.shaw.ca
I found out what the problem was but I still am not able to solve it.
I have two jar files, file1.jar (contains abc.class and abcBeanInfo.class)
and file2.jar (contains only abcBeanInfo.class, this file is different than
the abcBeanInfo.class in file1.jar). VE always use the abcBeanInfo file in
file1.jar even though I have edited my plugin.xml to set the beaninfo path
to the abcBeanInfo file in file2.jar. If I delete the abcBeanInfo.class
from file1.jar, then VE will go look at the abcBeanInfo.class from
file2.jar. The problem here is that I don't have authorization to delete
files in file1.jar. What can I do to set VE to look for the abcBeanInfo
file in file2.jar when the a file with the same name existed in file1.jar?
Thanks
Edward
"Rich Kulp" <richkulp@us.NO_SPAM.ibm.com> wrote in message
news:esnju6$2ke$1@utils.eclipse.org...
> Is this during development? If it is, then there are problems because the
> beaninfo jar must exist in the project at development time to work.
>
> --
> Thanks,
> Rich Kulp
|
|
|
Re: Can't get BeanInfo file to work [message #136374 is a reply to message #136365] |
Tue, 13 March 2007 19:39 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
Hi,
That is not a limitation of VE, it is a limitation of the Java Beaninfo
specs themselves. The spec says that it will FIRST look for a class
abcBeanInfo in the same package before it starts looking in the search path.
We've always felt this was a mistake. But the specs can't be changed, it
uses the actual Introspector from Java and can't be overrode. :-(
In fact we always felt it was a mistake to ever include beaninfo in the
same package as the main class. This prevents things like not shipping
the beaninfo when not needed and it prevents overriding as you would
like to do.
Edward wrote:
> I found out what the problem was but I still am not able to solve it.
>
> I have two jar files, file1.jar (contains abc.class and abcBeanInfo.class)
> and file2.jar (contains only abcBeanInfo.class, this file is different than
> the abcBeanInfo.class in file1.jar). VE always use the abcBeanInfo file in
> file1.jar even though I have edited my plugin.xml to set the beaninfo path
> to the abcBeanInfo file in file2.jar. If I delete the abcBeanInfo.class
> from file1.jar, then VE will go look at the abcBeanInfo.class from
> file2.jar. The problem here is that I don't have authorization to delete
> files in file1.jar. What can I do to set VE to look for the abcBeanInfo
> file in file2.jar when the a file with the same name existed in file1.jar?
>
> Thanks
>
> Edward
>
>
>
> "Rich Kulp" <richkulp@us.NO_SPAM.ibm.com> wrote in message
> news:esnju6$2ke$1@utils.eclipse.org...
>> Is this during development? If it is, then there are problems because the
>> beaninfo jar must exist in the project at development time to work.
>>
>> --
>> Thanks,
>> Rich Kulp
>
>
--
Thanks,
Rich Kulp
|
|
|
Re: Can't get BeanInfo file to work [message #615104 is a reply to message #136248] |
Tue, 06 March 2007 14:20 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
The beaninfo needs to be inside a package when inside a jar. Classes
from default packages often aren't loadable when in a jar (I don't know
the exact criteria). They need to be in a package. That means you need
to put both classes (the main class and the beaninfo class) in two
different packages and change the extension point to include the search
path to the beaninfo package.
--
Thanks,
Rich Kulp
|
|
|
|
Re: Can't get BeanInfo file to work [message #615109 is a reply to message #136256] |
Thu, 08 March 2007 00:04 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
Is this during development? If it is, then there are problems because
the beaninfo jar must exist in the project at development time to work.
--
Thanks,
Rich Kulp
|
|
|
|
Re: Can't get BeanInfo file to work [message #615118 is a reply to message #136365] |
Tue, 13 March 2007 19:39 |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
Hi,
That is not a limitation of VE, it is a limitation of the Java Beaninfo
specs themselves. The spec says that it will FIRST look for a class
abcBeanInfo in the same package before it starts looking in the search path.
We've always felt this was a mistake. But the specs can't be changed, it
uses the actual Introspector from Java and can't be overrode. :-(
In fact we always felt it was a mistake to ever include beaninfo in the
same package as the main class. This prevents things like not shipping
the beaninfo when not needed and it prevents overriding as you would
like to do.
Edward wrote:
> I found out what the problem was but I still am not able to solve it.
>
> I have two jar files, file1.jar (contains abc.class and abcBeanInfo.class)
> and file2.jar (contains only abcBeanInfo.class, this file is different than
> the abcBeanInfo.class in file1.jar). VE always use the abcBeanInfo file in
> file1.jar even though I have edited my plugin.xml to set the beaninfo path
> to the abcBeanInfo file in file2.jar. If I delete the abcBeanInfo.class
> from file1.jar, then VE will go look at the abcBeanInfo.class from
> file2.jar. The problem here is that I don't have authorization to delete
> files in file1.jar. What can I do to set VE to look for the abcBeanInfo
> file in file2.jar when the a file with the same name existed in file1.jar?
>
> Thanks
>
> Edward
>
>
>
> "Rich Kulp" <richkulp@us.NO_SPAM.ibm.com> wrote in message
> news:esnju6$2ke$1@utils.eclipse.org...
>> Is this during development? If it is, then there are problems because the
>> beaninfo jar must exist in the project at development time to work.
>>
>> --
>> Thanks,
>> Rich Kulp
>
>
--
Thanks,
Rich Kulp
|
|
|
Powered by
FUDForum. Page generated in 0.07119 seconds