Project

General

Profile

« Previous | Next » 

Revision d9f54449

Added by Katja Luther over 3 years ago

ref #7428: updateEditors method in AbstractUtility class

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/model/AbstractUtility.java
61 61
import eu.etaxonomy.cdm.api.service.IProgressMonitorService;
62 62
import eu.etaxonomy.cdm.api.service.UpdateResult;
63 63
import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
64
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
64 65
import eu.etaxonomy.cdm.io.common.ExportDataWrapper;
65 66
import eu.etaxonomy.cdm.io.common.ExportResult;
66 67
import eu.etaxonomy.cdm.io.common.ExportResultType;
67 68
import eu.etaxonomy.cdm.io.common.ExportType;
69
import eu.etaxonomy.cdm.model.common.CdmBase;
70
import eu.etaxonomy.cdm.model.taxon.Synonym;
71
import eu.etaxonomy.cdm.model.taxon.Taxon;
72
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
68 73
import eu.etaxonomy.cdm.model.term.IEnumTerm;
74
import eu.etaxonomy.taxeditor.editor.ITaxonEditor;
69 75
import eu.etaxonomy.taxeditor.event.EventUtility;
70 76
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
71 77
import eu.etaxonomy.taxeditor.operation.IFeedbackGenerator;
......
635 641
                    // collect reports
636 642
//	                    for(String report : remotingMonitor.getResult()) {
637 643
                    createResult(label, showResult, remotingMonitor);
638

  
644
                    updateNameEditors(remotingMonitor);
639 645
                    return Status.OK_STATUS;
640 646
                }
641 647

  
......
665 671
        }
666 672

  
667 673

  
668
    private static void createResult(final String label, final boolean showResult,
674
    public static void createResult(String label, boolean showResult,
669 675
            IRemotingProgressMonitor remotingMonitor) {
670 676
        final StringBuilder reportSb = new StringBuilder();
671 677
        if (remotingMonitor.getResult() instanceof ExportResult) {
......
789 795
            }
790 796
        }
791 797
    }
798
    public static void updateNameEditors(IRemotingProgressMonitor remotingMonitor){
799
        List<Taxon> taxaToUpdate = new ArrayList();
800
        for (CdmBase object: ((UpdateResult)remotingMonitor.getResult()).getUpdatedObjects()){
801
            Taxon taxon = null;
802
            TaxonNode node = null;
803
            if (object instanceof Taxon){
804
                taxon = HibernateProxyHelper.deproxy(object, Taxon.class);
805

  
806

  
807
            }else if (object instanceof Synonym){
808
                Synonym syn = HibernateProxyHelper.deproxy(object, Synonym.class);
809
                taxon = syn.getAcceptedTaxon();
810
            }
811
            taxaToUpdate.add(taxon);
812
        }
813

  
814
        Display.getDefault().asyncExec(new Runnable() {
815
              @Override
816
              public void run() {
817
                  EPartService partService = TaxeditorStorePlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getService(EPartService.class);
818
                  for (MPart part : partService.getParts()){
819
                      Object object = part.getObject();
820
                      boolean setFocus = false;
821
//                      if (part == activePart){
822
//                          setFocus = true;
823
//                      }
824
                      if (object instanceof ITaxonEditor){
825
                          if (object != null ){
826
                             ((ITaxonEditor)object).update();
827

  
828
                          }
829
                      }
830

  
831
                  }
832
              }
833
        });
834

  
835
    }
836

  
837

  
792 838
}

Also available in: Unified diff