Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddunne2010-11-02 16:58:26 -0400
committerRyan D. Brooks2010-11-02 16:58:26 -0400
commitec70a940c7957d651b72bd96ceb8c5c9684665e1 (patch)
treedbd7c637cf94159740b80f5da0fb8cac4e21967c /plugins/org.eclipse.osee.coverage
parente5bb52166c23d1356e5f0d18d74dd0ed580f71dd (diff)
downloadorg.eclipse.osee-ec70a940c7957d651b72bd96ceb8c5c9684665e1.tar.gz
org.eclipse.osee-ec70a940c7957d651b72bd96ceb8c5c9684665e1.tar.xz
org.eclipse.osee-ec70a940c7957d651b72bd96ceb8c5c9684665e1.zip
feature: Improve performance of Coverage event handling
Diffstat (limited to 'plugins/org.eclipse.osee.coverage')
-rw-r--r--plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/CoverageEventManager.java35
1 files changed, 22 insertions, 13 deletions
diff --git a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/CoverageEventManager.java b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/CoverageEventManager.java
index 55361be5bc..4ae38bf82d 100644
--- a/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/CoverageEventManager.java
+++ b/plugins/org.eclipse.osee.coverage/src/org/eclipse/osee/coverage/event/CoverageEventManager.java
@@ -274,36 +274,45 @@ public class CoverageEventManager implements IArtifactEventListener, OseeMessagi
private void handleCoverageEditorSaveEvent(CoverageEditor editor, CoveragePackage coveragePackage, CoveragePackageEvent coverageEvent) {
// System.out.println("handle coverage save event => " + coverageEvent.getCoverages().size() + " items");
+ List<String> reloaded = new ArrayList<String>();
for (CoverageChange change : coverageEvent.getCoverages()) {
if (change.getEventType() == CoverageEventType.Modified) {
- reloadCoverage(editor, coveragePackage, change);
+ reloadCoverage(reloaded, editor, coveragePackage, change);
}
}
}
- private void reloadCoverage(CoverageEditor editor, CoveragePackage coveragePackage, CoverageChange change) {
+ private void reloadCoverage(List<String> reloaded, CoverageEditor editor, CoveragePackage coveragePackage, CoverageChange change) {
// System.out.println("handle reloadCoverage coverage => " + change);
ICoverage coverage = coveragePackage.getCoverage(change.getGuid());
if (coverage != null) {
if (coverage instanceof CoverageItem) {
try {
CoverageUnit parent = (CoverageUnit) ((CoverageItem) coverage).getParent();
- OseeCoverageUnitStore store = new OseeCoverageUnitStore(parent, editor.getBranch());
- store.reloadItem(change.getEventType(), (CoverageItem) coverage, change,
- coveragePackage.getCoverageOptionManager());
- OseeCoveragePackageStore cpStore = new OseeCoveragePackageStore(coveragePackage, editor.getBranch());
- cpStore.loadWorkProductTaskNames(Arrays.asList(coverage));
- editor.refresh(coverage);
+ // Don't reload parent twice
+ if (!reloaded.contains(parent.getGuid())) {
+ OseeCoverageUnitStore store = new OseeCoverageUnitStore(parent, editor.getBranch());
+ store.reloadItem(change.getEventType(), (CoverageItem) coverage, change,
+ coveragePackage.getCoverageOptionManager());
+ OseeCoveragePackageStore cpStore = new OseeCoveragePackageStore(coveragePackage, editor.getBranch());
+ cpStore.loadWorkProductTaskNames(Arrays.asList(coverage));
+ editor.refresh(coverage);
+ reloaded.add(coverage.getGuid());
+ }
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, Level.SEVERE, ex);
}
} else if (coverage instanceof CoverageUnit) {
try {
- OseeCoverageUnitStore store = new OseeCoverageUnitStore((CoverageUnit) coverage, editor.getBranch());
- store.load(coveragePackage.getCoverageOptionManager());
- OseeCoveragePackageStore cpStore = new OseeCoveragePackageStore(coveragePackage, editor.getBranch());
- cpStore.loadWorkProductTaskNames(Arrays.asList(coverage));
- editor.refresh(coverage);
+ // Don't reload twice
+ if (!reloaded.contains(coverage.getGuid())) {
+ OseeCoverageUnitStore store = new OseeCoverageUnitStore((CoverageUnit) coverage, editor.getBranch());
+ store.load(coveragePackage.getCoverageOptionManager());
+ OseeCoveragePackageStore cpStore = new OseeCoveragePackageStore(coveragePackage, editor.getBranch());
+ cpStore.loadWorkProductTaskNames(Arrays.asList(coverage));
+ editor.refresh(coverage);
+ reloaded.add(coverage.getGuid());
+ }
} catch (OseeCoreException ex) {
OseeLog.log(Activator.class, Level.SEVERE, ex);
}

Back to the top