Package com.iizix.swt
Class SWTHelper
java.lang.Object
com.iizix.swt.SWTHelper
Some SWT helpers.
- Author:
- Christopher Mindus
- Constructor SummaryConstructors
- Method SummaryModifier and TypeMethodDescription- static void- addCapsLockWarning- (org.eclipse.swt.widgets.Text passwordField) Adds a caps-lock warning decorator to a password field.- static org.eclipse.swt.custom.TableEditor- addEditableTableColumn- (org.eclipse.swt.widgets.Table table, int column, int minimumWidth, org.eclipse.swt.events.ModifyListener modifyListener) Adds an editable column for a table.- static void- addMenuSeparator- (org.eclipse.swt.widgets.Menu menu) Adds a menu separator.- static void- addTableColumnResizer- (org.eclipse.swt.widgets.Table table) Adds a table column re-sizer to make the last column resize with the table and dialog box.- static void- addTableSorter- (org.eclipse.swt.widgets.Table table, String... dataKeys) Adds a table sorter.- static void- addTreeColumnResizer- (org.eclipse.swt.widgets.Tree tree) Adds a table column re-sizer to make the last column resize with the table and dialog box.- static org.eclipse.swt.browser.Browser- createBrowser- (org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.graphics.Color background) Creates a Browser instance that uses Edge under Windows if Eclipse is of version 4.21 or better and Edge is installed.- static org.eclipse.swt.graphics.Image- createImage- (int rgb, int width, int height) Create an image of a color.- static org.eclipse.swt.graphics.Image- createImage- (int rgb, int width, int height, boolean doFrame) Create an image of a color.- static org.eclipse.swt.graphics.Image- createImage- (int r, int g, int b, int width, int height) Create an image of a color.- static org.eclipse.swt.graphics.Image- createImage- (int r, int g, int b, int width, int height, boolean doFrame) Create an image of a color.- static org.eclipse.swt.graphics.Image- createImage- (org.eclipse.swt.graphics.Color color, int width, int height) Create an image of the specified color.- static org.eclipse.swt.graphics.Image- createImage- (org.eclipse.swt.graphics.Color color, int width, int height, boolean doFrame) Create an image of the specified color.- static void- enableDialogMove- (org.eclipse.swt.widgets.Shell shell) Enables move of a dialog box.- static void- expandAll- (org.eclipse.jface.viewers.TreeViewer viewer) Performs the Expand all on a tree viewer, very fast.- static void- fixComboMWScroll- (org.eclipse.swt.widgets.Control combo) Fix for Combobox processing mouse wheel when not focused in Win32, eating mouse from scroll pane.- static org.osgi.framework.VersionAttempts to get the version of the Eclipse IDE we're running in.- static intGets the edited line number of a Table Editor.- static org.eclipse.swt.widgets.TextGets the entry field being edited, null for none.- static org.eclipse.swt.widgets.Control- getFocusControl- (org.eclipse.swt.widgets.Composite composite) Gets the control in focus for a composite.- static booleanReturns if Eclipse uses Microsoft Internet Explorer (11) or not for sure, or if the default browser is being used.- static void- resizeColumns- (org.eclipse.swt.widgets.Table table) Packs the tables columns and resizes the last column in a table to fit the table width.- static void- resizeColumns- (org.eclipse.swt.widgets.Tree tree) Packs the tree table columns and resizes the last column in a table to fit the table width.- static void- setEnabledRecursive- (org.eclipse.swt.widgets.Control control, boolean isEnabled) Enables or disables a control/composite and all its children.- static void- showPopupMenu- (IzMenu menu) Displays a drop-down menu at screen location where mouse is located.- static void- showPopupMenu- (IzMenu menu, int x, int y) Displays a drop-down menu at screen location.- static void- showPopupMenu- (IzMenu menu, org.eclipse.swt.widgets.Control control) Displays a drop-down menu below a control.- static void- showPopupMenu- (IzMenu menu, org.eclipse.swt.widgets.Control control, int xOffset, int yOffset) Displays a drop-down menu below a control.- static void- showPopupMenu- (IzMenu menu, org.eclipse.swt.widgets.ToolItem item) Displays a drop-down menu below a control.- static void- showPopupMenu- (org.eclipse.swt.widgets.Menu menu) Displays a drop-down menu at screen location where mouse is located.- static void- showPopupMenu- (org.eclipse.swt.widgets.Menu menu, int x, int y) Displays a drop-down menu at screen location.- static void- showPopupMenu- (org.eclipse.swt.widgets.Menu menu, org.eclipse.swt.widgets.Control control) Displays a drop-down menu below a control.- static void- showPopupMenu- (org.eclipse.swt.widgets.Menu menu, org.eclipse.swt.widgets.Control control, int xOffset, int yOffset) Displays a drop-down menu below a control.- static void- showPopupMenu- (org.eclipse.swt.widgets.Menu menu, org.eclipse.swt.widgets.ToolItem item) Displays a drop-down menu below a control.
- Constructor Details- SWTHelperpublic SWTHelper()
 
