import eu.etaxonomy.cdm.api.service.IProgressMonitorService;
import eu.etaxonomy.cdm.api.service.UpdateResult;
import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
import eu.etaxonomy.cdm.io.common.ExportDataWrapper;
import eu.etaxonomy.cdm.io.common.ExportResult;
import eu.etaxonomy.cdm.io.common.ExportResultType;
import eu.etaxonomy.cdm.io.common.ExportType;
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.taxon.Synonym;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
import eu.etaxonomy.cdm.model.term.IEnumTerm;
+import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
import eu.etaxonomy.taxeditor.event.EventUtility;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
import eu.etaxonomy.taxeditor.operation.IFeedbackGenerator;
// collect reports
// for(String report : remotingMonitor.getResult()) {
createResult(label, showResult, remotingMonitor);
-
+ updateNameEditors(remotingMonitor);
return Status.OK_STATUS;
}
}
- private static void createResult(final String label, final boolean showResult,
+ public static void createResult(String label, boolean showResult,
IRemotingProgressMonitor remotingMonitor) {
final StringBuilder reportSb = new StringBuilder();
if (remotingMonitor.getResult() instanceof ExportResult) {
}
}
}
+ public static void updateNameEditors(IRemotingProgressMonitor remotingMonitor){
+ List<Taxon> taxaToUpdate = new ArrayList();
+ for (CdmBase object: ((UpdateResult)remotingMonitor.getResult()).getUpdatedObjects()){
+ Taxon taxon = null;
+ TaxonNode node = null;
+ if (object instanceof Taxon){
+ taxon = HibernateProxyHelper.deproxy(object, Taxon.class);
+
+
+ }else if (object instanceof Synonym){
+ Synonym syn = HibernateProxyHelper.deproxy(object, Synonym.class);
+ taxon = syn.getAcceptedTaxon();
+ }
+ taxaToUpdate.add(taxon);
+ }
+
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ EPartService partService = TaxeditorStorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
+ for (MPart part : partService.getParts()){
+ Object object = part.getObject();
+ boolean setFocus = false;
+// if (part == activePart){
+// setFocus = true;
+// }
+ if (object instanceof ITaxonEditor){
+ if (object != null ){
+ ((ITaxonEditor)object).update();
+
+ }
+ }
+
+ }
+ }
+ });
+
+ }
+
+
}