Skip to content

Commit

Permalink
[26877] add refreshForceUpdate to refresh same patient after changes
Browse files Browse the repository at this point in the history
  • Loading branch information
huthomas committed Jan 21, 2025
1 parent 3cf2fb2 commit 06d9fb5
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public MedicationView() {
private MedicationComposite tpc;

private RefreshingPartListener udpateOnVisible = new RefreshingPartListener(this) {
@Override
public void partActivated(org.eclipse.ui.IWorkbenchPartReference partRef) {
super.partActivated(partRef);
if (tpc != null && !tpc.isDisposed()) {
Expand All @@ -40,6 +41,8 @@ public void partActivated(org.eclipse.ui.IWorkbenchPartReference partRef) {
};
};

private boolean refreshForceUpdate;

public static final String PART_ID = "ch.elexis.core.ui.medication.views.MedicationView"; //$NON-NLS-1$

@Inject
Expand Down Expand Up @@ -70,6 +73,8 @@ public void reload(@UIEventTopic(ElexisEventTopics.EVENT_RELOAD) Class<?> clazz)
Display.getDefault().asyncExec(() -> {
updateUi(ContextServiceHolder.get().getActivePatient().orElse(null), true);
});
} else {
refreshForceUpdate = true;
}
}
}
Expand All @@ -90,6 +95,8 @@ void updatePrescription(@UIEventTopic(ElexisEventTopics.EVENT_UPDATE) IPrescript
updateUi(prescription.getPatient(), true);
}
}
} else {
refreshForceUpdate = true;
}
}

Expand Down Expand Up @@ -147,10 +154,12 @@ private void updateUi(IPatient patient, boolean forceUpdate) {
tpc.updateUi(patient, forceUpdate);
}

@Override
public void refresh() {
Display.getDefault().asyncExec(() -> {
if (CoreUiUtil.isActiveControl(tpc)) {
updateUi(ContextServiceHolder.get().getActivePatient().orElse(null), false);
updateUi(ContextServiceHolder.get().getActivePatient().orElse(null), refreshForceUpdate);
refreshForceUpdate = false;
}
});
}
Expand Down

0 comments on commit 06d9fb5

Please sign in to comment.