Probelms using JME in Eclipse RCP application

I am having hard times with JME in my RCP application. While prototype works fine I cannot get JME to render something in the dialog, that is invoked from my RCP application. However everything is fine, if I just reuse this dialog like this:





final Display display = new Display();

Shell shell = new Shell(display);

shell.setLayout(new RowLayout());



final JmeTestDialog d = new JmeTestDialog(shell);



shell.setText(“SWT shapefile renderer prototype”);

shell.setSize(width, height);

shell.layout();

shell.open();



Button b = new Button(shell, 0);

b.setText(“Show dialog”);

b.addSelectionListener(new SelectionListener() {



@Override

public void widgetSelected(SelectionEvent e) {

d.open();

}



@Override

public void widgetDefaultSelected(SelectionEvent e) {

}

});



while (!shell.isDisposed()) {

if (!display.readAndDispatch())

display.sleep();

}

display.dispose();

}





Moreover, it renders correctly if I reuse it from HelloRCP application mockup in Eclipse!



So I think problem is not about how I render it but about how I initialize JME in my RCP.



This dialog renders large point cloud and allows to spin it using mouse.



Any ideas would be appreciated.

Did you check out the jmetest example of how to do this?



http://code.google.com/p/jmonkeyengine/source/browse/trunk/src/jmetest/util/JMESWTTest.java

Sure.



And my dialog (which also uses stuff like ds.registerCanvasConstructor(“SWT”, LWJGLSWTCanvasConstructor.class); ) works in the similar environment. Like I said, it also works from HelloRCP application mockup.



It seems to me it works everywhere except my RCP application :(.

And by the way, I am not getting any exceptions. I am just getting normal output like:

Sep 9, 2010 12:43:32 PM com.jme.scene.Node

INFO: Node created.

Sep 9, 2010 12:43:32 PM com.jme.scene.Node attachChild

INFO: Child “Camera Node” attached to this node “rootNode”

Sep 9, 2010 12:43:32 PM com.jme.scene.Node

INFO: Node created.

Sep 9, 2010 12:43:32 PM com.jme.scene.Point

INFO: Point created.

Sep 9, 2010 12:43:32 PM com.jme.scene.Line



But my dialog is just gray and empty when I open it from my RCP.

Have you tried using a different layout? I sometimes don’t have the best luck with row layouts (though not necessarily in SWT)

Yes I tried both org.eclipse.swt.layout.FillLayout and org.eclipse.swt.layout.GridLayout

But IMHO in the case of incorrect layout setup I would be unable to see anything anywhere, not only at my production RCP app.



And everything works in HelloRCP and in the example above.

Right, if the two applications were exactly the same I would say that the layout wouldn’t matter but since the two clearly aren’t the same then I would say its up for grabs.



Then again, its kind of tough to think of ideas when the only code you’ve posted is what works :wink:

I found an issue %-)



I feed -Xms40m -Xmx1024m params to my jvm at startup, in order to enlarge the available memory.

-Xms40m -Xmx 512m works, but -Xms40m -Xmx1024m - NO.

Which JVM are you using? I remember some time back I was having trouble setting the Xmx above 1000 (999 worked fine), but I frankly forgot about it and haven’t had that problem in a while.


lsa said:I feed -Xms40m -Xmx1024m params to my jvm at startup, in order to enlarge the available memory.
-Xms40m -Xmx 512m works, but -Xms40m -Xmx1024m - NO.


Are you setting this through Eclipse for your RCP app or through Eclipse's ini file? They have two different effects.. (And I think my problem might have actually been when giving Eclipse more memory through the ini)
sbook said:
Which JVM are you using?

java version "1.6.0_18"
sbook said:
Are you setting this through Eclipse for your RCP app or through Eclipse’s ini file?

Through Eclipse.