]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Updated Font dialog to not use SWT graphics when possible. If SWT graphics are used...
authorlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 25 Feb 2013 09:48:37 +0000 (09:48 +0000)
committerlempinen <lempinen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 25 Feb 2013 09:48:37 +0000 (09:48 +0000)
git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/trunk@26892 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/VariableInformationTab.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/CustomFontDialog.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/FontModifyListener.java
org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/properties/widgets/FontSelectionComposite.java

index 506e7a75c1f198a98858a3800a0e0202c893d0e9..53f7c9aa70b2d358fc5fd809e6f7581cb5147ddc 100644 (file)
 package org.simantics.sysdyn.ui.properties;\r
 \r
 import java.awt.Color;\r
+import java.awt.Font;\r
 \r
 import org.eclipse.jface.layout.GridDataFactory;\r
 import org.eclipse.jface.layout.GridLayoutFactory;\r
+import org.eclipse.jface.resource.FontDescriptor;\r
+import org.eclipse.jface.resource.JFaceResources;\r
+import org.eclipse.jface.resource.LocalResourceManager;\r
 import org.eclipse.swt.SWT;\r
 import org.eclipse.swt.SWTException;\r
-import org.eclipse.swt.graphics.Font;\r
 import org.eclipse.swt.graphics.FontData;\r
+import org.eclipse.swt.graphics.RGB;\r
 import org.eclipse.swt.widgets.Composite;\r
 import org.eclipse.swt.widgets.Display;\r
 import org.eclipse.swt.widgets.Group;\r
@@ -66,12 +70,17 @@ public class VariableInformationTab extends LabelPropertyTabContributor implemen
     private WidgetSupport support;\r
     private Resource component;\r
     private org.simantics.browsing.ui.swt.widgets.Label sample;\r
