@openui5/sap.ui.rta 1.105.1 → 1.107.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (163) hide show
  1. package/.reuse/dep5 +20 -17
  2. package/THIRDPARTY.txt +31 -21
  3. package/package.json +6 -6
  4. package/src/sap/ui/rta/.library +1 -1
  5. package/src/sap/ui/rta/Client.js +1 -1
  6. package/src/sap/ui/rta/RuntimeAuthoring.js +652 -653
  7. package/src/sap/ui/rta/Utils.js +1 -1
  8. package/src/sap/ui/rta/appVariant/AppVariantManager.js +1 -1
  9. package/src/sap/ui/rta/appVariant/AppVariantUtils.js +2 -0
  10. package/src/sap/ui/rta/command/AddIFrame.js +1 -1
  11. package/src/sap/ui/rta/command/AddProperty.js +1 -1
  12. package/src/sap/ui/rta/command/AddXML.js +1 -1
  13. package/src/sap/ui/rta/command/AddXMLAtExtensionPoint.js +1 -1
  14. package/src/sap/ui/rta/command/AppDescriptorCommand.js +1 -1
  15. package/src/sap/ui/rta/command/BaseCommand.js +1 -1
  16. package/src/sap/ui/rta/command/BindProperty.js +1 -1
  17. package/src/sap/ui/rta/command/Combine.js +1 -1
  18. package/src/sap/ui/rta/command/CommandFactory.js +6 -5
  19. package/src/sap/ui/rta/command/CompositeCommand.js +7 -5
  20. package/src/sap/ui/rta/command/ControlVariantConfigure.js +1 -1
  21. package/src/sap/ui/rta/command/ControlVariantSave.js +1 -1
  22. package/src/sap/ui/rta/command/ControlVariantSaveAs.js +1 -1
  23. package/src/sap/ui/rta/command/ControlVariantSetTitle.js +1 -1
  24. package/src/sap/ui/rta/command/ControlVariantSwitch.js +1 -1
  25. package/src/sap/ui/rta/command/CreateContainer.js +1 -1
  26. package/src/sap/ui/rta/command/CustomAdd.js +1 -1
  27. package/src/sap/ui/rta/command/FlexCommand.js +3 -3
  28. package/src/sap/ui/rta/command/LREPSerializer.js +3 -2
  29. package/src/sap/ui/rta/command/LocalReset.js +1 -1
  30. package/src/sap/ui/rta/command/Move.js +1 -1
  31. package/src/sap/ui/rta/command/Property.js +1 -1
  32. package/src/sap/ui/rta/command/Remove.js +1 -1
  33. package/src/sap/ui/rta/command/Rename.js +1 -1
  34. package/src/sap/ui/rta/command/Resize.js +1 -1
  35. package/src/sap/ui/rta/command/Reveal.js +1 -1
  36. package/src/sap/ui/rta/command/Settings.js +1 -1
  37. package/src/sap/ui/rta/command/Split.js +1 -1
  38. package/src/sap/ui/rta/command/Stack.js +26 -7
  39. package/src/sap/ui/rta/command/appDescriptor/AddLibrary.js +1 -1
  40. package/src/sap/ui/rta/command/compVariant/CompVariantContent.js +1 -1
  41. package/src/sap/ui/rta/command/compVariant/CompVariantSaveAs.js +1 -1
  42. package/src/sap/ui/rta/command/compVariant/CompVariantSwitch.js +1 -1
  43. package/src/sap/ui/rta/command/compVariant/CompVariantUpdate.js +1 -1
  44. package/src/sap/ui/rta/enablement/elementActionTest.js +89 -15
  45. package/src/sap/ui/rta/library.js +2 -2
  46. package/src/sap/ui/rta/messagebundle.properties +31 -0
  47. package/src/sap/ui/rta/messagebundle_ar.properties +16 -11
  48. package/src/sap/ui/rta/messagebundle_bg.properties +16 -11
  49. package/src/sap/ui/rta/messagebundle_ca.properties +16 -11
  50. package/src/sap/ui/rta/messagebundle_cs.properties +16 -11
  51. package/src/sap/ui/rta/messagebundle_cy.properties +16 -11
  52. package/src/sap/ui/rta/messagebundle_da.properties +16 -11
  53. package/src/sap/ui/rta/messagebundle_de.properties +17 -12
  54. package/src/sap/ui/rta/messagebundle_el.properties +16 -11
  55. package/src/sap/ui/rta/messagebundle_en.properties +7 -2
  56. package/src/sap/ui/rta/messagebundle_en_GB.properties +7 -2
  57. package/src/sap/ui/rta/messagebundle_en_US_sappsd.properties +13 -1
  58. package/src/sap/ui/rta/messagebundle_en_US_saprigi.properties +6 -1
  59. package/src/sap/ui/rta/messagebundle_en_US_saptrc.properties +6 -1
  60. package/src/sap/ui/rta/messagebundle_es.properties +16 -11
  61. package/src/sap/ui/rta/messagebundle_es_MX.properties +16 -11
  62. package/src/sap/ui/rta/messagebundle_et.properties +16 -11
  63. package/src/sap/ui/rta/messagebundle_fi.properties +16 -11
  64. package/src/sap/ui/rta/messagebundle_fr.properties +16 -11
  65. package/src/sap/ui/rta/messagebundle_fr_CA.properties +16 -11
  66. package/src/sap/ui/rta/messagebundle_hi.properties +16 -11
  67. package/src/sap/ui/rta/messagebundle_hr.properties +16 -11
  68. package/src/sap/ui/rta/messagebundle_hu.properties +16 -11
  69. package/src/sap/ui/rta/messagebundle_id.properties +16 -11
  70. package/src/sap/ui/rta/messagebundle_it.properties +16 -11
  71. package/src/sap/ui/rta/messagebundle_iw.properties +16 -11
  72. package/src/sap/ui/rta/messagebundle_ja.properties +16 -11
  73. package/src/sap/ui/rta/messagebundle_kk.properties +16 -11
  74. package/src/sap/ui/rta/messagebundle_ko.properties +16 -11
  75. package/src/sap/ui/rta/messagebundle_lt.properties +16 -11
  76. package/src/sap/ui/rta/messagebundle_lv.properties +16 -11
  77. package/src/sap/ui/rta/messagebundle_ms.properties +16 -11
  78. package/src/sap/ui/rta/messagebundle_nl.properties +16 -11
  79. package/src/sap/ui/rta/messagebundle_no.properties +16 -11
  80. package/src/sap/ui/rta/messagebundle_pl.properties +16 -11
  81. package/src/sap/ui/rta/messagebundle_pt.properties +16 -11
  82. package/src/sap/ui/rta/messagebundle_pt_PT.properties +16 -11
  83. package/src/sap/ui/rta/messagebundle_ro.properties +16 -11
  84. package/src/sap/ui/rta/messagebundle_ru.properties +16 -11
  85. package/src/sap/ui/rta/messagebundle_sh.properties +16 -11
  86. package/src/sap/ui/rta/messagebundle_sk.properties +16 -11
  87. package/src/sap/ui/rta/messagebundle_sl.properties +16 -11
  88. package/src/sap/ui/rta/messagebundle_sv.properties +16 -11
  89. package/src/sap/ui/rta/messagebundle_th.properties +16 -11
  90. package/src/sap/ui/rta/messagebundle_tr.properties +16 -11
  91. package/src/sap/ui/rta/messagebundle_uk.properties +16 -11
  92. package/src/sap/ui/rta/messagebundle_vi.properties +16 -11
  93. package/src/sap/ui/rta/messagebundle_zh_CN.properties +16 -11
  94. package/src/sap/ui/rta/messagebundle_zh_TW.properties +16 -11
  95. package/src/sap/ui/rta/plugin/AddXMLAtExtensionPoint.js +7 -5
  96. package/src/sap/ui/rta/plugin/BaseCreate.js +2 -2
  97. package/src/sap/ui/rta/plugin/Combine.js +1 -1
  98. package/src/sap/ui/rta/plugin/CompVariant.js +8 -6
  99. package/src/sap/ui/rta/plugin/ControlVariant.js +1 -1
  100. package/src/sap/ui/rta/plugin/CreateContainer.js +9 -4
  101. package/src/sap/ui/rta/plugin/CutPaste.js +1 -1
  102. package/src/sap/ui/rta/plugin/DragDrop.js +1 -1
  103. package/src/sap/ui/rta/plugin/EasyAdd.js +3 -1
  104. package/src/sap/ui/rta/plugin/EasyRemove.js +3 -1
  105. package/src/sap/ui/rta/plugin/LocalReset.js +2 -2
  106. package/src/sap/ui/rta/plugin/Plugin.js +1 -1
  107. package/src/sap/ui/rta/plugin/RTAElementMover.js +1 -1
  108. package/src/sap/ui/rta/plugin/Remove.js +1 -1
  109. package/src/sap/ui/rta/plugin/Rename.js +3 -3
  110. package/src/sap/ui/rta/plugin/RenameHandler.js +2 -2
  111. package/src/sap/ui/rta/plugin/Resize.js +3 -3
  112. package/src/sap/ui/rta/plugin/Selection.js +1 -1
  113. package/src/sap/ui/rta/plugin/Settings.js +2 -2
  114. package/src/sap/ui/rta/plugin/Split.js +2 -2
  115. package/src/sap/ui/rta/plugin/Stretch.js +3 -1
  116. package/src/sap/ui/rta/plugin/additionalElements/ActionExtractor.js +1 -1
  117. package/src/sap/ui/rta/plugin/additionalElements/AddElementsDialog.js +1 -1
  118. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsAnalyzer.js +9 -6
  119. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsPlugin.js +9 -9
  120. package/src/sap/ui/rta/plugin/additionalElements/AdditionalElementsUtils.js +1 -1
  121. package/src/sap/ui/rta/plugin/additionalElements/CommandBuilder.js +2 -2
  122. package/src/sap/ui/rta/plugin/iframe/AddIFrame.js +3 -3
  123. package/src/sap/ui/rta/plugin/iframe/AddIFrameDialog.js +1 -1
  124. package/src/sap/ui/rta/service/Action.js +1 -1
  125. package/src/sap/ui/rta/service/ControllerExtension.js +1 -1
  126. package/src/sap/ui/rta/service/Outline.js +6 -4
  127. package/src/sap/ui/rta/service/Property.js +1 -1
  128. package/src/sap/ui/rta/service/Selection.js +1 -1
  129. package/src/sap/ui/rta/service/SupportTools.js +189 -0
  130. package/src/sap/ui/rta/service/index.js +7 -6
  131. package/src/sap/ui/rta/toolbar/Adaptation.fragment.xml +11 -1
  132. package/src/sap/ui/rta/toolbar/Adaptation.js +9 -1
  133. package/src/sap/ui/rta/toolbar/AdaptationRenderer.js +3 -1
  134. package/src/sap/ui/rta/toolbar/Base.js +1 -1
  135. package/src/sap/ui/rta/toolbar/BaseRenderer.js +6 -4
  136. package/src/sap/ui/rta/toolbar/Fiori.js +1 -1
  137. package/src/sap/ui/rta/toolbar/FioriLike.js +1 -1
  138. package/src/sap/ui/rta/toolbar/OverflowToolbarButton.js +1 -1
  139. package/src/sap/ui/rta/toolbar/Personalization.js +1 -1
  140. package/src/sap/ui/rta/toolbar/Standalone.js +1 -1
  141. package/src/sap/ui/rta/toolbar/contextBased/SaveAsContextBasedAdaptation.js +125 -0
  142. package/src/sap/ui/rta/toolbar/contextBased/SaveAsContextBasedAdaptationDialog.fragment.xml +79 -0
  143. package/src/sap/ui/rta/toolbar/translation/Translation.js +1 -5
  144. package/src/sap/ui/rta/toolbar/versioning/Versioning.js +1 -1
  145. package/src/sap/ui/rta/util/BindingsExtractor.js +97 -41
  146. package/src/sap/ui/rta/util/PluginManager.js +1 -1
  147. package/src/sap/ui/rta/util/PopupManager.js +1 -1
  148. package/src/sap/ui/rta/util/ReloadManager.js +1 -1
  149. package/src/sap/ui/rta/util/ServiceEventBus.js +1 -1
  150. package/src/sap/ui/rta/util/StylesLoader.js +3 -3
  151. package/src/sap/ui/rta/util/adaptationStarter.js +13 -4
  152. package/src/sap/ui/rta/util/changeVisualization/ChangeCategories.js +50 -0
  153. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicator.js +44 -41
  154. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorCategorySelection.fragment.xml +2 -2
  155. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorPopover.fragment.xml +2 -1
  156. package/src/sap/ui/rta/util/changeVisualization/ChangeIndicatorRegistry.js +69 -43
  157. package/src/sap/ui/rta/util/changeVisualization/ChangeVisualization.js +57 -83
  158. package/src/sap/ui/rta/util/changeVisualization/{categories → commands}/CombineVisualization.js +1 -1
  159. package/src/sap/ui/rta/util/changeVisualization/{categories → commands}/MoveVisualization.js +13 -10
  160. package/src/sap/ui/rta/util/changeVisualization/{categories → commands}/RenameVisualization.js +1 -1
  161. package/src/sap/ui/rta/util/changeVisualization/{categories → commands}/SplitVisualization.js +1 -1
  162. package/src/sap/ui/rta/util/changeVisualization/commands/getCommandVisualization.js +37 -0
  163. package/src/sap/ui/rta/util/changeVisualization/categories/getVisualizationCategory.js +0 -35
@@ -24,6 +24,7 @@ sap.ui.define([
24
24
  "sap/ui/events/KeyCodes",
25
25
  "sap/ui/fl/write/api/Version",
26
26
  "sap/ui/fl/apply/api/SmartVariantManagementApplyAPI",
27
+ "sap/ui/fl/write/api/ContextBasedAdaptationsAPI",
27
28
  "sap/ui/fl/write/api/ControlPersonalizationWriteAPI",
28
29
  "sap/ui/fl/write/api/FeaturesAPI",
29
30
  "sap/ui/fl/write/api/PersistenceWriteAPI",
@@ -71,6 +72,7 @@ sap.ui.define([
71
72
  KeyCodes,
72
73
  Version,
73
74
  SmartVariantManagementApplyAPI,
75
+ ContextBasedAdaptationsAPI,
74
76
  ControlPersonalizationWriteAPI,
75
77
  FeaturesAPI,
76
78
  PersistenceWriteAPI,
@@ -116,7 +118,7 @@ sap.ui.define([
116
118
  * @class The runtime authoring allows to adapt the fields of a running application.
117
119
  * @extends sap.ui.base.ManagedObject
118
120
  * @author SAP SE
119
- * @version 1.105.1
121
+ * @version 1.107.0
120
122
  * @constructor
121
123
  * @private
122
124
  * @since 1.30
@@ -134,12 +136,6 @@ sap.ui.define([
134
136
  }
135
137
  },
136
138
  properties: {
137
- /** The URL which is called when the custom field dialog is opened */
138
- customFieldUrl: "string",
139
-
140
- /** Whether the create custom field button should be shown */
141
- showCreateCustomField: "boolean",
142
-
143
139
  /** Whether the create custom field button should be shown */
144
140
  showToolbars: {
145
141
  type: "boolean",
@@ -247,8 +243,8 @@ sap.ui.define([
247
243
  this.addDependent(new PopupManager(), "popupManager");
248
244
 
249
245
  if (this.getShowToolbars()) {
250
- this.getPopupManager().attachOpen(this.onPopupOpen, this);
251
- this.getPopupManager().attachClose(this.onPopupClose, this);
246
+ this.getPopupManager().attachOpen(onPopupOpen, this);
247
+ this.getPopupManager().attachClose(onPopupClose, this);
252
248
 
253
249
  // Change visualization can only be triggered from the toolbar
254
250
  this.addDependent(new ChangeVisualization(), "changeVisualization");
@@ -257,24 +253,53 @@ sap.ui.define([
257
253
  if (window.parent !== window) {
258
254
  this.startService("receiver");
259
255
  }
256
+ this.startService("supportTools");
260
257
 
261
258
  this._loadUShellServicesPromise = FlexUtils.getUShellServices(["URLParsing", "AppLifeCycle", "CrossApplicationNavigation"])
262
- .then(function (mUShellServices) {
259
+ .then(function(mUShellServices) {
263
260
  this._mUShellServices = mUShellServices;
264
261
  ReloadManager.setUShellServices(mUShellServices);
265
262
  }.bind(this));
266
263
  }
267
264
  });
268
265
 
269
- RuntimeAuthoring.prototype._shouldValidateFlexEnabled = function () {
270
- var sUriParam = UriParameters.fromQuery(window.location.search).get("sap-ui-rta-skip-flex-validation");
271
- return Settings.getInstance()
272
- .then(function (oSettings) {
273
- return !oSettings.isCustomerSystem() && sUriParam !== "true";
274
- });
266
+ /**
267
+ * The RTA FLP plugin checks whether RTA needs to be restarted and restarts it if needed.
268
+ *
269
+ * @public
270
+ * @static
271
+ * @param {sap.ui.fl.Layer} sLayer - Active layer
272
+ * @returns {boolean} Returns true if restart is needed
273
+ */
274
+ RuntimeAuthoring.needsRestart = function(sLayer) {
275
+ return ReloadManager.needsAutomaticStart(sLayer);
276
+ };
277
+
278
+ /**
279
+ * Enable restart of RTA
280
+ * the RTA FLP plugin handles the restart
281
+ *
282
+ * @public
283
+ * @static
284
+ * @param {sap.ui.fl.Layer} sLayer - Active layer
285
+ * @param {sap.ui.core.Control} oRootControl - Root control for which RTA was started
286
+ */
287
+ RuntimeAuthoring.enableRestart = function(sLayer, oRootControl) {
288
+ ReloadManager.enableAutomaticStart(sLayer, oRootControl);
289
+ };
290
+
291
+ /**
292
+ * Disable restart of RTA
293
+ *
294
+ * @public
295
+ * @static
296
+ * @param {sap.ui.fl.Layer} sLayer - Active layer
297
+ */
298
+ RuntimeAuthoring.disableRestart = function(sLayer) {
299
+ ReloadManager.disableAutomaticStart(sLayer);
275
300
  };
276
301
 
277
- RuntimeAuthoring.prototype.addDependent = function (oObject, sName, bCreateGetter) {
302
+ RuntimeAuthoring.prototype.addDependent = function(oObject, sName, bCreateGetter) {
278
303
  bCreateGetter = typeof bCreateGetter === "undefined" ? true : !!bCreateGetter;
279
304
  if (!(sName in this._dependents)) {
280
305
  if (sName && bCreateGetter) {
@@ -294,35 +319,18 @@ sap.ui.define([
294
319
  return this._dependents[sName];
295
320
  };
296
321
 
297
- RuntimeAuthoring.prototype.getDependents = function () {
322
+ RuntimeAuthoring.prototype.getDependents = function() {
298
323
  return this._dependents;
299
324
  };
300
325
 
301
- RuntimeAuthoring.prototype.removeDependent = function (sName) {
326
+ RuntimeAuthoring.prototype.removeDependent = function(sName) {
302
327
  delete this._dependents[sName];
303
328
  };
304
329
 
305
-
306
- RuntimeAuthoring.prototype.onPopupOpen = function(oEvent) {
307
- var oOpenedPopup = oEvent.getParameters().getSource();
308
- if (
309
- oOpenedPopup.isA("sap.m.Dialog")
310
- && this.getToolbar().type === "fiori"
311
- ) {
312
- this.getToolbar().setColor("contrast");
313
- }
314
- this.getToolbar().bringToFront();
315
- };
316
-
317
- RuntimeAuthoring.prototype.onPopupClose = function(oEvent) {
318
- if (oEvent.getParameters().isA("sap.m.Dialog")) {
319
- this.getToolbar().setColor();
320
- }
321
- };
322
-
323
330
  /**
324
331
  * Setter method for plugins. Plugins can't be set when runtime authoring is started.
325
- * @param {object} mPlugins - map of plugins
332
+ *
333
+ * @param {object} mPlugins - Map of plugins
326
334
  */
327
335
  RuntimeAuthoring.prototype.setPlugins = function(mPlugins) {
328
336
  if (this._sStatus !== STOPPED) {
@@ -333,9 +341,10 @@ sap.ui.define([
333
341
 
334
342
  /**
335
343
  * Getter method for plugins.
336
- * @returns {Object<string, sap.ui.rta.plugin.Plugin>} map with plugins
344
+ *
345
+ * @returns {Object<string, sap.ui.rta.plugin.Plugin>} Map with plugins
337
346
  */
338
- RuntimeAuthoring.prototype.getPlugins = function () {
347
+ RuntimeAuthoring.prototype.getPlugins = function() {
339
348
  return this.getPluginManager
340
349
  && this.getPluginManager()
341
350
  && this.getPluginManager().getPlugins();
@@ -351,9 +360,9 @@ sap.ui.define([
351
360
  * always the same instances get returned.
352
361
  *
353
362
  * @public
354
- * @return {Object<string,sap.ui.rta.plugin.Plugin>} Map with plugins
363
+ * @returns {Object<string,sap.ui.rta.plugin.Plugin>} Map with plugins
355
364
  */
356
- RuntimeAuthoring.prototype.getDefaultPlugins = function () {
365
+ RuntimeAuthoring.prototype.getDefaultPlugins = function() {
357
366
  return this.getPluginManager().getDefaultPlugins(this.getFlexSettings());
358
367
  };
359
368
 
@@ -392,10 +401,10 @@ sap.ui.define([
392
401
  /**
393
402
  * Checks the uri parameters for "sap-ui-layer" and returns either the current layer or the layer from the uri parameter, if there is one
394
403
  *
395
- * @returns {string} the layer after checking the uri parameters
404
+ * @returns {string} The layer after checking the uri parameters
396
405
  * @private
397
406
  */
398
- RuntimeAuthoring.prototype.getLayer = function () {
407
+ RuntimeAuthoring.prototype.getLayer = function() {
399
408
  return this.getFlexSettings().layer;
400
409
  };
401
410
 
@@ -410,41 +419,13 @@ sap.ui.define([
410
419
  return sap.ui.getCore().getLibraryResourceBundle("sap.ui.rta");
411
420
  };
412
421
 
413
- RuntimeAuthoring.prototype._setVersionsModel = function(oModel) {
414
- this._oVersionsModel = oModel;
415
- };
416
-
417
- RuntimeAuthoring.prototype._initVersioning = function() {
418
- return VersionsAPI.initialize({
419
- control: this.getRootControlInstance(),
420
- layer: this.getLayer()
421
- }).then(this._setVersionsModel.bind(this));
422
- };
423
-
424
- RuntimeAuthoring.prototype._onPersonalizationChangeCreation = function() {
425
- if (this.getMode() === "navigation" && !this._bNavigationModeWarningShown) {
426
- this._showMessageToast("MSG_NAVIGATION_MODE_CHANGES_WARNING", {
427
- duration: 5000
428
- });
429
- this._bNavigationModeWarningShown = true;
430
- }
431
- };
432
-
433
- function addOrRemoveStyleClass(oRootControl, bAdd) {
434
- if (oRootControl.isA("sap.ui.core.UIComponent")) {
435
- oRootControl = oRootControl.getRootControl();
436
- }
437
- if (oRootControl) {
438
- oRootControl[bAdd ? "addStyleClass" : "removeStyleClass"]("sapUiRtaRoot");
439
- }
440
- }
441
-
442
422
  /**
443
423
  * Start UI adaptation at runtime (RTA).
444
- * @return {Promise} Returns a Promise with the initialization of RTA
424
+ *
425
+ * @returns {Promise} Returns a Promise with the initialization of RTA
445
426
  * @public
446
427
  */
447
- RuntimeAuthoring.prototype.start = function () {
428
+ RuntimeAuthoring.prototype.start = function() {
448
429
  var oDesignTimePromise;
449
430
  var vError;
450
431
  // Create DesignTime
@@ -458,7 +439,7 @@ sap.ui.define([
458
439
  }
459
440
 
460
441
  return this._loadUShellServicesPromise
461
- .then(this._initVersioning.bind(this))
442
+ .then(initVersioning.bind(this))
462
443
  /*
463
444
  Check if the application has personalized changes and reload without them;
464
445
  Also Check if the application has an available draft and if yes, reload with those changes.
@@ -484,13 +465,13 @@ sap.ui.define([
484
465
 
485
466
  this.getPluginManager().preparePlugins(
486
467
  this.getFlexSettings(),
487
- this._handleElementModified.bind(this),
468
+ handleElementModified.bind(this),
488
469
  this.getCommandStack()
489
470
  );
490
471
 
491
472
  var aPlugins = this.getPluginManager().getPluginList();
492
473
 
493
- oDesignTimePromise = new Promise(function (fnResolve, fnReject) {
474
+ oDesignTimePromise = new Promise(function(fnResolve, fnReject) {
494
475
  Measurement.start("rta.dt.startup", "Measurement of RTA: DesignTime start up");
495
476
  this._oDesignTime = new DesignTime({
496
477
  scope: this.getMetadataScope(),
@@ -528,23 +509,23 @@ sap.ui.define([
528
509
  window.onbeforeunload = this._onUnload.bind(this);
529
510
  return undefined;
530
511
  }.bind(this))
531
- .then(function () {
512
+ .then(function() {
532
513
  if (this.getShowToolbars()) {
533
514
  // Create ToolsMenu
534
- return this._getToolbarButtonsVisibility()
535
- .then(this._createToolsMenu.bind(this));
515
+ return getToolbarButtonsVisibility(this.getRootControlInstance(), this.getLayer(), this._oSerializer)
516
+ .then(createToolsMenu.bind(this));
536
517
  }
537
518
  return undefined;
538
519
  }.bind(this))
539
520
  // this is needed to initially check if undo is available, e.g. when the stack gets initialized with changes
540
- .then(this._onStackModified.bind(this))
541
- .then(function () {
521
+ .then(onStackModified.bind(this))
522
+ .then(function() {
542
523
  //Resolve the CSS variable set in themes/base/OverlayWithScrollbar.css
543
524
  Overlay.getOverlayContainer().get(0).style.setProperty("--sap-ui-rta-scrollbar-scrollWidth", DOMUtil.getScrollbarWidth() + "px");
544
525
  Overlay.getOverlayContainer().get(0).style.setProperty("--sap-ui-rta-scrollbar-scrollWidthPlusTwo", DOMUtil.getScrollbarWidth() + 2 + "px");
545
526
  return oDesignTimePromise;
546
527
  })
547
- .then(function () {
528
+ .then(function() {
548
529
  // PopupManager sets the toolbar to already open popups' autoCloseAreas
549
530
  // Since at this point the toolbar is not available, it waits for RTA to start,
550
531
  // before adding it to the autoCloseAreas of the open popups
@@ -555,24 +536,24 @@ sap.ui.define([
555
536
  }
556
537
  return undefined;
557
538
  }.bind(this))
558
- .then(function () {
539
+ .then(function() {
559
540
  if (Device.browser.name === "ff") {
560
541
  // in FF shift+f10 also opens a browser context menu.
561
542
  // It seems that the only way to get rid of it is to completely turn off context menu in ff..
562
- jQuery(document).on("contextmenu", _ffContextMenuHandler);
543
+ jQuery(document).on("contextmenu", ffContextMenuHandler);
563
544
  }
564
545
  })
565
546
  .then(function() {
566
- this.fnKeyDown = this._onKeyDown.bind(this);
547
+ this.fnKeyDown = onKeyDown.bind(this);
567
548
  jQuery(document).on("keydown", this.fnKeyDown);
568
- this.fnOnPersonalizationChangeCreation = this._onPersonalizationChangeCreation.bind(this);
549
+ this.fnOnPersonalizationChangeCreation = onPersonalizationChangeCreation.bind(this);
569
550
  ControlPersonalizationWriteAPI.attachChangeCreation(
570
551
  this.getRootControlInstance(),
571
552
  this.fnOnPersonalizationChangeCreation
572
553
  );
573
554
  }.bind(this))
574
- .then(this._shouldValidateFlexEnabled)
575
- .then(function (bShouldValidateFlexEnabled) {
555
+ .then(shouldValidateFlexEnabled)
556
+ .then(function(bShouldValidateFlexEnabled) {
576
557
  if (bShouldValidateFlexEnabled) {
577
558
  validateFlexEnabled(this);
578
559
  }
@@ -581,7 +562,7 @@ sap.ui.define([
581
562
  editablePluginsCount: this.getPluginManager().getEditableOverlaysCount()
582
563
  });
583
564
  }.bind(this))
584
- .catch(function (vError) {
565
+ .catch(function(vError) {
585
566
  if (vError === "Reload triggered") {
586
567
  // destroy rta when reload is triggered - otherwise the consumer needs to take care of this
587
568
  this.destroy();
@@ -595,62 +576,57 @@ sap.ui.define([
595
576
  return Promise.reject("RuntimeAuthoring is already started");
596
577
  };
597
578
 
598
- function _ffContextMenuHandler() {
599
- return false;
600
- }
601
-
602
579
  /**
603
- * Checks the publish button, draft buttons(activate and delete) and app variant support (i.e. Save As and Overview of App Variants) availability
604
- * @private
605
- * @returns {Promise<map>} with publishAvailable, publishAppVariantSupported and draftAvailable values
606
- * @description The publish button shall not be available if the system is productive and if a merge error occurred during merging changes into the view on startup
607
- * The app variant support shall not be available if the system is productive and if the platform is not enabled (See Feature.js) to show the app variant tooling
608
- * isProductiveSystem should only return true if it is a test or development system with the provision of custom catalog extensions
580
+ * Stops Runtime Authoring
581
+ *
582
+ * @public
583
+ * @param {boolean} bSkipSave - Stop RTA with or w/o saving changes
584
+ * @param {boolean} bSkipRestart - Stop RTA with or w/o checking if a reload is needed to apply e.g. personalization/app descriptor changes
585
+ * @returns {Promise} Resolves with undefined
609
586
  */
610
- RuntimeAuthoring.prototype._getToolbarButtonsVisibility = function() {
611
- return FeaturesAPI.isPublishAvailable().then(function(bIsPublishAvailable) {
612
- return RtaAppVariantFeature.isSaveAsAvailable(this.getRootControlInstance(), this.getLayer(), this._oSerializer).then(function(bIsSaveAsAvailable) {
613
- return {
614
- publishAvailable: bIsPublishAvailable,
615
- saveAsAvailable: bIsPublishAvailable && bIsSaveAsAvailable
616
- };
617
- });
618
- }.bind(this));
619
- };
620
-
621
- RuntimeAuthoring.prototype._isOldVersionDisplayed = function() {
622
- return VersionsAPI.isOldVersionDisplayed({
623
- control: this.getRootControlInstance(),
624
- layer: this.getLayer()
625
- });
626
- };
627
-
628
- RuntimeAuthoring.prototype._isDraftAvailable = function() {
629
- return VersionsAPI.isDraftAvailable({
630
- control: this.getRootControlInstance(),
631
- layer: this.getLayer()
632
- });
587
+ RuntimeAuthoring.prototype.stop = function(bSkipSave, bSkipRestart) {
588
+ checkToolbarAndExecuteFunction.call(this, "setBusy", true);
589
+ var oReloadInfo;
590
+ return waitForPendingActions.call(this)
591
+ .then(function() {
592
+ if (bSkipRestart) {
593
+ return {};
594
+ }
595
+ return ReloadManager.checkReloadOnExit({
596
+ layer: this.getLayer(),
597
+ selector: this.getRootControlInstance(),
598
+ isDraftAvailable: this._oVersionsModel.getProperty("/draftAvailable"),
599
+ versioningEnabled: this._oVersionsModel.getProperty("/versioningEnabled"),
600
+ activeVersion: this._oVersionsModel.getProperty("/activeVersion"),
601
+ changesNeedReloadPromise: this._bSavedChangesNeedReload ? Promise.resolve(true) : this._oSerializer.needsReload()
602
+ });
603
+ }.bind(this))
604
+ .then(function(oReturn) {
605
+ oReloadInfo = oReturn;
606
+ return bSkipSave ? Promise.resolve() : this._serializeToLrep();
607
+ }.bind(this))
608
+ .then(checkToolbarAndExecuteFunction.bind(this, "hide", bSkipSave))
609
+ .then(function() {
610
+ this.fireStop();
611
+ if (!bSkipRestart) {
612
+ ReloadManager.handleUrlParametersOnExit(oReloadInfo);
613
+ }
614
+ }.bind(this))
615
+ .catch(showTechnicalError)
616
+ .then(function() {
617
+ checkToolbarAndExecuteFunction.call(this, "setBusy", false);
618
+ this._sStatus = STOPPED;
619
+ jQuery("body").removeClass("sapUiRtaMode");
620
+ }.bind(this));
633
621
  };
634
622
 
635
- function showTechnicalError(vError) {
636
- BusyIndicator.hide();
637
- var sErrorMessage = vError.userMessage || vError.stack || vError.message || vError.status || vError;
638
- var oTextResources = sap.ui.getCore().getLibraryResourceBundle("sap.ui.rta");
639
- Log.error("Failed to transfer changes", sErrorMessage);
640
- var sMsg = oTextResources.getText("MSG_LREP_TRANSFER_ERROR") + "\n"
641
- + oTextResources.getText("MSG_ERROR_REASON", sErrorMessage);
642
- MessageBox.error(sMsg, {
643
- styleClass: Utils.getRtaStyleClassName()
644
- });
645
- }
646
-
647
623
  /**
648
624
  * @override
649
625
  */
650
626
  RuntimeAuthoring.prototype.setCommandStack = function(oCommandStack) {
651
627
  var oOldCommandStack = this.getProperty("commandStack");
652
628
  if (oOldCommandStack) {
653
- oOldCommandStack.detachModified(this._onStackModified, this);
629
+ oOldCommandStack.detachModified(onStackModified, this);
654
630
  }
655
631
 
656
632
  if (this._oInternalCommandStack) {
@@ -661,7 +637,7 @@ sap.ui.define([
661
637
  var oResult = this.setProperty("commandStack", oCommandStack);
662
638
 
663
639
  if (oCommandStack) {
664
- oCommandStack.attachModified(this._onStackModified, this);
640
+ oCommandStack.attachModified(onStackModified, this);
665
641
  }
666
642
 
667
643
  if (this.getPluginManager && this.getPluginManager()) {
@@ -672,7 +648,6 @@ sap.ui.define([
672
648
  };
673
649
 
674
650
  /**
675
- *
676
651
  * @override
677
652
  */
678
653
  RuntimeAuthoring.prototype.getCommandStack = function() {
@@ -687,151 +662,210 @@ sap.ui.define([
687
662
  };
688
663
 
689
664
  /**
690
- * adapt the enablement of undo/redo/reset/transport button
691
- * @returns {Promise} Resolves as soon as the MessageBox is closed
692
- * @private
665
+ * @override
693
666
  */
694
- RuntimeAuthoring.prototype._onStackModified = function() {
695
- var bBackEndDraftExists = this._oVersionsModel.getProperty("/backendDraft");
696
- var bDraftDisplayed = this._oVersionsModel.getProperty("/displayedVersion") === Version.Number.Draft;
697
- var oCommandStack = this.getCommandStack();
698
- var bCanUndo = oCommandStack.canUndo();
667
+ RuntimeAuthoring.prototype.setMode = function(sNewMode) {
668
+ var sCurrentMode = this.getMode();
669
+ if (sCurrentMode !== sNewMode) {
670
+ var oTabHandlingPlugin = this.getPluginManager().getPlugin("tabHandling");
671
+ var oSelectionPlugin = this.getPluginManager().getPlugin("selection");
699
672
 
700
- if (
701
- !this.getShowToolbars() ||
702
- !bCanUndo ||
703
- this._bUserDiscardedDraft ||
704
- bDraftDisplayed ||
705
- !bBackEndDraftExists
706
- ) {
707
- return this._modifyStack();
708
- }
673
+ // Switch between another mode and navigation -> toggle overlay & App-TabIndex enablement
674
+ if (sCurrentMode === "navigation" || sNewMode === "navigation") {
675
+ this._oDesignTime.setEnabled(sNewMode !== "navigation");
676
+ oTabHandlingPlugin[(sNewMode === "navigation") ? "restoreTabIndex" : "removeTabIndex"]();
677
+ }
709
678
 
710
- // warn the user: the existing draft would be discarded in case the user saves
711
- return Utils.showMessageBox("warning", "MSG_DRAFT_DISCARD_AND_CREATE_NEW_DIALOG", {
712
- titleKey: "TIT_DRAFT_DISCARD_DIALOG",
713
- actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
714
- emphasizedAction: MessageBox.Action.OK
715
- })
716
- .then(function(sAction) {
717
- if (sAction === MessageBox.Action.OK) {
718
- this._discardDraftConfirmed();
719
- } else {
720
- this.undo();
679
+ var oChangeVisualization = this.getChangeVisualization && this.getChangeVisualization();
680
+ if (sNewMode === "visualization" || sCurrentMode === "visualization") {
681
+ DtUtil.waitForSynced(this._oDesignTime)()
682
+ .then(function() {
683
+ return oChangeVisualization.triggerModeChange(this.getRootControl(), this.getToolbar());
684
+ }.bind(this));
721
685
  }
722
- }.bind(this));
723
- };
724
686
 
725
- RuntimeAuthoring.prototype._discardDraftConfirmed = function() {
726
- this._bUserDiscardedDraft = true;
727
- this._modifyStack();
728
- };
687
+ if (sCurrentMode === "adaptation") {
688
+ this.getPluginManager().handleStopCutPaste();
689
+ }
729
690
 
730
- RuntimeAuthoring.prototype._modifyStack = function() {
731
- if (this.getShowToolbars()) {
732
- var oCommandStack = this.getCommandStack();
733
- var bCanUndo = oCommandStack.canUndo();
734
- var bCanRedo = oCommandStack.canRedo();
735
- var bTranslationRelevantDirtyChange = this._oToolbarControlsModel.getProperty("/translationVisible") &&
736
- TranslationAPI.hasTranslationRelevantDirtyChanges({layer: Layer.CUSTOMER, selector: this.getRootControlInstance()});
691
+ oTabHandlingPlugin[(sNewMode === "adaptation") ? "restoreOverlayTabIndex" : "removeOverlayTabIndex"]();
692
+ oSelectionPlugin.setIsActive(!(sNewMode === "visualization"));
737
693
 
738
- // TODO: move to the setter to the ChangesState
739
- this._oVersionsModel.setDirtyChanges(bCanUndo);
740
- this._oToolbarControlsModel.setProperty("/undoEnabled", bCanUndo);
741
- this._oToolbarControlsModel.setProperty("/redoEnabled", bCanRedo);
742
- this._oToolbarControlsModel.setProperty("/publishEnabled", this.bInitialPublishEnabled || bCanUndo);
743
- this._oToolbarControlsModel.setProperty("/restoreEnabled", this.bInitialResetEnabled || bCanUndo);
744
- this._oToolbarControlsModel.setProperty("/translationEnabled", this.bPersistedDataTranslatable || bTranslationRelevantDirtyChange);
745
- }
746
- this.fireUndoRedoStackModified();
747
- return Promise.resolve();
748
- };
694
+ Overlay.getOverlayContainer().toggleClass("sapUiRtaVisualizationMode", (sNewMode === "visualization"));
695
+ if (sNewMode === "visualization") {
696
+ jQuery(".sapUiDtOverlayMovable").css("cursor", "default");
697
+ } else {
698
+ jQuery(".sapUiDtOverlayMovable").css("cursor", "move");
699
+ }
749
700
 
750
- RuntimeAuthoring.prototype._checkToolbarAndExecuteFunction = function (sName, vValue) {
751
- if (this.getShowToolbars() && this.getToolbar && this.getToolbar()) {
752
- return this.getToolbar()[sName](vValue);
701
+ this._oToolbarControlsModel.setProperty("/modeSwitcher", sNewMode);
702
+ this.setProperty("mode", sNewMode);
703
+ this.fireModeChanged({mode: sNewMode});
753
704
  }
754
- return undefined;
755
705
  };
756
706
 
757
707
  /**
758
- * Returns a selection from the DesignTime
759
- * @return {sap.ui.dt.Overlay[]} selected overlays
760
- * @public
708
+ * @override
761
709
  */
762
- RuntimeAuthoring.prototype.getSelection = function() {
763
- if (this._oDesignTime) {
764
- return this._oDesignTime.getSelectionManager().get();
710
+ RuntimeAuthoring.prototype.setMetadataScope = function(sScope) {
711
+ // We do not support scope change after creation of DesignTime instance
712
+ // as this requires re-initialization of all overlays
713
+ if (this._sStatus !== STOPPED) {
714
+ Log.error("sap.ui.rta: Failed to set metadata scope on RTA instance after RTA is started");
715
+ return;
765
716
  }
766
- return [];
767
- };
768
717
 
769
- function waitForPendingActions() {
770
- return Promise.resolve(this._oDesignTime && this._oDesignTime.waitForBusyPlugins())
771
- .then(function() {
772
- return this._pElementModified;
773
- }.bind(this));
774
- }
718
+ this.setProperty("metadataScope", sScope);
719
+ };
775
720
 
776
721
  /**
777
- * Stops Runtime Authoring
722
+ * Exit Runtime Authoring - destroy all controls and plugins
778
723
  *
779
- * @public
780
- * @param {boolean} bDontSaveChanges - Stop RTA with or w/o saving changes
781
- * @param {boolean} bSkipRestart - Stop RTA with or w/o checking if a reload is needed to apply e.g. personalization/app descriptor changes
782
- * @returns {Promise} Resolves with undefined
724
+ * @protected
783
725
  */
784
- RuntimeAuthoring.prototype.stop = function(bDontSaveChanges, bSkipRestart) {
785
- this._checkToolbarAndExecuteFunction("setBusy", true);
786
- var oReloadInfo;
787
- return waitForPendingActions.call(this)
788
- .then(function() {
789
- if (bSkipRestart) {
790
- return {};
791
- }
792
- return ReloadManager.checkReloadOnExit({
793
- layer: this.getLayer(),
794
- selector: this.getRootControlInstance(),
795
- isDraftAvailable: this._oVersionsModel.getProperty("/draftAvailable"),
796
- versioningEnabled: this._oVersionsModel.getProperty("/versioningEnabled"),
797
- activeVersion: this._oVersionsModel.getProperty("/activeVersion"),
798
- changesNeedReloadPromise: this._bSavedChangesNeedReload ? Promise.resolve(true) : this._oSerializer.needsReload()
799
- });
800
- }.bind(this))
801
- .then(function(oReturn) {
802
- oReloadInfo = oReturn;
803
- return bDontSaveChanges ? Promise.resolve() : this._serializeToLrep(this);
804
- }.bind(this))
805
- .then(this._checkToolbarAndExecuteFunction.bind(this, "hide", bDontSaveChanges))
806
- .then(function() {
807
- this.fireStop();
808
- if (!bSkipRestart) {
809
- ReloadManager.handleUrlParametersOnExit(oReloadInfo);
810
- }
811
- }.bind(this))
812
- .catch(showTechnicalError)
813
- .then(function () {
814
- this._checkToolbarAndExecuteFunction("setBusy", false);
815
- this._sStatus = STOPPED;
816
- jQuery("body").removeClass("sapUiRtaMode");
817
- }.bind(this));
726
+ RuntimeAuthoring.prototype.destroy = function() {
727
+ jQuery.map(this._dependents, function(oDependent, sName) {
728
+ this.removeDependent(sName);
729
+ // Destroy should be called with suppress invalidate = true here to prevent static UI Area invalidation
730
+ oDependent.destroy(true);
731
+ }.bind(this));
732
+
733
+ Object.keys(this._mServices).forEach(function(sServiceName) {
734
+ this.stopService(sServiceName);
735
+ }, this);
736
+
737
+ if (this._oDesignTime) {
738
+ this._oDesignTime.destroy();
739
+ this._oDesignTime = null;
740
+
741
+ // detach browser events
742
+ jQuery(document).off("keydown", this.fnKeyDown);
743
+
744
+ if (this.fnOnPersonalizationChangeCreation) {
745
+ ControlPersonalizationWriteAPI.detachChangeCreation(
746
+ this.getRootControlInstance(),
747
+ this.fnOnPersonalizationChangeCreation
748
+ );
749
+ }
750
+ }
751
+
752
+ if (this.getRootControlInstance()) {
753
+ addOrRemoveStyleClass(this.getRootControlInstance(), false);
754
+ }
755
+
756
+ this.setCommandStack(null);
757
+
758
+ if (this._oServiceEventBus) {
759
+ this._oServiceEventBus.destroy();
760
+ }
761
+
762
+ if (Device.browser.name === "ff") {
763
+ jQuery(document).off("contextmenu", ffContextMenuHandler);
764
+ }
765
+
766
+ window.onbeforeunload = this._oldUnloadHandler;
767
+
768
+ ManagedObject.prototype.destroy.apply(this, arguments);
818
769
  };
819
770
 
771
+ // ---- API ----
772
+
773
+ /**
774
+ * Returns the selected overlays from the DesignTime. Used by VisualEditor
775
+ * @returns {sap.ui.dt.Overlay[]} Selected overlays
776
+ * @public
777
+ */
778
+ RuntimeAuthoring.prototype.getSelection = function() {
779
+ if (this._oDesignTime) {
780
+ return this._oDesignTime.getSelectionManager().get();
781
+ }
782
+ return [];
783
+ };
784
+
785
+ /**
786
+ * Discard all LREP changes and restores the default app state,
787
+ * opens a MessageBox where the user can confirm
788
+ * the restoring to the default app state
789
+ *
790
+ * @returns {Promise} Resolves when Message Box is closed.
791
+ */
820
792
  RuntimeAuthoring.prototype.restore = function() {
821
- return this._onRestore();
793
+ var sLayer = this.getLayer();
794
+ var sMessageKey = sLayer === Layer.USER
795
+ ? "FORM_PERS_RESET_MESSAGE_PERSONALIZATION"
796
+ : "FORM_PERS_RESET_MESSAGE";
797
+ var sTitleKey = sLayer === Layer.USER
798
+ ? "BTN_RESTORE"
799
+ : "FORM_PERS_RESET_TITLE";
800
+
801
+ this.getPluginManager().handleStopCutPaste();
802
+
803
+ return Utils.showMessageBox("warning", sMessageKey, {
804
+ titleKey: sTitleKey,
805
+ actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
806
+ emphasizedAction: MessageBox.Action.OK
807
+ }).then(function(sAction) {
808
+ if (sAction === MessageBox.Action.OK) {
809
+ RuntimeAuthoring.enableRestart(sLayer, this.getRootControlInstance());
810
+ return deleteChanges.call(this);
811
+ }
812
+ return undefined;
813
+ }.bind(this));
822
814
  };
823
815
 
816
+ /**
817
+ * Function to handle ABAP transport of the changes
818
+ *
819
+ * @returns {Promise} Returns a Promise processing the transport of changes
820
+ */
824
821
  RuntimeAuthoring.prototype.transport = function() {
825
- return this._onTransport();
822
+ this.getPluginManager().handleStopCutPaste();
823
+
824
+ BusyIndicator.show(500);
825
+ return this._serializeToLrep().then(function() {
826
+ BusyIndicator.hide();
827
+ var bVariantByStartupParameter = FlexUtils.isVariantByStartupParameter(this._oRootControl);
828
+ var bAppVariantRunning = SmartVariantManagementApplyAPI.isApplicationVariant({control: this._oRootControl}) && !bVariantByStartupParameter;
829
+ return (bAppVariantRunning ? RtaAppVariantFeature.getAppVariantDescriptor(this._oRootControl) : Promise.resolve())
830
+ .then(function(oAppVariantDescriptor) {
831
+ var aAppVariantDescriptor = [];
832
+ if (oAppVariantDescriptor) {
833
+ aAppVariantDescriptor.push(oAppVariantDescriptor);
834
+ }
835
+ return PersistenceWriteAPI.publish({
836
+ selector: this.getRootControlInstance(),
837
+ styleClass: Utils.getRtaStyleClassName(),
838
+ layer: this.getLayer(),
839
+ appVariantDescriptors: aAppVariantDescriptor
840
+ })
841
+ .then(function(sMessage) {
842
+ if (sMessage !== "Error" && sMessage !== "Cancel") {
843
+ MessageToast.show(sMessage);
844
+ if (this.getShowToolbars()) {
845
+ PersistenceWriteAPI.getResetAndPublishInfo({
846
+ selector: this.getRootControlInstance(),
847
+ layer: this.getLayer()
848
+ })
849
+ .then(function(oPublishAndResetInfo) {
850
+ this._oToolbarControlsModel.setProperty("/publishEnabled", oPublishAndResetInfo.isPublishEnabled);
851
+ this._oToolbarControlsModel.setProperty("/restoreEnabled", oPublishAndResetInfo.isResetEnabled);
852
+ }.bind(this));
853
+ }
854
+ }
855
+ }.bind(this));
856
+ }.bind(this));
857
+ }.bind(this))
858
+ .catch(showTechnicalError);
826
859
  };
827
860
 
828
- // ---- backward compatibility API
829
861
  RuntimeAuthoring.prototype.undo = function() {
830
- return this._onUndo();
862
+ this.getPluginManager().handleStopCutPaste();
863
+ return this.getCommandStack().undo();
831
864
  };
832
865
 
833
866
  RuntimeAuthoring.prototype.redo = function() {
834
- return this._onRedo();
867
+ this.getPluginManager().handleStopCutPaste();
868
+ return this.getCommandStack().redo();
835
869
  };
836
870
 
837
871
  RuntimeAuthoring.prototype.canUndo = function() {
@@ -841,9 +875,207 @@ sap.ui.define([
841
875
  RuntimeAuthoring.prototype.canRedo = function() {
842
876
  return this.getCommandStack().canRedo();
843
877
  };
844
- // ---- backward compatibility API
845
878
 
846
- RuntimeAuthoring.prototype._onKeyDown = function(oEvent) {
879
+ RuntimeAuthoring.prototype.save = function() {
880
+ return waitForPendingActions.call(this)
881
+ .then(this._serializeToLrep.bind(this));
882
+ };
883
+
884
+ // ---- API ----
885
+
886
+ // this function is used to save in the Visual Editor
887
+ RuntimeAuthoring.prototype._serializeToLrep = function(bCondenseAnyLayer) {
888
+ // when saving a change that requires a reload, the information has to be cached
889
+ // to do the reload when exiting UI Adaptation as then the change will not be available anymore
890
+ if (!this._bSavedChangesNeedReload) {
891
+ return this._oSerializer.needsReload().then(function(bReloadNeeded) {
892
+ this._bSavedChangesNeedReload = bReloadNeeded;
893
+ return serializeAndSave.call(this, undefined, bCondenseAnyLayer);
894
+ }.bind(this));
895
+ }
896
+ return serializeAndSave.call(this, undefined, bCondenseAnyLayer);
897
+ };
898
+
899
+ /**
900
+ * Check for unsaved changes before leaving UI adaptation at runtime
901
+ *
902
+ * @returns {string} Returns the message to be displayed in the unsaved changes dialog
903
+ * @private
904
+ */
905
+ RuntimeAuthoring.prototype._onUnload = function() {
906
+ // this function is still in the prototype scope for easier testing
907
+ var oCommandStack = this.getCommandStack();
908
+ var bUnsaved = oCommandStack.canUndo();
909
+ if (bUnsaved && this.getShowWindowUnloadDialog()) {
910
+ return this._getTextResources().getText("MSG_UNSAVED_CHANGES");
911
+ }
912
+ window.onbeforeunload = this._oldUnloadHandler;
913
+ return undefined;
914
+ };
915
+
916
+ function shouldValidateFlexEnabled() {
917
+ var sUriParam = UriParameters.fromQuery(window.location.search).get("sap-ui-rta-skip-flex-validation");
918
+ return Settings.getInstance()
919
+ .then(function(oSettings) {
920
+ return !oSettings.isCustomerSystem() && sUriParam !== "true";
921
+ });
922
+ }
923
+
924
+ function onPopupOpen(oEvent) {
925
+ var oOpenedPopup = oEvent.getParameters().getSource();
926
+ if (
927
+ oOpenedPopup.isA("sap.m.Dialog")
928
+ && this.getToolbar().type === "fiori"
929
+ ) {
930
+ this.getToolbar().setColor("contrast");
931
+ }
932
+ this.getToolbar().bringToFront();
933
+ }
934
+
935
+ function onPopupClose(oEvent) {
936
+ if (oEvent.getParameters().isA("sap.m.Dialog")) {
937
+ this.getToolbar().setColor();
938
+ }
939
+ }
940
+
941
+ function onPersonalizationChangeCreation() {
942
+ if (this.getMode() === "navigation" && !this._bNavigationModeWarningShown) {
943
+ showMessageToast.call(this, "MSG_NAVIGATION_MODE_CHANGES_WARNING", {
944
+ duration: 5000
945
+ });
946
+ this._bNavigationModeWarningShown = true;
947
+ }
948
+ }
949
+
950
+ function showMessageToast(sMessageKey, mOptions) {
951
+ var sMessage = this._getTextResources().getText(sMessageKey);
952
+
953
+ MessageToast.show(sMessage, mOptions || {});
954
+ }
955
+
956
+ function addOrRemoveStyleClass(oRootControl, bAdd) {
957
+ if (oRootControl.isA("sap.ui.core.UIComponent")) {
958
+ oRootControl = oRootControl.getRootControl();
959
+ }
960
+ if (oRootControl) {
961
+ oRootControl[bAdd ? "addStyleClass" : "removeStyleClass"]("sapUiRtaRoot");
962
+ }
963
+ }
964
+
965
+ function ffContextMenuHandler() {
966
+ return false;
967
+ }
968
+
969
+ /**
970
+ * Checks the publish button, draft buttons(activate and delete) and app variant support (i.e. Save As and Overview of App Variants) availability
971
+ * The publish button shall not be available if the system is productive and if a merge error occurred during merging changes into the view on startup
972
+ * The app variant support shall not be available if the system is productive and if the platform is not enabled (See Feature.js) to show the app variant tooling
973
+ * isProductiveSystem should only return true if it is a test or development system with the provision of custom catalog extensions
974
+ *
975
+ * @param {object} oRootControl - Root control instance
976
+ * @param {sap.ui.fl.Layer} sLayer - Active layer
977
+ * @param {sap.ui.rta.command.LREPSerializer} oSerializer - LREP Serializer
978
+ * @returns {Promise<map>} with publishAvailable, publishAppVariantSupported and draftAvailable values
979
+ */
980
+ function getToolbarButtonsVisibility(oRootControl, sLayer, oSerializer) {
981
+ return Promise.all([
982
+ FeaturesAPI.isPublishAvailable(),
983
+ RtaAppVariantFeature.isSaveAsAvailable(oRootControl, sLayer, oSerializer),
984
+ FeaturesAPI.isContextBasedAdaptationAvailable(sLayer)
985
+ ]).then(function(aRtaFeaturesAvailability) {
986
+ var bIsPublishAvailable = aRtaFeaturesAvailability[0];
987
+ var bIsSaveAsAvailable = aRtaFeaturesAvailability[1];
988
+ var bIsContextBasedAdaptationAvailable = aRtaFeaturesAvailability[2];
989
+ return {
990
+ publishAvailable: bIsPublishAvailable,
991
+ saveAsAvailable: bIsPublishAvailable && bIsSaveAsAvailable,
992
+ contextBasedAdaptationAvailable: bIsContextBasedAdaptationAvailable
993
+ };
994
+ });
995
+ }
996
+
997
+ function showTechnicalError(vError) {
998
+ BusyIndicator.hide();
999
+ var sErrorMessage = vError.userMessage || vError.stack || vError.message || vError.status || vError;
1000
+ var oTextResources = sap.ui.getCore().getLibraryResourceBundle("sap.ui.rta");
1001
+ Log.error("Failed to transfer changes", sErrorMessage);
1002
+ var sMsg = oTextResources.getText("MSG_LREP_TRANSFER_ERROR") + "\n"
1003
+ + oTextResources.getText("MSG_ERROR_REASON", sErrorMessage);
1004
+ MessageBox.error(sMsg, {
1005
+ styleClass: Utils.getRtaStyleClassName()
1006
+ });
1007
+ }
1008
+
1009
+ /**
1010
+ * Adapt the enablement of undo/redo/reset/transport button
1011
+ *
1012
+ * @returns {Promise} Resolves as soon as the MessageBox is closed
1013
+ */
1014
+ function onStackModified() {
1015
+ var bBackEndDraftExists = this._oVersionsModel.getProperty("/backendDraft");
1016
+ var bDraftDisplayed = this._oVersionsModel.getProperty("/displayedVersion") === Version.Number.Draft;
1017
+ var oCommandStack = this.getCommandStack();
1018
+ var bCanUndo = oCommandStack.canUndo();
1019
+
1020
+ if (
1021
+ !this.getShowToolbars() ||
1022
+ !bCanUndo ||
1023
+ this._bUserDiscardedDraft ||
1024
+ bDraftDisplayed ||
1025
+ !bBackEndDraftExists
1026
+ ) {
1027
+ return modifyStack.call(this);
1028
+ }
1029
+
1030
+ // warn the user: the existing draft would be discarded in case the user saves
1031
+ return Utils.showMessageBox("warning", "MSG_DRAFT_DISCARD_AND_CREATE_NEW_DIALOG", {
1032
+ titleKey: "TIT_DRAFT_DISCARD_DIALOG",
1033
+ actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
1034
+ emphasizedAction: MessageBox.Action.OK
1035
+ })
1036
+ .then(function(sAction) {
1037
+ if (sAction === MessageBox.Action.OK) {
1038
+ discardDraftConfirmed.call(this);
1039
+ } else {
1040
+ this.undo();
1041
+ }
1042
+ }.bind(this));
1043
+ }
1044
+
1045
+ function modifyStack() {
1046
+ if (this.getShowToolbars()) {
1047
+ var oCommandStack = this.getCommandStack();
1048
+ var bCanUndo = oCommandStack.canUndo();
1049
+ var bCanRedo = oCommandStack.canRedo();
1050
+ var bTranslationRelevantDirtyChange = this._oToolbarControlsModel.getProperty("/translationVisible") &&
1051
+ TranslationAPI.hasTranslationRelevantDirtyChanges({layer: Layer.CUSTOMER, selector: this.getRootControlInstance()});
1052
+
1053
+ // TODO: move to the setter to the ChangesState
1054
+ this._oVersionsModel.setDirtyChanges(bCanUndo);
1055
+ this._oToolbarControlsModel.setProperty("/undoEnabled", bCanUndo);
1056
+ this._oToolbarControlsModel.setProperty("/redoEnabled", bCanRedo);
1057
+ this._oToolbarControlsModel.setProperty("/publishEnabled", this.bInitialPublishEnabled || bCanUndo);
1058
+ this._oToolbarControlsModel.setProperty("/restoreEnabled", this.bInitialResetEnabled || bCanUndo);
1059
+ this._oToolbarControlsModel.setProperty("/translationEnabled", this.bPersistedDataTranslatable || bTranslationRelevantDirtyChange);
1060
+ }
1061
+ this.fireUndoRedoStackModified();
1062
+ }
1063
+
1064
+ function checkToolbarAndExecuteFunction(sName, vValue) {
1065
+ if (this.getShowToolbars() && this.getToolbar && this.getToolbar()) {
1066
+ return this.getToolbar()[sName](vValue);
1067
+ }
1068
+ return undefined;
1069
+ }
1070
+
1071
+ function waitForPendingActions() {
1072
+ return Promise.resolve(this._oDesignTime && this._oDesignTime.waitForBusyPlugins())
1073
+ .then(function() {
1074
+ return this._pElementModified;
1075
+ }.bind(this));
1076
+ }
1077
+
1078
+ function onKeyDown(oEvent) {
847
1079
  // if for example the addField Dialog/transport/reset Popup is open, we don't want the user to be able to undo/redo
848
1080
  var bMacintosh = Device.os.macintosh;
849
1081
  var bFocusInsideOverlayContainer = Overlay.getOverlayContainer().get(0).contains(document.activeElement);
@@ -867,7 +1099,7 @@ sap.ui.define([
867
1099
  && oEvent.altKey === false
868
1100
  && bCtrlKey === true
869
1101
  ) {
870
- this._onUndo().then(oEvent.stopPropagation.bind(oEvent));
1102
+ this.undo().then(oEvent.stopPropagation.bind(oEvent));
871
1103
  } else if (
872
1104
  ((// OSX: CMD+SHIFT+Z
873
1105
  bMacintosh
@@ -881,35 +1113,27 @@ sap.ui.define([
881
1113
  && oEvent.altKey === false
882
1114
  && bCtrlKey === true
883
1115
  ) {
884
- this._onRedo().then(oEvent.stopPropagation.bind(oEvent));
1116
+ this.redo().then(oEvent.stopPropagation.bind(oEvent));
885
1117
  }
886
1118
  }
887
- };
1119
+ }
888
1120
 
889
- /**
890
- * Check for unsaved changes before leaving UI adaptation at runtime
891
- * @return {string} Returns the message to be displayed in the unsaved changes dialog
892
- *
893
- * @private
894
- */
895
- RuntimeAuthoring.prototype._onUnload = function() {
896
- var oCommandStack = this.getCommandStack();
897
- var bUnsaved = oCommandStack.canUndo();
898
- if (bUnsaved && this.getShowWindowUnloadDialog()) {
899
- return this._getTextResources().getText("MSG_UNSAVED_CHANGES");
900
- }
901
- window.onbeforeunload = this._oldUnloadHandler;
902
- return undefined;
903
- };
1121
+ function onSaveAsContextBasedAdaptation(oEvent) {
1122
+ var mPropertyBag = {
1123
+ parameters: oEvent.mParameters,
1124
+ control: this.getRootControlInstance(),
1125
+ layer: this.getLayer()
1126
+ };
1127
+ return ContextBasedAdaptationsAPI.create(mPropertyBag);
1128
+ }
904
1129
 
905
- RuntimeAuthoring.prototype._saveOnly = function(oEvent) {
1130
+ function saveOnly(oEvent) {
906
1131
  var fnCallback = oEvent.getParameter("callback") || function() {};
907
- return waitForPendingActions.call(this)
908
- .then(this._serializeToLrep.bind(this))
1132
+ return this.save()
909
1133
  .then(fnCallback);
910
- };
1134
+ }
911
1135
 
912
- RuntimeAuthoring.prototype._serializeAndSave = function(bActivateVersion) {
1136
+ function serializeAndSave(bActivateVersion, bCondenseAnyLayer) {
913
1137
  if (this.getShowToolbars()) {
914
1138
  this.bPersistedDataTranslatable = this._oToolbarControlsModel.getProperty("/translationEnabled");
915
1139
  }
@@ -918,37 +1142,16 @@ sap.ui.define([
918
1142
  saveAsDraft: this._oVersionsModel.getProperty("/versioningEnabled") && this.getLayer() === Layer.CUSTOMER,
919
1143
  layer: this.getLayer(),
920
1144
  removeOtherLayerChanges: true,
921
- version: bActivateVersion ? this._oVersionsModel.getProperty("/displayedVersion") : undefined
1145
+ version: bActivateVersion ? this._oVersionsModel.getProperty("/displayedVersion") : undefined,
1146
+ condenseAnyLayer: bCondenseAnyLayer
922
1147
  };
923
1148
 
924
1149
  return this._oSerializer.saveCommands(mPropertyBag);
925
- };
926
-
927
- RuntimeAuthoring.prototype._serializeToLrep = function() {
928
- // when saving a change that requires a reload, the information has to be cached
929
- // to do the reload when exiting UI Adaptation as then the change will not be available anymore
930
- if (!this._bSavedChangesNeedReload) {
931
- return this._oSerializer.needsReload().then(function(bReloadNeeded) {
932
- this._bSavedChangesNeedReload = bReloadNeeded;
933
- return this._serializeAndSave();
934
- }.bind(this));
935
- }
936
- return this._serializeAndSave();
937
- };
938
-
939
- RuntimeAuthoring.prototype._onUndo = function() {
940
- this.getPluginManager().handleStopCutPaste();
941
- return this.getCommandStack().undo();
942
- };
943
-
944
- RuntimeAuthoring.prototype._onRedo = function() {
945
- this.getPluginManager().handleStopCutPaste();
946
- return this.getCommandStack().redo();
947
- };
1150
+ }
948
1151
 
949
- RuntimeAuthoring.prototype._onActivate = function(oEvent) {
1152
+ function onActivate(oEvent) {
950
1153
  var sVersionTitle = oEvent.getParameter("versionTitle");
951
- if (this._isOldVersionDisplayed() && this._isDraftAvailable()) {
1154
+ if (isOldVersionDisplayed.call(this) && isDraftAvailable.call(this)) {
952
1155
  return Utils.showMessageBox("warning", "MSG_DRAFT_DISCARD_ON_REACTIVATE_DIALOG", {
953
1156
  titleKey: "TIT_DRAFT_DISCARD_ON_REACTIVATE_DIALOG",
954
1157
  actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
@@ -956,49 +1159,37 @@ sap.ui.define([
956
1159
  })
957
1160
  .then(function(sAction) {
958
1161
  if (sAction === MessageBox.Action.OK) {
959
- return this._activate(sVersionTitle);
1162
+ return activate.call(this, sVersionTitle);
960
1163
  }
961
1164
  }.bind(this));
962
1165
  }
963
- return this._activate(sVersionTitle);
964
- };
1166
+ return activate.call(this, sVersionTitle);
1167
+ }
965
1168
 
966
- RuntimeAuthoring.prototype._activate = function(sVersionTitle) {
1169
+ function activate(sVersionTitle) {
967
1170
  var sLayer = this.getLayer();
968
1171
  var oSelector = this.getRootControlInstance();
969
1172
  var sDisplayedVersion = this._oVersionsModel.getProperty("/displayedVersion");
970
- return this._serializeAndSave(true)
971
- .then(function () {
1173
+ return serializeAndSave.call(this, true)
1174
+ .then(function() {
972
1175
  return VersionsAPI.activate({
973
1176
  layer: sLayer,
974
1177
  control: oSelector,
975
1178
  title: sVersionTitle,
976
1179
  displayedVersion: sDisplayedVersion
977
1180
  });
978
- }).then(function () {
979
- this._showMessageToast("MSG_DRAFT_ACTIVATION_SUCCESS");
1181
+ }).then(function() {
1182
+ showMessageToast.call(this, "MSG_DRAFT_ACTIVATION_SUCCESS");
980
1183
  this.bInitialResetEnabled = true;
981
1184
  this._oToolbarControlsModel.setProperty("/restoreEnabled", true);
982
1185
  this.getCommandStack().removeAllCommands();
983
1186
  }.bind(this))
984
- .catch(function (oError) {
1187
+ .catch(function(oError) {
985
1188
  Utils.showMessageBox("error", "MSG_DRAFT_ACTIVATION_FAILED", {error: oError});
986
1189
  });
987
- };
988
-
989
- RuntimeAuthoring.prototype._handleDiscard = function() {
990
- var sLayer = this.getLayer();
991
- var oReloadInfo = {
992
- layer: sLayer,
993
- removeDraft: true
994
- };
995
- RuntimeAuthoring.enableRestart(sLayer, this.getRootControlInstance());
996
- this.getCommandStack().removeAllCommands();
997
- ReloadManager.triggerReload(oReloadInfo);
998
- return this.stop(true, true);
999
- };
1190
+ }
1000
1191
 
1001
- RuntimeAuthoring.prototype._onDiscardDraft = function() {
1192
+ function onDiscardDraft() {
1002
1193
  return Utils.showMessageBox("warning", "MSG_DRAFT_DISCARD_DIALOG", {
1003
1194
  actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
1004
1195
  emphasizedAction: MessageBox.Action.OK
@@ -1010,13 +1201,25 @@ sap.ui.define([
1010
1201
  control: this.getRootControlInstance(),
1011
1202
  updateState: true
1012
1203
  })
1013
- .then(this._handleDiscard.bind(this));
1204
+ .then(handleDiscard.bind(this));
1014
1205
  }
1015
1206
  return undefined;
1016
1207
  }.bind(this));
1017
- };
1208
+ }
1018
1209
 
1019
- RuntimeAuthoring.prototype._onSwitchVersion = function (oEvent) {
1210
+ function handleDiscard() {
1211
+ var sLayer = this.getLayer();
1212
+ var oReloadInfo = {
1213
+ layer: sLayer,
1214
+ removeDraft: true
1215
+ };
1216
+ RuntimeAuthoring.enableRestart(sLayer, this.getRootControlInstance());
1217
+ this.getCommandStack().removeAllCommands();
1218
+ ReloadManager.triggerReload(oReloadInfo);
1219
+ return this.stop(true, true);
1220
+ }
1221
+
1222
+ function onSwitchVersion(oEvent) {
1020
1223
  var sVersion = oEvent.getParameter("version");
1021
1224
  var sDisplayedVersion = this._oVersionsModel.getProperty("/displayedVersion");
1022
1225
 
@@ -1031,38 +1234,82 @@ sap.ui.define([
1031
1234
  titleKey: "TIT_SWITCH_VERSION_DIALOG",
1032
1235
  actions: [MessageBox.Action.YES, MessageBox.Action.NO, MessageBox.Action.CANCEL],
1033
1236
  emphasizedAction: MessageBox.Action.YES
1034
- }).then(function (sAction) {
1237
+ }).then(function(sAction) {
1035
1238
  if (sAction === MessageBox.Action.YES) {
1036
- this._serializeToLrep(this)
1037
- .then(this._switchVersion.bind(this, this._sSwitchToVersion));
1239
+ this._serializeToLrep()
1240
+ .then(switchVersion.bind(this, this._sSwitchToVersion));
1038
1241
  } else if (sAction === MessageBox.Action.NO) {
1039
1242
  // avoids the data loss popup; a reload is triggered later and will destroy RTA & the command stack
1040
1243
  this.getCommandStack().removeAllCommands(true);
1041
- this._switchVersion(this._sSwitchToVersion);
1244
+ switchVersion.call(this, this._sSwitchToVersion);
1042
1245
  }
1043
1246
  return undefined;
1044
1247
  }.bind(this));
1045
1248
  return;
1046
1249
  }
1047
- this._switchVersion(sVersion);
1048
- };
1250
+ switchVersion.call(this, sVersion);
1251
+ }
1049
1252
 
1050
- RuntimeAuthoring.prototype._switchVersion = function (sVersion) {
1253
+ function switchVersion(sVersion) {
1051
1254
  RuntimeAuthoring.enableRestart(this.getLayer(), this.getRootControlInstance());
1052
1255
 
1053
1256
  VersionsAPI.loadVersionForApplication({
1054
1257
  control: this.getRootControlInstance(),
1055
- layer: this.getLayer(),
1056
- version: sVersion
1057
- });
1058
- var oReloadInfo = {
1059
- versionSwitch: true,
1060
- version: sVersion
1061
- };
1062
- ReloadManager.triggerReload(oReloadInfo);
1063
- };
1258
+ layer: this.getLayer(),
1259
+ version: sVersion
1260
+ });
1261
+ var oReloadInfo = {
1262
+ versionSwitch: true,
1263
+ version: sVersion
1264
+ };
1265
+ ReloadManager.triggerReload(oReloadInfo);
1266
+ }
1267
+
1268
+ function onPublishVersion() {
1269
+ this.getPluginManager().handleStopCutPaste();
1270
+
1271
+ return VersionsAPI.publish({
1272
+ selector: this.getRootControlInstance(),
1273
+ styleClass: Utils.getRtaStyleClassName(),
1274
+ layer: this.getLayer(),
1275
+ version: this._oVersionsModel.getProperty("/displayedVersion")
1276
+ })
1277
+ .then(function(sMessage) {
1278
+ if (sMessage !== "Error" && sMessage !== "Cancel") {
1279
+ MessageToast.show(sMessage);
1280
+ }
1281
+ });
1282
+ }
1283
+
1284
+ function discardDraftConfirmed() {
1285
+ this._bUserDiscardedDraft = true;
1286
+ modifyStack.call(this);
1287
+ }
1288
+
1289
+ function isOldVersionDisplayed() {
1290
+ return VersionsAPI.isOldVersionDisplayed({
1291
+ control: this.getRootControlInstance(),
1292
+ layer: this.getLayer()
1293
+ });
1294
+ }
1295
+
1296
+ function isDraftAvailable() {
1297
+ return VersionsAPI.isDraftAvailable({
1298
+ control: this.getRootControlInstance(),
1299
+ layer: this.getLayer()
1300
+ });
1301
+ }
1302
+
1303
+ function initVersioning() {
1304
+ return VersionsAPI.initialize({
1305
+ control: this.getRootControlInstance(),
1306
+ layer: this.getLayer()
1307
+ }).then(function(oModel) {
1308
+ this._oVersionsModel = oModel;
1309
+ }.bind(this));
1310
+ }
1064
1311
 
1065
- RuntimeAuthoring.prototype._createToolsMenu = function(aButtonsVisibility) {
1312
+ function createToolsMenu(aButtonsVisibility) {
1066
1313
  if (!this.getDependent("toolbar")) {
1067
1314
  var bUserLayer = this.getLayer() === Layer.USER;
1068
1315
  var oProperties = {
@@ -1072,23 +1319,24 @@ sap.ui.define([
1072
1319
  commandStack: this.getCommandStack()
1073
1320
  },
1074
1321
  textResources: this._getTextResources(),
1075
- restore: this._onRestore.bind(this),
1076
- exit: this.stop.bind(this, false, bUserLayer),
1077
- save: this._saveOnly.bind(this)
1322
+ restore: this.restore.bind(this),
1323
+ exit: this.stop.bind(this, false, bUserLayer)
1078
1324
  };
1079
1325
 
1080
1326
  if (!bUserLayer) {
1081
- oProperties.transport = this._onTransport.bind(this);
1082
- oProperties.publishVersion = this._onPublishVersion.bind(this);
1083
- oProperties.undo = this._onUndo.bind(this);
1084
- oProperties.redo = this._onRedo.bind(this);
1085
- oProperties.modeChange = this._onModeChange.bind(this);
1086
- oProperties.activate = this._onActivate.bind(this);
1087
- oProperties.discardDraft = this._onDiscardDraft.bind(this);
1088
- oProperties.switchVersion = this._onSwitchVersion.bind(this);
1327
+ oProperties.transport = this.transport.bind(this);
1328
+ oProperties.publishVersion = onPublishVersion.bind(this);
1329
+ oProperties.undo = this.undo.bind(this);
1330
+ oProperties.redo = this.redo.bind(this);
1331
+ oProperties.modeChange = onModeChange.bind(this);
1332
+ oProperties.activate = onActivate.bind(this);
1333
+ oProperties.discardDraft = onDiscardDraft.bind(this);
1334
+ oProperties.switchVersion = onSwitchVersion.bind(this);
1335
+ oProperties.saveAsContextBasedAdaptation = onSaveAsContextBasedAdaptation.bind(this);
1089
1336
  oProperties.openChangeCategorySelectionPopover = this.getChangeVisualization
1090
1337
  ? this.getChangeVisualization().openChangeCategorySelectionPopover.bind(this.getChangeVisualization())
1091
- : function () {};
1338
+ : function() {};
1339
+ oProperties.save = saveOnly.bind(this);
1092
1340
  }
1093
1341
 
1094
1342
  var oToolbar;
@@ -1125,6 +1373,7 @@ sap.ui.define([
1125
1373
  appVariantsOverviewVisible: bSaveAsAvailable && bExtendedOverview,
1126
1374
  appVariantsOverviewEnabled: bSaveAsAvailable && bExtendedOverview,
1127
1375
  saveAsVisible: bSaveAsAvailable,
1376
+ contextBasedAdaptationVisible: aButtonsVisibility.contextBasedAdaptationAvailable,
1128
1377
  saveAsEnabled: false,
1129
1378
  manageAppsVisible: bSaveAsAvailable && !bExtendedOverview,
1130
1379
  manageAppsEnabled: bSaveAsAvailable && !bExtendedOverview,
@@ -1132,26 +1381,26 @@ sap.ui.define([
1132
1381
  visualizationButtonVisible: bVisualizationButtonVisible
1133
1382
  });
1134
1383
 
1135
- var oTranslationPromise = new Promise(function (resolve) {
1384
+ var oTranslationPromise = new Promise(function(resolve) {
1136
1385
  if (!bTranslationAvailable) {
1137
1386
  resolve();
1138
1387
  return;
1139
1388
  }
1140
1389
 
1141
1390
  TranslationAPI.getSourceLanguages({selector: this.getRootControlInstance(), layer: this.getLayer()})
1142
- .then(function (aSourceLanguages) {
1391
+ .then(function(aSourceLanguages) {
1143
1392
  this.bPersistedDataTranslatable = aSourceLanguages.length > 0;
1144
1393
  this._oToolbarControlsModel.setProperty("/translationEnabled", this.bPersistedDataTranslatable);
1145
1394
  }.bind(this)).finally(resolve);
1146
1395
  }.bind(this));
1147
1396
 
1148
- var oSaveAsPromise = new Promise(function (resolve) {
1397
+ var oSaveAsPromise = new Promise(function(resolve) {
1149
1398
  if (!bSaveAsAvailable) {
1150
1399
  resolve();
1151
1400
  return;
1152
1401
  }
1153
1402
 
1154
- RtaAppVariantFeature.isManifestSupported().then(function (bResult) {
1403
+ RtaAppVariantFeature.isManifestSupported().then(function(bResult) {
1155
1404
  this._oToolbarControlsModel.setProperty("/saveAsEnabled", bResult);
1156
1405
  this._oToolbarControlsModel.setProperty("/appVariantsOverviewEnabled", bResult);
1157
1406
  this._oToolbarControlsModel.setProperty("/manageAppsEnabled", bResult);
@@ -1165,134 +1414,22 @@ sap.ui.define([
1165
1414
  }.bind(this));
1166
1415
  }
1167
1416
  return Promise.resolve();
1168
- };
1169
-
1170
- /**
1171
- * Exit Runtime Authoring - destroy all controls and plugins
1172
- *
1173
- * @protected
1174
- */
1175
- RuntimeAuthoring.prototype.destroy = function () {
1176
- jQuery.map(this._dependents, function (oDependent, sName) {
1177
- this.removeDependent(sName);
1178
- // Destroy should be called with suppress invalidate = true here to prevent static UI Area invalidation
1179
- oDependent.destroy(true);
1180
- }.bind(this));
1181
-
1182
- Object.keys(this._mServices).forEach(function (sServiceName) {
1183
- this.stopService(sServiceName);
1184
- }, this);
1185
-
1186
- if (this._oDesignTime) {
1187
- this._oDesignTime.destroy();
1188
- this._oDesignTime = null;
1189
-
1190
- // detach browser events
1191
- jQuery(document).off("keydown", this.fnKeyDown);
1192
-
1193
- if (this.fnOnPersonalizationChangeCreation) {
1194
- ControlPersonalizationWriteAPI.detachChangeCreation(
1195
- this.getRootControlInstance(),
1196
- this.fnOnPersonalizationChangeCreation
1197
- );
1198
- }
1199
- }
1200
-
1201
- if (this.getRootControlInstance()) {
1202
- addOrRemoveStyleClass(this.getRootControlInstance(), false);
1203
- }
1204
-
1205
- this.setCommandStack(null);
1206
-
1207
- if (this._oServiceEventBus) {
1208
- this._oServiceEventBus.destroy();
1209
- }
1210
-
1211
- if (Device.browser.name === "ff") {
1212
- jQuery(document).off("contextmenu", _ffContextMenuHandler);
1213
- }
1214
-
1215
- window.onbeforeunload = this._oldUnloadHandler;
1216
-
1217
- ManagedObject.prototype.destroy.apply(this, arguments);
1218
- };
1219
-
1220
- RuntimeAuthoring.prototype._onPublishVersion = function() {
1221
- this.getPluginManager().handleStopCutPaste();
1222
-
1223
- return VersionsAPI.publish({
1224
- selector: this.getRootControlInstance(),
1225
- styleClass: Utils.getRtaStyleClassName(),
1226
- layer: this.getLayer(),
1227
- version: this._oVersionsModel.getProperty("/displayedVersion")
1228
- })
1229
- .then(function(sMessage) {
1230
- if (sMessage !== "Error" && sMessage !== "Cancel") {
1231
- MessageToast.show(sMessage);
1232
- }
1233
- });
1234
- };
1235
-
1236
- /**
1237
- * Function to handle ABAP transport of the changes
1238
- * @return {Promise} Returns a Promise processing the transport of changes
1239
- *
1240
- * @private
1241
- */
1242
- RuntimeAuthoring.prototype._onTransport = function() {
1243
- this.getPluginManager().handleStopCutPaste();
1244
-
1245
- BusyIndicator.show(500);
1246
- return this._serializeToLrep().then(function () {
1247
- BusyIndicator.hide();
1248
- var bVariantByStartupParameter = FlexUtils.isVariantByStartupParameter(this._oRootControl);
1249
- var bAppVariantRunning = SmartVariantManagementApplyAPI.isApplicationVariant({control: this._oRootControl}) && !bVariantByStartupParameter;
1250
- return (bAppVariantRunning ? RtaAppVariantFeature.getAppVariantDescriptor(this._oRootControl) : Promise.resolve())
1251
- .then(function(oAppVariantDescriptor) {
1252
- var aAppVariantDescriptor = [];
1253
- if (oAppVariantDescriptor) {
1254
- aAppVariantDescriptor.push(oAppVariantDescriptor);
1255
- }
1256
- return PersistenceWriteAPI.publish({
1257
- selector: this.getRootControlInstance(),
1258
- styleClass: Utils.getRtaStyleClassName(),
1259
- layer: this.getLayer(),
1260
- appVariantDescriptors: aAppVariantDescriptor
1261
- })
1262
- .then(function(sMessage) {
1263
- if (sMessage !== "Error" && sMessage !== "Cancel") {
1264
- MessageToast.show(sMessage);
1265
- if (this.getShowToolbars()) {
1266
- PersistenceWriteAPI.getResetAndPublishInfo({
1267
- selector: this.getRootControlInstance(),
1268
- layer: this.getLayer()
1269
- })
1270
- .then(function(oPublishAndResetInfo) {
1271
- this._oToolbarControlsModel.setProperty("/publishEnabled", oPublishAndResetInfo.isPublishEnabled);
1272
- this._oToolbarControlsModel.setProperty("/restoreEnabled", oPublishAndResetInfo.isResetEnabled);
1273
- }.bind(this));
1274
- }
1275
- }
1276
- }.bind(this));
1277
- }.bind(this));
1278
- }.bind(this))["catch"](showTechnicalError);
1279
- };
1417
+ }
1280
1418
 
1281
1419
  /**
1282
1420
  * Delete all changes for current layer and root control's component.
1283
1421
  * In case of Base Applications (no App Variants) the App Descriptor Changes and UI Changes are saved in different Flex Persistence instances,
1284
1422
  * the changes for both places will be deleted. For App Variants all the changes are saved in one place.
1285
1423
  *
1286
- * @private
1287
1424
  * @returns {Promise} Resolves when change persistence is reset
1288
1425
  */
1289
- RuntimeAuthoring.prototype._deleteChanges = function() {
1426
+ function deleteChanges() {
1290
1427
  var sLayer = this.getLayer();
1291
1428
  var oSelector = FlexUtils.getAppComponentForControl(this.getRootControlInstance());
1292
1429
  return PersistenceWriteAPI.reset({
1293
1430
  selector: oSelector,
1294
1431
  layer: sLayer
1295
- }).then(function () {
1432
+ }).then(function() {
1296
1433
  // avoids the data loss popup; a reload is triggered later and will destroy RTA & the command stack
1297
1434
  this.getCommandStack().removeAllCommands(true);
1298
1435
  ReloadInfoAPI.removeInfoSessionStorage(oSelector);
@@ -1303,99 +1440,20 @@ sap.ui.define([
1303
1440
  };
1304
1441
  return ReloadManager.triggerReload(oReloadInfo);
1305
1442
  }.bind(this))
1306
- .catch(function (oError) {
1443
+ .catch(function(oError) {
1307
1444
  if (oError !== "cancel") {
1308
1445
  Utils.showMessageBox("error", "MSG_RESTORE_FAILED", {error: oError});
1309
1446
  }
1310
1447
  });
1311
- };
1312
-
1313
- /**
1314
- * Shows a message toast.
1315
- * @param {string} sMessageKey - The text key for the message
1316
- * @param {object} mOptions - Options for message toast
1317
- * @private
1318
- */
1319
- RuntimeAuthoring.prototype._showMessageToast = function(sMessageKey, mOptions) {
1320
- var sMessage = this._getTextResources().getText(sMessageKey);
1321
-
1322
- MessageToast.show(sMessage, mOptions || {});
1323
- };
1324
-
1325
- /**
1326
- * The RTA FLP plugin checks whether RTA needs to be restarted and restarts it if needed.
1327
- *
1328
- * @public
1329
- * @static
1330
- * @param {sap.ui.fl.Layer} sLayer - Active layer
1331
- * @returns {boolean} Returns true if restart is needed
1332
- */
1333
- RuntimeAuthoring.needsRestart = function(sLayer) {
1334
- return ReloadManager.needsAutomaticStart(sLayer);
1335
- };
1336
-
1337
- /**
1338
- * Enable restart of RTA
1339
- * the RTA FLP plugin handles the restart
1340
- *
1341
- * @public
1342
- * @static
1343
- * @param {sap.ui.fl.Layer} sLayer - Active layer
1344
- * @param {sap.ui.core.Control} oRootControl - Root control for which RTA was started
1345
- */
1346
- RuntimeAuthoring.enableRestart = function(sLayer, oRootControl) {
1347
- ReloadManager.enableAutomaticStart(sLayer, oRootControl);
1348
- };
1349
-
1350
- /**
1351
- * Disable restart of RTA
1352
- *
1353
- * @public
1354
- * @static
1355
- * @param {sap.ui.fl.Layer} sLayer - Active layer
1356
- */
1357
- RuntimeAuthoring.disableRestart = function(sLayer) {
1358
- ReloadManager.disableAutomaticStart(sLayer);
1359
- };
1360
-
1361
- /**
1362
- * Discard all LREP changes and restores the default app state,
1363
- * opens a MessageBox where the user can confirm
1364
- * the restoring to the default app state
1365
- *
1366
- * @private
1367
- * @returns {Promise} Resolves when Message Box is closed.
1368
- */
1369
- RuntimeAuthoring.prototype._onRestore = function() {
1370
- var sLayer = this.getLayer();
1371
- var sMessageKey = sLayer === Layer.USER
1372
- ? "FORM_PERS_RESET_MESSAGE_PERSONALIZATION"
1373
- : "FORM_PERS_RESET_MESSAGE";
1374
- var sTitleKey = sLayer === Layer.USER
1375
- ? "BTN_RESTORE"
1376
- : "FORM_PERS_RESET_TITLE";
1377
-
1378
- this.getPluginManager().handleStopCutPaste();
1379
-
1380
- return Utils.showMessageBox("warning", sMessageKey, {
1381
- titleKey: sTitleKey,
1382
- actions: [MessageBox.Action.OK, MessageBox.Action.CANCEL],
1383
- emphasizedAction: MessageBox.Action.OK
1384
- }).then(function(sAction) {
1385
- if (sAction === MessageBox.Action.OK) {
1386
- RuntimeAuthoring.enableRestart(sLayer, this.getRootControlInstance());
1387
- return this._deleteChanges();
1388
- }
1389
- return undefined;
1390
- }.bind(this));
1391
- };
1448
+ }
1392
1449
 
1393
1450
  /**
1394
1451
  * Triggers a callback when a control gets created with its associated overlay.
1452
+ *
1395
1453
  * @param {string} sNewControlID - ID of the newly created control
1396
1454
  * @param {Function} fnCallback - Callback to execute when the conditions are met, the overlay is the only parameter
1397
1455
  */
1398
- RuntimeAuthoring.prototype._scheduleOnCreated = function (sNewControlID, fnCallback) {
1456
+ function scheduleOnCreated(sNewControlID, fnCallback) {
1399
1457
  function onElementOverlayCreated (oEvent) {
1400
1458
  var oNewOverlay = oEvent.getParameter("elementOverlay");
1401
1459
  if (oNewOverlay.getElement().getId() === sNewControlID) {
@@ -1405,14 +1463,15 @@ sap.ui.define([
1405
1463
  }
1406
1464
 
1407
1465
  this._oDesignTime.attachEvent("elementOverlayCreated", onElementOverlayCreated, this);
1408
- };
1466
+ }
1409
1467
 
1410
1468
  /**
1411
1469
  * Triggers a callback when a control gets created and its associated overlay is visible.
1470
+ *
1412
1471
  * @param {string} sNewControlID - ID of the newly created control
1413
1472
  * @param {Function} fnCallback - Callback to execute when the conditions are met, the overlay is the only parameter
1414
1473
  */
1415
- RuntimeAuthoring.prototype._scheduleOnCreatedAndVisible = function (sNewControlID, fnCallback) {
1474
+ function scheduleOnCreatedAndVisible(sNewControlID, fnCallback) {
1416
1475
  function onGeometryChanged (oEvent) {
1417
1476
  var oElementOverlay = oEvent.getSource();
1418
1477
  if (oElementOverlay.getGeometry() && oElementOverlay.getGeometry().visible) {
@@ -1431,50 +1490,49 @@ sap.ui.define([
1431
1490
  }
1432
1491
  }
1433
1492
 
1434
- this._scheduleOnCreated(sNewControlID, function (oNewOverlay) {
1493
+ scheduleOnCreated.call(this, sNewControlID, function(oNewOverlay) {
1435
1494
  // the overlay needs to be rendered
1436
1495
  if (oNewOverlay.isRendered()) {
1437
1496
  onGeometryCheck(oNewOverlay);
1438
1497
  } else {
1439
- oNewOverlay.attachEventOnce("afterRendering", function (oEvent) {
1498
+ oNewOverlay.attachEventOnce("afterRendering", function(oEvent) {
1440
1499
  onGeometryCheck(oEvent.getSource());
1441
1500
  });
1442
1501
  }
1443
1502
  });
1444
- };
1503
+ }
1445
1504
 
1446
1505
  /**
1447
1506
  * Function to automatically start the rename plugin on a container when it gets created
1448
1507
  *
1449
- * @param {object} vAction The create action from designtime metadata
1450
- * @param {string} sNewControlID The id of the newly created container
1508
+ * @param {object} vAction - The create action from designtime metadata
1509
+ * @param {string} sNewControlID - The id of the newly created container
1451
1510
  */
1452
- RuntimeAuthoring.prototype._scheduleRenameOnCreatedContainer = function(vAction, sNewControlID) {
1453
- var fnStartEdit = function (oElementOverlay) {
1511
+ function scheduleRenameOnCreatedContainer(vAction, sNewControlID) {
1512
+ var fnStartEdit = function(oElementOverlay) {
1454
1513
  oElementOverlay.setSelected(true);
1455
1514
  this.getPluginManager().getPlugin("rename").startEdit(oElementOverlay);
1456
1515
  }.bind(this);
1457
1516
 
1458
- this._scheduleOnCreatedAndVisible(sNewControlID, function (oElementOverlay) {
1517
+ scheduleOnCreatedAndVisible.call(this, sNewControlID, function(oElementOverlay) {
1459
1518
  // get container of the new control for rename
1460
1519
  var sNewContainerID = this.getPluginManager().getPlugin("createContainer").getCreatedContainerId(vAction, oElementOverlay.getElement().getId());
1461
1520
  var oContainerElementOverlay = OverlayRegistry.getOverlay(sNewContainerID);
1462
1521
  if (oContainerElementOverlay) {
1463
1522
  fnStartEdit(oContainerElementOverlay);
1464
1523
  } else {
1465
- this._scheduleOnCreatedAndVisible(sNewContainerID, fnStartEdit);
1524
+ scheduleOnCreatedAndVisible.call(this, sNewContainerID, fnStartEdit);
1466
1525
  }
1467
1526
  }.bind(this));
1468
- };
1527
+ }
1469
1528
 
1470
1529
  /**
1471
1530
  * Function to handle modification of an element
1472
1531
  *
1473
1532
  * @param {sap.ui.base.Event} oEvent Event object
1474
1533
  * @returns {Promise} Returns promise that resolves after command was executed successfully
1475
- * @private
1476
1534
  */
1477
- RuntimeAuthoring.prototype._handleElementModified = function(oEvent) {
1535
+ function handleElementModified(oEvent) {
1478
1536
  // events are synchronously reset after the handlers are called
1479
1537
  var oCommand = oEvent.getParameter("command");
1480
1538
  var sNewControlID = oEvent.getParameter("newControlId");
@@ -1485,7 +1543,7 @@ sap.ui.define([
1485
1543
 
1486
1544
  if (oCommand instanceof BaseCommand) {
1487
1545
  if (sNewControlID) {
1488
- this._scheduleOnCreated(sNewControlID, function (oElementOverlay) {
1546
+ scheduleOnCreated.call(this, sNewControlID, function(oElementOverlay) {
1489
1547
  var oDesignTimeMetadata = oElementOverlay.getDesignTimeMetadata();
1490
1548
  var fnSelect = oDesignTimeMetadata.getData().select;
1491
1549
  if (typeof fnSelect === "function") {
@@ -1493,7 +1551,7 @@ sap.ui.define([
1493
1551
  }
1494
1552
  });
1495
1553
  if (vAction) {
1496
- this._scheduleRenameOnCreatedContainer(vAction, sNewControlID);
1554
+ scheduleRenameOnCreatedContainer.call(this, vAction, sNewControlID);
1497
1555
  }
1498
1556
  }
1499
1557
  return this.getCommandStack().pushAndExecute(oCommand)
@@ -1507,66 +1565,11 @@ sap.ui.define([
1507
1565
  }
1508
1566
  }.bind(this));
1509
1567
  return this._pElementModified;
1510
- };
1568
+ }
1511
1569
 
1512
- RuntimeAuthoring.prototype._onModeChange = function(oEvent) {
1570
+ function onModeChange(oEvent) {
1513
1571
  this.setMode(oEvent.getParameter("item").getKey());
1514
- };
1515
-
1516
- /**
1517
- * Setter for property 'mode'.
1518
- * @param {string} sNewMode The new value for the 'mode' property
1519
- */
1520
- RuntimeAuthoring.prototype.setMode = function (sNewMode) {
1521
- var sCurrentMode = this.getMode();
1522
- if (sCurrentMode !== sNewMode) {
1523
- var oChangeVisualization = this.getChangeVisualization && this.getChangeVisualization();
1524
- if (sNewMode === "visualization" || sCurrentMode === "visualization") {
1525
- oChangeVisualization.triggerModeChange(this.getRootControl(), this.getToolbar());
1526
- }
1527
- var oTabHandlingPlugin = this.getPluginManager().getPlugin("tabHandling");
1528
- var oSelectionPlugin = this.getPluginManager().getPlugin("selection");
1529
-
1530
- // Switch between another mode and navigation -> toggle overlay & App-TabIndex enablement
1531
- if (sCurrentMode === "navigation" || sNewMode === "navigation") {
1532
- this._oDesignTime.setEnabled(sNewMode !== "navigation");
1533
- oTabHandlingPlugin[(sNewMode === "navigation") ? "restoreTabIndex" : "removeTabIndex"]();
1534
- }
1535
-
1536
- if (sCurrentMode === "adaptation") {
1537
- this.getPluginManager().handleStopCutPaste();
1538
- }
1539
-
1540
- oTabHandlingPlugin[(sNewMode === "adaptation") ? "restoreOverlayTabIndex" : "removeOverlayTabIndex"]();
1541
- oSelectionPlugin.setIsActive(!(sNewMode === "visualization"));
1542
-
1543
- Overlay.getOverlayContainer().toggleClass("sapUiRtaVisualizationMode", (sNewMode === "visualization"));
1544
- if (sNewMode === "visualization") {
1545
- jQuery(".sapUiDtOverlayMovable").css("cursor", "default");
1546
- } else {
1547
- jQuery(".sapUiDtOverlayMovable").css("cursor", "move");
1548
- }
1549
-
1550
- this._oToolbarControlsModel.setProperty("/modeSwitcher", sNewMode);
1551
- this.setProperty("mode", sNewMode);
1552
- this.fireModeChanged({mode: sNewMode});
1553
- }
1554
- };
1555
-
1556
- /**
1557
- * Setter for property 'metadataScope'.
1558
- * @param {string} sScope The new value for the 'metadataScope' property
1559
- */
1560
- RuntimeAuthoring.prototype.setMetadataScope = function (sScope) {
1561
- // We do not support scope change after creation of DesignTime instance
1562
- // as this requires re-initialization of all overlays
1563
- if (this._sStatus !== STOPPED) {
1564
- Log.error("sap.ui.rta: Failed to set metadata scope on RTA instance after RTA is started");
1565
- return;
1566
- }
1567
-
1568
- this.setProperty("metadataScope", sScope);
1569
- };
1572
+ }
1570
1573
 
1571
1574
  function resolveServiceLocation(sName) {
1572
1575
  if (ServicesIndex.hasOwnProperty(sName)) {
@@ -1578,19 +1581,19 @@ sap.ui.define([
1578
1581
  /**
1579
1582
  * Starts a service
1580
1583
  * @param {string} sName - Registered service name
1581
- * @return {Promise} - promise is resolved with service api or rejected in case of any error.
1584
+ * @returns {Promise} - Promise is resolved with service api or rejected in case of any error.
1582
1585
  */
1583
- RuntimeAuthoring.prototype.startService = function (sName) {
1586
+ RuntimeAuthoring.prototype.startService = function(sName) {
1584
1587
  if (this._sStatus !== STARTED) {
1585
- return new Promise(function (fnResolve, fnReject) {
1588
+ return new Promise(function(fnResolve, fnReject) {
1586
1589
  this.attachEventOnce("start", fnResolve);
1587
1590
  this.attachEventOnce("failed", fnReject);
1588
1591
  }.bind(this))
1589
1592
  .then(
1590
- function () {
1593
+ function() {
1591
1594
  return this.startService(sName);
1592
1595
  }.bind(this),
1593
- function () {
1596
+ function() {
1594
1597
  return Promise.reject(
1595
1598
  DtUtil.createError(
1596
1599
  "RuntimeAuthoring#startService",
@@ -1641,10 +1644,10 @@ sap.ui.define([
1641
1644
  this._mServices[sName] = mService = {
1642
1645
  status: SERVICE_STARTING,
1643
1646
  location: sServiceLocation,
1644
- initPromise: new Promise(function (fnResolve, fnReject) {
1647
+ initPromise: new Promise(function(fnResolve, fnReject) {
1645
1648
  sap.ui.require(
1646
1649
  [sServiceLocation],
1647
- function (fnServiceFactory) {
1650
+ function(fnServiceFactory) {
1648
1651
  mService.factory = fnServiceFactory;
1649
1652
 
1650
1653
  if (!this._oServiceEventBus) {
@@ -1655,7 +1658,7 @@ sap.ui.define([
1655
1658
  this,
1656
1659
  this._oServiceEventBus.publish.bind(this._oServiceEventBus, sName)
1657
1660
  )
1658
- .then(function (oService) {
1661
+ .then(function(oService) {
1659
1662
  if (this.bIsDestroyed) {
1660
1663
  throw DtUtil.createError(
1661
1664
  "RuntimeAuthoring#startService",
@@ -1687,7 +1690,7 @@ sap.ui.define([
1687
1690
  var mExports = oService.exports || {};
1688
1691
  jQuery.extend(
1689
1692
  mService.exports,
1690
- Object.keys(mExports).reduce(function (mResult, sKey) {
1693
+ Object.keys(mExports).reduce(function(mResult, sKey) {
1691
1694
  var vValue = mExports[sKey];
1692
1695
  mResult[sKey] = typeof vValue === "function"
1693
1696
  ? DtUtil.waitForSynced(this._oDesignTime, vValue)
@@ -1701,7 +1704,7 @@ sap.ui.define([
1701
1704
  }.bind(this))
1702
1705
  .catch(fnReject);
1703
1706
  }.bind(this),
1704
- function (vError) {
1707
+ function(vError) {
1705
1708
  mService.status = SERVICE_FAILED;
1706
1709
  fnReject(
1707
1710
  DtUtil.propagateError(
@@ -1714,7 +1717,7 @@ sap.ui.define([
1714
1717
  }
1715
1718
  );
1716
1719
  }.bind(this))
1717
- .catch(function (vError) {
1720
+ .catch(function(vError) {
1718
1721
  mService.status = SERVICE_FAILED;
1719
1722
  return Promise.reject(
1720
1723
  DtUtil.propagateError(
@@ -1735,7 +1738,7 @@ sap.ui.define([
1735
1738
  * Stops a service
1736
1739
  * @param {string} sName - Started service name
1737
1740
  */
1738
- RuntimeAuthoring.prototype.stopService = function (sName) {
1741
+ RuntimeAuthoring.prototype.stopService = function(sName) {
1739
1742
  var oService = this._mServices[sName];
1740
1743
 
1741
1744
  if (oService) {
@@ -1757,15 +1760,11 @@ sap.ui.define([
1757
1760
  /**
1758
1761
  * Gets a service by name (and starts it if it's not running)
1759
1762
  * @param {string} sName - Registered service name
1760
- * @return {Promise} - promise is resolved with service api or rejected in case of any error.
1763
+ * @returns {Promise} - Promise is resolved with service api or rejected in case of any error.
1761
1764
  */
1762
- RuntimeAuthoring.prototype.getService = function (sName) {
1765
+ RuntimeAuthoring.prototype.getService = function(sName) {
1763
1766
  return this.startService(sName);
1764
1767
  };
1765
1768
 
1766
- RuntimeAuthoring.prototype._getUShellService = function(sServiceName) {
1767
- return FlexUtils.getUshellContainer() && this._mUShellServices[sServiceName];
1768
- };
1769
-
1770
1769
  return RuntimeAuthoring;
1771
1770
  });