}
@Override
public void updateItem(final Cell<?> cell, final Object item, boolean empty) {
final ContextMenu contextMenu = new ContextMenu();
cell.setContextMenu(contextMenu);
contextMenu.getItems().add(new MenuItem());
contextMenu.setOnShowing(new EventHandler<WindowEvent>() {
@Override
public void handle(WindowEvent event) {
List<?> selectedItems = getSelectionModel(cell);
deleteMenuItem.setDisable(!deleteHandler.canExecute(selectedItems));
cutMenuItem.setDisable(!cutHandler.canExecute(selectedItems));
copyMenuItem.setDisable(!copyHandler.canExecute(selectedItems));
Object item2 = cell.getItem();
pasteMenuItem.setDisable(!pasteHandler.canExecute(item2));
contextMenu.getItems().clear();
contextMenu.getItems().add(deleteMenuItem);
contextMenu.getItems().add(cutMenuItem);
contextMenu.getItems().add(copyMenuItem);
contextMenu.getItems().add(pasteMenuItem);
}
});
deleteMenuItem = new MenuItem("Delete", getImage("icons/silk/cross.png"));