boolean allPositionsSelected = selectedPositions.length == tablePositions.getRowCount();
boolean firstRowNotSelected = existsASelectedPosition && selectedPositions[0] != 0;
boolean existsAPosition = getPositionsModel().getRowCount() > 0;
boolean existsMoreThanOnePosition = getPositionsModel().getRowCount() > 1;
boolean supportsMultipleRoutes = formatAndRoutesModel.getFormat() instanceof MultipleRoutesFormat;
RouteCharacteristics characteristics = getCharacteristicsModel().getSelectedCharacteristics();
buttonMovePositionToTop.setEnabled(firstRowNotSelected);
buttonMovePositionUp.setEnabled(firstRowNotSelected);
boolean lastRowNotSelected = existsASelectedPosition && selectedPositions[selectedPositions.length - 1] != tablePositions.getRowCount() - 1;
buttonMovePositionDown.setEnabled(lastRowNotSelected);
buttonMovePositionToBottom.setEnabled(lastRowNotSelected);
RouteConverter r = RouteConverter.getInstance();
ActionManager actionManager = r.getContext().getActionManager();
actionManager.enable("cut", existsASelectedPosition);
actionManager.enable("copy", existsASelectedPosition);
actionManager.enable("delete", existsASelectedPosition);
actionManager.enable("select-all", existsAPosition && !allPositionsSelected);
findMenu(r.getFrame().getJMenuBar(), "position", "complete").setEnabled(existsASelectedPosition);
actionManager.enable("add-coordinates", existsASelectedPosition);
actionManager.enable("add-elevation", existsASelectedPosition);
actionManager.enable("add-postal-address", existsASelectedPosition);
actionManager.enable("add-populated-place", existsASelectedPosition);
actionManager.enable("add-speed", existsASelectedPosition);
actionManager.enable("add-time", existsASelectedPosition);
actionManager.enable("add-number", existsASelectedPosition);
actionManager.enable("split-positionlist", supportsMultipleRoutes && existsASelectedPosition);
actionManager.enable("insert-positions", existsAPosition);
actionManager.enable("delete-positions", existsAPosition);
actionManager.enable("revert-positions", existsMoreThanOnePosition);
tableHeaderMenu.enable(existsMoreThanOnePosition);
actionManager.enable("print-map", r.isMapViewAvailable() && existsAPosition);
actionManager.enable("print-map-and-route", r.isMapViewAvailable() && existsAPosition && characteristics.equals(Route));
actionManager.enable("print-profile", existsAPosition);
r.selectPositions(selectedPositions);
}