+    private LocalResourceManager resourceManager;\r
 \r
 \r
     @Override\r
     public void createControls(Composite body, IWorkbenchSite site, ISessionContext context, WidgetSupport support) {\r
         this.support = support;\r
         support.register(this);\r
+        \r
+        // Create a ResourceManager to dispose images when the widget is disposed.\r
+        this.resourceManager = new LocalResourceManager(JFaceResources.getResources(), body);\r
+        \r
 \r
         final Composite composite = new Composite(body, SWT.NONE);\r
         GridDataFactory.fillDefaults().grab(true, true).applyTo(composite);\r
@@ -143,20 +152,20 @@ public class VariableInformationTab extends LabelPropertyTabContributor implemen
 \r
         b.addSelectionListener(new SelectionListenerImpl<Resource>(context) {\r
 \r
-            java.awt.Font f;\r
+            Font f;\r
             Color color;\r
             Object input;\r
 \r
             @Override\r
             public void beforeApply() {\r
 \r
-                Triple<java.awt.Font, Color, String> result = null;\r
+                Triple<Font, Color, String> result = null;\r
 \r
                 try {\r
-                    result = SimanticsUI.getSession().syncRequest(new Read<Triple<java.awt.Font, Color, String>>(){\r
+                    result = SimanticsUI.getSession().syncRequest(new Read<Triple<Font, Color, String>>(){\r
 \r
                         @Override\r
-                        public Triple<java.awt.Font, Color, String> perform(ReadGraph graph) throws DatabaseException {\r
+                        public Triple<Font, Color, String> perform(ReadGraph graph) throws DatabaseException {\r
                             Resource component = ISelectionUtils.filterSingleSelection(input, Resource.class);\r
                             String name = NameUtils.getSafeName(graph, component);\r
 \r
@@ -166,14 +175,14 @@ public class VariableInformationTab extends LabelPropertyTabContributor implemen
                                 Resource fontResource = graph.getPossibleObject(element, g2d.HasFont);\r
                                 Resource colorResource = graph.getPossibleObject(element, g2d.HasColor);\r
 \r
-                                java.awt.Font font = null;\r
+                                Font font = null;\r
                                 if(fontResource != null)\r
                                     font = G2DUtils.getFont(graph, fontResource);\r
                                 Color color = null;\r
                                 if(colorResource != null)\r
                                     color = G2DUtils.getColor(graph, colorResource);\r
 \r
-                                return new Triple<java.awt.Font, Color, String>(font, color, name);\r
+                                return new Triple<Font, Color, String>(font, color, name);\r
                             }\r
 \r
                             return null;\r
@@ -204,12 +213,12 @@ public class VariableInformationTab extends LabelPropertyTabContributor implemen
                     color = dialog.getAWTColor();\r
                 }\r
 \r
-                Font swt = dialog.getSWTFont();\r
-                if(swt != null)\r
-                    sample.setFont(swt);\r
-                org.eclipse.swt.graphics.Color swtColor = dialog.getSWTColor();\r
-                if(swtColor != null)\r
-                    sample.setForeground(swtColor);\r
+                FontData fd = dialog.getSWTFontData();\r
+                if(fd != null)\r
+                    sample.setFont(resourceManager.createFont(FontDescriptor.createFrom(fd)));\r
+                RGB rgb = dialog.getRGB(); \r
+                if(rgb != null)\r
+                    sample.setForeground(resourceManager.createColor(rgb));\r
                 fontComposite.layout();\r
             }\r
 \r
@@ -239,7 +248,7 @@ public class VariableInformationTab extends LabelPropertyTabContributor implemen
 \r
     }\r
 \r
-    private Read<Pair<java.awt.Font, Color>> fontAndColorRead;\r
+    private Read<Pair<Font, Color>> fontAndColorRead;\r
 \r
     @Override\r
     public void setInput(ISessionContext context, Object input) {\r
@@ -270,11 +279,11 @@ public class VariableInformationTab extends LabelPropertyTabContributor implemen
 \r
         // Read font and color information for sample text\r
         if(fontAndColorRead == null) {\r
-            fontAndColorRead = new Read<Pair<java.awt.Font, Color>>() {\r
+            fontAndColorRead = new Read<Pair<Font, Color>>() {\r
 \r
                 @Override\r
-                public Pair<java.awt.Font, Color> perform(ReadGraph graph) throws DatabaseException {\r
-                    java.awt.Font font = null;\r
+                public Pair<Font, Color> perform(ReadGraph graph) throws DatabaseException {\r
+                    Font font = null;\r
                     Color color = null;\r
                     if(component != null) {\r
                         Resource element = graph.getPossibleObject(component, ModelingResources.getInstance(graph).ComponentToElement);\r
@@ -288,14 +297,14 @@ public class VariableInformationTab extends LabelPropertyTabContributor implemen
                                 color = G2DUtils.getColor(graph, colorResource);\r
                         }\r
                     }\r
-                    return new Pair<java.awt.Font, Color>(font, color);\r
+                    return new Pair<Font, Color>(font, color);\r
                 }\r
             };\r
 \r
-            SimanticsUI.getSession().asyncRequest(fontAndColorRead, new Listener<Pair<java.awt.Font, Color>>() {\r
+            SimanticsUI.getSession().asyncRequest(fontAndColorRead, new Listener<Pair<Font, Color>>() {\r
 \r
                 @Override\r
-                public void execute(final Pair<java.awt.Font, Color> result) {\r
+                public void execute(final Pair<Font, Color> result) {\r
                     final Display device;\r
                     try {\r
                         device = sample.getWidget().getDisplay();\r
@@ -319,15 +328,12 @@ public class VariableInformationTab extends LabelPropertyTabContributor implemen
                             }\r
                             if(result.first != null) {\r
                                 FontData fd = toSwtFontData(result.first);\r
-                                sample.setFont(new Font(device, fd));\r
+                                sample.setFont(resourceManager.createFont(FontDescriptor.createFrom(fd)));\r
                             }\r
                             if(result.second != null) {\r
-                                sample.setForeground(new org.eclipse.swt.graphics.Color(\r
-                                        device, \r
-                                        result.second.getRed(), \r
-                                        result.second.getGreen(), \r
-                                        result.second.getBlue())\r
-                                        );\r
+                                RGB rgb = new RGB(result.second.getRed(), result.second.getGreen(), \r
+                                        result.second.getBlue());\r
+                                sample.setForeground(resourceManager.createColor(rgb));\r
                             }\r
                             try {\r
                                 sample.getWidget().getParent().getParent().layout();\r
@@ -358,7 +364,7 @@ public class VariableInformationTab extends LabelPropertyTabContributor implemen
      * @param font AWT Font\r
      * @return SWT FontData based on AWT Font\r
      */\r
-    private static FontData toSwtFontData(java.awt.Font font) {\r
+    private static FontData toSwtFontData(Font font) {\r
         FontData fontData = new FontData();\r
         fontData.setName(font.getFamily());\r
         fontData.setStyle(font.getStyle());\r
index 4fd2fe1b35dc8bf96ca449b5ca35fb4aa0ac4daf..51bcf324ca90479b3b43ffa595c4bf54a712aaec 100644 (file)
@@ -19,13 +19,16 @@ import java.util.Map;
 import org.eclipse.jface.dialogs.Dialog;\r
 import org.eclipse.jface.layout.GridDataFactory;\r
 import org.eclipse.jface.layout.GridLayoutFactory;\r
+import org.eclipse.jface.resource.FontDescriptor;\r
+import org.eclipse.jface.resource.JFaceResources;\r
+import org.eclipse.jface.resource.LocalResourceManager;\r
 import org.eclipse.nebula.widgets.tablecombo.TableCombo;\r
 import org.eclipse.swt.SWT;\r
 import org.eclipse.swt.events.SelectionEvent;\r
 import org.eclipse.swt.events.SelectionListener;\r
 import org.eclipse.swt.graphics.FontData;\r
-import org.eclipse.swt.graphics.GC;\r
 import org.eclipse.swt.graphics.Image;\r
+import org.eclipse.swt.graphics.RGB;\r
 import org.eclipse.swt.graphics.Rectangle;\r
 import org.eclipse.swt.widgets.Composite;\r
 import org.eclipse.swt.widgets.Control;\r
@@ -35,6 +38,7 @@ import org.eclipse.swt.widgets.Label;
 import org.eclipse.swt.widgets.Shell;\r
 import org.eclipse.swt.widgets.Table;\r
 import org.eclipse.swt.widgets.TableItem;\r
+import org.simantics.utils.ui.gfx.ColorImageDescriptor;\r
 \r
 /**\r
  * Custom dialog for selecting font and font color. Similar to SWT FontDialog.\r
@@ -45,9 +49,9 @@ public class CustomFontDialog extends Dialog {
     \r
     private Map<String, Integer> systemColors = createColorMap();\r
     \r
-    private org.eclipse.swt.graphics.Font resultSWTFont;\r
-    private java.awt.Font awtFont;\r
-    private java.awt.Font resultAWTFont;\r
+    private FontData resultSWTFontData;\r
+    private Font awtFont;\r
+    private Font resultAWTFont;\r
     private Color color;\r
     private Color resultAWTColor;\r
     \r
@@ -57,8 +61,10 @@ public class CustomFontDialog extends Dialog {
     private String example = "Example";\r
     private Label sample;\r
     private Group sampleGroup;\r
-    private org.eclipse.swt.graphics.Font swtFont;\r
-    private org.eclipse.swt.graphics.Color swtColor;\r
+    private RGB rgb;\r
+    \r
+    private LocalResourceManager resourceManager;\r
+\r
 \r
     // Default color map\r
     protected static Map<String, Integer> createColorMap() {\r
@@ -111,11 +117,11 @@ public class CustomFontDialog extends Dialog {
     }\r
     \r
     /**\r
-     * Get selected font as SWT font\r
+     * Get selected font as SWT font dta\r
      * @return\r
      */\r
-    public org.eclipse.swt.graphics.Font getSWTFont() {\r
-        return resultSWTFont;\r
+    public FontData getSWTFontData() {\r
+        return resultSWTFontData;\r
     }\r
     \r
     /**\r
@@ -136,11 +142,11 @@ public class CustomFontDialog extends Dialog {
     }\r
     \r
     /**\r
-     * Get selected color as SWT color\r
+     * Get selected color as RGB\r
      * @return\r
      */\r
-    public org.eclipse.swt.graphics.Color getSWTColor() {\r
-        return swtColor;\r
+    public RGB getRGB() {\r
+        return rgb;\r
     }\r
     \r
     \r
@@ -156,8 +162,8 @@ public class CustomFontDialog extends Dialog {
         vpc.addFontModifiedListener(new FontModifyListener() {\r
             \r
             @Override\r
-            public void swtFontChanged(org.eclipse.swt.graphics.Font font) {\r
-                sample.setFont(font);\r
+            public void swtFontDataChanged(FontData fd) {\r
+                sample.setFont(resourceManager.createFont(FontDescriptor.createFrom(fd)));\r
                 sampleGroup.layout();\r
             }\r
             \r
@@ -173,6 +179,9 @@ public class CustomFontDialog extends Dialog {
      * @param parent Parent composite\r
      */\r
     protected void createColorChooser(Composite parent) {\r
+        // Create a ResourceManager to dispose images when the widget is disposed.\r
+        this.resourceManager = new LocalResourceManager(JFaceResources.getResources(), parent);\r
+        \r
         Composite colorComposite = new Composite(parent, SWT.NONE);\r
         GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).applyTo(colorComposite);\r
         GridLayoutFactory.fillDefaults().numColumns(2).applyTo(colorComposite);\r
@@ -188,20 +197,17 @@ public class CustomFontDialog extends Dialog {
         tc.setDisplayColumnIndex(1);\r
         tc.setToolTipText("this is tooltip");\r
         \r
-        if(swtColor != null) {\r
-            tc.setForeground(swtColor);\r
-        }\r
-        \r
         createColorItems(tc.getTable());\r
 \r
         if(this.color != null) {\r
             for(int i = 0; i < tc.getTable().getItemCount(); i++) {\r
                 TableItem ti = tc.getTable().getItem(i);\r
-                org.eclipse.swt.graphics.Color color = (org.eclipse.swt.graphics.Color) ti.getData();\r
-                if(color.getRed() == this.color.getRed() &&\r
-                        color.getGreen() == this.color.getGreen() &&\r
-                        color.getBlue() == this.color.getBlue()) {\r
+                RGB rgb = (RGB) ti.getData();\r
+                if(rgb.red == this.color.getRed() &&\r
+                        rgb.green == this.color.getGreen() &&\r
+                        rgb.blue == this.color.getBlue()) {\r
                     tc.setText(ti.getText(1));\r
+                    tc.setForeground(resourceManager.createColor(rgb));\r
                     break;\r
                 }\r
             }\r
@@ -214,8 +220,8 @@ public class CustomFontDialog extends Dialog {
             public void widgetSelected(SelectionEvent e) {\r
                 TableItem[] selection = tc.getTable().getSelection();\r
                 if(selection.length == 1) {\r
-                    org.eclipse.swt.graphics.Color color = (org.eclipse.swt.graphics.Color) selection[0].getData();\r
-                    swtColor = color;\r
+                    rgb = (RGB) selection[0].getData();\r
+                    org.eclipse.swt.graphics.Color swtColor = resourceManager.createColor(rgb);\r
                     sample.setForeground(swtColor);\r
                     tc.setForeground(swtColor);\r
                 }\r
@@ -242,11 +248,10 @@ public class CustomFontDialog extends Dialog {
         sample = new Label(sampleGroup, SWT.NONE);\r
         sample.setText(example);\r
         if(awtFont != null) {\r
-            swtFont = new org.eclipse.swt.graphics.Font(sample.getDisplay(), toSwtFontData(awtFont, -1));\r
-            sample.setFont(swtFont);\r
+            sample.setFont(resourceManager.createFont(FontDescriptor.createFrom(toSwtFontData(awtFont))));\r
         }\r
-        if(swtColor != null) {\r
-            sample.setForeground(swtColor);\r
+        if(rgb != null) {\r
+            sample.setForeground(resourceManager.createColor(rgb));\r
         }\r
         GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).grab(true, true).applyTo(sample);\r
     }\r
@@ -259,9 +264,9 @@ public class CustomFontDialog extends Dialog {
 \r
         GridLayoutFactory.fillDefaults().margins(3, 3).numColumns(2).applyTo(composite);\r
         \r
-        // Init SWT color, if AWT color has been set\r
+        // Init SWT RGB, if AWT color has been set\r
         if(color != null)\r
-            this.swtColor = new org.eclipse.swt.graphics.Color(Display.getCurrent(), color.getRed(), color.getGreen(), color.getBlue());\r
+            this.rgb = new RGB(color.getRed(), color.getGreen(), color.getBlue());\r
 \r
         // Font selection composite\r
         createFontChooser(composite);\r
@@ -283,7 +288,7 @@ public class CustomFontDialog extends Dialog {
         resultAWTFont = awtFont;\r
         resultAWTColor = color;\r
         if(resultAWTFont != null)\r
-               resultSWTFont =  new org.eclipse.swt.graphics.Font(Display.getCurrent(), toSwtFontData(resultAWTFont, -1));\r
+               resultSWTFontData =  toSwtFontData(resultAWTFont);\r
 \r
         setReturnCode(CANCEL);\r
         close();\r
@@ -292,13 +297,12 @@ public class CustomFontDialog extends Dialog {
     @Override\r
     protected void okPressed() {\r
         resultAWTFont = vpc.getAWTFont();\r
-        resultSWTFont =  swtFont;\r
+        resultSWTFontData =  toSwtFontData(resultAWTFont);\r
         \r
         TableItem[] selection = tc.getTable().getSelection();\r
         if(selection.length == 1) {\r
-            org.eclipse.swt.graphics.Color color = (org.eclipse.swt.graphics.Color) selection[0].getData();\r
-            resultAWTColor = new Color(color.getRed(), color.getGreen(), color.getBlue());\r
-            \r
+            RGB rgb = (RGB) selection[0].getData();\r
+            resultAWTColor = new Color(rgb.red, rgb.green, rgb.blue);\r
         }\r
 \r
         setReturnCode(OK);\r
@@ -323,11 +327,11 @@ public class CustomFontDialog extends Dialog {
      * @param height Height for the created data (or -1 if inherited directly from awt font, size matching not guaranteed)\r
      * @return\r
      */\r
-    protected static FontData toSwtFontData(Font font, int height) {\r
+    protected static FontData toSwtFontData(Font font) {\r
         FontData fontData = new FontData();\r
         fontData.setName(font.getFontName());\r
         fontData.setStyle(font.getStyle());\r
-        fontData.setHeight(height > 0 ? height : font.getSize());\r
+        fontData.setHeight(font.getSize());\r
         return fontData;\r
     }\r
     \r
@@ -337,21 +341,14 @@ public class CustomFontDialog extends Dialog {
      */\r
     protected void createColorItems(Table table) {\r
         Image image;\r
-        GC gc;\r
         TableItem ti;\r
         int code;\r
-        org.eclipse.swt.graphics.Color color;\r
+        RGB color;\r
         Display display = Display.getCurrent();\r
         for(String text : systemColors.keySet()) {\r
             code = systemColors.get(text);\r
-            color = display.getSystemColor(code);\r
-            \r
-            image = new Image(display, 25, 15);\r
-            gc = new GC (image);\r
-            gc.setBackground (color);\r
-            gc.fillRectangle (image.getBounds());\r
-            gc.dispose ();\r
-            \r
+            color = display.getSystemColor(code).getRGB();\r
+            image = resourceManager.createImage(new ColorImageDescriptor(color.red, color.green, color.blue, 25, 15, false));\r
             \r
             ti = new TableItem(table, SWT.NONE);\r
             ti.setImage(0, image);\r
index 2b72e360691505b768e7b68629e11d4d1034c9f6..eb1e11b1aaf2516f5dc66d771920d2beeaa8703f 100644 (file)
@@ -13,6 +13,8 @@ package org.simantics.sysdyn.ui.properties.widgets;
 \r
 import java.awt.Font;\r
 \r
+import org.eclipse.swt.graphics.FontData;\r
+\r
 /**\r
  * Font change listening interface\r
  * @author Teemu Lempinen\r
@@ -28,7 +30,7 @@ public interface FontModifyListener {
     \r
     /**\r
      * Called when font is changed\r
-     * @param font New font as SWT font\r
+     * @param font New font data as SWT font data\r
      */\r
-    public void swtFontChanged(org.eclipse.swt.graphics.Font font);\r
+    public void swtFontDataChanged(FontData font);\r
 }\r
index f5d07f1a0becefe5470a7871f69067c8de1999f9..9a8f43887c069d90fb0c399c59b6d94652af8a55 100644 (file)
@@ -21,6 +21,9 @@ import java.util.TreeMap;
 import org.eclipse.core.runtime.ListenerList;\r
 import org.eclipse.jface.layout.GridDataFactory;\r
 import org.eclipse.jface.layout.GridLayoutFactory;\r
+import org.eclipse.jface.resource.FontDescriptor;\r
+import org.eclipse.jface.resource.JFaceResources;\r
+import org.eclipse.jface.resource.LocalResourceManager;\r
 import org.eclipse.swt.SWT;\r
 import org.eclipse.swt.events.KeyEvent;\r
 import org.eclipse.swt.events.KeyListener;\r
@@ -55,11 +58,10 @@ public class FontSelectionComposite extends Composite {
     protected TreeMap<String, ArrayList<Font>> fonts = getFonts(familyIndex);\r
     protected Table fontFamilyTable, fontStyleTable, fontSizeTable;\r
     protected String[] sizes = new String[] {"8", "9", "10", "11", "12", "14", "16", "18", "20", "24", "26", "28", "36", "48", "72"};\r
-    protected org.eclipse.swt.graphics.Font swt;\r
-    protected FontData fontData;\r
 \r
     private ListenerList modifyListeners;\r
-\r
+    \r
+    private final LocalResourceManager resourceManager;\r
 \r
     /**\r
      * Gets all available fonts\r
@@ -103,6 +105,9 @@ public class FontSelectionComposite extends Composite {
      */\r
     public FontSelectionComposite(Composite parent, int style) {\r
         super(parent, style);\r
+        \r
+        // Create a ResourceManager to dispose images when the widget is disposed.\r
+        this.resourceManager = new LocalResourceManager(JFaceResources.getResources(), this);\r
 \r
         modifyListeners = new ListenerList();\r
 \r
@@ -234,8 +239,7 @@ public class FontSelectionComposite extends Composite {
         else\r
             return null;\r
     }\r
-\r
-\r
+    \r
     /**\r
      * Adds listeners for font family name text and table\r
      */\r
@@ -289,7 +293,7 @@ public class FontSelectionComposite extends Composite {
                 Font font = fonts.get(family).get(0);\r
                 if(font.canDisplay('a')) {\r
                     FontData fontData =  toSwtFontData(font, 10);\r
-                    org.eclipse.swt.graphics.Font swtFont = new org.eclipse.swt.graphics.Font(item.getDisplay(), fontData);\r
+                    org.eclipse.swt.graphics.Font swtFont = resourceManager.createFont(FontDescriptor.createFrom(fontData));\r
                     item.setFont(swtFont);\r
                 }\r
             }\r
@@ -590,7 +594,7 @@ public class FontSelectionComposite extends Composite {
                 // If the font is not symbolic, use the font in the created item\r
                 if(font.canDisplay('a')) {\r
                     FontData fontData = toSwtFontData(font, 10);\r
-                    org.eclipse.swt.graphics.Font swtFont = new org.eclipse.swt.graphics.Font(item.getDisplay(), fontData);\r
+                    org.eclipse.swt.graphics.Font swtFont = resourceManager.createFont(FontDescriptor.createFrom(fontData));\r
                     item.setFont(swtFont);\r
                 }\r
             }\r
@@ -664,15 +668,12 @@ public class FontSelectionComposite extends Composite {
             int style = 0;\r
             style |= (font.getFontName(Locale.ROOT).contains("Bold") ? SWT.BOLD : 0);\r
             style |= (font.getFontName(Locale.ROOT).contains("Italic") ? SWT.ITALIC : 0);\r
-            fontData = new FontData(font.getFamily(Locale.ROOT), font.getSize(), style);\r
-            if(swt != null)\r
-                swt.dispose();\r
-            swt = new org.eclipse.swt.graphics.Font(this.getDisplay(), fontData);\r
+            FontData fontData = new FontData(font.getFamily(Locale.ROOT), font.getSize(), style);\r
             \r
             Object[] listenersArray = modifyListeners.getListeners();\r
             for (int i = 0; i < listenersArray.length; i++) {\r
                 ((FontModifyListener)listenersArray[i]).awtFontChanged(font);\r
-                ((FontModifyListener)listenersArray[i]).swtFontChanged(swt);\r
+                ((FontModifyListener)listenersArray[i]).swtFontDataChanged(fontData);\r
             }\r
         }\r
     }\r