Package org.eclipse.ui.editors.text
Class DefaultEncodingSupport
java.lang.Object
org.eclipse.ui.editors.text.DefaultEncodingSupport
- All Implemented Interfaces:
IEncodingSupport
The standard implementation of
IEncodingSupport.- Since:
- 2.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcreateStatusEncodingChangeControl(Composite parent, IStatus status) Creates the control which allows to change the encoding.voiddispose()Disposes this encoding support.Returns the default character encoding.Returns the character encoding.getStatusBanner(IStatus status) Returns a banner for the given status.getStatusHeader(IStatus status) Returns a status header for the given status.getStatusMessage(IStatus status) Returns a status message if any.voidinitialize(StatusTextEditor textEditor) Associates this encoding support to the given text editor and initializes this encoding.booleanisEncodingError(IStatus status) Returnstrueif the given status is an encoding error.voidreset()Resets this encoding support.voidsetEncoding(String encoding) Sets the character encoding.protected voidsetEncoding(String encoding, boolean overwrite) Sets the encoding of the editor's input to the given value.
-
Constructor Details
-
DefaultEncodingSupport
public DefaultEncodingSupport()Creates a new encoding support.
-
-
Method Details
-
initialize
Associates this encoding support to the given text editor and initializes this encoding.- Parameters:
textEditor- the editor
-
dispose
public void dispose()Disposes this encoding support. -
reset
public void reset()Resets this encoding support. Should be called if, e.g., the input element of the associated editor changed. -
setEncoding
Sets the encoding of the editor's input to the given value. Ifoverwriteistruethe value is set even if the encoding is already set.- Parameters:
encoding- the new encodingoverwrite-trueif current encoding should be overwritten
-
setEncoding
Description copied from interface:IEncodingSupportSets the character encoding.- Specified by:
setEncodingin interfaceIEncodingSupport- Parameters:
encoding- the character encoding
-
getEncoding
Description copied from interface:IEncodingSupportReturns the character encoding.- Specified by:
getEncodingin interfaceIEncodingSupport- Returns:
- the character encoding
-
getDefaultEncoding
Description copied from interface:IEncodingSupportReturns the default character encoding.- Specified by:
getDefaultEncodingin interfaceIEncodingSupport- Returns:
- the default character encoding
-
getStatusHeader
Returns a status header for the given status.- Parameters:
status- the status- Returns:
- a status header for the given status.
-
getStatusBanner
Returns a banner for the given status.- Parameters:
status- the status- Returns:
- a banner for the given status.
-
getStatusMessage
Returns a status message if any.- Parameters:
status- the status- Returns:
- a status message indicating encoding problems or
nullotherwise
-
isEncodingError
Returnstrueif the given status is an encoding error.- Parameters:
status- the status to check- Returns:
trueif the given status is an encoding error- Since:
- 3.1
-
createStatusEncodingChangeControl
Creates the control which allows to change the encoding. In case of encoding errors this control will be placed below the status of the status editor.- Parameters:
parent- the parent controlstatus- the status- Since:
- 3.1
-