Runtime

org.eclipse.gmf.runtime.common.ui.util
Class WindowUtil

java.lang.Object
  extended byorg.eclipse.gmf.runtime.common.ui.util.WindowUtil

public class WindowUtil
extends java.lang.Object

Utilities for windows. There is one utility method here to center the dialog relative to its parent. There are also several utility methods that can be used on controls in a window.


Constructor Summary
WindowUtil()
           
 
Method Summary
static void centerDialog(Shell dialogShell, Shell parentShell)
          Center the dialog relative to a parent window.
static void disposeChildren(Composite parent)
          Dispose a parent's children
static void doMessageBox(java.lang.String message, java.lang.String title, int swtStyle, Shell shell)
          Display a message box
static GridData makeButtonData(Button button)
          Returns height and width data in a GridData for the button that was passed in.
static GridData makeFixedButtonData(Button button)
          Makes the GridData for a button to be a fixed size, regardless of the contents of the button
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WindowUtil

public WindowUtil()
Method Detail

centerDialog

public static void centerDialog(Shell dialogShell,
                                Shell parentShell)
Center the dialog relative to a parent window.

Parameters:
dialogShell - contains the dialog to center
parentShell - contains the window to center relative to

disposeChildren

public static void disposeChildren(Composite parent)
Dispose a parent's children

Parameters:
parent - composite containing children to be disposed.

makeButtonData

public static GridData makeButtonData(Button button)
Returns height and width data in a GridData for the button that was passed in. You can call button.setLayoutData with the returned data.

Parameters:
button - which has already been made. We'll be making the GridData for this button, so be sure that the text has already been set.
Returns:
GridData for this button with the suggested height and width

makeFixedButtonData

public static GridData makeFixedButtonData(Button button)
Makes the GridData for a button to be a fixed size, regardless of the contents of the button

Parameters:
button - the button control that we'll make the GridData for.
Returns:
GridData the new GridData for the button control.

doMessageBox

public static void doMessageBox(java.lang.String message,
                                java.lang.String title,
                                int swtStyle,
                                Shell shell)
Display a message box

Parameters:
message - the String message for the message box
title - the String title for the message box
swtStyle - the int style for the message box
shell - the Shell for the message box, such as Display.getActive().getShell()

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.