MenuElement[] () { MenuSelectionManager menuselectionmanager = MenuSelectionManager.defaultManager(); MenuElement[] amenuelement = menuselectionmanager.getSelectedPath(); int i1 = amenuelement.length; if (i1 == 0){ return new MenuElement[0]; } Container container = menuItem.getParent(); MenuElement[] amenuelement1; if (amenuelement[i1 - 1].getComponent() == container){ amenuelement1 = new MenuElement[i1 + 1]; System.arraycopy(amenuelement, 0, amenuelement1, 0, i1); amenuelement1[i1] = menuItem; } else{ int j1; for(j1 = amenuelement.length - 1; j1 >= 0; j1--){ if (amenuelement[j1].getComponent() == container){ break; } } amenuelement1 = new MenuElement[j1 + 2]; System.arraycopy(amenuelement, 0, amenuelement1, 0, j1 + 1); amenuelement1[j1 + 1] = menuItem; } return amenuelement1; }