Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » headless usage of GMF rendering
headless usage of GMF rendering [message #67322] Sat, 21 October 2006 21:45 Go to next message
Eclipse UserFriend
Originally posted by: alexander.schwartzonline.de

Hi,

I know this question might sound a little bit strange:

Assume we are given a model instance file and a corressponding notation
file. Is there a change to produce an image of the given instance
using the GMF API without launching the Eclipse UI?


Regards,


Alex
Re: headless usage of GMF rendering [message #68086 is a reply to message #67322] Mon, 23 October 2006 17:18 Go to previous messageGo to next message
Cherie Revells is currently offline Cherie RevellsFriend
Messages: 299
Registered: July 2009
Senior Member
Alex,

You can produce an image without bringing up an editor within Eclipse if
this is any help.

See OffscreenEditPartFactory and CopyToImageUtil for details.

Regards,
Cherie

Alex Schwartz wrote:
> Hi,
>
> I know this question might sound a little bit strange:
>
> Assume we are given a model instance file and a corressponding notation
> file. Is there a change to produce an image of the given instance
> using the GMF API without launching the Eclipse UI?
>
>
> Regards,
>
>
> Alex
Re: headless usage of GMF rendering [message #71221 is a reply to message #68086] Sat, 28 October 2006 10:46 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: alexander.schwartzonline.de

Hello Cherie,


> You can produce an image without bringing up an editor within Eclipse if
> this is any help.
>
> See OffscreenEditPartFactory and CopyToImageUtil for details.

Thanks for your hint. I found these classes and created a headless RCP
which runs the image conversion.

Unfortunately I run into some problems with the initialization.
Loading the class ImageFileFormat fails with the following exception:

org.osgi.framework.BundleException: Exception in
org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin. start() of
bundle org.eclipse.gmf.runtime.diagram.ui.
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1014)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:970)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:317)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:256)
at
org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter .preFindLocalClass(EclipseLazyStarter.java:86)
at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoc alClass(ClasspathManager.java:409)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.fin dLocalClass(DefaultClassLoader.java:188)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findLo calClass(BundleLoader.java:339)
at
org.eclipse.osgi.framework.internal.core.SingleSourcePackage .loadClass(SingleSourcePackage.java:37)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:388)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:352)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at
de.schwartzonline.gmf.mavendependencies.diagram.MavenDepende nciesDiagramImageExporter. <init>(MavenDependenciesDiagramImageExporter.java:31)
at
de.schwartzonline.gmf.mavendependencies.offscreen.rcp.MavenD ependencyOffscreenRendererApplication.run(MavenDependencyOff screenRendererApplication.java:49)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Caused by: org.eclipse.jface.util.Assert$AssertionFailedException: null
argument;
at org.eclipse.jface.util.Assert.isNotNull(Assert.java:150)
at org.eclipse.jface.util.Assert.isNotNull(Assert.java:126)
at org.eclipse.jface.resource.FontRegistry.<init>(FontRegistry.java:273)
at org.eclipse.jface.resource.FontRegistry.<init>(FontRegistry.java:288)
at
org.eclipse.jface.resource.JFaceResources.getFontRegistry(JF aceResources.java:267)
at
org.eclipse.jface.resource.JFaceResources.getDefaultFont(JFa ceResources.java:220)
at
org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePre ferencePage.setDefaultFontPreference(AppearancePreferencePag e.java:228)
at
org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePre ferencePage.initDefaults(AppearancePreferencePage.java:169)
at
org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin. initializeDefaultDiagramPreferenceStore(DiagramUIPlugin.java :95)
at
org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin. start(DiagramUIPlugin.java:76)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:995)
at java.security.AccessController.doPrivileged(Native Method)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:989)
.... 28 more
Root exception:
org.eclipse.jface.util.Assert$AssertionFailedException: null argument;
at org.eclipse.jface.util.Assert.isNotNull(Assert.java:150)
at org.eclipse.jface.util.Assert.isNotNull(Assert.java:126)
at org.eclipse.jface.resource.FontRegistry.<init>(FontRegistry.java:273)
at org.eclipse.jface.resource.FontRegistry.<init>(FontRegistry.java:288)
at
org.eclipse.jface.resource.JFaceResources.getFontRegistry(JF aceResources.java:267)
at
org.eclipse.jface.resource.JFaceResources.getDefaultFont(JFa ceResources.java:220)
at
org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePre ferencePage.setDefaultFontPreference(AppearancePreferencePag e.java:228)
at
org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePre ferencePage.initDefaults(AppearancePreferencePage.java:169)
at
org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin. initializeDefaultDiagramPreferenceStore(DiagramUIPlugin.java :95)
at
org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin. start(DiagramUIPlugin.java:76)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:995)
at java.security.AccessController.doPrivileged(Native Method)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:989)
at
org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:970)
at
org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:317)
at
org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:256)
at
org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter .preFindLocalClass(EclipseLazyStarter.java:86)
at
org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoc alClass(ClasspathManager.java:409)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.fin dLocalClass(DefaultClassLoader.java:188)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findLo calClass(BundleLoader.java:339)
at
org.eclipse.osgi.framework.internal.core.SingleSourcePackage .loadClass(SingleSourcePackage.java:37)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:388)
at
org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:352)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClassInternal(Unknown Source)
at
de.schwartzonline.gmf.mavendependencies.diagram.MavenDepende nciesDiagramImageExporter. <init>(MavenDependenciesDiagramImageExporter.java:31)
at
de.schwartzonline.gmf.mavendependencies.offscreen.rcp.MavenD ependencyOffscreenRendererApplication.run(MavenDependencyOff screenRendererApplication.java:49)
at
org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)


