Skip to content

Commit

Permalink
Fix update issues on SWT
Browse files Browse the repository at this point in the history
  • Loading branch information
prasser committed Jul 4, 2020
1 parent f89c1f8 commit 0391d86
Showing 1 changed file with 16 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public void dispose() {
public void reset() {
this.attributes = null;
this.table.setCurrentPage(0);
this.table.refreshPage();
this.refreshTable();
SWTUtil.disable(this.table);
}

Expand All @@ -159,11 +159,11 @@ public void update(final ModelEvent event) {
} else if (event.part == ModelPart.ATTRIBUTE_TYPE ||
event.part == ModelPart.ATTRIBUTE_TYPE_BULK_UPDATE) {
if (!attributes.isEmpty()) {
table.refreshPage();
this.refreshTable();
}
} else if (event.part == ModelPart.DATA_TYPE) {
if (!attributes.isEmpty()) {
table.refreshPage();
this.refreshTable();
}
}
}
Expand Down Expand Up @@ -243,7 +243,7 @@ private void actionDataTypeChanged(String label) {
// Set and update
if (changed) {
this.model.getInputDefinition().setDataType(attribute, type);
table.refreshPage();
this.refreshTable();
this.controller.update(new ModelEvent(this, ModelPart.DATA_TYPE, attribute));
}
}
Expand Down Expand Up @@ -375,7 +375,7 @@ else if (i == 3 && e.button == 1) {
String attribute = (String)item.getData();
boolean isResponseVariable = !model.getInputDefinition().isResponseVariable(attribute);
model.getInputDefinition().setResponseVariable(attribute, isResponseVariable);
table.refreshPage();
refreshTable();
controller.update(new ModelEvent(this, ModelPart.RESPONSE_VARIABLES, attribute));
return;
}
Expand All @@ -386,7 +386,7 @@ else if (i == 3 && e.button == 1) {
}
});
this.table.setCurrentPage(0);
this.table.refreshPage();
this.refreshTable();
}

/**
Expand Down Expand Up @@ -542,6 +542,14 @@ private boolean isValidDataType(DataType<?> type, Collection<String> values) {
return true;
}

/**
* Refresh the table
*/
private void refreshTable() {
this.table.getViewer().refresh();
this.table.refreshPage();
}

/**
* Updates the view.
*
Expand All @@ -564,10 +572,10 @@ private void updateEntries() {

// Refresh
this.table.setCurrentPage(0);
this.table.refreshPage();
this.refreshTable();
SWTUtil.enable(this.table);
}

/**
* Update
* @param attribute
Expand Down

0 comments on commit 0391d86

Please sign in to comment.