Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 342711
Collapse All | Expand All

(-)src/org/eclipse/jface/preference/PreferenceConverter.java (-6 / +18 lines)
Lines 12-17 Link Here
12
12
13
import java.util.Arrays;
13
import java.util.Arrays;
14
import java.util.StringTokenizer;
14
import java.util.StringTokenizer;
15
import java.util.concurrent.atomic.AtomicReference;
15
16
16
import org.eclipse.jface.resource.JFaceResources;
17
import org.eclipse.jface.resource.JFaceResources;
17
import org.eclipse.jface.resource.StringConverter;
18
import org.eclipse.jface.resource.StringConverter;
Lines 76-87 Link Here
76
     */
77
     */
77
    public static final FontData FONTDATA_DEFAULT_DEFAULT;
78
    public static final FontData FONTDATA_DEFAULT_DEFAULT;
78
    static {
79
    static {
79
		Display display = Display.getCurrent();
80
    	
80
		if (display == null) {
81
        FONTDATA_ARRAY_DEFAULT_DEFAULT = readDefaultFontData();
81
			display = Display.getDefault ();
82
		}
83
		
84
        FONTDATA_ARRAY_DEFAULT_DEFAULT = display.getSystemFont().getFontData();
85
        /**
82
        /**
86
         * The default-default value for <code>FontData</code> preferences.
83
         * The default-default value for <code>FontData</code> preferences.
87
         * This is left in for compatibility purposes. It is recommended that
84
         * This is left in for compatibility purposes. It is recommended that
Lines 90-95 Link Here
90
87
91
        FONTDATA_DEFAULT_DEFAULT = FONTDATA_ARRAY_DEFAULT_DEFAULT[0];
88
        FONTDATA_DEFAULT_DEFAULT = FONTDATA_ARRAY_DEFAULT_DEFAULT[0];
92
    }
89
    }
90
    
91
	private static FontData[] readDefaultFontData() {
92
		final Display display = Display.getCurrent() == null ? Display.getDefault() : Display.getCurrent();
93
94
		final AtomicReference<FontData[]> result = new AtomicReference<FontData[]>();
95
96
		display.syncExec(new Runnable() {
97
98
			public void run() {
99
				result.set(display.getSystemFont().getFontData());
100
			}
101
		});
102
103
		return result.get();
104
	}
93
105
94
    /* (non-Javadoc)
106
    /* (non-Javadoc)
95
     * private constructor to prevent instantiation.
107
     * private constructor to prevent instantiation.

Return to bug 342711