Skip to content

Commit

Permalink
Synchronously update itemCount after creating an empty TableItem. Fix #…
Browse files Browse the repository at this point in the history
  • Loading branch information
shlxue committed Nov 20, 2024
1 parent 254aa21 commit 8acfc4c
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 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 @@ -1904,8 +1904,7 @@ public void clearAll(boolean ask) {
}

if (id == SWT.YES) {
table.removeAll();
new TableItem(table, SWT.NONE);
removeAll();
if (!readonly) {
parent.getDisplay().asyncExec(() -> edit(0, 1));
}
Expand Down Expand Up @@ -2289,7 +2288,8 @@ public void delSelected() {
table.remove(items);

if (table.getItemCount() == 0) {
TableItem item = new TableItem(table, SWT.NONE);
removeAll();
TableItem item = table.getItem(0);
// Save undo infomation!
String[] stritem = getItemText(item);
ta = new ChangeAction();
Expand Down Expand Up @@ -2370,7 +2370,8 @@ public void keepSelected() {
table.remove(itemsToDelete);

if (table.getItemCount() == 0) {
TableItem item = new TableItem(table, SWT.NONE);
removeAll();
TableItem item = table.getItem(0);
// Save undo information!
String[] strItem = getItemText(item);
ta = new ChangeAction();
Expand Down Expand Up @@ -3050,8 +3051,7 @@ public void removeEmptyRows(int column) {
}
}
if (table.getItemCount() == 0) { // At least one empty row!

new TableItem(table, SWT.NONE);
removeAll();
}
}

Expand Down Expand Up @@ -3529,14 +3529,14 @@ public int getSelectionIndex() {
public void remove(int index) {
table.remove(index);
if (table.getItemCount() == 0) {
new TableItem(table, SWT.NONE);
removeAll();
}
}

public void remove(int[] index) {
table.remove(index);
if (table.getItemCount() == 0) {
new TableItem(table, SWT.NONE);
removeAll();
}
}

Expand Down Expand Up @@ -3587,6 +3587,7 @@ public void removeAll() {
table.removeAll();
if (table.getItemCount() == 0) {
new TableItem(table, SWT.NONE);
table.setItemCount(1);
}
}

Expand Down

0 comments on commit 8acfc4c

Please sign in to comment.