diff dwtx/jface/dialogs/PopupDialog.d @ 72:5df4896124c7

JFace and its examples do compile
author Frank Benoit <benoit@tionex.de>
date Thu, 22 May 2008 17:56:17 +0200
parents 4878bef4a38e
children 7ffeace6c47f
line wrap: on
line diff
--- a/dwtx/jface/dialogs/PopupDialog.d	Thu May 22 04:03:58 2008 +0200
+++ b/dwtx/jface/dialogs/PopupDialog.d	Thu May 22 17:56:17 2008 +0200
@@ -55,6 +55,7 @@
 import dwtx.jface.window.Window;
 
 import dwt.dwthelper.utils;
+import dwt.dwthelper.Runnable;
 
 /**
  * A lightweight, transient dialog that is popped up to show contextual or
@@ -81,7 +82,17 @@
     /**
      *
      */
-    private static const GridDataFactory LAYOUTDATA_GRAB_BOTH;
+    private static GridDataFactory LAYOUTDATA_GRAB_BOTH_;
+    private static GridDataFactory LAYOUTDATA_GRAB_BOTH(){
+        if( LAYOUTDATA_GRAB_BOTH_ is null ){
+            synchronized( PopupDialog.classinfo ){
+                if( LAYOUTDATA_GRAB_BOTH_ is null ){
+                    LAYOUTDATA_GRAB_BOTH_ = GridDataFactory.fillDefaults().grab(true,true);
+                }
+            }
+        }
+        return LAYOUTDATA_GRAB_BOTH_;
+    }
 
     /**
      * The dialog settings key name for stored dialog x location.
@@ -285,25 +296,30 @@
      *
      * @since 3.3
      */
-    public static final String POPUP_IMG_MENU = "popup_menu_image"; //$NON-NLS-1$
+    public static const String POPUP_IMG_MENU = "popup_menu_image"; //$NON-NLS-1$
 
     /**
      * Image registry key for disabled menu image.
      *
      * @since 3.3
      */
-    public static final String POPUP_IMG_MENU_DISABLED = "popup_menu_image_diabled"; //$NON-NLS-1$
+    public static const String POPUP_IMG_MENU_DISABLED = "popup_menu_image_diabled"; //$NON-NLS-1$
 
     /**
      *
      */
-    private static final GridLayoutFactory POPUP_LAYOUT_FACTORY;
-
-    static this(){
-        LAYOUTDATA_GRAB_BOTH = GridDataFactory.fillDefaults().grab(true,true);
-        POPUP_LAYOUT_FACTORY = GridLayoutFactory
-            .fillDefaults().margins(POPUP_MARGINWIDTH, POPUP_MARGINHEIGHT)
-            .spacing(POPUP_HORIZONTALSPACING, POPUP_VERTICALSPACING);
+    private static GridLayoutFactory POPUP_LAYOUT_FACTORY_;
+    private static GridLayoutFactory POPUP_LAYOUT_FACTORY() {
+        if( POPUP_LAYOUT_FACTORY_ is null ){
+            synchronized( PopupDialog.classinfo ){
+                if( POPUP_LAYOUT_FACTORY_ is null ){
+                    POPUP_LAYOUT_FACTORY_ = GridLayoutFactory
+                        .fillDefaults().margins(POPUP_MARGINWIDTH, POPUP_MARGINHEIGHT)
+                        .spacing(POPUP_HORIZONTALSPACING, POPUP_VERTICALSPACING);
+                }
+            }
+        }
+        return POPUP_LAYOUT_FACTORY_;
     }
 
     /**
@@ -835,7 +851,7 @@
         titleLabel = new Label(parent, DWT.NONE);
 
         GridDataFactory.fillDefaults().align_(DWT.FILL, DWT.CENTER).grab(true,
-                false).span(showDialogMenu ? 1 : 2, 1).applyTo(titleLabel);
+                false).span(showDialogMenu_ ? 1 : 2, 1).applyTo(titleLabel);
 
         if (titleText !is null) {
             titleLabel.setText(titleText);
@@ -1208,11 +1224,11 @@
                 settings.put(prefix ~ DIALOG_ORIGIN_X, shellLocation.x);
                 settings.put(prefix ~ DIALOG_ORIGIN_Y, shellLocation.y);
             }
-            if (showPersistActions && showDialogMenu) {
-                settings.put(getClass().getName() + DIALOG_USE_PERSISTED_SIZE,
+            if (showPersistActions && showDialogMenu_) {
+                settings.put(this.classinfo.name ~ DIALOG_USE_PERSISTED_SIZE,
                         persistSize);
-                settings.put(getClass().getName()
-                        + DIALOG_USE_PERSISTED_LOCATION, persistLocation);
+                settings.put(this.classinfo.name
+                        ~ DIALOG_USE_PERSISTED_LOCATION, persistLocation);
 
             }
         }
@@ -1582,16 +1598,16 @@
         if (settings is null)
             return;
 
-        final String className = getClass().getName();
+        final String className = this.classinfo.name;
 
-        String key = className + DIALOG_USE_PERSISTED_BOUNDS;
+        String key = className ~ DIALOG_USE_PERSISTED_BOUNDS;
         String value = settings.get(key);
         if (value is null || DIALOG_VALUE_MIGRATED_TO_34.equals(value))
             return;
 
         bool storeBounds = settings.getBoolean(key);
-        settings.put(className + DIALOG_USE_PERSISTED_LOCATION, storeBounds);
-        settings.put(className + DIALOG_USE_PERSISTED_SIZE, storeBounds);
+        settings.put(className ~ DIALOG_USE_PERSISTED_LOCATION, storeBounds);
+        settings.put(className ~ DIALOG_USE_PERSISTED_SIZE, storeBounds);
         settings.put(key, DIALOG_VALUE_MIGRATED_TO_34);
     }