Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » VE doesn't like: new Display() - new Shell(Display)
VE doesn't like: new Display() - new Shell(Display) [message #118996] Mon, 27 February 2006 12:02 Go to next message
Eclipse UserFriend
Originally posted by: ras_nas.yahoo.com

Hello Everyone,

My most important question is: how do I package a bean into a jar to
run as a stand-alone program when the Visual Class generated doesn't
have a main() and adding one manually seems to make it unable to be run
on Eclipse? Is the createSShell() method generated recognized as a main()
entry point equivalent somehow?

I'm no seasoned developer in the GUI world, so please bear with me
here because I couldn't find much about this in the FAQ.

When in Eclipse I clicked my way through from New->Visual Class,
the skeleton class generated with a createSShell() didn't include the
following:

Display display = new Display();
Shell sShell = new Shell(display);
...
...
...
...
sShell.open();
while (!sShell.isDisposed())
{
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();


If I add the new Shell(display);
Visual Editor announces NullPointerException on trying to display
the window; and if I use the loop block, upon closing the window VE
has this to say:
============================================================ ================
=========
IWAV0056I Java Bean com.socius.invensys.EmailSenderUI started with the
createSShell method
Exception in thread "main" org.eclipse.swt.SWTException: Widget is disposed
at org.eclipse.swt.SWT.error(SWT.java:2942)
at org.eclipse.swt.widgets.Widget.error(Widget.java:395)
at org.eclipse.swt.widgets.Widget.getDisplay(Widget.java:505)
at
org.eclipse.ve.internal.java.vce.launcher.remotevm.SWTLaunch er.runEventLoop(
SWTLauncher.java:486)
at
org.eclipse.ve.internal.java.vce.launcher.remotevm.SWTLaunch er.runShell(SWTL
auncher.java:469)
at
org.eclipse.ve.internal.java.vce.launcher.remotevm.SWTLaunch er.launch(SWTLau
ncher.java:181)
at
org.eclipse.ve.internal.java.vce.launcher.remotevm.JavaBeans Launcher.main(Ja
vaBeansLauncher.java:77)
============================================================ ================
=========

I thought the above construct was a strength of SWT for not hiding the event
loop from me?
Why do such errors occur on VE? What about the skeleton generated using only
"new Shell()"
instead of "new Shell(Display)", in the latter case throwing NPE w/o a stack
trace?

Rico.
Re: VE doesn't like: new Display() - new Shell(Display) [message #119034 is a reply to message #118996] Mon, 27 February 2006 15:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Please attach the entire file. That way we can see what the interactions
are.
--
Thanks,
Rich Kulp
Re: VE doesn't like: new Display() - new Shell(Display) [message #119071 is a reply to message #118996] Mon, 27 February 2006 17:00 Go to previous messageGo to next message
Jeff Myers is currently offline Jeff MyersFriend
Messages: 489
Registered: July 2009
Senior Member
If you check the create public static void main() option in the New
Visual Class wizard, you'll get a main method generated that supports
running your new visual class.

- Jeff
Re: VE doesn't like: new Display() - new Shell(Display) [message #119179 is a reply to message #119071] Tue, 28 February 2006 07:28 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ras_nas.yahoo.com

"Jeff Myers" <jeff.myers@eclipse.org> wrote in message
news:dtvb9j$sp1$1@utils.eclipse.org...
> If you check the create public static void main() option in the New
> Visual Class wizard, you'll get a main method generated that supports
> running your new visual class.
>
> - Jeff

All right. That's cool. Thanks Jeff.
Now.. Things seem to be working fine within Eclipse.
But I need to deploy the application..
So far I've used David Weiss's convenient Invoker.jar to
take care of whatever classpath and jars required.

For SWT.. is it just a matter of dropping the
org.eclipse.swt.win32.win32.x86_3.1.1.jar in the same folder as
the jar for my application?

Doesn't look like it.. What's this thing about -Djava.library.path=C:\SWT ?
Is that referring to some time when the swt dll's were not part
of the jar that seems to be all Eclipse needs to include for things to
work: org.eclipse.swt.win32.win32.x86_3.1.1.jar ?
Or do I need to do something more than placing the latter jar on
the classpath for SWT to work?

Thanks.

Rico.
Re: VE doesn't like: new Display() - new Shell(Display) [message #119191 is a reply to message #119071] Tue, 28 February 2006 07:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: ras_nas.yahoo.com

"Jeff Myers" <jeff.myers@eclipse.org> wrote in message
news:dtvb9j$sp1$1@utils.eclipse.org...
> If you check the create public static void main() option in the New
> Visual Class wizard, you'll get a main method generated that supports
> running your new visual class.
>
> - Jeff

All right. That's cool. Thanks Jeff.
Now.. Things seem to be working fine within Eclipse.
But I need to deploy the application..
So far I've used David Weiss's convenient Invoker.jar to
take care of whatever classpath and jars required.

For SWT.. is it just a matter of dropping the
org.eclipse.swt.win32.win32.x86_3.1.1.jar in the same folder as
the jar for my application?

Doesn't look like it.. What's this thing about -Djava.library.path=<some
path to dlls> ?
Is that referring to some time when the swt dll's were not part
of the jar that seems to be all Eclipse needs to include for things to
work: org.eclipse.swt.win32.win32.x86_3.1.1.jar ?
Or do I need to do something more than placing the latter jar on
the classpath for SWT to work?
I've tried copying org.eclipse.swt_3.1.0.jar in as well.. no good.

Thanks.

Rico.
Re: VE doesn't like: new Display() - new Shell(Display) [message #119265 is a reply to message #119191] Tue, 28 February 2006 15:34 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Yes, Eclipse has changed how SWT is deployed since then. See the
download page for the Eclipse 3.2M5 download and scroll down to the SWT
Binary and Source section. It has a paragraph there on how to deploy an
SWT app.

Rico wrote:
> "Jeff Myers" <jeff.myers@eclipse.org> wrote in message
> news:dtvb9j$sp1$1@utils.eclipse.org...
>
>>If you check the create public static void main() option in the New
>>Visual Class wizard, you'll get a main method generated that supports
>>running your new visual class.
>>
>> - Jeff
>
>
> All right. That's cool. Thanks Jeff.
> Now.. Things seem to be working fine within Eclipse.
> But I need to deploy the application..
> So far I've used David Weiss's convenient Invoker.jar to
> take care of whatever classpath and jars required.
>
> For SWT.. is it just a matter of dropping the
> org.eclipse.swt.win32.win32.x86_3.1.1.jar in the same folder as
> the jar for my application?
>
> Doesn't look like it.. What's this thing about -Djava.library.path=<some
> path to dlls> ?
> Is that referring to some time when the swt dll's were not part
> of the jar that seems to be all Eclipse needs to include for things to
> work: org.eclipse.swt.win32.win32.x86_3.1.1.jar ?
> Or do I need to do something more than placing the latter jar on
> the classpath for SWT to work?
> I've tried copying org.eclipse.swt_3.1.0.jar in as well.. no good.
>
> Thanks.
>
> Rico.
>
>
>

--
Thanks,
Rich Kulp
Re: VE doesn't like: new Display() - new Shell(Display) [message #119456 is a reply to message #119265] Wed, 01 March 2006 03:22 Go to previous message
Eclipse UserFriend
Originally posted by: ras_nas.yahoo.com

"Rich Kulp" <richkulp@us.NO_SPAM.ibm.com> wrote in message
news:du1qhe$vmj$3@utils.eclipse.org...
> Yes, Eclipse has changed how SWT is deployed since then. See the
> download page for the Eclipse 3.2M5 download and scroll down to the SWT
> Binary and Source section. It has a paragraph there on how to deploy an
> SWT app.

Okay. I've used the method described there and finally it's working.
There was a comment in the auto-generated main() of the visual class:

/*
* Before this is run, be sure to set up the launch configuration
* (Arguments->VM Arguments) for the correct SWT library path in order
* to run with the SWT dlls. The dlls are located in the SWT plugin jar.
* For example, on Windows the Eclipse SWT 3.1 plugin jar is:
* installation_directory\plugins\org.eclipse.swt.win32_3.1.0.j ar
*/

To run from Eclipse, I didn't really need the above.. but.. Eclipse seems
to be able to access the dll's from the SWT plugin jar. How does it do this
if having that jar on the classpath is not all it takes?
where do I get to know more about things like java.library.path and how to
identify cases where I am supposed to call onto them?

Rico.

> Rico wrote:
> > For SWT.. is it just a matter of dropping the
> > org.eclipse.swt.win32.win32.x86_3.1.1.jar in the same folder as
> > the jar for my application?
> >
> > Doesn't look like it.. What's this thing about -Djava.library.path=<some
> > path to dlls> ?
> > Is that referring to some time when the swt dll's were not part
> > of the jar that seems to be all Eclipse needs to include for things to
> > work: org.eclipse.swt.win32.win32.x86_3.1.1.jar ?
> > Or do I need to do something more than placing the latter jar on
> > the classpath for SWT to work?
> > I've tried copying org.eclipse.swt_3.1.0.jar in as well.. no good.
> >
> > Thanks.
> >
> > Rico.
> >
> >
> >
>
> --
> Thanks,
> Rich Kulp
Re: VE doesn't like: new Display() - new Shell(Display) [message #612189 is a reply to message #118996] Mon, 27 February 2006 15:03 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Please attach the entire file. That way we can see what the interactions
are.
--
Thanks,
Rich Kulp
Re: VE doesn't like: new Display() - new Shell(Display) [message #612192 is a reply to message #118996] Mon, 27 February 2006 17:00 Go to previous message
Jeff Myers is currently offline Jeff MyersFriend
Messages: 489
Registered: July 2009
Senior Member
If you check the create public static void main() option in the New
Visual Class wizard, you'll get a main method generated that supports
running your new visual class.

- Jeff
Re: VE doesn't like: new Display() - new Shell(Display) [message #612201 is a reply to message #119071] Tue, 28 February 2006 07:28 Go to previous message
Rico is currently offline RicoFriend
Messages: 4
Registered: July 2009
Junior Member
"Jeff Myers" <jeff.myers@eclipse.org> wrote in message
news:dtvb9j$sp1$1@utils.eclipse.org...
> If you check the create public static void main() option in the New
> Visual Class wizard, you'll get a main method generated that supports
> running your new visual class.
>
> - Jeff

All right. That's cool. Thanks Jeff.
Now.. Things seem to be working fine within Eclipse.
But I need to deploy the application..
So far I've used David Weiss's convenient Invoker.jar to
take care of whatever classpath and jars required.

For SWT.. is it just a matter of dropping the
org.eclipse.swt.win32.win32.x86_3.1.1.jar in the same folder as
the jar for my application?

Doesn't look like it.. What's this thing about -Djava.library.path=C:\SWT ?
Is that referring to some time when the swt dll's were not part
of the jar that seems to be all Eclipse needs to include for things to
work: org.eclipse.swt.win32.win32.x86_3.1.1.jar ?
Or do I need to do something more than placing the latter jar on
the classpath for SWT to work?

Thanks.

Rico.
Re: VE doesn't like: new Display() - new Shell(Display) [message #612202 is a reply to message #119071] Tue, 28 February 2006 07:42 Go to previous message
Rico is currently offline RicoFriend
Messages: 4
Registered: July 2009
Junior Member
"Jeff Myers" <jeff.myers@eclipse.org> wrote in message
news:dtvb9j$sp1$1@utils.eclipse.org...
> If you check the create public static void main() option in the New
> Visual Class wizard, you'll get a main method generated that supports
> running your new visual class.
>
> - Jeff

All right. That's cool. Thanks Jeff.
Now.. Things seem to be working fine within Eclipse.
But I need to deploy the application..
So far I've used David Weiss's convenient Invoker.jar to
take care of whatever classpath and jars required.

For SWT.. is it just a matter of dropping the
org.eclipse.swt.win32.win32.x86_3.1.1.jar in the same folder as
the jar for my application?

Doesn't look like it.. What's this thing about -Djava.library.path=<some
path to dlls> ?
Is that referring to some time when the swt dll's were not part
of the jar that seems to be all Eclipse needs to include for things to
work: org.eclipse.swt.win32.win32.x86_3.1.1.jar ?
Or do I need to do something more than placing the latter jar on
the classpath for SWT to work?
I've tried copying org.eclipse.swt_3.1.0.jar in as well.. no good.

Thanks.

Rico.
Re: VE doesn't like: new Display() - new Shell(Display) [message #612208 is a reply to message #119191] Tue, 28 February 2006 15:34 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Yes, Eclipse has changed how SWT is deployed since then. See the
download page for the Eclipse 3.2M5 download and scroll down to the SWT
Binary and Source section. It has a paragraph there on how to deploy an
SWT app.

Rico wrote:
> "Jeff Myers" <jeff.myers@eclipse.org> wrote in message
> news:dtvb9j$sp1$1@utils.eclipse.org...
>
>>If you check the create public static void main() option in the New
>>Visual Class wizard, you'll get a main method generated that supports
>>running your new visual class.
>>
>> - Jeff
>
>
> All right. That's cool. Thanks Jeff.
> Now.. Things seem to be working fine within Eclipse.
> But I need to deploy the application..
> So far I've used David Weiss's convenient Invoker.jar to
> take care of whatever classpath and jars required.
>
> For SWT.. is it just a matter of dropping the
> org.eclipse.swt.win32.win32.x86_3.1.1.jar in the same folder as
> the jar for my application?
>
> Doesn't look like it.. What's this thing about -Djava.library.path=<some
> path to dlls> ?
> Is that referring to some time when the swt dll's were not part
> of the jar that seems to be all Eclipse needs to include for things to
> work: org.eclipse.swt.win32.win32.x86_3.1.1.jar ?
> Or do I need to do something more than placing the latter jar on
> the classpath for SWT to work?
> I've tried copying org.eclipse.swt_3.1.0.jar in as well.. no good.
>
> Thanks.
>
> Rico.
>
>
>

--
Thanks,
Rich Kulp
Re: VE doesn't like: new Display() - new Shell(Display) [message #612223 is a reply to message #119265] Wed, 01 March 2006 03:22 Go to previous message
Rico is currently offline RicoFriend
Messages: 4
Registered: July 2009
Junior Member
"Rich Kulp" <richkulp@us.NO_SPAM.ibm.com> wrote in message
news:du1qhe$vmj$3@utils.eclipse.org...
> Yes, Eclipse has changed how SWT is deployed since then. See the
> download page for the Eclipse 3.2M5 download and scroll down to the SWT
> Binary and Source section. It has a paragraph there on how to deploy an
> SWT app.

Okay. I've used the method described there and finally it's working.
There was a comment in the auto-generated main() of the visual class:

/*
* Before this is run, be sure to set up the launch configuration
* (Arguments->VM Arguments) for the correct SWT library path in order
* to run with the SWT dlls. The dlls are located in the SWT plugin jar.
* For example, on Windows the Eclipse SWT 3.1 plugin jar is:
* installation_directory\plugins\org.eclipse.swt.win32_3.1.0.j ar
*/

To run from Eclipse, I didn't really need the above.. but.. Eclipse seems
to be able to access the dll's from the SWT plugin jar. How does it do this
if having that jar on the classpath is not all it takes?
where do I get to know more about things like java.library.path and how to
identify cases where I am supposed to call onto them?

Rico.

> Rico wrote:
> > For SWT.. is it just a matter of dropping the
> > org.eclipse.swt.win32.win32.x86_3.1.1.jar in the same folder as
> > the jar for my application?
> >
> > Doesn't look like it.. What's this thing about -Djava.library.path=<some
> > path to dlls> ?
> > Is that referring to some time when the swt dll's were not part
> > of the jar that seems to be all Eclipse needs to include for things to
> > work: org.eclipse.swt.win32.win32.x86_3.1.1.jar ?
> > Or do I need to do something more than placing the latter jar on
> > the classpath for SWT to work?
> > I've tried copying org.eclipse.swt_3.1.0.jar in as well.. no good.
> >
> > Thanks.
> >
> > Rico.
> >
> >
> >
>
> --
> Thanks,
> Rich Kulp
Previous Topic:VE performace
Next Topic:Does the VE have any relations to the NAB (eWideStudio) ?
Goto Forum:
  


Current Time: Fri Apr 26 19:14:46 GMT 2024

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

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

Back to the top