Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 409124
Collapse All | Expand All

(-)a/bundles/org.eclipse.rap.rwt/js/rwt/widgets/Menu.js (-1 / +5 lines)
Lines 187-193 Link Here
187
        // it is essential that this happens before the menuItem is added
187
        // it is essential that this happens before the menuItem is added
188
        menuItem.setParentMenu( this );
188
        menuItem.setParentMenu( this );
189
      }
189
      }
190
      this._layout.addAt( menuItem, index );
190
      var position = index;
191
      if( this._preItem && this._preItem !== menuItem ) {
192
        position++;
193
      }
194
      this._layout.addAt( menuItem, position );
191
    },
195
    },
192
196
193
    scheduleMenuLayout : function() {
197
    scheduleMenuLayout : function() {
(-)a/tests/org.eclipse.rap.rwt.jstest/js/org/eclipse/rwt/test/tests/MenuTest.js (-2 / +16 lines)
Lines 170-175 Link Here
170
      widget.destroy();
170
      widget.destroy();
171
    },
171
    },
172
172
173
    testCreateMenuItemByProtocolAtPosition : function() {
174
      var menu = createPopUpMenuByProtocol( "w3" );
175
      menu.setHasShowListener( true );
176
      menu._menuShown();
177
178
      createMenuItemByProtocol( "w4", "w3", [ "PUSH" ] );
179
      createMenuItemByProtocol( "w5", "w3", [ "PUSH" ] );
180
      var item = createMenuItemByProtocol( "w6", "w3", [ "PUSH" ], 1 );
181
182
      assertEquals( 0, menu._layout.indexOf( menu._preItem ) );
183
      assertEquals( 2, menu._layout.indexOf( item ) );
184
      menu.destroy();
185
    },
186
173
    testCreateMenuItemWithMnemonicByProtocol : function() {
187
    testCreateMenuItemWithMnemonicByProtocol : function() {
174
      var menu = createPopUpMenuByProtocol( "w3" );
188
      var menu = createPopUpMenuByProtocol( "w3" );
175
      var item = createMenuItemByProtocol( "w4", "w3", [ "PUSH" ] );
189
      var item = createMenuItemByProtocol( "w4", "w3", [ "PUSH" ] );
Lines 1833-1839 Link Here
1833
  return ObjectRegistry.getObject( id );
1847
  return ObjectRegistry.getObject( id );
1834
};
1848
};
1835
1849
1836
var createMenuItemByProtocol = function( id, parentId, style ) {
1850
var createMenuItemByProtocol = function( id, parentId, style, index ) {
1837
  MessageProcessor.processOperation( {
1851
  MessageProcessor.processOperation( {
1838
    "target" : id,
1852
    "target" : id,
1839
    "action" : "create",
1853
    "action" : "create",
Lines 1841-1847 Link Here
1841
    "properties" : {
1855
    "properties" : {
1842
      "style" : style,
1856
      "style" : style,
1843
      "parent" : parentId,
1857
      "parent" : parentId,
1844
      "index" : 0
1858
      "index" : index ? index : 0
1845
    }
1859
    }
1846
  } );
1860
  } );
1847
  return ObjectRegistry.getObject( id );
1861
  return ObjectRegistry.getObject( id );

Return to bug 409124