aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Besedin2012-10-24 13:14:32 (EDT)
committerOleg Besedin2012-10-24 13:14:32 (EDT)
commitbef47180f41e3951d610fdb3dcb52eb15adce0c8 (patch)
treed823b5652ec705c87753f54b47449b12e7008ce8
parent6284352db0ecc667dbb867f57ac51a2a55472cd2 (diff)
downloadeclipse.platform.runtime-bef47180f41e3951d610fdb3dcb52eb15adce0c8.zip
eclipse.platform.runtime-bef47180f41e3951d610fdb3dcb52eb15adce0c8.tar.gz
eclipse.platform.runtime-bef47180f41e3951d610fdb3dcb52eb15adce0c8.tar.bz2
Bug 390346 - Listener methods on part still called after closing the
part
-rw-r--r--bundles/org.eclipse.e4.core.di.extensions/META-INF/MANIFEST.MF2
-rw-r--r--bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/internal/extensions/EventObjectSupplier.java8
-rw-r--r--bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ClassRequestor.java25
-rw-r--r--bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ConstructorRequestor.java25
-rw-r--r--bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/FieldRequestor.java25
-rw-r--r--bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/MethodRequestor.java25
-rw-r--r--bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/Requestor.java34
7 files changed, 137 insertions, 7 deletions
diff --git a/bundles/org.eclipse.e4.core.di.extensions/META-INF/MANIFEST.MF b/bundles/org.eclipse.e4.core.di.extensions/META-INF/MANIFEST.MF
index 600d819..3eb44a5 100644
--- a/bundles/org.eclipse.e4.core.di.extensions/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.e4.core.di.extensions/META-INF/MANIFEST.MF
@@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.e4.core.di.extensions;singleton:=true
-Bundle-Version: 0.11.0.qualifier
+Bundle-Version: 0.11.100.qualifier
Bundle-Activator: org.eclipse.e4.core.di.internal.extensions.DIEActivator
Require-Bundle: org.eclipse.osgi;bundle-version="3.6.0",
org.eclipse.equinox.preferences;bundle-version="3.3.0",
diff --git a/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/internal/extensions/EventObjectSupplier.java b/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/internal/extensions/EventObjectSupplier.java
index c15c202..907466c 100644
--- a/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/internal/extensions/EventObjectSupplier.java
+++ b/bundles/org.eclipse.e4.core.di.extensions/src/org/eclipse/e4/core/di/internal/extensions/EventObjectSupplier.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -157,6 +157,8 @@ public class EventObjectSupplier extends ExtendedObjectSupplier {
if (track)
subscribe(topic, eventAdmin, requestor);
+ else
+ unsubscribe(requestor);
if (!currentEvents.containsKey(topic))
return IInjector.NOT_A_VALUE;
@@ -205,12 +207,14 @@ public class EventObjectSupplier extends ExtendedObjectSupplier {
}
protected void unsubscribe(IRequestor requestor) {
+ if (requestor == null)
+ return;
synchronized (registrations) {
Iterator<Entry<Subscriber, ServiceRegistration>> i = registrations.entrySet().iterator();
while (i.hasNext()) {
Entry<Subscriber, ServiceRegistration> entry = i.next();
Subscriber key = entry.getKey();
- if (key.getRequestor() != requestor)
+ if (!requestor.equals(key.getRequestor()))
continue;
ServiceRegistration registration = entry.getValue();
registration.unregister();
diff --git a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ClassRequestor.java b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ClassRequestor.java
index f8b32a8..d868e7a 100644
--- a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ClassRequestor.java
+++ b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ClassRequestor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -67,4 +67,27 @@ public class ClassRequestor extends Requestor {
return tmp.toString();
}
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((clazzName == null) ? 0 : clazzName.hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ClassRequestor other = (ClassRequestor) obj;
+ if (clazzName == null) {
+ if (other.clazzName != null)
+ return false;
+ } else if (!clazzName.equals(other.clazzName))
+ return false;
+ return true;
+ }
+
}
diff --git a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ConstructorRequestor.java b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ConstructorRequestor.java
index 848e5b1..72a3c19 100644
--- a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ConstructorRequestor.java
+++ b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/ConstructorRequestor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010, 2011 IBM Corporation and others.
+ * Copyright (c) 2010, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -98,4 +98,27 @@ public class ConstructorRequestor extends Requestor {
return tmp.toString();
}
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((constructor == null) ? 0 : constructor.hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ConstructorRequestor other = (ConstructorRequestor) obj;
+ if (constructor == null) {
+ if (other.constructor != null)
+ return false;
+ } else if (!constructor.equals(other.constructor))
+ return false;
+ return true;
+ }
+
}
diff --git a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/FieldRequestor.java b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/FieldRequestor.java
index d6a7a2b..6e82310 100644
--- a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/FieldRequestor.java
+++ b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/FieldRequestor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -71,4 +71,27 @@ public class FieldRequestor extends Requestor {
return tmp.toString();
}
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((field == null) ? 0 : field.hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ FieldRequestor other = (FieldRequestor) obj;
+ if (field == null) {
+ if (other.field != null)
+ return false;
+ } else if (!field.equals(other.field))
+ return false;
+ return true;
+ }
+
}
diff --git a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/MethodRequestor.java b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/MethodRequestor.java
index dcef637..1b70ad9 100644
--- a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/MethodRequestor.java
+++ b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/MethodRequestor.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2012 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -107,4 +107,27 @@ public class MethodRequestor extends Requestor {
return tmp.toString();
}
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((method == null) ? 0 : method.hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (!super.equals(obj))
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ MethodRequestor other = (MethodRequestor) obj;
+ if (method == null) {
+ if (other.method != null)
+ return false;
+ } else if (!method.equals(other.method))
+ return false;
+ return true;
+ }
+
}
diff --git a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/Requestor.java b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/Requestor.java
index 41552b2..64e0f47 100644
--- a/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/Requestor.java
+++ b/bundles/org.eclipse.e4.core.di/src/org/eclipse/e4/core/internal/di/Requestor.java
@@ -157,4 +157,38 @@ abstract public class Requestor implements IRequestor {
actualArgs = null;
return;
}
+
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + (groupUpdates ? 1231 : 1237);
+ result = prime * result + ((injector == null) ? 0 : injector.hashCode());
+ result = prime * result + (isOptional ? 1231 : 1237);
+ result = prime * result + ((primarySupplier == null) ? 0 : primarySupplier.hashCode());
+ Object refObject = getRequestingObject();
+ result = prime * result + ((refObject == null) ? 0 : refObject.hashCode());
+ return result;
+ }
+
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ Requestor other = (Requestor) obj;
+ if (groupUpdates != other.groupUpdates)
+ return false;
+ if (injector != other.injector)
+ return false;
+ if (isOptional != other.isOptional)
+ return false;
+ if (primarySupplier != other.primarySupplier)
+ return false;
+ if (getRequestingObject() != other.getRequestingObject())
+ return false;
+ return true;
+ }
+
}