Code Editor
Display or edit source code with syntax highlighting for various source types.
Z2UI5_CL_SMPC_APP_114
Controls
sap.ui.codeeditor
UI5 1.71
The facts
- Repository
- abap2UI5/samples-controls
- Class
Z2UI5_CL_SMPC_APP_114- Source file
z2ui5_cl_smpc_app_114.clas.abap↗- Library
- sap.ui.codeeditor
- UI5 entity
sap.ui.codeeditor.CodeEditor- Demo kit sample
sap.ui.codeeditor.sample.CodeEditor- SAP's own sample
- running at sdk.openui5.org ↗
- Minimum UI5
- 1.71 — the floor abap2UI5 holds its samples to
- In the playground
- runs in the browser, with no system and nothing installed
Keywords: codeeditor, code, editor, sap.ui.codeeditor, ace
Controls it builds
Read out of the builder chain by the abap2UI5 linter, not from the category this sample is filed under — which is what makes “which samples build one of these” a question the catalogue can answer at all.
Libraries
Run it here
The sample running, in this page — the app on its own, with no editor over it.
Switch to Playground with this code
Nothing is installed and nothing is sent anywhere: the ABAP is compiled to JavaScript in this browser and runs against abap2UI5 itself.
The ABAP
z2ui5_cl_smpc_app_114.clas.abap — 64 lines
Click a number to link to a line — shift-click for a range.
Read it on GitHub ↗
" @keywords codeeditor code editor sap.ui.codeeditor ace
" @summary Display or edit source code with syntax highlighting for various source types.
CLASS z2ui5_cl_smpc_app_114 DEFINITION PUBLIC.
PUBLIC SECTION.
INTERFACES z2ui5_if_app.
PROTECTED SECTION.
DATA client TYPE REF TO z2ui5_if_client.
METHODS view_display.
PRIVATE SECTION.
ENDCLASS.
CLASS z2ui5_cl_smpc_app_114 IMPLEMENTATION.
METHOD z2ui5_if_app~main.
me->client = client.
IF client->check_on_navigated( ).
view_display( ).
ENDIF.
ENDMETHOD.
METHOD view_display.
DATA(view) = z2ui5_cl_ui5_view_builder=>factory( ).
" the JSON value carries literal braces, which the XMLView parser would read
" as a binding - the original escapes them in its own view.xml (value='\{...').
" The escape has to SURVIVE into the serialized attribute, so the braces come
" from `backtick` literals (verbatim) while the body uses |…| templates for
" the real newlines: inside a template \{ would collapse to a bare brace
view->ele( n = `View` ns = `mvc`
)->a( n = `xmlns` v = `sap.ui.codeeditor`
)->a( n = `xmlns:mvc` v = `sap.ui.core.mvc`
)->a( n = `height` v = `100%`
)->tag( `CodeEditor`
)->a( n = `type` v = `json`
)->a( n = `value` v = `\{` &&
|\n\t\t"Chinese" : "你好世界",| &&
|\n\t\t"Dutch" : "Hallo wereld",| &&
|\n\t\t"English" : "Hello world",| &&
|\n\t\t"French" : "Bonjour monde",| &&
|\n\t\t"German" : "Hallo Welt",| &&
|\n\t\t"Greek" : "γειά σου κόσμος",| &&
|\n\t\t"Italian" : "Ciao mondo",| &&
|\n\t\t"Japanese" : "こんにちは世界",| &&
|\n\t\t"Korean" : "여보세요 세계",| &&
|\n\t\t"Portuguese" : "Olá mundo",| &&
|\n\t\t"Russian" : "Здравствуй мир",| &&
|\n\t\t"Spanish" : "Hola mundo"| &&
|\n\t| && `\}`
)->a( n = `height` v = `300px` ).
client->view_display( view->stringify( ) ).
ENDMETHOD.
ENDCLASS.
More in sap.ui.codeeditor
- Code Editor with IconTabHeader — Example how to use CodeEditor with IconTabHeader to create a tab-based experience.
On this page