aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOleg Besedin2012-09-25 10:06:58 (EDT)
committerOleg Besedin2012-09-25 10:07:30 (EDT)
commitbba83be0f4032360e1d8eebad230ecc55240f36e (patch)
treed68b339a5d05f0ec51cc327a6f684ae8d6909e06
parent25ae8d06f0f765c305d27cc0d54a3b7947002b77 (diff)
downloadeclipse.platform.ui-bba83be0f4032360e1d8eebad230ecc55240f36e.zip
eclipse.platform.ui-bba83be0f4032360e1d8eebad230ecc55240f36e.tar.gz
eclipse.platform.ui-bba83be0f4032360e1d8eebad230ecc55240f36e.tar.bz2
Bug 389250 - Lots of stuff leaked when closing and reopening views
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java3
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IServiceLocatorCreator.java5
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocator.java2
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocatorCreator.java7
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorSite.java9
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageSite.java5
8 files changed, 23 insertions, 14 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java
index 965e682..ee64706 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java
@@ -198,8 +198,7 @@ public abstract class PartSite implements IWorkbenchPartSite {
public void dispose() {
// not sure what to do here
}
- });
- serviceLocator.setContext(e4Context);
+ }, e4Context);
initializeDefaultServices();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
index 5b3e021..bed87ab 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
@@ -494,8 +494,7 @@ public final class Workbench extends EventManager implements IWorkbench {
close(PlatformUI.RETURN_RESTART, true);
}
}
- });
- serviceLocator.setContext(appContext);
+ }, appContext);
serviceLocator.registerService(IServiceLocatorCreator.class, slc);
serviceLocator.registerService(IWorkbenchLocationService.class,
new WorkbenchLocationService(IServiceScopes.WORKBENCH_SCOPE, this, null, null,
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
index df8c8ef9..4eb1b2b 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
@@ -427,8 +427,7 @@ public class WorkbenchWindow implements IWorkbenchWindow {
close();
}
}
- });
- serviceLocator.setContext(windowContext);
+ }, windowContext);
windowContext.set(IExtensionTracker.class.getName(), new ContextFunction() {
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IServiceLocatorCreator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IServiceLocatorCreator.java
index c719926..6170ba8 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IServiceLocatorCreator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/IServiceLocatorCreator.java
@@ -11,6 +11,7 @@
package org.eclipse.ui.internal.services;
+import org.eclipse.e4.core.contexts.IEclipseContext;
import org.eclipse.ui.services.AbstractServiceFactory;
import org.eclipse.ui.services.IDisposable;
import org.eclipse.ui.services.IServiceLocator;
@@ -60,4 +61,8 @@ public interface IServiceLocatorCreator {
*/
public IServiceLocator createServiceLocator(IServiceLocator parent,
AbstractServiceFactory factory, IDisposable owner);
+
+ public IServiceLocator createServiceLocator(IServiceLocator parent,
+ AbstractServiceFactory factory, IDisposable owner, IEclipseContext context);
+
} \ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocator.java
index fc3c1cd..9c25250 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocator.java
@@ -243,6 +243,8 @@ public final class ServiceLocator implements IDisposable, INestable,
}
public void setContext(IEclipseContext context) {
+// if (e4Context != null) // XXX
+// e4Context.dispose();
e4Context = context;
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocatorCreator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocatorCreator.java
index 42cf4eb..4a09e3d 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocatorCreator.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/services/ServiceLocatorCreator.java
@@ -35,4 +35,11 @@ public class ServiceLocatorCreator implements IServiceLocatorCreator {
}
return serviceLocator;
}
+
+ public IServiceLocator createServiceLocator(IServiceLocator parent,
+ AbstractServiceFactory factory, IDisposable owner, IEclipseContext context) {
+ ServiceLocator serviceLocator = new ServiceLocator(parent, factory, owner);
+ serviceLocator.setContext(context);
+ return serviceLocator;
+ }
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorSite.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorSite.java
index f647723..18ecd41 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorSite.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorSite.java
@@ -131,15 +131,14 @@ public class MultiPageEditorSite implements IEditorSite, INestable {
IServiceLocatorCreator slc = (IServiceLocatorCreator) site
.getService(IServiceLocatorCreator.class);
- this.serviceLocator = (ServiceLocator) slc.createServiceLocator(
+ context = site.getModel().getContext().createChild("MultiPageEditorSite"); //$NON-NLS-1$
+ serviceLocator = (ServiceLocator) slc.createServiceLocator(
multiPageEditor.getSite(), null, new IDisposable(){
public void dispose() {
getMultiPageEditor().close();
- }});
-
- context = site.getModel().getContext().createChild("MultiPageEditorSite"); //$NON-NLS-1$
+ }
+ }, context);
site.getModel().getContext().set("MultiPageEditorSite", context); //$NON-NLS-1$
- serviceLocator.setContext(context);
initializeDefaultServices();
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageSite.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageSite.java
index 41ecf1b..c93ec1f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageSite.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageSite.java
@@ -95,6 +95,7 @@ public class PageSite implements IPageSite, INestable {
// Initialize the service locator.
IServiceLocatorCreator slc = (IServiceLocatorCreator) parentSite
.getService(IServiceLocatorCreator.class);
+ e4Context = ((PartSite) parentViewSite).getContext().createChild("PageSite"); //$NON-NLS-1$
this.serviceLocator = (ServiceLocator) slc.createServiceLocator(parentViewSite, null,
new IDisposable() {
public void dispose() {
@@ -105,9 +106,7 @@ public class PageSite implements IPageSite, INestable {
// }
// TODO compat: not tsure what this should do
}
- });
- e4Context = ((PartSite) parentViewSite).getContext().createChild("PageSite"); //$NON-NLS-1$
- serviceLocator.setContext(e4Context);
+ }, e4Context);
initializeDefaultServices();
}