though unspecified, I would expect the event to be fired only if there's a state transition from not-editing -> editing. TreeCell behaves as expected, List/TableCell don't
Failing test for ListCell:
@Test
public void testListEditStartOnCellTwiceStandalone() {
ListView<String> control = new ListView<>(FXCollections
.observableArrayList("Item1", "Item2", "Item3", "Item4"));
control.setEditable(true);
control.setCellFactory(TextFieldListCell.forListView());
new StageLoader(control);
int editIndex = 1;
IndexedCell cell = getCell(control, editIndex);
SimpleIntegerProperty counter = new SimpleIntegerProperty(0);
control.addEventHandler(ListView.editStartEvent(), e -> counter.set(counter.get() + 1));
// start edit on control
cell.startEdit();
// start again -> nothing changed, no event
cell.startEdit();
// test editEvent
assertEquals("second start on editing cell must not fire event", 1, counter.get());
}
Failing test for ListCell:
@Test
public void testListEditStartOnCellTwiceStandalone() {
ListView<String> control = new ListView<>(FXCollections
.observableArrayList("Item1", "Item2", "Item3", "Item4"));
control.setEditable(true);
control.setCellFactory(TextFieldListCell.forListView());
new StageLoader(control);
int editIndex = 1;
IndexedCell cell = getCell(control, editIndex);
SimpleIntegerProperty counter = new SimpleIntegerProperty(0);
control.addEventHandler(ListView.editStartEvent(), e -> counter.set(counter.get() + 1));
// start edit on control
cell.startEdit();
// start again -> nothing changed, no event
cell.startEdit();
// test editEvent
assertEquals("second start on editing cell must not fire event", 1, counter.get());
}