- Method Details- resizeColumnspublic static void resizeColumns- (org.eclipse.swt.widgets.Table table) Packs the tables columns and resizes the last column in a table to fit the table width.- Parameters:
- table- The table to resize the last column.
 
- resizeColumnspublic static void resizeColumns- (org.eclipse.swt.widgets.Tree tree) Packs the tree table columns and resizes the last column in a table to fit the table width.- Parameters:
- tree- The tree table to resize the last column.
 
- addTableColumnResizerpublic static void addTableColumnResizer- (org.eclipse.swt.widgets.Table table) Adds a table column re-sizer to make the last column resize with the table and dialog box.- Parameters:
- table- The table to resize the last column.
 
- addTreeColumnResizerpublic static void addTreeColumnResizer- (org.eclipse.swt.widgets.Tree tree) Adds a table column re-sizer to make the last column resize with the table and dialog box.- Parameters:
- tree- The tree to resize the last column.
 
- addTableSorterAdds a table sorter.
- addEditableTableColumnpublic static org.eclipse.swt.custom.TableEditor addEditableTableColumn- (org.eclipse.swt.widgets.Table table, int column, int minimumWidth, org.eclipse.swt.events.ModifyListener modifyListener) Adds an editable column for a table.- Parameters:
- table- The table.
- column- The column index.
- minimumWidth- The minimum pixel width of the Text editor (for layout).
- modifyListener- Possible listener for entry field Text modifications.
- Returns:
- The table editor created.
 
- getEditedTableLinepublic static int getEditedTableLine()Gets the edited line number of a Table Editor.
- getEditedTableTextpublic static org.eclipse.swt.widgets.Text getEditedTableText()Gets the entry field being edited, null for none.
- createImagepublic static org.eclipse.swt.graphics.Image createImage- (int rgb, int width, int height) Create an image of a color.- Parameters:
- rgb- RGB value color.
- width- Width of image.
- height- Height of image.
- Returns:
- The image filled with the color.
 
- createImagepublic static org.eclipse.swt.graphics.Image createImage- (int rgb, int width, int height, boolean doFrame) Create an image of a color.- Parameters:
- rgb- RGB value color.
- width- Width of image.
- height- Height of image.
- doFrame- If the image should be framed.
- Returns:
- The image filled with the color.
 
- createImagepublic static org.eclipse.swt.graphics.Image createImage- (int r, int g, int b, int width, int height) Create an image of a color.- Parameters:
- r- Red color of image (0-255).
- g- Green color of image (0-255).
- b- Blue color of image (0-255).
- width- Width of image.
- height- Height of image.
- Returns:
- The image filled with the color.
 
- createImagepublic static org.eclipse.swt.graphics.Image createImage- (int r, int g, int b, int width, int height, boolean doFrame) Create an image of a color.- Parameters:
- r- Red color of image (0-255).
- g- Green color of image (0-255).
- b- Blue color of image (0-255).
- width- Width of image.
- height- Height of image.
- doFrame- If the image should be framed.
- Returns:
- The image filled with the color.
 
- createImagepublic static org.eclipse.swt.graphics.Image createImage- (org.eclipse.swt.graphics.Color color, int width, int height) Create an image of the specified color.- Parameters:
- color- Color of image.
- width- Width of image.
- height- Height of image.
- Returns:
- The image filled with the color.
 
