Node custom image not working [message #100570] |
Fri, 02 February 2007 13:53 |
Eclipse User |
|
|
|
Originally posted by: paolo.bisiach.equadro.com
Hi, I am in trouble trying to associate an image to a node. After reading
ohter msgs and a bunch of trials I wrote in ComponentEditPart (Eclipse
3.3.0, GMF2.0):
protected IFigure createNodeShape() {
URL url = null;
Bundle bundle = Platform.getBundle("MyFirstProject.diagram");
try {
url = Platform.resolve( bundle.getEntry("/icons/nodes/hyst_limit.jpg") );
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
System.out.print("url = " + url.toString());
return primaryShape = new
ScalableImageFigure(RenderedImageFactory.getInstance(url), true, true,
true);
}
url is correct (if I paste it in Explorer I see my image), but when I add a
component nothing happens, except a strange 3-4 seconds pause
Any ideas ?
Regards,
Paolo
|
|
|
Re: Node custom image not working [message #103175 is a reply to message #100570] |
Mon, 12 February 2007 18:40 |
Eclipse User |
|
|
|
Originally posted by: jan.herriger.gmx.de
Hi all,
I have another problem regarding ScalableImageFigure.
I'm using ScalableImageFigures for EditParts and decorators. Sometimes,
while loading the editor, a SWTException is thrown and some or all
images are missing. "Sometimes" means: i can´t reproduce this behavior.
Did anybody see this behavior before?
Best regards
Jan
The stack trace is as follows:
!ENTRY org.eclipse.gmf.runtime.draw2d.ui.render.awt 4 4 2007-02-12
14:51:09.950
!MESSAGE org.eclipse.swt.SWTException: Invalid thread access
!STACK 0
org.eclipse.swt.SWTException: Invalid thread access
at org.eclipse.swt.SWT.error(SWT.java:3450)
at org.eclipse.swt.SWT.error(SWT.java:3373)
at org.eclipse.swt.SWT.error(SWT.java:3344)
at org.eclipse.swt.widgets.Widget.error(Widget.java:433)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:274)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:265)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:218)
at org.eclipse.swt.widgets.Shell.<init>(Shell.java:156)
at
org.eclipse.gmf.runtime.draw2d.ui.internal.graphics.GCUtilit ies.supportsAdvancedGraphics(GCUtilities.java:33)
at
org.eclipse.gmf.runtime.draw2d.ui.render.awt.internal.svg.SV GImage.renderImage(SVGImage.java:66)
at
org.eclipse.gmf.runtime.draw2d.ui.render.internal.AbstractRe nderedImage.getSWTImage(AbstractRenderedImage.java:130)
at
org.eclipse.gmf.runtime.draw2d.ui.render.internal.RenderHelp er$1.run(RenderHelper.java:103)
at java.lang.Thread.run(Unknown Source)
Paolo schrieb:
> Hi, I am in trouble trying to associate an image to a node. After reading
> ohter msgs and a bunch of trials I wrote in ComponentEditPart (Eclipse
> 3.3.0, GMF2.0):
>
>
> protected IFigure createNodeShape() {
>
> URL url = null;
>
>
> Bundle bundle = Platform.getBundle("MyFirstProject.diagram");
>
> try {
>
> url = Platform.resolve( bundle.getEntry("/icons/nodes/hyst_limit.jpg") );
>
> } catch (IOException e) {
>
> // TODO Auto-generated catch block
>
> e.printStackTrace();
>
> }
>
>
> System.out.print("url = " + url.toString());
>
> return primaryShape = new
> ScalableImageFigure(RenderedImageFactory.getInstance(url), true, true,
> true);
>
> }
>
> url is correct (if I paste it in Explorer I see my image), but when I add a
> component nothing happens, except a strange 3-4 seconds pause
> Any ideas ?
>
> Regards,
> Paolo
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04184 seconds