org.eclipse.cdt.internal.ui.util
Class SWTUtil

java.lang.Object
  extended by org.eclipse.cdt.internal.ui.util.SWTUtil

public class SWTUtil
extends java.lang.Object

Utility class to simplify access to some SWT resources.


Constructor Summary
SWTUtil()
           
 
Method Summary
static int getButtonHeigthHint(org.eclipse.swt.widgets.Button button)
          Deprecated.  
static int getButtonWidthHint(org.eclipse.swt.widgets.Button button)
          Returns a width hint for a button control.
static org.eclipse.swt.widgets.Shell getShell(org.eclipse.swt.widgets.Widget widget)
          Returns the shell for the given widget.
static org.eclipse.swt.widgets.Display getStandardDisplay()
          Returns the standard display to be used.
static int getTableHeightHint(org.eclipse.swt.widgets.Table table, int rows)
           
static void setButtonDimensionHint(org.eclipse.swt.widgets.Button button)
          Sets width for the button control.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SWTUtil

public SWTUtil()
Method Detail

getStandardDisplay

public static org.eclipse.swt.widgets.Display getStandardDisplay()
Returns the standard display to be used. The method first checks, if the thread calling this method has an associated disaply. If so, this display is returned. Otherwise the method returns the default display.


getShell

public static org.eclipse.swt.widgets.Shell getShell(org.eclipse.swt.widgets.Widget widget)
Returns the shell for the given widget. If the widget doesn't represent a SWT object that manage a shell, null is returned.

Returns:
the shell for the given widget

getButtonWidthHint

public static int getButtonWidthHint(org.eclipse.swt.widgets.Button button)
Returns a width hint for a button control.


getButtonHeigthHint

public static int getButtonHeigthHint(org.eclipse.swt.widgets.Button button)
Deprecated. 

Returns a height hint for a button control.

See Also:
IDialogConstants.BUTTON_HEIGHT

setButtonDimensionHint

public static void setButtonDimensionHint(org.eclipse.swt.widgets.Button button)
Sets width for the button control. Note: This is a NOP if the button's layout data is not an instance of GridData.

Parameters:
button - a button for which to set the dimension hint

getTableHeightHint

public static int getTableHeightHint(org.eclipse.swt.widgets.Table table,
                                     int rows)