Class BidiUtils
- Since:
- 3.9
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Auto (contextual) Base Text Direction.static final String
Base Text Direction defined ingetTextDirection()
static final String
Left-To-Right Base Text Direction.static final String
Right-To-Left Base Text Direction.static final String
Visual Left-To-Right Text Direction.static final String
Visual Right-To-Left Text Direction -
Method Summary
Modifier and TypeMethodDescriptionstatic void
applyBidiProcessing
(StyledText field, String handlingType) Applies bidi processing to the given styled text field.static void
applyBidiProcessing
(Combo combo, String handlingType) Applies bidi processing to the given combo.static void
applyBidiProcessing
(Text field, String handlingType) Applies bidi processing to the given text field.static void
applyTextDirection
(Control control, String textDirection) Applies a Base Text Direction to the given control (and its descendants, if it's aComposite
).static boolean
Returns whether bidi support is enabled.static SegmentListener
getSegmentListener
(String handlingType) Returns a segment listener for the givenhandlingType
that can e.g. be passed toText.addSegmentListener(SegmentListener)
.static String
Returns the Base Text Direction.static void
setBidiSupport
(boolean bidi) Enables or disables bidi support.static void
setTextDirection
(String direction) Sets the Base Text Direction.
-
Field Details
-
LEFT_TO_RIGHT
Left-To-Right Base Text Direction.- See Also:
-
RIGHT_TO_LEFT
Right-To-Left Base Text Direction.- See Also:
-
AUTO
Auto (contextual) Base Text Direction.- See Also:
-
BTD_DEFAULT
Base Text Direction defined ingetTextDirection()
-
VISUAL_LEFT_TO_RIGHT
Visual Left-To-Right Text Direction.Note: This handling type is deprecated and should only be used when interfacing with legacy systems that store data in visual order.
-
VISUAL_RIGHT_TO_LEFT
Visual Right-To-Left Text DirectionNote: This handling type is deprecated and should only be used when interfacing with legacy systems that store data in visual order.
-
-
Method Details
-
getTextDirection
Returns the Base Text Direction. Possible values are:LEFT_TO_RIGHT
RIGHT_TO_LEFT
AUTO
null
(no direction set)
- Returns:
- the base text direction
-
setTextDirection
Sets the Base Text Direction. Possible values are:LEFT_TO_RIGHT
RIGHT_TO_LEFT
AUTO
null
(no default direction)
- Parameters:
direction
- the text direction to set- Throws:
IllegalArgumentException
- ifdirection
is not legal
-
getBidiSupport
public static boolean getBidiSupport()Returns whether bidi support is enabled.- Returns:
true
iff bidi support is enabled
-
setBidiSupport
public static void setBidiSupport(boolean bidi) Enables or disables bidi support.- Parameters:
bidi
-true
to enable bidi support,false
to disable
-
applyBidiProcessing
Applies bidi processing to the given text field.Possible values for
handlingType
are:LEFT_TO_RIGHT
RIGHT_TO_LEFT
AUTO
BTD_DEFAULT
VISUAL_LEFT_TO_RIGHT
VISUAL_RIGHT_TO_LEFT
- the
String
constants inStructuredTextTypeHandlerFactory
- if OSGi is running, the types that have been contributed to the
org.eclipse.equinox.bidi.bidiTypes
extension point.
The 3 values
LEFT_TO_RIGHT
,RIGHT_TO_LEFT
, andAUTO
are usable whetherbidi support
is enabled or disabled.The remaining values only have an effect if bidi support is enabled.
The 4 first values
LEFT_TO_RIGHT
,RIGHT_TO_LEFT
,AUTO
, andBTD_DEFAULT
are for Base Text Direction (BTD) handling. The remaining values are for Structured Text handling.Note: If this method is called on a text control, then
applyTextDirection(Control, String)
must not be called on the same control.Note: The Structured Text handling only works if the
org.eclipse.equinox.bidi
bundle is on the classpath!Note:
Text.addSegmentListener(SegmentListener)
is currently only implemented on Windows and GTK, so this method won't have an effect on Cocoa.- Parameters:
field
- the text fieldhandlingType
- the type of handling- Throws:
IllegalArgumentException
- ifhandlingType
is not a known type identifier
-
applyBidiProcessing
Applies bidi processing to the given styled text field.Possible values for
handlingType
are:LEFT_TO_RIGHT
RIGHT_TO_LEFT
AUTO
BTD_DEFAULT
VISUAL_LEFT_TO_RIGHT
VISUAL_RIGHT_TO_LEFT
- the
String
constants inStructuredTextTypeHandlerFactory
- if OSGi is running, the types that have been contributed to the
org.eclipse.equinox.bidi.bidiTypes
extension point.
The 3 values
LEFT_TO_RIGHT
,RIGHT_TO_LEFT
, andAUTO
are usable whetherbidi support
is enabled or disabled.The remaining values only have an effect if bidi support is enabled.
The 4 first values
LEFT_TO_RIGHT
,RIGHT_TO_LEFT
,AUTO
, andBTD_DEFAULT
are for Base Text Direction (BTD) handling. The remaining values are for Structured Text handling.Note: If this method is called on a text control, then
applyTextDirection(Control, String)
must not be called on the same control.Note: The Structured Text handling only works if the
org.eclipse.equinox.bidi
bundle is on the classpath!- Parameters:
field
- the styled text fieldhandlingType
- the type of handling- Throws:
IllegalArgumentException
- ifhandlingType
is not a known type identifier
-
applyBidiProcessing
Applies bidi processing to the given combo.Possible values for
handlingType
are:LEFT_TO_RIGHT
RIGHT_TO_LEFT
AUTO
BTD_DEFAULT
VISUAL_LEFT_TO_RIGHT
VISUAL_RIGHT_TO_LEFT
- the
String
constants inStructuredTextTypeHandlerFactory
- if OSGi is running, the types that have been contributed to the
org.eclipse.equinox.bidi.bidiTypes
extension point.
The 3 values
LEFT_TO_RIGHT
,RIGHT_TO_LEFT
, andAUTO
are usable whetherbidi support
is enabled or disabled.The remaining values only have an effect if bidi support is enabled.
The 4 first values
LEFT_TO_RIGHT
,RIGHT_TO_LEFT
,AUTO
, andBTD_DEFAULT
are for Base Text Direction (BTD) handling. The remaining values are for Structured Text handling.Note: If this method is called on a combo control, then
applyTextDirection(Control, String)
must not be called on the same control.Note: The Structured Text handling only works if the
org.eclipse.equinox.bidi
bundle is on the classpath!Note:
Combo.addSegmentListener(SegmentListener)
is currently only implemented on Windows so this method won't have an effect on Cocoa and GTK.- Parameters:
combo
- the combo fieldhandlingType
- the type of handling- Throws:
IllegalArgumentException
- ifhandlingType
is not a known type identifier- Since:
- 3.10
-
getSegmentListener
Returns a segment listener for the givenhandlingType
that can e.g. be passed toText.addSegmentListener(SegmentListener)
.Note: The Structured Text handling only works if the
org.eclipse.equinox.bidi
bundle is on the classpath!- Parameters:
handlingType
- the handling type as specified inapplyBidiProcessing(Text, String)
- Returns:
- the segment listener, or
null
if no handling is required - Throws:
IllegalArgumentException
- ifhandlingType
is not a known type identifier- See Also:
-
applyTextDirection
Applies a Base Text Direction to the given control (and its descendants, if it's aComposite
).Possible values for
textDirection
are:The 3 values
LEFT_TO_RIGHT
,RIGHT_TO_LEFT
, andAUTO
are usable whetherbidi support
is enabled or disabled.The remaining value
BTD_DEFAULT
only has an effect if bidi support is enabled.Note: If this method is called on a control, then no
applyBidiProcessing
method must be called on the same control.Note:
Control.setTextDirection(int)
is currently only implemented on Windows, so the direction won't be inherited by descendants on GTK and Cocoa.- Parameters:
control
- the controltextDirection
- the text direction
-