- createImagepublic static org.eclipse.swt.graphics.Image createImage- (org.eclipse.swt.graphics.Color color, int width, int height, boolean doFrame) Create an image of the specified color.- Parameters:
- color- Color of image.
- width- Width of image.
- height- Height of image.
- doFrame- If the image should be framed.
- Returns:
- The image filled with the color.
 
- showPopupMenupublic static void showPopupMenu- (org.eclipse.swt.widgets.Menu menu, org.eclipse.swt.widgets.ToolItem item) Displays a drop-down menu below a control.
- showPopupMenuDisplays a drop-down menu below a control.
- showPopupMenupublic static void showPopupMenu- (org.eclipse.swt.widgets.Menu menu, org.eclipse.swt.widgets.Control control) Displays a drop-down menu below a control.
- showPopupMenuDisplays a drop-down menu below a control.
- showPopupMenupublic static void showPopupMenu- (org.eclipse.swt.widgets.Menu menu, org.eclipse.swt.widgets.Control control, int xOffset, int yOffset) Displays a drop-down menu below a control.
- showPopupMenupublic static void showPopupMenu- (IzMenu menu, org.eclipse.swt.widgets.Control control, int xOffset, int yOffset) Displays a drop-down menu below a control.
- showPopupMenupublic static void showPopupMenu- (org.eclipse.swt.widgets.Menu menu, int x, int y) Displays a drop-down menu at screen location.
- showPopupMenuDisplays a drop-down menu at screen location.
- showPopupMenupublic static void showPopupMenu- (org.eclipse.swt.widgets.Menu menu) Displays a drop-down menu at screen location where mouse is located.
- showPopupMenuDisplays a drop-down menu at screen location where mouse is located.
- expandAllpublic static void expandAll- (org.eclipse.jface.viewers.TreeViewer viewer) Performs the Expand all on a tree viewer, very fast.
- getFocusControlpublic static org.eclipse.swt.widgets.Control getFocusControl- (org.eclipse.swt.widgets.Composite composite) Gets the control in focus for a composite.- Returns:
- The control having focus in the composite, of null for none.
 
- fixComboMWScrollpublic static void fixComboMWScroll- (org.eclipse.swt.widgets.Control combo) Fix for Combobox processing mouse wheel when not focused in Win32, eating mouse from scroll pane.
- setEnabledRecursivepublic static void setEnabledRecursive- (org.eclipse.swt.widgets.Control control, boolean isEnabled) Enables or disables a control/composite and all its children.- Parameters:
- control- The control or composite.
- isEnabled- Enabled flag.
 
- addMenuSeparatorpublic static void addMenuSeparator- (org.eclipse.swt.widgets.Menu menu) Adds a menu separator.- Parameters:
- menu- The menu.
 
- enableDialogMovepublic static void enableDialogMove- (org.eclipse.swt.widgets.Shell shell) Enables move of a dialog box.- Parameters:
- shell- The shell that should be movable.
 
- addCapsLockWarningpublic static void addCapsLockWarning- (org.eclipse.swt.widgets.Text passwordField) Adds a caps-lock warning decorator to a password field. If you call this method multiple times for the same password field, nothing will happen (except for the first time).- Parameters:
- passwordField- The password field.
 
- getEclipseVersionpublic static org.osgi.framework.Version getEclipseVersion()Attempts to get the version of the Eclipse IDE we're running in.- Returns:
- The version, or null if it couldn't be detected.
 
- createBrowserpublic static org.eclipse.swt.browser.Browser createBrowser- (org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.graphics.Color background) Creates a Browser instance that uses Edge under Windows if Eclipse is of version 4.21 or better and Edge is installed. If the environment variable "com.iizi.browser" is set to either "default", "edge" or "webkit", that type of browser will be used (the string value of the environment variable is case insensitive).- Parameters:
- parent- The parent composite.
- background- The background color.
- Returns:
- The browser instance.
 
- isUsingMSIEpublic static boolean isUsingMSIE()Returns if Eclipse uses Microsoft Internet Explorer (11) or not for sure, or if the default browser is being used. This value is always false if such a browser instance never has been created.- Returns:
- true If Microsoft Internet Explorer has been used previously for WebViews and is the candidate for default WebView usage.