void (int from, int where, int preserveSeparatorAt) { if (myItems.get(from).isPrependWithSeparator() || myItems.get(where).isPrependWithSeparator()) { String fromText = myItems.get(from).getSeparatorText(); String whereText = myItems.get(where).getSeparatorText(); myItems.get(from).setSeparatorText(null); if (preserveSeparatorAt == from) { myItems.get(from + 1).setSeparatorText(fromText); } if (preserveSeparatorAt == where) { myItems.get(where).setSeparatorText(null); myItems.get(from).setSeparatorText(whereText); } } PopupFactoryImpl.ActionItem toMove = myItems.get(from); myItems.add(where, toMove); if (where < from) { from ++; } myItems.remove(from); }