src/sap.ui.rta/src/sap/ui/rta/service/ControllerExtension.js
function(sCodeRef, sViewId) {
					var oFlexSettings = oRta.getFlexSettings();
					if (!oFlexSettings.developerMode) {
						throw DtUtil.createError("service.ControllerExtension#add", "code extensions can only be created in developer mode", "sap.ui.rta");
					}

					if (!sCodeRef) {
						throw DtUtil.createError("service.ControllerExtension#add", "can't create controller extension without codeRef", "sap.ui.rta");
					}

					if (!sCodeRef.endsWith(".js")) {
						throw DtUtil.createError("service.ControllerExtension#add", "codeRef has to end with 'js'");
					}

					var oFlexController = oRta._getFlexController();
					var oView = sap.ui.getCore().byId(sViewId);
					var oAppComponent = FlexUtils.getAppComponentForControl(oView);
					var sControllerName = oView.getControllerName && oView.getControllerName() || oView.getController() && oView.getController().getMetadata().getName();

					var oChangeSpecificData = {
						content: {
							codeRef: sCodeRef
						},
						selector: {
							controllerName: sControllerName
						},
						changeType: "codeExt",
						namespace: oFlexSettings.namespace,
						developerMode: oFlexSettings.developerMode,
						scenario: oFlexSettings.scenario
					};

					var oPreparedChange = oFlexController.createBaseChange(oChangeSpecificData, oAppComponent);
					oFlexController.addPreparedChange(oPreparedChange, oAppComponent);
					return oPreparedChange.getDefinition();
				}
function(sCodeRef, sViewId) {
					var oFlexSettings = oRta.getFlexSettings();
					if (!oFlexSettings.developerMode) {
						throw DtUtil.createError("service.ControllerExtension#add", "code extensions can only be created in developer mode", "sap.ui.rta");
					}

					if (!sCodeRef) {
						throw DtUtil.createError("service.ControllerExtension#add", "can't create controller extension without codeRef", "sap.ui.rta");
					}

					if (!sCodeRef.endsWith(".js")) {
						throw DtUtil.createError("service.ControllerExtension#add", "codeRef has to end with 'js'");
					}

					var oFlexController = oRta._getFlexController();
					var oView = sap.ui.getCore().byId(sViewId);
					var oAppComponent = FlexUtils.getAppComponentForControl(oView);
					var sControllerName = oView.getControllerName && oView.getControllerName() || oView.getController() && oView.getController().getMetadata().getName();

					var oChangeSpecificData = {
						content: {
							codeRef: sCodeRef
						},
						selector: {
							controllerName: sControllerName
						},
						changeType: "codeExt",
						namespace: oFlexSettings.namespace,
						developerMode: oFlexSettings.developerMode,
						scenario: oFlexSettings.scenario
					};

					var oPreparedChange = oFlexController.createBaseChange(oChangeSpecificData, oAppComponent);
					oFlexController.addPreparedChange(oPreparedChange, oAppComponent);
					return oPreparedChange.getDefinition();
				}
function ( sCodeRef , sViewId ) { var oFlexSettings = oRta . getFlexSettings ( ) ; if ( ! oFlexSettings . developerMode ) { throw DtUtil . createError ( "service.ControllerExtension#add" , "code extensions can only be created in developer mode" , "sap.ui.rta" ) ; } if ( ! sCodeRef ) { throw DtUtil . createError ( "service.ControllerExtension#add" , "can't create controller extension without codeRef" , "sap.ui.rta" ) ; } if ( ! sCodeRef . endsWith ( ".js" ) ) { throw DtUtil . createError ( "service.ControllerExtension#add" , "codeRef has to end with 'js'" ) ; } var oFlexController = oRta . _getFlexController ( ) ; var oView = sap . ui . getCore ( ) . byId ( sViewId ) ; var oAppComponent = FlexUtils . getAppComponentForControl ( oView ) ; var sControllerName = oView . getControllerName && oView . getControllerName ( ) || oView . getController ( ) && oView . getController ( ) . getMetadata ( ) . getName ( ) ; var oChangeSpecificData = { content : { codeRef : sCodeRef } , selector : { controllerName : sControllerName } , changeType : "codeExt" , namespace : oFlexSettings . namespace , developerMode : oFlexSettings . developerMode , scenario : oFlexSettings . scenario } ; var oPreparedChange = oFlexController . createBaseChange ( oChangeSpecificData , oAppComponent ) ; oFlexController . addPreparedChange ( oPreparedChange , oAppComponent ) ; return oPreparedChange . getDefinition ( ) ; }
Creates a change that adds an extension to the controller associated with the given view.
Throws an error if the information is not complete.
As of now, this only creates the change with a reference to a file. The consumer has to take care of creating that file
and adding it to the backend.

@method sap.ui.rta.service.ControllerExtension.add
@param {object} sCodeRef Name of the file, without path, with the extension '.js'. Must comply to UI5 module naming convention.
Has to be unique and must not conflict with other already defined modules.
@param {string} sViewId ID of the view whose controller should be extended
@return {object} Returns the definition of the newly created change
@public
Creates a change that adds an extension to the controller associated with the given view . Throws an error if the information is not complete . As of now this only creates the change with a reference to a file . The consumer has to take care of creating that file and adding it to the backend .