| Home » Eclipse Projects » Eclipse 4 » XWT and GUI related classes in a third-party jar
 Goto Forum:| 
| XWT and GUI related classes in a third-party jar [message #1103] | Sat, 25 July 2009 08:37  |  | 
| Eclipse User  |  |  |  |  | I have a third party OSGi enabled jar. It exports a layout class. Its a modified MigLayout jar.
 
 I was creating a XWT declarative GUI. After defining the namespace and
 adding the layout to my composite, I am unable to get the MigLayout
 class to be found by the XWT engine and I keep getting a class not found
 error. Most of the demos use classes defined in the same jar as the .xwt
 file itself, but MigLayout is another jar altogether, the XWT bundle
 cannot find the layout class. Any ideas on resolving this? Or do I have
 something else potentially wrong? It looks like a standard class loading
 problem but its not clear how to resolve it using the usual tricks (no
 eclipse-buddy mechanism can be added to xwt and I cannot declare
 everything in an application to be a fragment). Also, the XWT visual
 editor does not use the layout dynamically (I have added the mig jar so
 it is found by my application plugin of course).
 |  |  |  |  |  |  |  |  | 
| Re: XWT and GUI related classes in a third-party jar [message #480611 is a reply to message #479894] | Mon, 17 August 2009 17:31   |  | 
| Eclipse User  |  |  |  |  | I did do this in terms of the xmlns cls-namespace specification. However, when using the XWT visual gui, there is no way to inform it
 about which classloader to use for that stringized version of the class
 specification. I'll play with it more, perhaps I had an error somewhere,
 however, I am concerned that underneath, the XWT editor does not pull in
 the right class loader to load the class in the 3rd party jar so it
 can't use it during visual design. I think the examples all work because
 the additional element (such as MyGridLayout) is in the plugin that
 defines the ui element to begin with. But MigLayout is another plugin
 that is not the UI plugin that I am creating.
 
 
 Yves YANG wrote:
 > You can find an example here:
 >  http://wiki.eclipse.org/E4/XWT#Extensibility_and_Re-usabilit y
 > <Composite xmlns="http://www.eclipse.org/xwt/presentation"
 >     xmlns:x="http://www.eclipse.org/xwt"
 >     xmlns:y="cls-namespace:ui">
 >     <Composite.layout>
 >         <y:MyGridLayout numColumns="2"/>
 >     </Composite.layout>
 >     <Label text="Hello, world"/>
 >     <Text x:style="BORDER">
 >         <Text.layoutData>
 >            <GridData horizontalAlignment="FILL"
 >                grabExcessHorizontalSpace="true"/>
 >         </Text.layoutData>
 >     </Text>
 > </Composite>You need to:    1. define a namespace corresponds to your java
 > package, which contains your MigLayout.    2. Use your Layout with the
 > created namespace's prefix.If you still have the problem of class loading,
 > it is the problem of class loader.Best regardsYves YANG --
 > http://www.soyatec.com"aappddeevv" <aappddeevv@verizon.net> wrote in message
 > news:h4euac$pe$1@build.eclipse.org...>I have a third party OSGi enabled jar.
 > It exports a layout class. Its a
 >> modified MigLayout jar.
 >>
 >> I was creating a XWT declarative GUI. After defining the namespace and
 >> adding the layout to my composite, I am unable to get the MigLayout class
 >> to be found by the XWT engine and I keep getting a class not found error.
 >> Most of the demos use classes defined in the same jar as the .xwt file
 >> itself, but MigLayout is another jar altogether, the XWT bundle cannot
 >> find the layout class. Any ideas on resolving this? Or do I have something
 >> else potentially wrong? It looks like a standard class loading problem but
 >> its not clear how to resolve it using the usual tricks (no eclipse-buddy
 >> mechanism can be added to xwt and I cannot declare everything in an
 >> application to be a fragment). Also, the XWT visual editor does not use
 >> the layout dynamically (I have added the mig jar so it is found by my
 >> application plugin of course).
 >
 >
 |  |  |  |  | 
| Re: XWT and GUI related classes in a third-party jar [message #480919 is a reply to message #480611] | Tue, 18 August 2009 18:37  |  | 
| Eclipse User  |  |  |  |  | XWT editor has already setup a class loader. It should work if the thrid part jar is referenced by the project that contains the XWT file.
 
 Regards
 yves
 "aappddeevv" <aappddeevv@verizon.net> wrote in message
 news:h6ci7l$7jp$1@build.eclipse.org...
 >I did do this in terms of the xmlns cls-namespace specification. However,
 >when using the XWT visual gui, there is no way to inform it about which
 >classloader to use for that stringized version of the class specification.
 >I'll play with it more, perhaps I had an error somewhere, however, I am
 >concerned that underneath, the XWT editor does not pull in the right class
 >loader to load the class in the 3rd party jar so it can't use it during
 >visual design. I think the examples all work because the additional element
 >(such as MyGridLayout) is in the plugin that defines the ui element to
 >begin with. But MigLayout is another plugin that is not the UI plugin that
 >I am creating.
 >
 >
 > Yves YANG wrote:
 >> You can find an example here:
 >>  http://wiki.eclipse.org/E4/XWT#Extensibility_and_Re-usabilit y
 >> <Composite xmlns="http://www.eclipse.org/xwt/presentation"
 >>     xmlns:x="http://www.eclipse.org/xwt"
 >>     xmlns:y="cls-namespace:ui">
 >>     <Composite.layout>
 >>         <y:MyGridLayout numColumns="2"/>
 >>     </Composite.layout>
 >>     <Label text="Hello, world"/>
 >>     <Text x:style="BORDER">
 >>         <Text.layoutData>
 >>            <GridData horizontalAlignment="FILL"
 >>                grabExcessHorizontalSpace="true"/>
 >>         </Text.layoutData>
 >>     </Text>
 >> </Composite>You need to:    1. define a namespace corresponds to your
 >> java package, which contains your MigLayout.    2. Use your Layout with
 >> the created namespace's prefix.If you still have the problem of class
 >> loading, it is the problem of class loader.Best regardsYves YANG --
 >> http://www.soyatec.com"aappddeevv" <aappddeevv@verizon.net> wrote in
 >> message news:h4euac$pe$1@build.eclipse.org...>I have a third party OSGi
 >> enabled jar. It exports a layout class. Its a
 >>> modified MigLayout jar.
 >>>
 >>> I was creating a XWT declarative GUI. After defining the namespace and
 >>> adding the layout to my composite, I am unable to get the MigLayout
 >>> class to be found by the XWT engine and I keep getting a class not found
 >>> error. Most of the demos use classes defined in the same jar as the .xwt
 >>> file itself, but MigLayout is another jar altogether, the XWT bundle
 >>> cannot find the layout class. Any ideas on resolving this? Or do I have
 >>> something else potentially wrong? It looks like a standard class loading
 >>> problem but its not clear how to resolve it using the usual tricks (no
 >>> eclipse-buddy mechanism can be added to xwt and I cannot declare
 >>> everything in an application to be a fragment). Also, the XWT visual
 >>> editor does not use the layout dynamically (I have added the mig jar so
 >>> it is found by my application plugin of course).
 >>
 |  |  |  |  | 
| Re: XWT and GUI related classes in a third-party jar [message #562333 is a reply to message #1103] | Wed, 12 August 2009 18:50  |  | 
| Eclipse User  |  |  |  |  | You can find an example here: http://wiki.eclipse.org/E4/XWT#Extensibility_and_Re-usabilit y
 <Composite xmlns="http://www.eclipse.org/xwt/presentation"
 xmlns:x="http://www.eclipse.org/xwt"
 xmlns:y="cls-namespace:ui">
 <Composite.layout>
 <y:MyGridLayout numColumns="2"/>
 </Composite.layout>
 <Label text="Hello, world"/>
 <Text x:style="BORDER">
 <Text.layoutData>
 <GridData horizontalAlignment="FILL"
 grabExcessHorizontalSpace="true"/>
 </Text.layoutData>
 </Text>
 </Composite>You need to:    1. define a namespace corresponds to your java
 package, which contains your MigLayout.    2. Use your Layout with the
 created namespace's prefix.If you still have the problem of class loading,
 it is the problem of class loader.Best regardsYves YANG --
 http://www.soyatec.com"aappddeevv" <aappddeevv@verizon.net> wrote in message
 news:h4euac$pe$1@build.eclipse.org...>I have a third party OSGi enabled jar.
 It exports a layout class. Its a
 > modified MigLayout jar.
 >
 > I was creating a XWT declarative GUI. After defining the namespace and
 > adding the layout to my composite, I am unable to get the MigLayout class
 > to be found by the XWT engine and I keep getting a class not found error.
 > Most of the demos use classes defined in the same jar as the .xwt file
 > itself, but MigLayout is another jar altogether, the XWT bundle cannot
 > find the layout class. Any ideas on resolving this? Or do I have something
 > else potentially wrong? It looks like a standard class loading problem but
 > its not clear how to resolve it using the usual tricks (no eclipse-buddy
 > mechanism can be added to xwt and I cannot declare everything in an
 > application to be a fragment). Also, the XWT visual editor does not use
 > the layout dynamically (I have added the mig jar so it is found by my
 > application plugin of course).
 |  |  |  |  | 
| Re: XWT and GUI related classes in a third-party jar [message #562382 is a reply to message #1103] | Wed, 12 August 2009 19:23  |  | 
| Eclipse User  |  |  |  |  | To resolve the class loader, use the following code: ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
 try {
 Thread.currentThread().setContextClassLoader(Activator.class .getClassLoader());
 root = XWT.load(url, dataContext);
 } finally {
 Thread.currentThread().setContextClassLoader(classLoader);
 }
 
 Activator chould be a class which is in the name bundle as MigLayout.
 
 yves
 "aappddeevv" <aappddeevv@verizon.net> wrote in message
 news:h4euac$pe$1@build.eclipse.org...
 >I have a third party OSGi enabled jar. It exports a layout class. Its a
 >modified MigLayout jar.
 >
 > I was creating a XWT declarative GUI. After defining the namespace and
 > adding the layout to my composite, I am unable to get the MigLayout class
 > to be found by the XWT engine and I keep getting a class not found error.
 > Most of the demos use classes defined in the same jar as the .xwt file
 > itself, but MigLayout is another jar altogether, the XWT bundle cannot
 > find the layout class. Any ideas on resolving this? Or do I have something
 > else potentially wrong? It looks like a standard class loading problem but
 > its not clear how to resolve it using the usual tricks (no eclipse-buddy
 > mechanism can be added to xwt and I cannot declare everything in an
 > application to be a fragment). Also, the XWT visual editor does not use
 > the layout dynamically (I have added the mig jar so it is found by my
 > application plugin of course).
 |  |  |  |  | 
| Re: XWT and GUI related classes in a third-party jar [message #562407 is a reply to message #479894] | Mon, 17 August 2009 17:31  |  | 
| Eclipse User  |  |  |  |  | I did do this in terms of the xmlns cls-namespace specification. However, when using the XWT visual gui, there is no way to inform it
 about which classloader to use for that stringized version of the class
 specification. I'll play with it more, perhaps I had an error somewhere,
 however, I am concerned that underneath, the XWT editor does not pull in
 the right class loader to load the class in the 3rd party jar so it
 can't use it during visual design. I think the examples all work because
 the additional element (such as MyGridLayout) is in the plugin that
 defines the ui element to begin with. But MigLayout is another plugin
 that is not the UI plugin that I am creating.
 
 
 Yves YANG wrote:
 > You can find an example here:
 >  http://wiki.eclipse.org/E4/XWT#Extensibility_and_Re-usabilit y
 > <Composite xmlns="http://www.eclipse.org/xwt/presentation"
 >     xmlns:x="http://www.eclipse.org/xwt"
 >     xmlns:y="cls-namespace:ui">
 >     <Composite.layout>
 >         <y:MyGridLayout numColumns="2"/>
 >     </Composite.layout>
 >     <Label text="Hello, world"/>
 >     <Text x:style="BORDER">
 >         <Text.layoutData>
 >            <GridData horizontalAlignment="FILL"
 >                grabExcessHorizontalSpace="true"/>
 >         </Text.layoutData>
 >     </Text>
 > </Composite>You need to:    1. define a namespace corresponds to your java
 > package, which contains your MigLayout.    2. Use your Layout with the
 > created namespace's prefix.If you still have the problem of class loading,
 > it is the problem of class loader.Best regardsYves YANG --
 > http://www.soyatec.com"aappddeevv" <aappddeevv@verizon.net> wrote in message
 > news:h4euac$pe$1@build.eclipse.org...>I have a third party OSGi enabled jar.
 > It exports a layout class. Its a
 >> modified MigLayout jar.
 >>
 >> I was creating a XWT declarative GUI. After defining the namespace and
 >> adding the layout to my composite, I am unable to get the MigLayout class
 >> to be found by the XWT engine and I keep getting a class not found error.
 >> Most of the demos use classes defined in the same jar as the .xwt file
 >> itself, but MigLayout is another jar altogether, the XWT bundle cannot
 >> find the layout class. Any ideas on resolving this? Or do I have something
 >> else potentially wrong? It looks like a standard class loading problem but
 >> its not clear how to resolve it using the usual tricks (no eclipse-buddy
 >> mechanism can be added to xwt and I cannot declare everything in an
 >> application to be a fragment). Also, the XWT visual editor does not use
 >> the layout dynamically (I have added the mig jar so it is found by my
 >> application plugin of course).
 >
 >
 |  |  |  |  | 
| Re: XWT and GUI related classes in a third-party jar [message #562513 is a reply to message #480611] | Tue, 18 August 2009 18:37  |  | 
| Eclipse User  |  |  |  |  | XWT editor has already setup a class loader. It should work if the thrid part jar is referenced by the project that contains the XWT file.
 
 Regards
 yves
 "aappddeevv" <aappddeevv@verizon.net> wrote in message
 news:h6ci7l$7jp$1@build.eclipse.org...
 >I did do this in terms of the xmlns cls-namespace specification. However,
 >when using the XWT visual gui, there is no way to inform it about which
 >classloader to use for that stringized version of the class specification.
 >I'll play with it more, perhaps I had an error somewhere, however, I am
 >concerned that underneath, the XWT editor does not pull in the right class
 >loader to load the class in the 3rd party jar so it can't use it during
 >visual design. I think the examples all work because the additional element
 >(such as MyGridLayout) is in the plugin that defines the ui element to
 >begin with. But MigLayout is another plugin that is not the UI plugin that
 >I am creating.
 >
 >
 > Yves YANG wrote:
 >> You can find an example here:
 >>  http://wiki.eclipse.org/E4/XWT#Extensibility_and_Re-usabilit y
 >> <Composite xmlns="http://www.eclipse.org/xwt/presentation"
 >>     xmlns:x="http://www.eclipse.org/xwt"
 >>     xmlns:y="cls-namespace:ui">
 >>     <Composite.layout>
 >>         <y:MyGridLayout numColumns="2"/>
 >>     </Composite.layout>
 >>     <Label text="Hello, world"/>
 >>     <Text x:style="BORDER">
 >>         <Text.layoutData>
 >>            <GridData horizontalAlignment="FILL"
 >>                grabExcessHorizontalSpace="true"/>
 >>         </Text.layoutData>
 >>     </Text>
 >> </Composite>You need to:    1. define a namespace corresponds to your
 >> java package, which contains your MigLayout.    2. Use your Layout with
 >> the created namespace's prefix.If you still have the problem of class
 >> loading, it is the problem of class loader.Best regardsYves YANG --
 >> http://www.soyatec.com"aappddeevv" <aappddeevv@verizon.net> wrote in
 >> message news:h4euac$pe$1@build.eclipse.org...>I have a third party OSGi
 >> enabled jar. It exports a layout class. Its a
 >>> modified MigLayout jar.
 >>>
 >>> I was creating a XWT declarative GUI. After defining the namespace and
 >>> adding the layout to my composite, I am unable to get the MigLayout
 >>> class to be found by the XWT engine and I keep getting a class not found
 >>> error. Most of the demos use classes defined in the same jar as the .xwt
 >>> file itself, but MigLayout is another jar altogether, the XWT bundle
 >>> cannot find the layout class. Any ideas on resolving this? Or do I have
 >>> something else potentially wrong? It looks like a standard class loading
 >>> problem but its not clear how to resolve it using the usual tricks (no
 >>> eclipse-buddy mechanism can be added to xwt and I cannot declare
 >>> everything in an application to be a fragment). Also, the XWT visual
 >>> editor does not use the layout dynamically (I have added the mig jar so
 >>> it is found by my application plugin of course).
 >>
 |  |  |  | 
 
 
 Current Time: Fri Oct 31 01:12:00 EDT 2025 
 Powered by FUDForum . Page generated in 0.04842 seconds |