aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBorislav Kapukaranov2011-09-12 07:47:12 (EDT)
committerBorislav Kapukaranov2011-09-28 12:30:13 (EDT)
commitfb9b5b5ee759c70d7b57c95f710eb3a2ef1c381d (patch)
treeae40838dc3cc5e9c56cb13d4d1e66ea595bea9d7
parent2b7a05447c2f5ae31841d0a50acd59a8c3f25f63 (diff)
downloadrt.equinox.bundles-fb9b5b5ee759c70d7b57c95f710eb3a2ef1c381d.zip
rt.equinox.bundles-fb9b5b5ee759c70d7b57c95f710eb3a2ef1c381d.tar.gz
rt.equinox.bundles-fb9b5b5ee759c70d7b57c95f710eb3a2ef1c381d.tar.bz2
bug354655 - improved the behaviour when setting non-existing regions as defaults and removing default regions from the digraph
-rwxr-xr-x[-rw-r--r--]bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/StandardRegionDigraph.java19
-rwxr-xr-x[-rw-r--r--]bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/hook/RegionBundleEventHook.java2
-rwxr-xr-x[-rw-r--r--]bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/region/RegionDigraph.java4
3 files changed, 16 insertions, 9 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 81e4943..90b515d 100644..100755
--- 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
@@ -67,7 +67,7 @@ public final class StandardRegionDigraph implements RegionDigraph {
private long originTimeStamp;
private final AtomicLong timeStamp = new AtomicLong();
- private volatile Region defaultAssignRegion;
+ private volatile Region defaultRegion;
StandardRegionDigraph(StandardRegionDigraph origin) throws BundleException {
this(null, null, origin);
@@ -108,6 +108,7 @@ public final class StandardRegionDigraph implements RegionDigraph {
} else {
this.originTimeStamp = -1;
}
+ this.defaultRegion = null;
}
/**
@@ -260,6 +261,9 @@ public final class StandardRegionDigraph implements RegionDigraph {
throw new IllegalArgumentException("The region cannot be null."); //$NON-NLS-1$
notifyRemoving(region);
synchronized (this.monitor) {
+ if (this.defaultRegion != null && this.defaultRegion.equals(region)) {
+ this.defaultRegion = null;
+ }
this.regions.remove(region);
this.edges.remove(region);
for (Region r : this.edges.keySet()) {
@@ -463,13 +467,16 @@ public final class StandardRegionDigraph implements RegionDigraph {
}
@Override
- public void setDefaultAssignRegion(Region defaultRegion) {
- this.defaultAssignRegion = defaultRegion;
-
+ public void setDefaultRegion(Region defaultRegion) {
+ if (this.regions.contains(defaultRegion) || defaultRegion == null) {
+ this.defaultRegion = defaultRegion;
+ } else {
+ throw new IllegalArgumentException("Can't set " + defaultRegion.toString() + " as default region. It isn't contained in this digraph.");
+ }
}
@Override
- public Region getDefaultAssignRegion() {
- return this.defaultAssignRegion;
+ public Region getDefaultRegion() {
+ return this.defaultRegion;
}
}
diff --git a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/hook/RegionBundleEventHook.java b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/hook/RegionBundleEventHook.java
index e170bd2..3edb511 100644..100755
--- a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/hook/RegionBundleEventHook.java
+++ b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/internal/region/hook/RegionBundleEventHook.java
@@ -79,7 +79,7 @@ public final class RegionBundleEventHook implements EventHook {
if (installRegion != null) {
addBundleToRegion(eventBundle, installRegion);
} else {
- Region defaultAssignRegion = this.regionDigraph.getDefaultAssignRegion();
+ Region defaultAssignRegion = this.regionDigraph.getDefaultRegion();
if (defaultAssignRegion != null) {
addBundleToRegion(eventBundle, defaultAssignRegion);
} else {
diff --git a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/region/RegionDigraph.java b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/region/RegionDigraph.java
index 9017126..9d30db9 100644..100755
--- a/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/region/RegionDigraph.java
+++ b/bundles/org.eclipse.equinox.region/src/org/eclipse/equinox/region/RegionDigraph.java
@@ -221,7 +221,7 @@ public interface RegionDigraph extends Iterable<Region> {
*
* @param defaultRegion the region where all bundles installed via {@link BundleContext} will be assigned to
*/
- void setDefaultAssignRegion(Region defaultRegion);
+ void setDefaultRegion(Region defaultRegion);
/**
* Gets the default {@link Region}, where all bundles installed via {@link BundleContext} are assigned.
@@ -230,6 +230,6 @@ public interface RegionDigraph extends Iterable<Region> {
* @param defaultRegion the region where all bundles installed via {@link BundleContext} will be assigned to
* @return The default region to assign to or <b>null</b> if it isn't set
*/
- Region getDefaultAssignRegion();
+ Region getDefaultRegion();
}