Class BidiUtils
- Since:
- 3.9
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringAuto (contextual) Base Text Direction.static final StringBase Text Direction defined ingetTextDirection()static final StringLeft-To-Right Base Text Direction.static final StringRight-To-Left Base Text Direction.static final StringVisual Left-To-Right Text Direction.static final StringVisual Right-To-Left Text Direction -
Method Summary
Modifier and TypeMethodDescriptionstatic voidapplyBidiProcessing(StyledText field, String handlingType) Applies bidi processing to the given styled text field.static voidapplyBidiProcessing(Combo combo, String handlingType) Applies bidi processing to the given combo.static voidapplyBidiProcessing(Text field, String handlingType) Applies bidi processing to the given text field.static voidapplyTextDirection(Control control, String textDirection) Applies a Base Text Direction to the given control (and its descendants, if it's aComposite).static booleanReturns whether bidi support is enabled.static SegmentListenergetSegmentListener(String handlingType) Returns a segment listener for the givenhandlingTypethat can e.g. be passed toText.addSegmentListener(SegmentListener).static StringReturns the Base Text Direction.static voidsetBidiSupport(boolean bidi) Enables or disables bidi support.static voidsetTextDirection(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_RIGHTRIGHT_TO_LEFTAUTOnull(no direction set)
- Returns:
- the base text direction
-
setTextDirection
Sets the Base Text Direction. Possible values are:LEFT_TO_RIGHTRIGHT_TO_LEFTAUTOnull(no default direction)
- Parameters:
direction- the text direction to set- Throws:
IllegalArgumentException- ifdirectionis not legal
-
getBidiSupport
public static boolean getBidiSupport()Returns whether bidi support is enabled.- Returns:
trueiff bidi support is enabled
-
setBidiSupport
public static void setBidiSupport(boolean bidi) Enables or disables bidi support.- Parameters:
bidi-trueto enable bidi support,falseto disable
-
applyBidiProcessing
Applies bidi processing to the given text field.Possible values for
handlingTypeare:LEFT_TO_RIGHTRIGHT_TO_LEFTAUTOBTD_DEFAULTVISUAL_LEFT_TO_RIGHTVISUAL_RIGHT_TO_LEFT- the
Stringconstants inStructuredTextTypeHandlerFactory - if OSGi is running, the types that have been contributed to the
org.eclipse.equinox.bidi.bidiTypesextension point.
The 3 values
LEFT_TO_RIGHT,RIGHT_TO_LEFT, andAUTOare usable whetherbidi supportis 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_DEFAULTare 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.bidibundle 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- ifhandlingTypeis not a known type identifier
-
applyBidiProcessing
Applies bidi processing to the given styled text field.Possible values for
handlingTypeare:LEFT_TO_RIGHTRIGHT_TO_LEFTAUTOBTD_DEFAULTVISUAL_LEFT_TO_RIGHTVISUAL_RIGHT_TO_LEFT- the
Stringconstants inStructuredTextTypeHandlerFactory - if OSGi is running, the types that have been contributed to the
org.eclipse.equinox.bidi.bidiTypesextension point.
The 3 values
LEFT_TO_RIGHT,RIGHT_TO_LEFT, andAUTOare usable whetherbidi supportis 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_DEFAULTare 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.bidibundle is on the classpath!- Parameters:
field- the styled text fieldhandlingType- the type of handling- Throws:
IllegalArgumentException- ifhandlingTypeis not a known type identifier
-
applyBidiProcessing
Applies bidi processing to the given combo.Possible values for
handlingTypeare:LEFT_TO_RIGHTRIGHT_TO_LEFTAUTOBTD_DEFAULTVISUAL_LEFT_TO_RIGHTVISUAL_RIGHT_TO_LEFT- the
Stringconstants inStructuredTextTypeHandlerFactory - if OSGi is running, the types that have been contributed to the
org.eclipse.equinox.bidi.bidiTypesextension point.
The 3 values
LEFT_TO_RIGHT,RIGHT_TO_LEFT, andAUTOare usable whetherbidi supportis 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_DEFAULTare 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.bidibundle 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- ifhandlingTypeis not a known type identifier- Since:
- 3.10
-
getSegmentListener
Returns a segment listener for the givenhandlingTypethat can e.g. be passed toText.addSegmentListener(SegmentListener).Note: The Structured Text handling only works if the
org.eclipse.equinox.bidibundle is on the classpath!- Parameters:
handlingType- the handling type as specified inapplyBidiProcessing(Text, String)- Returns:
- the segment listener, or
nullif no handling is required - Throws:
IllegalArgumentException- ifhandlingTypeis 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
textDirectionare:The 3 values
LEFT_TO_RIGHT,RIGHT_TO_LEFT, andAUTOare usable whetherbidi supportis enabled or disabled.The remaining value
BTD_DEFAULTonly has an effect if bidi support is enabled.Note: If this method is called on a control, then no
applyBidiProcessingmethod 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
-