Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Watson2013-10-01 13:49:21 +0000
committerThomas Watson2013-10-01 13:49:21 +0000
commitc8870d93c5f77c82a9a3defa310c4a11ae898e45 (patch)
tree4eb17989bf62cfcb8f6a524119972d79824cc0be /bundles/org.eclipse.equinox.region
parentd2e7657420be8b7663acc8bed5c22ebc7d0f677b (diff)
downloadrt.equinox.bundles-c8870d93c5f77c82a9a3defa310c4a11ae898e45.tar.gz
rt.equinox.bundles-c8870d93c5f77c82a9a3defa310c4a11ae898e45.tar.xz
rt.equinox.bundles-c8870d93c5f77c82a9a3defa310c4a11ae898e45.zip
Reuse existing region objects on replaceI20131009-0430I20131008-2330
Diffstat (limited to 'bundles/org.eclipse.equinox.region')
-rw-r--r--bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionDigraph.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionDigraph.java b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionDigraph.java
index c7e28e793..57b75daa8 100644
--- a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionDigraph.java
+++ b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionDigraph.java
@@ -413,11 +413,23 @@ public final class StandardRegionDigraph implements BundleIdToRegionMapping, Reg
if (check && this.updateCount.get() != replacement.originUpdateCount) {
throw new BundleException("The origin update count has changed since the replacement copy was created.", BundleException.INVALID_OPERATION); //$NON-NLS-1$
}
+ Map<String, Region> nameToRegion = new HashMap<String, Region>();
+ for (Region region : regions) {
+ nameToRegion.put(region.getName(), region);
+ }
this.regions.clear();
this.edges.clear();
this.bundleIdToRegionMapping.clear();
for (Region original : filteredRegions.keySet()) {
- Region copy = this.createRegion(original.getName());
+ Region copy = nameToRegion.get(original.getName());
+ if (copy != null) {
+ // reuse the previous region object
+ regions.add(copy);
+ edges.put(copy, EMPTY_EDGE_SET);
+ } else {
+ // create a new one
+ copy = this.createRegion(original.getName());
+ }
for (Long id : original.getBundleIds()) {
copy.addBundle(id);
}

Back to the top