Class Utils
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
static class
static class
private static class
private static class
static interface
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static Pattern
(package private) static ConcurrentLinkedQueue
<Object[]> (package private) static Runnable
(package private) static AtomicInteger
private static boolean
static int
static int
private static ParameterListener
private static ParameterListener
private static ParameterListener
private static boolean
private static final boolean
Debug/Diagnose SWT exec calls.private static AEDiagnosticsLogger
private static org.eclipse.swt.widgets.Display
private static AtomicInteger
private static int
static final org.eclipse.swt.graphics.Rectangle
private static AEDiagnosticsEvidenceGenerator
private static AsyncDispatcher
private static boolean
static final String
private static boolean
private static boolean
private static boolean
private static boolean
(package private) static final boolean
private static Pattern
private static boolean
private static org.eclipse.swt.graphics.Image
private static Boolean
private static boolean
private static boolean
static final boolean
static boolean
static final boolean
Some platforms expand the last column to fit the remaining width of the table.private static CopyOnWriteList
<Utils.TerminateListener> private static ParameterListener
static final String
private static Set
<DiskManagerFileInfo> private static TimerEventPeriodic
private static int
static final String
static final int
static final int
static final int
static final int
private static String
private static org.eclipse.swt.graphics.Image[]
private static Utils.Skinner
private static int
private static final String
private static final int
private static final int
static final boolean
GTK already handles alternating background for tablesprivate static boolean
private static boolean
static final String
private static ThreadPool
private static Map
private static boolean
(package private) static final boolean
private static int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addAndFireParameterListener
(Map<String, ParameterListener> mapConfigListeners, boolean requiresSWTThread, String parameter, ParameterListener listener) static void
addListenerAndChildren
(org.eclipse.swt.widgets.Composite area, int event, org.eclipse.swt.widgets.Listener listener) static void
addSafeMouseUpListener
(org.eclipse.swt.widgets.Control control, org.eclipse.swt.widgets.Listener mouseUpListener) static void
addSafeMouseUpListener
(org.eclipse.swt.widgets.Control control, org.eclipse.swt.widgets.Listener mouseDownListener, org.eclipse.swt.widgets.Listener mouseUpListener) static void
static void
alternateRowBackground
(org.eclipse.swt.widgets.TableItem item) static void
alternateTableBackground
(org.eclipse.swt.widgets.Table table) static boolean
anyShellHaveStyle
(int styles) static void
beep()
static org.eclipse.swt.graphics.Image
blitImage
(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.Image srcImage, org.eclipse.swt.graphics.Rectangle srcArea, org.eclipse.swt.graphics.Image dstImage, org.eclipse.swt.graphics.Point dstPos) static boolean
static void
centerRelativeTo
(org.eclipse.swt.graphics.Rectangle target, org.eclipse.swt.graphics.Rectangle reference) Centers the targetRectangle
relative to the reference Rectanglestatic void
centerWindowRelativeTo
(org.eclipse.swt.widgets.Shell window, org.eclipse.swt.widgets.Control control) Centers a window relative to a control.static void
centreWindow
(org.eclipse.swt.widgets.Shell shell) static void
centreWindow
(org.eclipse.swt.widgets.Shell shell, boolean shrink_if_needed) static void
clearMenu
(org.eclipse.swt.widgets.Menu menu) static int[]
colorToIntArray
(org.eclipse.swt.graphics.Color color) private static BufferedImage
convertToAWT
(org.eclipse.swt.graphics.ImageData data) private static org.eclipse.swt.graphics.ImageData
convertToSWT
(BufferedImage bufferedImage) static org.eclipse.swt.widgets.Button
createAlertButton
(org.eclipse.swt.widgets.Composite panel, String localizationKey) static org.eclipse.swt.graphics.Image
createAlphaImage
(org.eclipse.swt.graphics.Device device, int width, int height) static org.eclipse.swt.graphics.Image
createAlphaImage
(org.eclipse.swt.graphics.Device device, int width, int height, byte defaultAlpha) static Utils.ColorButton
createColorButton
(org.eclipse.swt.widgets.Composite composite, org.eclipse.swt.graphics.Point size, boolean isForeground, int[] existingColor, int[] defaultColor, Consumer<int[]> listener) static org.eclipse.swt.widgets.Button[]
createOKCancelButtons
(org.eclipse.swt.widgets.Composite panel) static BrowserWrapper
createSafeBrowser
(org.eclipse.swt.widgets.Composite parent, int style) static org.eclipse.swt.widgets.Sash
createSash
(org.eclipse.swt.widgets.Composite form, int SASH_WIDTH) static org.eclipse.swt.widgets.Sash
createSash
(org.eclipse.swt.widgets.Composite form, int SASH_WIDTH, int style) static Utils.SashWrapper
createSashWrapper
(org.eclipse.swt.widgets.Composite parent, String config_key, int def_pct) static Utils.SashWrapper2
createSashWrapper2
(org.eclipse.swt.widgets.Composite parent, String config_key) static org.eclipse.swt.widgets.Composite
createScrolledComposite
(org.eclipse.swt.widgets.Composite parent) Creates a ScrollComposite that scrolls vertically and handles recalculating size.static org.eclipse.swt.widgets.Composite
createScrolledComposite
(org.eclipse.swt.widgets.Composite parent, int style) private static org.eclipse.swt.widgets.Composite
createScrolledComposite
(org.eclipse.swt.widgets.Composite parent, int style, org.eclipse.swt.widgets.Control mega_parent) static org.eclipse.swt.widgets.Composite
createScrolledComposite
(org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.widgets.Control mega_parent) static org.eclipse.swt.widgets.Composite
createSkinnedComposite
(org.eclipse.swt.widgets.Composite parent, int style, Object parentLayoutData) static org.eclipse.swt.widgets.Composite[]
createSkinnedCompositeEx
(org.eclipse.swt.widgets.Composite parent, int style, Object parentLayoutData) static org.eclipse.swt.widgets.Group
createSkinnedGroup
(org.eclipse.swt.widgets.Composite parent, int style) static org.eclipse.swt.widgets.Control
createSkinnedLabelSeparator
(org.eclipse.swt.widgets.Composite parent, int style) static org.eclipse.swt.widgets.Control
createSkinnedLabelSeparator
(org.eclipse.swt.widgets.Composite parent, int style, org.eclipse.swt.graphics.Color color) static org.eclipse.swt.custom.StyledText
createStyledText
(org.eclipse.swt.widgets.Composite parent, int style) static String
createSubViewID
(String base, String sub) static void
dispose()
static void
disposeComposite
(org.eclipse.swt.widgets.Composite composite) static void
disposeComposite
(org.eclipse.swt.widgets.Composite composite, boolean disposeSelf) static void
disposeSWTObjects
(Object... disposeList) static void
disposeSWTObjects
(List disposeList) Dispose of a list of SWT objectsstatic boolean
drawImage
(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Image image, org.eclipse.swt.graphics.Point srcStart, org.eclipse.swt.graphics.Rectangle dstRect, org.eclipse.swt.graphics.Rectangle clipping, int hOffset, int vOffset, boolean clearArea) static void
drawImageCenterScaleDown
(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Image imgSrc, org.eclipse.swt.graphics.Rectangle area) static void
drawResizedImage
(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight) static void
drawStriped
(org.eclipse.swt.graphics.GC gcImg, int x, int y, int width, int height, int lineDist, int leftshift, boolean fallingLines) Draws diagonal stripes onto the specified area of a GCprivate static void
dump
(IndentWriter iw, org.eclipse.swt.widgets.Control comp, Set<Object> done) static void
dump
(org.eclipse.swt.widgets.Control comp) static void
static void
static String
escapeAccelerators
(String str) static boolean
execSWTThread
(Runnable code) Execute code in the Runnable object using SWT's thread.static boolean
execSWTThread
(Runnable code, boolean async) Execute code in the Runnable object using SWT's thread.private static boolean
execSWTThread
(Runnable code, int msLater) static boolean
execSWTThreadLater
(int msLater, Runnable code) Schedule execution of the code in the Runnable object using SWT's thread.static Boolean
execSWTThreadWithBool
(String ID, AERunnableBoolean code, long millis) Runs code within the SWT thread, waits for code to complete executing, (using a semaphore), and then returns a value.static Object
execSWTThreadWithObject
(String ID, AERunnableObject code, long millis) Runs code within the SWT thread, waits for code to complete executing, (using a semaphore), and then returns a value.private static boolean
fallbackLaunch
(String command, String... args) static boolean
fileExistsWithTimeout
(File file) static boolean
fileExistsWithTimeout
(String path) static long
fileLengthWithTimeout
(File file) static org.eclipse.swt.widgets.Shell
static org.eclipse.swt.widgets.Shell
findAnyShell
(boolean preferMainShell) static org.eclipse.swt.widgets.Control
findBackgroundImageControl
(org.eclipse.swt.widgets.Control control) static org.eclipse.swt.widgets.Control
findChild
(org.eclipse.swt.widgets.Composite comp, int x, int y) static org.eclipse.swt.widgets.Shell
findFirstShellWithStyle
(int styles) static org.eclipse.swt.widgets.Shell
static List
<org.eclipse.swt.widgets.Control> getAllChildren
(org.eclipse.swt.widgets.Composite c) private static void
getAllChildren
(org.eclipse.swt.widgets.Control c, List<org.eclipse.swt.widgets.Control> kids) static String
getBaseViewID
(String id) static String
static String
getCCString
(String cc) static org.eclipse.swt.graphics.Color
getConfigColor
(String name, org.eclipse.swt.graphics.Color def) static org.eclipse.swt.widgets.Control
Sometimes, Display.getCursorControl doesn't go deep enough..static org.eclipse.swt.widgets.Control
getCursorControl
(org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.graphics.Point cursorLocation) static List
<org.eclipse.swt.graphics.RGB> static int
static int
static org.eclipse.swt.widgets.Display
private static org.eclipse.swt.widgets.Display
getDisplay
(boolean warn) static org.eclipse.swt.widgets.Display
static int
private static String
getExplicitLauncher
(String file) static org.eclipse.swt.layout.FormData
static org.eclipse.swt.layout.GridData
getHSpanGridData
(int hspan, int styles) static String
getLinkFromClipboard
(org.eclipse.swt.widgets.Display display) Gets a URL from the clipboardstatic org.eclipse.swt.graphics.Point
getLocationRelativeToShell
(org.eclipse.swt.widgets.Control control) private static org.eclipse.swt.widgets.Monitor
getMonitor
(int x, int y) Returns theMonitor
that the given x,y coordinates resides instatic org.eclipse.swt.widgets.Monitor
getMonitor
(org.eclipse.swt.graphics.Point location) Returns theMonitor
that the givenPoint
resides instatic void
getOffOfSWTThread
(AERunnable runnable) static void
getOffOfSWTThread
(Runnable runnable) static String
static org.eclipse.swt.graphics.Image
getResizedImage
(org.eclipse.swt.graphics.Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destWidth, int destHeight) static org.eclipse.swt.layout.GridLayout
getSimpleGridLayout
(int cols) static org.eclipse.swt.layout.RowLayout
getSimpleRowLayout
(boolean fill) static org.eclipse.swt.graphics.Color
getSkinnedBackground
(org.eclipse.swt.widgets.Control c) static org.eclipse.swt.graphics.Color
getSkinnedForeground
(org.eclipse.swt.widgets.Control c) static String
static int
static int
static String
static int
getTableBottomIndex
(org.eclipse.swt.widgets.Table table, int iTopIndex) Bottom Index may be negative.static boolean
static int
static String
static org.eclipse.swt.layout.GridData
getWrappableLabelGridData
(int hspan, int styles) static boolean
private static void
handlePluginLaunch
(String eb_choice, String net_type, boolean use_plugins, String sFileOriginal, String sFileModified, boolean sync, boolean force_url, boolean force_anon) static boolean
hasAlpha
(org.eclipse.swt.graphics.Image image) static boolean
hasShellMetricsConfig
(String sConfigPrefix) static boolean
hasSkinnedBackground
(org.eclipse.swt.widgets.Control control) static boolean
hasSkinnedForeground
(org.eclipse.swt.widgets.Control control) static void
initialize
(org.eclipse.swt.widgets.Display _display) (package private) static void
initStatic
(Core core) private static boolean
installTorBrowser
(String remember_id, boolean[] install_outcome, Runnable callback) static boolean
isAZ2UI()
static boolean
isAZ3UI()
static boolean
static boolean
static boolean
Hack to switch some things to dark on Windows until proper support availablestatic boolean
static boolean
static boolean
static boolean
static boolean
static boolean
static boolean
static boolean
static boolean
static void
launch
(DiskManagerFileInfo fileInfo) static void
static void
static void
static void
static void
static void
static void
launchFileExplicit
(DiskManagerFileInfo file, String exe) static void
launchFileExplicit
(String sfile, String... cmd_args) static boolean
linkShellMetricsToConfig
(org.eclipse.swt.widgets.Shell shell, String sConfigPrefix) static File[]
static void
maintainSashPanelWidth
(org.eclipse.swt.custom.SashForm sash, org.eclipse.swt.widgets.Composite comp, int[] default_weights, String config_key) static void
makeButtonsEqualWidth
(List<org.eclipse.swt.widgets.Button> buttons) static void
makeButtonsEqualWidth
(org.eclipse.swt.widgets.Button... buttons) private static Runnable
makeRunnableSafe
(Runnable code) static void
makeVisibleOnCursor
(org.eclipse.swt.graphics.Rectangle rect) Ensure that the givenRectangle
is fully visible on the monitor that the cursor is currently in.static void
makeVisibleOnMonitor
(org.eclipse.swt.graphics.Rectangle rect, org.eclipse.swt.widgets.Monitor monitor) Ensure that the givenRectangle
is fully visible on the givenMonitor
.static void
private static void
quickView
(DiskManagerFileInfo file) private static void
static boolean
readAndDispatchLoop
(Supplier<Boolean> done) static void
readAndDispatchLoop
(org.eclipse.swt.widgets.Control owner) static void
readAndDispatchLoop
(org.eclipse.swt.widgets.Control owner, boolean check_visible) static void
static void
readAndDispatchUntilIdleFor
(long millis) static void
static void
relayout
(org.eclipse.swt.widgets.Control control) Relayout all composites up from control until there's enough room for the control to fitstatic void
relayout
(org.eclipse.swt.widgets.Control control, boolean expandOnly) Relayout all composites up from control until there's enough room for the control to fitstatic void
relayoutUp
(org.eclipse.swt.widgets.Composite c) static void
removeParameterListeners
(Map<String, ParameterListener> mapListeners) static org.eclipse.swt.graphics.Image
renderTransparency
(org.eclipse.swt.widgets.Display display, org.eclipse.swt.graphics.Image background, org.eclipse.swt.graphics.Image foreground, org.eclipse.swt.graphics.Point foregroundOffsetOnBg, int modifyForegroundAlpha) static void
static org.eclipse.swt.graphics.Image
resizeImage
(org.eclipse.swt.graphics.Image image, int newWidth, int newHeight) Resizes an image, using the given scaling factor.static boolean
runIfNotSWTThread
(Runnable code) Run code on SWT Thread if we are calling from non-SWT Thread.static void
setCheckedInSetData
(org.eclipse.swt.widgets.TableItem item, boolean checked) Sets the checkbox in a Virtual Table while inside a SWT.SetData listener trigger.static void
setClipping
(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle r) static void
setConfigColor
(String name, org.eclipse.swt.graphics.Color c) static void
setEnabled
(org.eclipse.swt.widgets.Composite composite, boolean enabled) static org.eclipse.swt.layout.GridData
setGridData
(org.eclipse.swt.widgets.Composite composite, int gridStyle, org.eclipse.swt.widgets.Control ctrlBestSize, int maxHeight) static void
setLinkForeground
(org.eclipse.swt.widgets.Control label) static void
setMenuItemImage
(MenuItem item, String repoKey) static void
setMenuItemImage
(org.eclipse.swt.custom.CLabel item, String repoKey) static void
setMenuItemImage
(org.eclipse.swt.widgets.MenuItem item, String repoKey) Set a MenuItem's image with the given ImageRepository key.static void
setMenuItemImage
(org.eclipse.swt.widgets.MenuItem item, org.eclipse.swt.graphics.Image image) static boolean
setPeronalShare
(Map<String, String> properties) static void
setQuickViewActive
(DiskManagerFileInfo file, boolean active) static void
setShellIcon
(org.eclipse.swt.widgets.Shell shell) Sets the shell's Icon(s) to the default App icon.static void
setShellMetricsConfigEnabled
(org.eclipse.swt.widgets.Shell shell, boolean enabled) static void
setSkinnedBackground
(org.eclipse.swt.widgets.Control control, org.eclipse.swt.graphics.Color color) static void
setSkinnedBackground
(org.eclipse.swt.widgets.Control control, org.eclipse.swt.graphics.Color color, boolean force) static void
setSkinnedBackground
(org.eclipse.swt.widgets.Control control, org.eclipse.swt.widgets.Control from) private static void
setSkinnedBackgroundDefault
(org.eclipse.swt.widgets.Control control, org.eclipse.swt.graphics.Color color) static void
setSkinnedControlType
(org.eclipse.swt.widgets.Control control, int type) static void
setSkinnedForeground
(org.eclipse.swt.widgets.Control control, org.eclipse.swt.graphics.Color color) static void
setSkinnedForeground
(org.eclipse.swt.widgets.Control control, org.eclipse.swt.graphics.Color color, boolean force) private static void
setSkinnedForegroundDefault
(org.eclipse.swt.custom.CTabItem control, org.eclipse.swt.graphics.Color color) private static void
setSkinnedForegroundDefault
(org.eclipse.swt.widgets.Control control, org.eclipse.swt.graphics.Color color) static void
setSkinningEnabled
(boolean enabled) static void
static void
setTextWithURLs
(org.eclipse.swt.custom.StyledText text, String value, boolean allow_focus) static void
setTT
(BufferedTruncatedLabel c, String text) static void
setTT
(UISWTStatusEntry c, String text) static void
setTT
(TrayItemDelegate c, String text) static void
static void
static void
static void
static void
static void
setUIVisible
(boolean visible) static org.eclipse.swt.graphics.RGB
showColorDialog
(org.eclipse.swt.widgets.Control parent, org.eclipse.swt.graphics.RGB existing) static org.eclipse.swt.graphics.RGB
showColorDialog
(org.eclipse.swt.widgets.Shell parent_shell, org.eclipse.swt.graphics.RGB existing) static void
static void
static String
toColorHexString
(org.eclipse.swt.graphics.Color color) static String
truncateText
(org.eclipse.swt.graphics.GC gc, String text, int maxWidth, boolean cache) private static void
twoHex
(StringBuffer sb, int h) static void
updateCustomColors
(org.eclipse.swt.graphics.RGB[] new_cc) static void
updateScrolledComposite
(org.eclipse.swt.custom.ScrolledComposite sc) protected static void
updateScrolledComposite
(org.eclipse.swt.custom.ScrolledComposite sc, int style) static boolean
verifyShellRect
(org.eclipse.swt.widgets.Shell shell, boolean bAdjustIfInvalid) private static boolean
verifyShellRect
(org.eclipse.swt.widgets.Shell shell, boolean bAdjustIfInvalid, boolean reverifyOnChange) static void
Waits until modal dialogs are disposed.
-
Field Details
-
hasDPIUtils
static final boolean hasDPIUtils -
GOOD_STRING
- See Also:
-
isGTK
public static final boolean isGTK -
isGTK3
public static boolean isGTK3 -
LAST_TABLECOLUMN_EXPANDS
public static final boolean LAST_TABLECOLUMN_EXPANDSSome platforms expand the last column to fit the remaining width of the table. -
TABLE_GRIDLINE_IS_ALTERNATING_COLOR
public static final boolean TABLE_GRIDLINE_IS_ALTERNATING_COLORGTK already handles alternating background for tables -
BUTTON_MARGIN
public static int BUTTON_MARGIN -
BUTTON_MINWIDTH
public static int BUTTON_MINWIDTH -
SCT_SKINNING_DISABLED
public static final int SCT_SKINNING_DISABLED- See Also:
-
SCT_NONE
public static final int SCT_NONE- See Also:
-
SCT_BUBBLE_TEXT_BOX
public static final int SCT_BUBBLE_TEXT_BOX- See Also:
-
SCT_MENU_ITEM
public static final int SCT_MENU_ITEM- See Also:
-
DEBUG_SWTEXEC
private static final boolean DEBUG_SWTEXECDebug/Diagnose SWT exec calls. Provides useful information like how many we are queuing up, and how long each call takes. Good to turn on occasionally to see if we coded something stupid. -
queue
-
diag_logger
-
shellIcons
private static org.eclipse.swt.graphics.Image[] shellIcons -
icon128
private static org.eclipse.swt.graphics.Image icon128 -
EMPTY_RECT
public static final org.eclipse.swt.graphics.Rectangle EMPTY_RECT -
userMode
private static int userMode -
isAZ2
private static boolean isAZ2 -
isAZ3
private static boolean isAZ3 -
evidenceGenerator
-
configUserModeListener
-
configUIListener
-
configOtherListener
-
terminated
private static boolean terminated -
SWT_VERSION
private static final int SWT_VERSION -
SWT_REVISION
private static final int SWT_REVISION -
SWT_PLATFORM
-
is_dark_appearance
-
force_dark_appearance
private static boolean force_dark_appearance -
skinner
-
skinning_enabled
private static int skinning_enabled -
dark_misc_things
private static volatile boolean dark_misc_things -
gradient_fill
private static volatile boolean gradient_fill -
gui_refresh_disable_when_min
private static volatile boolean gui_refresh_disable_when_min -
gui_is_minimized
private static volatile boolean gui_is_minimized -
gui_refresh_enable
private static volatile boolean gui_refresh_enable -
SHELL_METRICS_DISABLED_KEY
-
display
private static org.eclipse.swt.widgets.Display display -
quick_view_active
-
quick_view_event
-
dragDetectMask
private static volatile int dragDetectMask -
listeners
-
USE_ASYNC_EXEC_QUEUE
static final boolean USE_ASYNC_EXEC_QUEUE- Since:
- 3.0.4.3
- See Also:
-
async_seq
-
async_exec_q
-
async_runner
-
pending_ext_urls
-
ext_url_dispatcher
-
i2p_install_active_for_url
private static boolean i2p_install_active_for_url -
browser_install_active_for_url
private static boolean browser_install_active_for_url -
tb_installing
private static boolean tb_installing -
PL_SHOW_FILE
- See Also:
-
truncatedTextCache
-
THREAD_NAME_OFFSWT
- See Also:
-
tp
-
qv_exts
-
qv_max_bytes
private static int qv_max_bytes -
pconfigQuickViewListeners
-
RELAYOUT_UP_STOP_HERE
- See Also:
-
tt_enabled
private static boolean tt_enabled -
a_pattern
-
href_pattern
-
dl_depth
-
-
Constructor Details
-
Utils
public Utils()
-
-
Method Details
-
initStatic
-
initialize
public static void initialize(org.eclipse.swt.widgets.Display _display) -
setSkinningEnabled
public static void setSkinningEnabled(boolean enabled) -
setSkinnedControlType
public static void setSkinnedControlType(org.eclipse.swt.widgets.Control control, int type) -
setSkinnedForegroundDefault
private static void setSkinnedForegroundDefault(org.eclipse.swt.widgets.Control control, org.eclipse.swt.graphics.Color color) -
setSkinnedBackgroundDefault
private static void setSkinnedBackgroundDefault(org.eclipse.swt.widgets.Control control, org.eclipse.swt.graphics.Color color) -
setSkinnedForegroundDefault
private static void setSkinnedForegroundDefault(org.eclipse.swt.custom.CTabItem control, org.eclipse.swt.graphics.Color color) -
hasSkinnedForeground
public static boolean hasSkinnedForeground(org.eclipse.swt.widgets.Control control) -
setSkinnedForeground
public static void setSkinnedForeground(org.eclipse.swt.widgets.Control control, org.eclipse.swt.graphics.Color color) -
setSkinnedForeground
public static void setSkinnedForeground(org.eclipse.swt.widgets.Control control, org.eclipse.swt.graphics.Color color, boolean force) -
getSkinnedForeground
public static org.eclipse.swt.graphics.Color getSkinnedForeground(org.eclipse.swt.widgets.Control c) -
hasSkinnedBackground
public static boolean hasSkinnedBackground(org.eclipse.swt.widgets.Control control) -
getSkinnedBackground
public static org.eclipse.swt.graphics.Color getSkinnedBackground(org.eclipse.swt.widgets.Control c) -
setSkinnedBackground
public static void setSkinnedBackground(org.eclipse.swt.widgets.Control control, org.eclipse.swt.graphics.Color color) -
setSkinnedBackground
public static void setSkinnedBackground(org.eclipse.swt.widgets.Control control, org.eclipse.swt.graphics.Color color, boolean force) -
setSkinnedBackground
public static void setSkinnedBackground(org.eclipse.swt.widgets.Control control, org.eclipse.swt.widgets.Control from) -
createSkinnedLabelSeparator
public static org.eclipse.swt.widgets.Control createSkinnedLabelSeparator(org.eclipse.swt.widgets.Composite parent, int style) -
createSkinnedLabelSeparator
public static org.eclipse.swt.widgets.Control createSkinnedLabelSeparator(org.eclipse.swt.widgets.Composite parent, int style, org.eclipse.swt.graphics.Color color) -
createSkinnedComposite
public static org.eclipse.swt.widgets.Composite createSkinnedComposite(org.eclipse.swt.widgets.Composite parent, int style, Object parentLayoutData) -
createSkinnedCompositeEx
public static org.eclipse.swt.widgets.Composite[] createSkinnedCompositeEx(org.eclipse.swt.widgets.Composite parent, int style, Object parentLayoutData) -
createSkinnedGroup
public static org.eclipse.swt.widgets.Group createSkinnedGroup(org.eclipse.swt.widgets.Composite parent, int style) -
setLinkForeground
public static void setLinkForeground(org.eclipse.swt.widgets.Control label) -
getDragDetectModifiers
public static int getDragDetectModifiers() -
getSWTVersion
public static int getSWTVersion() -
getSWTRevision
public static int getSWTRevision() -
getSWTPlatform
-
getSWTVersionAndRevision
-
getDeviceZoom
public static int getDeviceZoom() -
setUIVisible
public static void setUIVisible(boolean visible) -
isUIUpdateEnabled
public static boolean isUIUpdateEnabled() -
addTerminateListener
-
setTerminated
public static void setTerminated() -
isTerminated
public static boolean isTerminated() -
isAZ2UI
public static boolean isAZ2UI() -
isAZ3UI
public static boolean isAZ3UI() -
getUserMode
public static int getUserMode() -
setEnabled
public static void setEnabled(org.eclipse.swt.widgets.Composite composite, boolean enabled) -
disposeComposite
public static void disposeComposite(org.eclipse.swt.widgets.Composite composite, boolean disposeSelf) -
disposeComposite
public static void disposeComposite(org.eclipse.swt.widgets.Composite composite) -
disposeSWTObjects
Dispose of a list of SWT objects- Parameters:
disposeList
-
-
disposeSWTObjects
-
getLinkFromClipboard
Gets a URL from the clipboard
The supported protocols currently are http, https and udp.
- Parameters:
display
-- Returns:
- first valid link from clipboard, else "http://"
-
centreWindow
public static void centreWindow(org.eclipse.swt.widgets.Shell shell) -
centreWindow
public static void centreWindow(org.eclipse.swt.widgets.Shell shell, boolean shrink_if_needed) -
centerWindowRelativeTo
public static void centerWindowRelativeTo(org.eclipse.swt.widgets.Shell window, org.eclipse.swt.widgets.Control control) Centers a window relative to a control. That is to say, the window will be located at the center of the control.- Parameters:
window
-control
-
-
getCustomColors
-
updateCustomColors
public static void updateCustomColors(org.eclipse.swt.graphics.RGB[] new_cc) -
getConfigColor
public static org.eclipse.swt.graphics.Color getConfigColor(String name, org.eclipse.swt.graphics.Color def) -
setConfigColor
-
createColorButton
public static Utils.ColorButton createColorButton(org.eclipse.swt.widgets.Composite composite, org.eclipse.swt.graphics.Point size, boolean isForeground, int[] existingColor, int[] defaultColor, Consumer<int[]> listener) -
showColorDialog
public static org.eclipse.swt.graphics.RGB showColorDialog(org.eclipse.swt.widgets.Control parent, org.eclipse.swt.graphics.RGB existing) -
showColorDialog
public static org.eclipse.swt.graphics.RGB showColorDialog(org.eclipse.swt.widgets.Shell parent_shell, org.eclipse.swt.graphics.RGB existing) -
isDisplayDisposed
public static boolean isDisplayDisposed() -
getDisplayIfNotDisposing
public static org.eclipse.swt.widgets.Display getDisplayIfNotDisposing() -
getSimpleRowLayout
public static org.eclipse.swt.layout.RowLayout getSimpleRowLayout(boolean fill) -
getSimpleGridLayout
public static org.eclipse.swt.layout.GridLayout getSimpleGridLayout(int cols) -
alternateRowBackground
public static void alternateRowBackground(org.eclipse.swt.widgets.TableItem item) -
alternateTableBackground
public static void alternateTableBackground(org.eclipse.swt.widgets.Table table) -
setMenuItemImage
Set a MenuItem's image with the given ImageRepository key. In compliance with platform human interface guidelines, the images are not set under Mac OS X.
- Parameters:
item
- SWT MenuItemrepoKey
- ImageRepository image key- See Also:
-
setMenuItemImage
-
setMenuItemImage
public static void setMenuItemImage(org.eclipse.swt.widgets.MenuItem item, org.eclipse.swt.graphics.Image image) -
setShellIcon
public static void setShellIcon(org.eclipse.swt.widgets.Shell shell) Sets the shell's Icon(s) to the default App icon. OSX doesn't require an icon, so they are skipped- Parameters:
shell
-
-
getDisplay
public static org.eclipse.swt.widgets.Display getDisplay() -
getDisplay
private static org.eclipse.swt.widgets.Display getDisplay(boolean warn) -
execSWTThread
Execute code in the Runnable object using SWT's thread. If current thread it already SWT's thread, the code will run immediately. If the current thread is not SWT's, code will be run either synchronously or asynchronously on SWT's thread at the next reasonable opportunity. This method does not catch any exceptions.- Parameters:
code
- code to runasync
- true if SWT asyncExec, false if SWT syncExec- Returns:
- success
-
execSWTThreadLater
Schedule execution of the code in the Runnable object using SWT's thread. Even if the current thread is the SWT Thread, the code will be scheduled.Much like Display.asyncExec, except getting the display is handled for you, and provides the ability to diagnose and monitor scheduled code run.
- Parameters:
msLater
- time to wait before running code on SWT thread. 0 does not mean immediate, but as soon as possible.code
- Code to run- Returns:
- success
- Since:
- 3.0.4.3
-
isSWTThread
public static boolean isSWTThread() -
execSWTThread
-
makeRunnableSafe
-
execSWTThread
Execute code in the Runnable object using SWT's thread. If current thread it already SWT's thread, the code will run immediately. If the current thread is not SWT's, code will be run asynchronously on SWT's thread at the next reasonable opportunity. This method does not catch any exceptions.- Parameters:
code
- code to run- Returns:
- success
-
isThisThreadSWT
public static boolean isThisThreadSWT() -
getTableBottomIndex
public static int getTableBottomIndex(org.eclipse.swt.widgets.Table table, int iTopIndex) Bottom Index may be negative. Returns bottom index even if invisible.Used by rssfeed
-
launch
-
launch
-
launch
-
launch
-
launch
-
launch
-
launch
public static void launch(String sFileOriginal, boolean sync, boolean force_url, boolean force_anon) -
launchFileExplicit
-
launchFileExplicit
-
fallbackLaunch
-
handlePluginLaunch
-
isInstallingTorBrowser
public static boolean isInstallingTorBrowser() -
installTorBrowser
-
getExplicitLauncher
-
getPredefinedExplicitLauncher
-
setCheckedInSetData
public static void setCheckedInSetData(org.eclipse.swt.widgets.TableItem item, boolean checked) Sets the checkbox in a Virtual Table while inside a SWT.SetData listener trigger. SWT 3.1 has an OSX bug that needs working around.- Parameters:
item
-checked
-
-
linkShellMetricsToConfig
public static boolean linkShellMetricsToConfig(org.eclipse.swt.widgets.Shell shell, String sConfigPrefix) -
setShellMetricsConfigEnabled
public static void setShellMetricsConfigEnabled(org.eclipse.swt.widgets.Shell shell, boolean enabled) -
hasShellMetricsConfig
-
setGridData
public static org.eclipse.swt.layout.GridData setGridData(org.eclipse.swt.widgets.Composite composite, int gridStyle, org.eclipse.swt.widgets.Control ctrlBestSize, int maxHeight) -
getFilledFormData
public static org.eclipse.swt.layout.FormData getFilledFormData() -
drawImageCenterScaleDown
public static void drawImageCenterScaleDown(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Image imgSrc, org.eclipse.swt.graphics.Rectangle area) -
hasAlpha
public static boolean hasAlpha(org.eclipse.swt.graphics.Image image) -
drawResizedImage
public static void drawResizedImage(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight) -
getResizedImage
public static org.eclipse.swt.graphics.Image getResizedImage(org.eclipse.swt.graphics.Image image, int srcX, int srcY, int srcWidth, int srcHeight, int destWidth, int destHeight) -
drawImage
public static boolean drawImage(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Image image, org.eclipse.swt.graphics.Point srcStart, org.eclipse.swt.graphics.Rectangle dstRect, org.eclipse.swt.graphics.Rectangle clipping, int hOffset, int vOffset, boolean clearArea) -
findChild
public static org.eclipse.swt.widgets.Control findChild(org.eclipse.swt.widgets.Composite comp, int x, int y) -
dump
public static void dump(org.eclipse.swt.widgets.Control comp) -
dump
-
addListenerAndChildren
public static void addListenerAndChildren(org.eclipse.swt.widgets.Composite area, int event, org.eclipse.swt.widgets.Listener listener) - Parameters:
area
-event
- idlistener
-
-
getActiveShell
public static org.eclipse.swt.widgets.Shell getActiveShell() -
findAnyShell
public static org.eclipse.swt.widgets.Shell findAnyShell() -
findAnyShell
public static org.eclipse.swt.widgets.Shell findAnyShell(boolean preferMainShell) -
verifyShellRect
public static boolean verifyShellRect(org.eclipse.swt.widgets.Shell shell, boolean bAdjustIfInvalid) -
verifyShellRect
private static boolean verifyShellRect(org.eclipse.swt.widgets.Shell shell, boolean bAdjustIfInvalid, boolean reverifyOnChange) -
relayout
public static void relayout(org.eclipse.swt.widgets.Control control) Relayout all composites up from control until there's enough room for the control to fit- Parameters:
control
- Control that had it's sized changed and needs more room
-
relayout
public static void relayout(org.eclipse.swt.widgets.Control control, boolean expandOnly) Relayout all composites up from control until there's enough room for the control to fit- Parameters:
control
- Control that had it's sized changed and needs more room
-
beep
public static void beep() -
execSWTThreadWithBool
Runs code within the SWT thread, waits for code to complete executing, (using a semaphore), and then returns a value.- Parameters:
ID
- id for debugcode
- code to runmillis
- ms to timeout in- Returns:
- returns NULL if code never run
-
execSWTThreadWithObject
Runs code within the SWT thread, waits for code to complete executing, (using a semaphore), and then returns a value.- Parameters:
ID
- id for debugcode
- code to runmillis
- ms to timeout in- Returns:
-
waitForModals
public static void waitForModals()Waits until modal dialogs are disposed. Assumes we are on SWT thread- Since:
- 3.0.1.3
-
getWrappableLabelGridData
public static org.eclipse.swt.layout.GridData getWrappableLabelGridData(int hspan, int styles) -
getHSpanGridData
public static org.eclipse.swt.layout.GridData getHSpanGridData(int hspan, int styles) -
createAlphaImage
public static org.eclipse.swt.graphics.Image createAlphaImage(org.eclipse.swt.graphics.Device device, int width, int height) -
createAlphaImage
public static org.eclipse.swt.graphics.Image createAlphaImage(org.eclipse.swt.graphics.Device device, int width, int height, byte defaultAlpha) -
blitImage
public static org.eclipse.swt.graphics.Image blitImage(org.eclipse.swt.graphics.Device device, org.eclipse.swt.graphics.Image srcImage, org.eclipse.swt.graphics.Rectangle srcArea, org.eclipse.swt.graphics.Image dstImage, org.eclipse.swt.graphics.Point dstPos) -
drawStriped
public static void drawStriped(org.eclipse.swt.graphics.GC gcImg, int x, int y, int width, int height, int lineDist, int leftshift, boolean fallingLines) Draws diagonal stripes onto the specified area of a GC- Parameters:
lineDist
- spacing between the individual linesleftshift
- moves the stripes to the left, useful to shift with the backgroundfallingLines
- true for top left to bottom-right lines, false otherwise
-
renderTransparency
public static org.eclipse.swt.graphics.Image renderTransparency(org.eclipse.swt.widgets.Display display, org.eclipse.swt.graphics.Image background, org.eclipse.swt.graphics.Image foreground, org.eclipse.swt.graphics.Point foregroundOffsetOnBg, int modifyForegroundAlpha) - Parameters:
display
-background
-foreground
-foregroundOffsetOnBg
-modifyForegroundAlpha
- 0 (fully transparent) to 255 (retain current alpha)- Returns:
-
findBackgroundImageControl
public static org.eclipse.swt.widgets.Control findBackgroundImageControl(org.eclipse.swt.widgets.Control control) -
anyShellHaveStyle
public static boolean anyShellHaveStyle(int styles) - Returns:
- Since:
- 3.0.3.5
-
findFirstShellWithStyle
public static org.eclipse.swt.widgets.Shell findFirstShellWithStyle(int styles) -
colorToIntArray
public static int[] colorToIntArray(org.eclipse.swt.graphics.Color color) -
centerRelativeTo
public static void centerRelativeTo(org.eclipse.swt.graphics.Rectangle target, org.eclipse.swt.graphics.Rectangle reference) Centers the targetRectangle
relative to the reference Rectangle- Parameters:
target
-reference
-
-
makeVisibleOnCursor
public static void makeVisibleOnCursor(org.eclipse.swt.graphics.Rectangle rect) Ensure that the givenRectangle
is fully visible on the monitor that the cursor is currently in. This method does not resize the given Rectangle; it merely reposition it if appropriate. If the given Rectangle is taller or wider than the current monitor then it may not fit 'fully' in the monitor.We use a best-effort approach with an emphasis to have at least the top-left of the Rectangle be visible. If the given Rectangle does not fit entirely in the monitor then portion of the right and/or left may be off-screen.
This method does honor global screen elements when possible. Screen elements include the TaskBar on Windows and the Application menu on OSX, and possibly others. The re-positioned Rectangle returned will fit on the screen without overlapping (or sliding under) these screen elements.
- Parameters:
rect
-
-
makeVisibleOnMonitor
public static void makeVisibleOnMonitor(org.eclipse.swt.graphics.Rectangle rect, org.eclipse.swt.widgets.Monitor monitor) Ensure that the givenRectangle
is fully visible on the givenMonitor
. This method does not resize the given Rectangle; it merely reposition it if appropriate. If the given Rectangle is taller or wider than the current monitor then it may not fit 'fully' in the monitor.We use a best-effort approach with an emphasis to have at least the top-left of the Rectangle be visible. If the given Rectangle does not fit entirely in the monitor then portion of the right and/or left may be off-screen.
This method does honor global screen elements when possible. Screen elements include the TaskBar on Windows and the Application menu on OSX, and possibly others. The re-positioned Rectangle returned will fit on the screen without overlapping (or sliding under) these screen elements.
- Parameters:
rect
-monitor
-
-
getMonitor
private static org.eclipse.swt.widgets.Monitor getMonitor(int x, int y) Returns theMonitor
that the given x,y coordinates resides in- Parameters:
x
-y
-- Returns:
- the monitor if found; otherwise returns
null
-
getMonitor
public static org.eclipse.swt.widgets.Monitor getMonitor(org.eclipse.swt.graphics.Point location) Returns theMonitor
that the givenPoint
resides in- Parameters:
location
-- Returns:
- the monitor if found; otherwise returns
null
-
makeButtonsEqualWidth
public static void makeButtonsEqualWidth(org.eclipse.swt.widgets.Button... buttons) -
makeButtonsEqualWidth
-
createOKCancelButtons
public static org.eclipse.swt.widgets.Button[] createOKCancelButtons(org.eclipse.swt.widgets.Composite panel) -
createAlertButton
public static org.eclipse.swt.widgets.Button createAlertButton(org.eclipse.swt.widgets.Composite panel, String localizationKey) -
truncateText
-
toColorHexString
- Parameters:
color
-- Returns:
- Since:
- 3.1.1.1
-
twoHex
-
getWidgetBGColorURLParam
-
reportError
-
getOffOfSWTThread
-
getOffOfSWTThread
-
runIfNotSWTThread
Run code on SWT Thread if we are calling from non-SWT Thread. Otherwise, do nothing and return false Use Case:
void foo() { if (Utils.runIfNotSWTThread(this::foo)) { return; } // Do SWT Stuff }
Use Case:
void foo(Object param) { if (Utils.runIfNotSWTThread(() -> foo(param)) { return; } // Do SWT Stuff }
-
createSafeBrowser
-
getLocationRelativeToShell
public static org.eclipse.swt.graphics.Point getLocationRelativeToShell(org.eclipse.swt.widgets.Control control) -
isQuickViewSupported
-
isQuickViewActive
-
setQuickViewActive
-
quickView
-
quickViewRAR
-
createSash
public static org.eclipse.swt.widgets.Sash createSash(org.eclipse.swt.widgets.Composite form, int SASH_WIDTH) -
createSash
public static org.eclipse.swt.widgets.Sash createSash(org.eclipse.swt.widgets.Composite form, int SASH_WIDTH, int style) -
createSashWrapper
public static Utils.SashWrapper createSashWrapper(org.eclipse.swt.widgets.Composite parent, String config_key, int def_pct) -
createSashWrapper2
public static Utils.SashWrapper2 createSashWrapper2(org.eclipse.swt.widgets.Composite parent, String config_key) -
getCursorControl
public static org.eclipse.swt.widgets.Control getCursorControl()Sometimes, Display.getCursorControl doesn't go deep enough.. -
getCursorControl
public static org.eclipse.swt.widgets.Control getCursorControl(org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.graphics.Point cursorLocation) -
relayoutUp
public static void relayoutUp(org.eclipse.swt.widgets.Composite c) -
createScrolledComposite
public static org.eclipse.swt.widgets.Composite createScrolledComposite(org.eclipse.swt.widgets.Composite parent) Creates a ScrollComposite that scrolls vertically and handles recalculating size.
If parent's layout isn't GridLayout, sets parent to GridLayout with 1 column.- Returns:
- a new Composite that is the main view of the ScrolledComposite. No layout for this composite has been set
-
createScrolledComposite
public static org.eclipse.swt.widgets.Composite createScrolledComposite(org.eclipse.swt.widgets.Composite parent, int style) -
createScrolledComposite
public static org.eclipse.swt.widgets.Composite createScrolledComposite(org.eclipse.swt.widgets.Composite parent, org.eclipse.swt.widgets.Control mega_parent) -
createScrolledComposite
private static org.eclipse.swt.widgets.Composite createScrolledComposite(org.eclipse.swt.widgets.Composite parent, int style, org.eclipse.swt.widgets.Control mega_parent) -
updateScrolledComposite
public static void updateScrolledComposite(org.eclipse.swt.custom.ScrolledComposite sc) -
updateScrolledComposite
protected static void updateScrolledComposite(org.eclipse.swt.custom.ScrolledComposite sc, int style) -
maintainSashPanelWidth
public static void maintainSashPanelWidth(org.eclipse.swt.custom.SashForm sash, org.eclipse.swt.widgets.Composite comp, int[] default_weights, String config_key) -
setClipping
public static void setClipping(org.eclipse.swt.graphics.GC gc, org.eclipse.swt.graphics.Rectangle r) -
addAndFireParameterListener
public static void addAndFireParameterListener(Map<String, ParameterListener> mapConfigListeners, boolean requiresSWTThread, String parameter, ParameterListener listener) -
removeParameterListeners
-
getTTEnabled
public static boolean getTTEnabled() -
setTT
-
setTT
-
setTT
-
setTT
-
setTT
-
setTT
-
setTT
-
setTT
-
dispose
public static void dispose() -
createSubViewID
-
getBaseViewID
-
isDarkAppearanceNativeWindows
public static boolean isDarkAppearanceNativeWindows() -
isDarkAppearanceNative
public static boolean isDarkAppearanceNative() -
isDarkAppearancePartial
public static boolean isDarkAppearancePartial()Hack to switch some things to dark on Windows until proper support available- Returns:
-
editSpeedLimitHandlerConfig
-
showText
-
showText
-
setTextWithURLs
public static void setTextWithURLs(org.eclipse.swt.custom.StyledText text, String value, boolean allow_focus) -
escapeAccelerators
-
addSafeMouseUpListener
public static void addSafeMouseUpListener(org.eclipse.swt.widgets.Control control, org.eclipse.swt.widgets.Listener mouseUpListener) -
addSafeMouseUpListener
public static void addSafeMouseUpListener(org.eclipse.swt.widgets.Control control, org.eclipse.swt.widgets.Listener mouseDownListener, org.eclipse.swt.widgets.Listener mouseUpListener) -
createStyledText
public static org.eclipse.swt.custom.StyledText createStyledText(org.eclipse.swt.widgets.Composite parent, int style) -
clearMenu
public static void clearMenu(org.eclipse.swt.widgets.Menu menu) -
getAllChildren
public static List<org.eclipse.swt.widgets.Control> getAllChildren(org.eclipse.swt.widgets.Composite c) -
getAllChildren
private static void getAllChildren(org.eclipse.swt.widgets.Control c, List<org.eclipse.swt.widgets.Control> kids) -
getCCString
-
resizeImage
public static org.eclipse.swt.graphics.Image resizeImage(org.eclipse.swt.graphics.Image image, int newWidth, int newHeight) Resizes an image, using the given scaling factor. Constructs a new image resource, please take care of resource disposal if you no longer need the original one. This method is optimized for quality, not for speed.- Parameters:
image
- source image- Returns:
- scaled image
-
convertToAWT
-
convertToSWT
-
gradientFillSelection
public static boolean gradientFillSelection() -
ensureDisplayUpdated
public static void ensureDisplayUpdated() -
readAndDispatchUntilIdle
public static void readAndDispatchUntilIdle() -
readAndDispatchLoop
public static void readAndDispatchLoop(org.eclipse.swt.widgets.Control owner) -
readAndDispatchLoop
public static void readAndDispatchLoop(org.eclipse.swt.widgets.Control owner, boolean check_visible) -
readAndDispatchUntilIdleFor
public static void readAndDispatchUntilIdleFor(long millis) -
readAndDispatchUntilIdleOr
-
getDispatchLoopDepth
public static int getDispatchLoopDepth() -
readAndDispatchLoop
-
fileExistsWithTimeout
-
fileExistsWithTimeout
-
isDirectoryWithTimeout
-
canReadFileWithTimeout
-
fileLengthWithTimeout
-
getCanonicalPathWithTimeout
- Throws:
IOException
-
listFileRootsWithTimeout
-
numberPrompt
-