1 20 package org.apache.directory.ldapstudio.apacheds.configuration; 21 22 23 import org.eclipse.jface.dialogs.Dialog; 24 import org.eclipse.jface.dialogs.IDialogConstants; 25 import org.eclipse.jface.resource.JFaceResources; 26 import org.eclipse.swt.graphics.FontMetrics; 27 import org.eclipse.swt.graphics.GC; 28 import org.eclipse.swt.widgets.Control; 29 import org.eclipse.ui.plugin.AbstractUIPlugin; 30 import org.osgi.framework.BundleContext; 31 32 33 39 public class Activator extends AbstractUIPlugin 40 { 41 42 public static final String PLUGIN_ID = "org.apache.directory.ldapstudio.apacheds.configuration"; 44 45 private static Activator plugin; 46 47 48 51 public Activator() 52 { 53 plugin = this; 54 } 55 56 57 61 public void start( BundleContext context ) throws Exception 62 { 63 super.start( context ); 64 } 65 66 67 71 public void stop( BundleContext context ) throws Exception 72 { 73 super.stop( context ); 74 } 75 76 77 83 public static Activator getDefault() 84 { 85 return plugin; 86 } 87 88 94 public static int getButtonWidth( Control control ) 95 { 96 GC gc = new GC( control ); 97 gc.setFont( JFaceResources.getDialogFont() ); 98 FontMetrics fontMetrics = gc.getFontMetrics(); 99 gc.dispose(); 100 101 int width = Dialog.convertHorizontalDLUsToPixels( fontMetrics, IDialogConstants.BUTTON_WIDTH ); 102 return width; 103 } 104 } 105 | Popular Tags |