removed NPE in XMLPreferenceInitializer
authorbananeweizen <bananeweizen>
Sun, 18 Dec 2005 15:50:53 +0000 (15:50 +0000)
committerbananeweizen <bananeweizen>
Sun, 18 Dec 2005 15:50:53 +0000 (15:50 +0000)
net.sourceforge.phpeclipse.xml.ui/src/net/sourceforge/phpeclipse/xml/ui/internal/preferences/XMLPreferenceInitializer.java

index b1186e7..aac1795 100644 (file)
@@ -9,7 +9,7 @@
  *     Roberto Gonzalez Rocha - Initial version
  *     Igor Malinin - refactoring, minor changes
  *
- * $Id: XMLPreferenceInitializer.java,v 1.1 2004-09-02 18:28:03 jsurfer Exp $
+ * $Id: XMLPreferenceInitializer.java,v 1.2 2005-12-18 15:50:53 bananeweizen Exp $
  */
 package net.sourceforge.phpeclipse.xml.ui.internal.preferences;
 
@@ -33,23 +33,28 @@ public class XMLPreferenceInitializer extends AbstractPreferenceInitializer {
         * @see org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer#initializeDefaultPreferences()
         */
        public void initializeDefaultPreferences() {
-               IPreferenceStore store = XMLPlugin.getDefault().getPreferenceStore();
+               final IPreferenceStore store = XMLPlugin.getDefault().getPreferenceStore();
+               final Display display=Display.getDefault();
 
                // TODO: ChainedPreferenceStore does not work for preferences preview
 
-               PreferenceConverter.setDefault(store,
-                       AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND,
-                       Display.getDefault()
-                               .getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB());
+               display.syncExec(new Runnable() {
+                       public void run() {
+                               PreferenceConverter.setDefault(store,
+                                               AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND,
+                                               display.getSystemColor(SWT.COLOR_LIST_FOREGROUND).getRGB());
+                       }});
 
                store.setDefault(
                        AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT,
                        true);
 
-               PreferenceConverter.setDefault(store,
-                       AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND,
-                       Display.getDefault()
-                               .getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB());
+               display.syncExec(new Runnable() {
+                       public void run() {
+                               PreferenceConverter.setDefault(store,
+                                               AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND,
+                                               display.getSystemColor(SWT.COLOR_LIST_BACKGROUND).getRGB());
+                       }});
 
                store.setDefault(
                        AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT,