You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2015/05/27 11:53:45 UTC

svn commit: r1681944 - in /directory/studio/trunk/plugins: apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ templateeditor/src/main/java/org/apache/directory/studio/templateeditor/view/preferences/

Author: elecharny
Date: Wed May 27 09:53:45 2015
New Revision: 1681944

URL: http://svn.apache.org/r1681944
Log:
Always get a Font from the FontRegistry.

Modified:
    directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditorPage.java
    directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/view/preferences/TemplatesLabelProvider.java

Modified: directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditorPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditorPage.java?rev=1681944&r1=1681943&r2=1681944&view=diff
==============================================================================
--- directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditorPage.java (original)
+++ directory/studio/trunk/plugins/apacheds.configuration/src/main/java/org/apache/directory/studio/apacheds/configuration/editor/ServerConfigurationEditorPage.java Wed May 27 09:53:45 2015
@@ -30,6 +30,7 @@ import org.apache.directory.studio.apach
 import org.apache.directory.studio.connection.core.Connection;
 import org.eclipse.jface.action.IToolBarManager;
 import org.eclipse.jface.action.Separator;
+import org.eclipse.jface.resource.JFaceResources;
 import org.eclipse.jface.viewers.IDoubleClickListener;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
 import org.eclipse.jface.viewers.SelectionChangedEvent;
@@ -475,8 +476,8 @@ public abstract class ServerConfiguratio
     protected Label setBold( Label label )
     {
         FontData fontData = label.getFont().getFontData()[0];
-        Font font = new Font( label.getDisplay(), new FontData( fontData.getName(), fontData.getHeight(), SWT.BOLD ) );
-        label.setFont( font );
+        Font boldFont = JFaceResources.getFontRegistry().getBold( fontData.getName() );
+        label.setFont( boldFont );
 
         return label;
     }

Modified: directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/view/preferences/TemplatesLabelProvider.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/view/preferences/TemplatesLabelProvider.java?rev=1681944&r1=1681943&r2=1681944&view=diff
==============================================================================
--- directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/view/preferences/TemplatesLabelProvider.java (original)
+++ directory/studio/trunk/plugins/templateeditor/src/main/java/org/apache/directory/studio/templateeditor/view/preferences/TemplatesLabelProvider.java Wed May 27 09:53:45 2015
@@ -29,10 +29,8 @@ import org.eclipse.jface.resource.JFaceR
 import org.eclipse.jface.viewers.ITableColorProvider;
 import org.eclipse.jface.viewers.ITableFontProvider;
 import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
 import org.eclipse.swt.graphics.Color;
 import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.ui.PlatformUI;
 
@@ -299,20 +297,8 @@ public class TemplatesLabelProvider exte
             {
                 if ( manager.isDefaultTemplate( ( Template ) element ) )
                 {
-                    Font defaultFont = JFaceResources.getFontRegistry().defaultFont();
-                    FontData[] fontDatas = defaultFont.getFontData();
-                    if ( fontDatas != null )
-                    {
-                        // Setting the font as bold
-                        for ( FontData fontData : fontDatas )
-                        {
-                            int style = fontData.getStyle();
-                            style |= SWT.BOLD;
-                            fontData.setStyle( SWT.BOLD );
-                        }
-
-                        return new Font( defaultFont.getDevice(), fontDatas );
-                    }
+                    // Get the default Bold Font
+                    return JFaceResources.getFontRegistry().getBold( JFaceResources.DEFAULT_FONT );
                 }
             }
         }