Bug 263244 - Exception initializing default diagram preference store
Summary: Exception initializing default diagram preference store
Status: RESOLVED FIXED
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal
Target Milestone: 2.2   Edit
Assignee: Alex Boyko CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-02 11:00 EST by Scott Cowan CLA
Modified: 2010-07-19 12:25 EDT (History)
2 users (show)

See Also:


Attachments
proposed patch (2.31 KB, patch)
2009-03-31 15:37 EDT, Alex Boyko CLA
no flags Details | Diff
proposed patch (7.66 KB, patch)
2009-04-01 21:34 EDT, Alex Boyko CLA
no flags Details | Diff
proposed patch (5.43 KB, application/octet-stream)
2009-04-01 21:44 EDT, Alex Boyko CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Scott Cowan CLA 2009-02-02 11:00:33 EST
Build ID: 1.2.0.v20081218-0714

Steps To Reproduce:
An exception is thrown during org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin.start(BundleContext) because it calls org.eclipse.gmf.runtime.diagram.ui.internal.DiagramUIPlugin.initializeDefaultDiagramPreferenceStore() which requires the thread it starts on to have a display.  My application starts this plugin on a thread that doesn't yet have a display.  It needs to be lazy initialized.



More information:
org.eclipse.core.runtime.AssertionFailedException: null argument:
	at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:85)
	at org.eclipse.core.runtime.Assert.isNotNull(Assert.java:73)
	at org.eclipse.jface.resource.FontRegistry.<init>(FontRegistry.java:282)
	at org.eclipse.jface.resource.FontRegistry.<init>(FontRegistry.java:300)
	at org.eclipse.jface.resource.JFaceResources.getFontRegistry(JFaceResources.java:342)
	at org.eclipse.jface.resource.JFaceResources.getDefaultFont(JFaceResources.java:245)
	at org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage.setDefaultFontPreference(AppearancePreferencePage.java:280)
	at org.eclipse.gmf.runtime.diagram.ui.preferences.AppearancePreferencePage.initDefaults(AppearancePreferencePage.java:221)
	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$1.run(BundleContextImpl.java:804)
	at java.security.AccessController.doPrivileged(AccessController.java:251)
	at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:798)
	... 42 more
Comment 1 Anthony Hunter CLA 2009-02-06 14:35:26 EST
Will look at fixing after M5.
Comment 2 Alex Boyko CLA 2009-03-31 15:09:10 EDT
Anthony, for this one, I'm thinking about getting the default font (i.e creating the registry) in async display message if current thread is not the UI thread (like we do for canonical and other things)
Comment 3 Alex Boyko CLA 2009-03-31 15:37:47 EDT
Created attachment 130454 [details]
proposed patch

Here is the patch for what I've proposed
Comment 4 Alex Boyko CLA 2009-03-31 15:40:27 EDT
It is sync display message, not async. We want to initialize preferences now and not later... If they are being initialized on a non-UI thread, we need to make one and initialize them right away I think.
Comment 5 Anthony Hunter CLA 2009-04-01 09:22:13 EDT
Rather than keeping this in the bundle startup, can we initialize on the first use? 
Comment 6 Alex Boyko CLA 2009-04-01 12:38:16 EDT
Hmm... I'll look into this. Thanks.
Comment 7 Alex Boyko CLA 2009-04-01 21:34:32 EDT
Created attachment 130638 [details]
proposed patch

Anthony, here is the patch that initializes default preferences when org.eclipse.gmf.diagra,.ui plugin preferences are first accessed.
I left the previous fix in though. There are no guarantees that default preferences are accessed on the UI thread (like via canonical view creation)
Comment 8 Alex Boyko CLA 2009-04-01 21:44:19 EDT
Created attachment 130639 [details]
proposed patch

Actually, canonical views are created on the UI thread, so I removed the first fix from the patch. We'll assume that preferences are accessed on the UI thread for now.
Comment 9 Anthony Hunter CLA 2009-04-03 16:12:43 EDT
(In reply to comment #8)
> Created an attachment (id=130639) [details]
> proposed patch
> 
> Actually, canonical views are created on the UI thread, so I removed the first
> fix from the patch. We'll assume that preferences are accessed on the UI thread
> for now.
> 

That is great, the patch looks good.
Comment 10 Alex Boyko CLA 2009-04-06 01:34:06 EDT
Committed the patch for 2.2 M7
Comment 11 Eclipse Webmaster CLA 2010-07-16 23:35:43 EDT
[target cleanup] 2.2 M7 was the original target milestone for this
bug
Comment 12 Eclipse Webmaster CLA 2010-07-19 12:25:51 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Runtime Diagram was the original product and component for this bug