|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.eclipse.datatools.sqltools.common.ui.util.SWTUtils
public class SWTUtils
This utility class provides convenience methods in creating controls on preference pages.
Field Summary | |
---|---|
static int |
DEFAULT_BUTTON_WIDTH
|
static int |
DEFAULT_COMBO_WIDTH
|
static int |
DEFAULT_RADIO_FILL
|
static int |
DEFAULT_TEXTBOX_WIDTH
|
Constructor Summary | |
---|---|
SWTUtils()
|
Method Summary | |
---|---|
static void |
computeScrollArea(org.eclipse.swt.custom.ScrolledComposite parentComposite,
org.eclipse.swt.widgets.Composite childComposite)
Computes the size of the composite inside the scroll area so that scroll bars show up correctly. |
static org.eclipse.swt.widgets.Button |
createCheckBox(org.eclipse.swt.widgets.Composite parent)
Creates a new checkbox and sets the default layout data. |
static org.eclipse.swt.widgets.Button |
createCheckBox(org.eclipse.swt.widgets.Composite parent,
java.lang.String label,
int numColumns)
Creates a new checkbox and sets the default layout data. |
static org.eclipse.swt.widgets.Button |
createCheckBox(org.eclipse.swt.widgets.Composite parent,
java.lang.String label,
int numColumns,
int indent)
Creates a new checkbox and sets the default layout data. |
static org.eclipse.swt.widgets.Combo |
createCombo(org.eclipse.swt.widgets.Composite parent,
java.lang.String[] items,
int numColumns)
Creates a combo box and sets the default layout data. |
static org.eclipse.swt.widgets.Combo |
createCombo(org.eclipse.swt.widgets.Composite parent,
java.lang.String[] items,
int numColumns,
int minWidth)
Creates a combo box and sets the default layout data. |
static org.eclipse.swt.widgets.Combo |
createCombo(org.eclipse.swt.widgets.Composite parent,
java.lang.String[] items,
int numColumns,
int minWidth,
boolean editable)
Creates a combo box and sets the default layout data. |
static org.eclipse.swt.widgets.Combo |
createCombo(org.eclipse.swt.widgets.Composite parent,
java.lang.String tokenString,
int numColumns)
Creates a combo box and sets the default layout data. |
static org.eclipse.swt.widgets.Combo |
createCombo(org.eclipse.swt.widgets.Composite parent,
java.lang.String tokenString,
int numColumns,
int minWidth)
Creates a combo box and sets the default layout data. |
static org.eclipse.swt.widgets.Combo |
createCombo(org.eclipse.swt.widgets.Composite parent,
java.lang.String tokenString,
int numColumns,
int minWidth,
boolean editable)
Creates a combo box and sets the default layout data. |
static org.eclipse.swt.widgets.Composite |
createComposite(org.eclipse.swt.widgets.Composite parent,
int numColumns)
Creates composite control and sets the default layout data. |
static org.eclipse.swt.widgets.Composite |
createComposite(org.eclipse.swt.widgets.Composite parent,
int numColumns,
int verticalSpacing,
int horizontalSpan)
Creates composite control and sets the default layout data. |
static org.eclipse.swt.widgets.Composite |
createComposite(org.eclipse.swt.widgets.Composite parent,
int numColumns,
int verticalSpacing,
int horizontalSpan,
int gridDataFill)
Creates composite control and sets the default layout data. |
static org.eclipse.swt.widgets.Composite |
createComposite(org.eclipse.swt.widgets.Composite parent,
int numColumns,
int verticalSpacing,
int horizontalSpan,
int gridDataFill,
int horizontalSpacing,
int marginWidth,
int marginHeight)
Creates composite control and sets the default layout data. |
static org.eclipse.swt.widgets.Group |
createGroup(org.eclipse.swt.widgets.Composite parent,
java.lang.String title,
int numColumns)
Utility method that creates a group and sets the default layout data. |
static org.eclipse.swt.widgets.Group |
createGroup(org.eclipse.swt.widgets.Composite parent,
java.lang.String title,
int numColumns,
int horizontalSpan,
int gridDataFill)
Utility method that creates a group and sets the default layout data. |
static org.eclipse.swt.widgets.Label |
createLabel(org.eclipse.swt.widgets.Composite parent,
java.lang.String text,
int numColumns)
Utility method that creates a label instance and sets the default layout data. |
static org.eclipse.swt.widgets.Label |
createLabel(org.eclipse.swt.widgets.Composite parent,
java.lang.String text,
int numColumns,
int indent)
Utility method that creates a label instance and sets the default layout data. |
static org.eclipse.swt.widgets.Label |
createLableImage(org.eclipse.swt.widgets.Composite parent,
org.eclipse.swt.graphics.Image theImage,
int numColumns,
org.eclipse.swt.graphics.Color background)
Create a image label for sticking in a composite. |
static org.eclipse.swt.widgets.List |
createList(org.eclipse.swt.widgets.Composite parent,
int numColumns,
int minWidth,
int minHeight,
java.lang.String[] items)
Create a list with the items listed in it. |
static org.eclipse.swt.widgets.List |
createList(org.eclipse.swt.widgets.Composite parent,
int numColumns,
int minWidth,
int minHeight,
java.lang.String[] items,
boolean bmulti)
Create a list with the items listed in it. |
static org.eclipse.swt.widgets.List |
createList(org.eclipse.swt.widgets.Composite parent,
int numColumns,
int minWidth,
int minHeight,
java.lang.String[] items,
boolean bmulti,
int verticalSpan)
Create a list with the items listed in it. |
static org.eclipse.swt.widgets.Button |
createPushButton(org.eclipse.swt.widgets.Composite parent,
org.eclipse.swt.graphics.Image theImage,
int widthHint)
Utility method that creates a push button instance and sets the default layout data. |
static org.eclipse.swt.widgets.Button |
createPushButton(org.eclipse.swt.widgets.Composite parent,
java.lang.String label)
Utility method that creates a push button instance and sets the default layout data. |
static org.eclipse.swt.widgets.Button |
createPushButton(org.eclipse.swt.widgets.Composite parent,
java.lang.String label,
int widthHint)
Utility method that creates a push button instance and sets the default layout data. |
static org.eclipse.swt.widgets.Button |
createRadioButton(org.eclipse.swt.widgets.Composite parent,
java.lang.String label)
Utility method that creates a radio button instance and sets the default layout data. |
static org.eclipse.swt.widgets.Button |
createRadioButton(org.eclipse.swt.widgets.Composite parent,
java.lang.String label,
int gridDataFill)
Utility method that creates a radio button instance and sets the default layout data. |
static org.eclipse.swt.widgets.Button |
createRadioButton(org.eclipse.swt.widgets.Composite parent,
java.lang.String label,
int gridDataFill,
int horizontalSpan)
Utility method that creates a radio button instance and sets the default layout data. |
static void |
createSpacer(org.eclipse.swt.widgets.Composite parent,
int numColumns)
Utility method that creates an empty line |
static void |
createSpacer(org.eclipse.swt.widgets.Composite parent,
int numColumns,
int minWidth)
Utility method that creates an empty line |
static org.eclipse.swt.widgets.Table |
createTable(org.eclipse.swt.widgets.Composite composite,
java.lang.String[] columns,
int tablewidth)
Create a table from a Composite object |
static org.eclipse.swt.widgets.Table |
createTable(org.eclipse.swt.widgets.Composite composite,
java.lang.String tokenString,
int tablewidth,
int tableHeight)
Create a table from a Composite object |
static org.eclipse.swt.widgets.TableColumn |
createTableColumn(org.eclipse.swt.widgets.Table parent,
org.eclipse.swt.graphics.Image image,
int index)
Create a table column with the image and the width of the column is set to the image width. |
static org.eclipse.swt.widgets.TableColumn |
createTableColumn(org.eclipse.swt.widgets.Table parent,
java.lang.String name,
int index)
Create a table column |
static org.eclipse.swt.widgets.TableColumn |
createTableColumn(org.eclipse.swt.widgets.Table parent,
java.lang.String name,
int index,
int tablewidth)
Create a table column |
static org.eclipse.swt.widgets.Text |
createTextBox(org.eclipse.swt.widgets.Composite parent)
Create a text field |
static org.eclipse.swt.widgets.Text |
createTextBox(org.eclipse.swt.widgets.Composite parent,
int numColumns)
Create a text field |
static org.eclipse.swt.widgets.Text |
createTextBox(org.eclipse.swt.widgets.Composite parent,
int numColumns,
int minWidth)
Create a text field |
static org.eclipse.swt.widgets.Text |
createTextBox(org.eclipse.swt.widgets.Composite parent,
int numColumns,
int minWidth,
int minHeight)
Create a text field |
static org.eclipse.swt.widgets.Text |
createTextBox(org.eclipse.swt.widgets.Composite parent,
java.lang.String text)
Create a text field |
static org.eclipse.swt.widgets.Text |
createTextBoxScrollable(org.eclipse.swt.widgets.Composite parent,
int numColumns,
int minWidth,
int minHeight)
Create a text field that is scrollable. |
static int |
getTableHeightHint(org.eclipse.swt.widgets.Table table,
int rows)
|
static java.lang.String[] |
getTokenNames(java.lang.String tokenString)
Builds an array of strings from a token list string. |
static void |
listenModify(org.eclipse.swt.widgets.Composite container,
org.eclipse.swt.widgets.Listener listener,
org.eclipse.swt.widgets.Widget[] except)
register the listener recursively, except for the except component |
static boolean |
notEmpty(org.eclipse.swt.widgets.Combo text)
Checks that a Combo control is not null and not empty |
static boolean |
notEmpty(org.eclipse.swt.widgets.Text text)
Checks that a Text control is not null and not empty |
static void |
processError(java.lang.String msg,
java.lang.Exception error,
org.eclipse.core.runtime.IStatus status)
|
static void |
recursiveEnable(org.eclipse.swt.widgets.Control control,
boolean enable)
Recursively enable/disable a group of controls. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int DEFAULT_BUTTON_WIDTH
public static final int DEFAULT_COMBO_WIDTH
public static final int DEFAULT_TEXTBOX_WIDTH
public static final int DEFAULT_RADIO_FILL
Constructor Detail |
---|
public SWTUtils()
Method Detail |
---|
public static org.eclipse.swt.widgets.Button createCheckBox(org.eclipse.swt.widgets.Composite parent)
parent
- the composite in which to create the checkboxlabel
- the string to set into the checkboxnumColumns
- the number of columns the new checkbox is to occupy
public static org.eclipse.swt.widgets.Button createCheckBox(org.eclipse.swt.widgets.Composite parent, java.lang.String label, int numColumns)
parent
- the composite in which to create the checkboxlabel
- the string to set into the checkboxnumColumns
- the number of columns the new checkbox is to occupy
public static org.eclipse.swt.widgets.Button createCheckBox(org.eclipse.swt.widgets.Composite parent, java.lang.String label, int numColumns, int indent)
parent
- the composite in which to create the checkboxlabel
- the string to set into the checkboxnumColumns
- the number of columns the new checkbox is to occupyindent
- the number of pixels to indent from the left
public static org.eclipse.swt.widgets.Combo createCombo(org.eclipse.swt.widgets.Composite parent, java.lang.String[] items, int numColumns)
parent
- the composite in which to create the comboitems
- the items in the combonumColumns
- the number of columns the new combo is to occupy
public static org.eclipse.swt.widgets.Combo createCombo(org.eclipse.swt.widgets.Composite parent, java.lang.String tokenString, int numColumns)
parent
- the composite in which to create the combotokenString
- a tokenized string that will be split into the fields.numColumns
- the number of columns the new combo is to occupy
public static org.eclipse.swt.widgets.Combo createCombo(org.eclipse.swt.widgets.Composite parent, java.lang.String tokenString, int numColumns, int minWidth)
parent
- the composite in which to create the combotokenString
- a tokenized string that will be split into the fields.numColumns
- the number of columns the new combo is to occupyminWidth
- minimum width of combo box in pixels
public static org.eclipse.swt.widgets.Combo createCombo(org.eclipse.swt.widgets.Composite parent, java.lang.String[] items, int numColumns, int minWidth)
parent
- the composite in which to create the comboitems
- the items in the combonumColumns
- the number of columns the new combo is to occupyminWidth
- minimum width of combo box in pixels
public static org.eclipse.swt.widgets.Combo createCombo(org.eclipse.swt.widgets.Composite parent, java.lang.String tokenString, int numColumns, int minWidth, boolean editable)
parent
- the composite in which to create the comboitems
- the items in the combonumColumns
- the number of columns the new combo is to occupyminWidth
- minimum width of combo box in pixelseditable
- whether the items in the combo is editable
public static org.eclipse.swt.widgets.Combo createCombo(org.eclipse.swt.widgets.Composite parent, java.lang.String[] items, int numColumns, int minWidth, boolean editable)
parent
- the composite in which to create the comboitems
- the items in the combonumColumns
- the number of columns the new combo is to occupyminWidth
- minimum width of combo box in pixelseditable
- whether the items in the combo is editable
public static org.eclipse.swt.widgets.Composite createComposite(org.eclipse.swt.widgets.Composite parent, int numColumns)
parent
- the parent of the new compositenumColumns
- the number of columns for the new composite
public static org.eclipse.swt.widgets.Composite createComposite(org.eclipse.swt.widgets.Composite parent, int numColumns, int verticalSpacing, int horizontalSpan)
parent
- the parent of the new compositenumColumns
- the number of columns for the new compositeverticalSpacing
- the spacing between rows.horizontalSpan
- the span for this new composite over the original composite.
public static org.eclipse.swt.widgets.Composite createComposite(org.eclipse.swt.widgets.Composite parent, int numColumns, int verticalSpacing, int horizontalSpan, int gridDataFill)
parent
- the parent of the new compositenumColumns
- the number of columns for the new compositeverticalSpacing
- the spacing between rows.horizontalSpan
- the span for this new composite over the original composite.gridDataFill
- the fill to use for this composite.
public static org.eclipse.swt.widgets.Composite createComposite(org.eclipse.swt.widgets.Composite parent, int numColumns, int verticalSpacing, int horizontalSpan, int gridDataFill, int horizontalSpacing, int marginWidth, int marginHeight)
parent
- the parent of the new compositenumColumns
- the number of columns for the new compositeverticalSpacing
- the spacing between rows.horizontalSpan
- the span for this new composite over the original composite.gridDataFill
- the fill to use for this composite.horizontalSpacing
- the spacing between objects._marginWidth
- the spacing at start and end of composite._marginHeight
- the spacing above and below composite.
public static org.eclipse.swt.widgets.Group createGroup(org.eclipse.swt.widgets.Composite parent, java.lang.String title, int numColumns)
parent
- the parent for the new grouptitle
- the label for the new groupnumColumns
- the number of columns for the new group
public static org.eclipse.swt.widgets.Group createGroup(org.eclipse.swt.widgets.Composite parent, java.lang.String title, int numColumns, int horizontalSpan, int gridDataFill)
parent
- the parent for the new grouptitle
- the label for the new groupnumColumns
- the number of columns for the new grouphorizontalSpan
- the number of columns this group should span on the parent
composite.fill
- the fill style of the new group -- set to for filling just
around the object: GridData.BEGINNING | GridData.CENTER
public static org.eclipse.swt.widgets.Label createLabel(org.eclipse.swt.widgets.Composite parent, java.lang.String text, int numColumns)
parent
- the parent for the new labeltext
- the text for the new labelnumColumns
- the number of columns for the new composite
public static org.eclipse.swt.widgets.Label createLabel(org.eclipse.swt.widgets.Composite parent, java.lang.String text, int numColumns, int indent)
parent
- the parent for the new labeltext
- the text for the new labelnumColumns
- the number of columns for the new compositeindent
- number of pixels to indent from the left
public static org.eclipse.swt.widgets.Label createLableImage(org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.graphics.Image theImage, int numColumns, org.eclipse.swt.graphics.Color background)
parent
- the parent for the new labeltheImage
- the image for the new labelnumColumns
- the number of columns for the new compositebackground
- pass null to use the composites background.
public static org.eclipse.swt.widgets.Button createPushButton(org.eclipse.swt.widgets.Composite parent, java.lang.String label)
parent
- the parent for the new buttonlabel
- the label for the new button
public static org.eclipse.swt.widgets.Button createPushButton(org.eclipse.swt.widgets.Composite parent, java.lang.String label, int widthHint)
parent
- the parent for the new buttonlabel
- the label for the new buttonwidthHint
- use this width for the button.
public static org.eclipse.swt.widgets.Button createPushButton(org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.graphics.Image theImage, int widthHint)
parent
- the parent for the new buttonlabel
- the label for the new buttonwidthHint
- use this width for the button.
public static org.eclipse.swt.widgets.Button createRadioButton(org.eclipse.swt.widgets.Composite parent, java.lang.String label)
parent
- the parent for the new buttonlabel
- the label for the new button
public static org.eclipse.swt.widgets.Button createRadioButton(org.eclipse.swt.widgets.Composite parent, java.lang.String label, int gridDataFill)
parent
- the parent for the new buttonlabel
- the label for the new button
public static org.eclipse.swt.widgets.Button createRadioButton(org.eclipse.swt.widgets.Composite parent, java.lang.String label, int gridDataFill, int horizontalSpan)
parent
- the parent for the new buttonlabel
- the label for the new buttonhorizontalSpan
- number of columns occupied by button
public static void createSpacer(org.eclipse.swt.widgets.Composite parent, int numColumns)
parent
- the parent for the new labelnumColumns
- the number of columns for the new compositepublic static void createSpacer(org.eclipse.swt.widgets.Composite parent, int numColumns, int minWidth)
parent
- the parent for the new labelnumColumns
- the number of columns for the new compositeint
- minimum width of spacerpublic static org.eclipse.swt.widgets.Table createTable(org.eclipse.swt.widgets.Composite composite, java.lang.String tokenString, int tablewidth, int tableHeight)
composite
- the Composite this table is to be created fromtokenString
- A string containing names of the columns in the order that
they should be displayed in the table with each column
separated by a comma(',') or null if no columns need to be
created.tablewidth
- the minimum width for the table
public static org.eclipse.swt.widgets.Table createTable(org.eclipse.swt.widgets.Composite composite, java.lang.String[] columns, int tablewidth)
composite
- the Composite this table is to be created fromcolumns
- A string array containing names of the columns in the order
that they should be displayed in the table, or null if no
columns need to be created.tablewidth
- the minimum width for the table
public static org.eclipse.swt.widgets.TableColumn createTableColumn(org.eclipse.swt.widgets.Table parent, java.lang.String name, int index)
parent
- the table that contains this columnname
- name of this columnindex
- the column within the parent composite
public static org.eclipse.swt.widgets.TableColumn createTableColumn(org.eclipse.swt.widgets.Table parent, org.eclipse.swt.graphics.Image image, int index)
parent
- the table that contains this columnimage
- iamge for this column
public static org.eclipse.swt.widgets.TableColumn createTableColumn(org.eclipse.swt.widgets.Table parent, java.lang.String name, int index, int tablewidth)
parent
- the table that contains this columnname
- name of this columnindex
- the column within the parent compositetablewidth
- the width for the column
public static org.eclipse.swt.widgets.Text createTextBox(org.eclipse.swt.widgets.Composite parent)
parent
- the parent of the new text field
public static org.eclipse.swt.widgets.Text createTextBox(org.eclipse.swt.widgets.Composite parent, java.lang.String text)
parent
- the parent of the new text field
public static org.eclipse.swt.widgets.Text createTextBox(org.eclipse.swt.widgets.Composite parent, int numColumns)
parent
- the parent of the new text fieldnumColumns
- number of columns the text box is to occupy
public static org.eclipse.swt.widgets.Text createTextBox(org.eclipse.swt.widgets.Composite parent, int numColumns, int minWidth)
parent
- the parent of the new text fieldnumColumns
- number of columns the text box is to occupyminWidth
- minimum width of text field
public static org.eclipse.swt.widgets.Text createTextBox(org.eclipse.swt.widgets.Composite parent, int numColumns, int minWidth, int minHeight)
parent
- the parent of the new text fieldnumColumns
- number of columns the text box is to occupyminWidth
- minimum width of text field
public static org.eclipse.swt.widgets.Text createTextBoxScrollable(org.eclipse.swt.widgets.Composite parent, int numColumns, int minWidth, int minHeight)
parent
- the parent of the new text fieldnumColumns
- number of columns the text box is to occupyminWidth
- minimum width of text fieldminHeight
- minimum height of text field
public static org.eclipse.swt.widgets.List createList(org.eclipse.swt.widgets.Composite parent, int numColumns, int minWidth, int minHeight, java.lang.String[] items)
parent
- the parent of the new text fieldnumColumns
- number of columns the text box is to occupyminWidth
- minimum width of text fieldminHeight
- minimum height of text fielditems
- the items in the list
public static org.eclipse.swt.widgets.List createList(org.eclipse.swt.widgets.Composite parent, int numColumns, int minWidth, int minHeight, java.lang.String[] items, boolean bmulti)
parent
- the parent of the new list boxnumColumns
- number of columns the list box is to occupyminWidth
- minimum width of list boxminHeight
- minimum height of list boxitems
- the items in the listbmulti
- whether multiple item selection is allowedverticalSpan
- the number of rows the list box is to occupy
public static org.eclipse.swt.widgets.List createList(org.eclipse.swt.widgets.Composite parent, int numColumns, int minWidth, int minHeight, java.lang.String[] items, boolean bmulti, int verticalSpan)
parent
- the parent of the new list boxnumColumns
- number of columns the list box is to occupyminWidth
- minimum width of list boxminHeight
- minimum height of list boxitems
- the items in the listbmulti
- whether multiple item selection is allowedverticalSpan
- the number of rows the list box is to occupy
public static void computeScrollArea(org.eclipse.swt.custom.ScrolledComposite parentComposite, org.eclipse.swt.widgets.Composite childComposite)
parentComposite
- childComposite
- public static java.lang.String[] getTokenNames(java.lang.String tokenString)
tokenString
-
public static void listenModify(org.eclipse.swt.widgets.Composite container, org.eclipse.swt.widgets.Listener listener, org.eclipse.swt.widgets.Widget[] except)
container
- listener
- except
- public static boolean notEmpty(org.eclipse.swt.widgets.Text text)
text
-
public static boolean notEmpty(org.eclipse.swt.widgets.Combo text)
text
-
public static void recursiveEnable(org.eclipse.swt.widgets.Control control, boolean enable)
control
- enable
- public static int getTableHeightHint(org.eclipse.swt.widgets.Table table, int rows)
public static void processError(java.lang.String msg, java.lang.Exception error, org.eclipse.core.runtime.IStatus status)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |