All files / src/ui/lib zcl_abapgit_gui_menus.clas.abap

100% Statements 221/221
100% Branches 5/5
100% Functions 1/1
100% Lines 221/221

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 2221x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 3x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 2x 3x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x  
CLASS zcl_abapgit_gui_menus DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC.
 
  PUBLIC SECTION.
 
    CLASS-METHODS advanced
      RETURNING
        VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar.
 
    CLASS-METHODS help
      RETURNING
        VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar.
 
    CLASS-METHODS back
      RETURNING
        VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar.
 
    CLASS-METHODS settings
      IMPORTING
        !iv_act        TYPE string OPTIONAL
        !iv_with_back  TYPE abap_bool DEFAULT abap_false
        !iv_form_id    TYPE string OPTIONAL
      RETURNING
        VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar.
 
    CLASS-METHODS repo_settings
      IMPORTING
        !iv_key        TYPE zif_abapgit_persistence=>ty_repo-key
        !iv_act        TYPE string OPTIONAL
        !iv_class      TYPE string OPTIONAL
        !iv_with_back  TYPE abap_bool DEFAULT abap_false
        !iv_form_id    TYPE string OPTIONAL
      RETURNING
        VALUE(ro_menu) TYPE REF TO zcl_abapgit_html_toolbar.
 
    CLASS-METHODS experimental
      IMPORTING
        io_menu TYPE REF TO zcl_abapgit_html_toolbar.
 
  PROTECTED SECTION.
  PRIVATE SECTION.
 
    CLASS-METHODS add_back
      IMPORTING
        io_menu      TYPE REF TO zcl_abapgit_html_toolbar
        iv_with_back TYPE abap_bool
        iv_form_id   TYPE string.
 
ENDCLASS.
 
 
 
CLASS zcl_abapgit_gui_menus IMPLEMENTATION.
 
 
  METHOD add_back.
 
    IF iv_with_back = abap_true.
      IF iv_form_id IS INITIAL.
        io_menu->add(
          iv_txt = 'Back'
          iv_act = zif_abapgit_definitions=>c_action-go_back ).
      ELSE.
        " Submit current fields for the page's dirty check
        io_menu->add(
          iv_txt = 'Back'
          iv_typ = zif_abapgit_html=>c_action_type-onclick
          iv_act = |submitSapeventForm(\{ \}, '{ zif_abapgit_definitions=>c_action-go_back }', 'post', |
                && |document.getElementById('{ iv_form_id }'))| ).
      ENDIF.
    ENDIF.
 
  ENDMETHOD.
 
 
  METHOD advanced.
 
    ro_menu = zcl_abapgit_html_toolbar=>create( 'toolbar-advanced' ).
 
    ro_menu->add(
      iv_txt = 'Database Utility'
      iv_act = zif_abapgit_definitions=>c_action-go_db
    )->add(
      iv_txt = 'Package to ZIP'
      iv_act = zif_abapgit_definitions=>c_action-zip_package
    )->add(
      iv_txt = 'Transport to ZIP'
      iv_act = zif_abapgit_definitions=>c_action-zip_transport
    )->add(
      iv_txt = 'Object to Files'
      iv_act = zif_abapgit_definitions=>c_action-zip_object
    )->add(
      iv_txt = 'Debug Info'
      iv_act = zif_abapgit_definitions=>c_action-go_debuginfo ).
 
    IF zcl_abapgit_ui_factory=>get_frontend_services( )->is_sapgui_for_windows( ) = abap_true.
      ro_menu->add(
        iv_txt = 'Open IE DevTools'
        iv_act = zif_abapgit_definitions=>c_action-ie_devtools ).
    ENDIF.
 
  ENDMETHOD.
 
 
  METHOD back.
 
    ro_menu = zcl_abapgit_html_toolbar=>create( 'toolbar-back' ).
 
    ro_menu->add(
      iv_txt = 'Back'
      iv_act = zif_abapgit_definitions=>c_action-go_back ).
 
  ENDMETHOD.
 
 
  METHOD experimental.
 
    IF zcl_abapgit_persist_factory=>get_settings( )->read( )->get_experimental_features( ) IS NOT INITIAL.
      io_menu->add(
        iv_txt = zcl_abapgit_gui_buttons=>experimental( )
        iv_act = zif_abapgit_definitions=>c_action-go_settings ).
    ENDIF.
 
  ENDMETHOD.
 
 
  METHOD help.
 
    ro_menu = zcl_abapgit_html_toolbar=>create( 'toolbar-help' ).
 
    ro_menu->add(
      iv_txt = 'Tutorial'
      iv_act = zif_abapgit_definitions=>c_action-go_tutorial
    )->add(
      iv_txt = 'Documentation'
      iv_act = zif_abapgit_definitions=>c_action-documentation
    )->add(
      iv_txt = 'Explore'
      iv_act = zif_abapgit_definitions=>c_action-go_explore
    )->add(
      iv_txt = 'Changelog'
      iv_act = zif_abapgit_definitions=>c_action-changelog
    )->add(
      iv_txt = 'Hotkeys'
      iv_act = zif_abapgit_definitions=>c_action-show_hotkeys ).
 
  ENDMETHOD.
 
 
  METHOD repo_settings.
 
    ro_menu = zcl_abapgit_html_toolbar=>create( 'toolbar-repo-settings' ).
 
    ro_menu->add(
      iv_txt   = 'Repository'
      iv_title = `Repository Settings`
      iv_class = iv_class
      iv_act   = |{ zif_abapgit_definitions=>c_action-repo_settings }?key={ iv_key }|
      iv_cur   = boolc( iv_act = zif_abapgit_definitions=>c_action-repo_settings )
    )->add(
      iv_txt   = 'Local'
      iv_title = `Local Settings`
      iv_class = iv_class
      iv_act   = |{ zif_abapgit_definitions=>c_action-repo_local_settings }?key={ iv_key }|
      iv_cur   = boolc( iv_act = zif_abapgit_definitions=>c_action-repo_local_settings )
    )->add(
      iv_txt   = 'Remote'
      iv_title = `Remote Settings`
      iv_class = iv_class
      iv_act   = |{ zif_abapgit_definitions=>c_action-repo_remote_settings }?key={ iv_key }|
      iv_cur   = boolc( iv_act = zif_abapgit_definitions=>c_action-repo_remote_settings )
    )->add(
      iv_txt   = 'Background'
      iv_title = `Background Settings`
      iv_class = iv_class
      iv_act   = |{ zif_abapgit_definitions=>c_action-repo_background }?key={ iv_key }|
      iv_cur   = boolc( iv_act = zif_abapgit_definitions=>c_action-repo_background )
    )->add(
      iv_txt   = 'Stats'
      iv_title = `Statistics`
      iv_class = iv_class
      iv_act   = |{ zif_abapgit_definitions=>c_action-repo_infos }?key={ iv_key }|
      iv_cur   = boolc( iv_act = zif_abapgit_definitions=>c_action-repo_infos ) ).
 
    IF iv_act IS NOT INITIAL.
      zcl_abapgit_exit=>get_instance( )->enhance_repo_toolbar(
        io_menu = ro_menu
        iv_key  = iv_key
        iv_act  = iv_act ).
    ENDIF.
 
    add_back(
      io_menu      = ro_menu
      iv_with_back = iv_with_back
      iv_form_id   = iv_form_id ).
 
  ENDMETHOD.
 
 
  METHOD settings.
 
    ro_menu = zcl_abapgit_html_toolbar=>create( 'toolbar-abapgit-settings' ).
 
    ro_menu->add(
      iv_txt = 'Global'
      iv_act = zif_abapgit_definitions=>c_action-go_settings
      iv_cur = boolc( iv_act = zif_abapgit_definitions=>c_action-go_settings )
    )->add(
      iv_txt = 'Personal'
      iv_act = zif_abapgit_definitions=>c_action-go_settings_personal
      iv_cur = boolc( iv_act = zif_abapgit_definitions=>c_action-go_settings_personal ) ).
 
    add_back(
      io_menu      = ro_menu
      iv_with_back = iv_with_back
      iv_form_id   = iv_form_id ).
 
  ENDMETHOD.
ENDCLASS.