Do I have to add some initialization steps?

Best regards,

Alex
Re: headless usage of GMF rendering [message #71700 is a reply to message #71221] Mon, 30 October 2006 17:02 Go to previous messageGo to next message
Cherie Revells is currently offline Cherie RevellsFriend
Messages: 299
Registered: July 2009
Senior Member
Alex,

When the Diagram UI plugin starts up it initializes the preference store
with font values. It is calling JFaceResources.getDefaultFont() and
when a new font registry is created in SWT it requires a Display.

We have not supported this use case in the past, but I don't see why we
shouldn't be able to support it assuming SWT supports this somehow.
Maybe there is another way we can get the default font. I would suggest
you create a bugzilla and someone can look into it.

Regards,
Cherie

Alex Schwartz wrote:
> Hello Cherie,
>
>
>> You can produce an image without bringing up an editor within Eclipse
>> if this is any help.
>>
>> See OffscreenEditPartFactory and CopyToImageUtil for details.
>
> Thanks for your hint. I found these classes and created a headless RCP
> which runs the image conversion.
>
> Unfortunately I run into some problems with the initialization.
> Loading the class ImageFileFormat fails with the following exception:
>
> org.osgi.framework.BundleException: Exception in
> org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin. start() of
> bundle org.eclipse.gmf.runtime.diagram.ui.
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:1014)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:970)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:317)
>
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:256)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter .preFindLocalClass(EclipseLazyStarter.java:86)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoc alClass(ClasspathManager.java:409)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.fin dLocalClass(DefaultClassLoader.java:188)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findLo calClass(BundleLoader.java:339)
>
> at
> org.eclipse.osgi.framework.internal.core.SingleSourcePackage .loadClass(SingleSourcePackage.java:37)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:388)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:352)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)
>
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> at
> de.schwartzonline.gmf.mavendependencies.diagram.MavenDepende nciesDiagramImageExporter. <init>(MavenDependenciesDiagramImageExporter.java:31)
>
> at
> de.schwartzonline.gmf.mavendependencies.offscreen.rcp.MavenD ependencyOffscreenRendererApplication.run(MavenDependencyOff screenRendererApplication.java:49)
>
> at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
> at org.eclipse.core.launcher.Main.run(Main.java:977)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
> Caused by: org.eclipse.jface.util.Assert$AssertionFailedException: null
> argument;
> at org.eclipse.jface.util.Assert.isNotNull(Assert.java:150)
> at org.eclipse.jface.util.Assert.isNotNull(Assert.java:126)
> at org.eclipse.jface.resource.FontRegistry.<init>(FontRegistry.java:273)
> at org.eclipse.jface.resource.FontRegistry.<init>(FontRegistry.java:288)
> at
> org.eclipse.jface.resource.JFaceResources.getFontRegistry(JF aceResources.java:267)
>
> at
> org.eclipse.jface.resource.JFaceResources.getDefaultFont(JFa ceResources.java:220)
>
> at
> org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePre ferencePage.setDefaultFontPreference(AppearancePreferencePag e.java:228)
>
> at
> org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePre ferencePage.initDefaults(AppearancePreferencePage.java:169)
>
> at
> org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin. initializeDefaultDiagramPreferenceStore(DiagramUIPlugin.java :95)
>
> at
> org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin. start(DiagramUIPlugin.java:76)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:995)
>
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:989)
>
> ... 28 more
> Root exception:
> org.eclipse.jface.util.Assert$AssertionFailedException: null argument;
> at org.eclipse.jface.util.Assert.isNotNull(Assert.java:150)
> at org.eclipse.jface.util.Assert.isNotNull(Assert.java:126)
> at org.eclipse.jface.resource.FontRegistry.<init>(FontRegistry.java:273)
> at org.eclipse.jface.resource.FontRegistry.<init>(FontRegistry.java:288)
> at
> org.eclipse.jface.resource.JFaceResources.getFontRegistry(JF aceResources.java:267)
>
> at
> org.eclipse.jface.resource.JFaceResources.getDefaultFont(JFa ceResources.java:220)
>
> at
> org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePre ferencePage.setDefaultFontPreference(AppearancePreferencePag e.java:228)
>
> at
> org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePre ferencePage.initDefaults(AppearancePreferencePage.java:169)
>
> at
> org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin. initializeDefaultDiagramPreferenceStore(DiagramUIPlugin.java :95)
>
> at
> org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin. start(DiagramUIPlugin.java:76)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl$2 .run(BundleContextImpl.java:995)
>
> at java.security.AccessController.doPrivileged(Native Method)
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tartActivator(BundleContextImpl.java:989)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleContextImpl.s tart(BundleContextImpl.java:970)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleHost.startWor ker(BundleHost.java:317)
>
> at
> org.eclipse.osgi.framework.internal.core.AbstractBundle.star t(AbstractBundle.java:256)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter .preFindLocalClass(EclipseLazyStarter.java:86)
>
> at
> org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLoc alClass(ClasspathManager.java:409)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.fin dLocalClass(DefaultClassLoader.java:188)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findLo calClass(BundleLoader.java:339)
>
> at
> org.eclipse.osgi.framework.internal.core.SingleSourcePackage .loadClass(SingleSourcePackage.java:37)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:388)
>
> at
> org.eclipse.osgi.framework.internal.core.BundleLoader.findCl ass(BundleLoader.java:352)
>
> at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa dClass(DefaultClassLoader.java:83)
>
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClassInternal(Unknown Source)
> at
> de.schwartzonline.gmf.mavendependencies.diagram.MavenDepende nciesDiagramImageExporter. <init>(MavenDependenciesDiagramImageExporter.java:31)
>
> at
> de.schwartzonline.gmf.mavendependencies.offscreen.rcp.MavenD ependencyOffscreenRendererApplication.run(MavenDependencyOff screenRendererApplication.java:49)
>
> at
> org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:78)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
>
> at
> org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
>
> at
> org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
>
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
> at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
> at org.eclipse.core.launcher.Main.run(Main.java:977)
> at org.eclipse.core.launcher.Main.main(Main.java:952)
>
>
> Do I have to add some initialization steps?
>
> Best regards,
>
> Alex
Re: headless usage of GMF rendering [message #74210 is a reply to message #71700] Fri, 03 November 2006 20:25 Go to previous message
Eclipse UserFriend
Originally posted by: alexander.schwartzonline.de

Hello Cherie,

> When the Diagram UI plugin starts up it initializes the preference store
> with font values. It is calling JFaceResources.getDefaultFont() and
> when a new font registry is created in SWT it requires a Display.
>
> We have not supported this use case in the past, but I don't see why we
> shouldn't be able to support it assuming SWT supports this somehow.
> Maybe there is another way we can get the default font. I would suggest
> you create a bugzilla and someone can look into it.

Thanks for analyzing the problem.

I entered the bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=163380


Best regards,

Alex
Previous Topic:Border item as a container
Next Topic:Obtain active editor name from paint method
Goto Forum:
  


Current Time: Fri Dec 27 03:00:27 GMT 2024

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

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

Back to the top