Skip to content

Commit

Permalink
content is lost when adding a new row during edit, fixes apache#4642
Browse files Browse the repository at this point in the history
  • Loading branch information
hansva committed Nov 29, 2024
1 parent 3e8b529 commit a354fc4
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions ui/src/main/java/org/apache/hop/ui/core/widget/TableView.java
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,24 @@ public void mouseDown(MouseEvent event) {
};
}

private void applyAllChanges() {
if (activeTableItem != null
&& !activeTableItem.isDisposed()
&& editor != null
&& editor.getEditor() != null
&& !editor.getEditor().isDisposed()
&& activeTableColumn > 0) {
switch (columns[activeTableColumn - 1].getType()) {
case ColumnInfo.COLUMN_TYPE_TEXT:
applyTextChange(activeTableItem, activeTableRow, activeTableColumn);
break;
case ColumnInfo.COLUMN_TYPE_CCOMBO:
applyComboChange(activeTableItem, activeTableRow, activeTableColumn);
break;
}
}
}

private Listener createKeyUpListener() {
return event -> {
if (table.isDisposed()) {
Expand Down Expand Up @@ -1832,7 +1850,7 @@ public void insertRowBefore() {
return;
}
int rowNr = table.indexOf(row);

applyAllChanges();
insertRow(rowNr);
}

Expand All @@ -1859,7 +1877,7 @@ public void insertRowAfter() {
return;
}
int rowNr = table.indexOf(tableItem);

applyAllChanges();
insertRow(rowNr + 1);
}

Expand Down Expand Up @@ -2096,6 +2114,7 @@ public void clipSelected() {
clipboard.dispose();
clipboard = null;
}
applyAllChanges();

clipboard = new Clipboard(getDisplay());
TextTransfer tran = TextTransfer.getInstance();
Expand Down

0 comments on commit a354fc4

Please sign in to comment.