Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Wolf2016-09-12 05:51:53 +0000
committerMatthias Sohn2016-09-12 20:05:50 +0000
commit435f10cb1e2679c1d47764f294fd2fc07f8a9fac (patch)
tree9550e2618fc7d4174f3d668cb5f6ef3b9308bf82
parent4f594e57d3b1af9d98204741df8f26a3d8ef85f1 (diff)
downloadegit-435f10cb1e2679c1d47764f294fd2fc07f8a9fac.tar.gz
egit-435f10cb1e2679c1d47764f294fd2fc07f8a9fac.tar.xz
egit-435f10cb1e2679c1d47764f294fd2fc07f8a9fac.zip
Create resource manager in UI plugin lazily
Don't create the UI plugin's resource manager up front but only when needed. Bug: 500230 Change-Id: Ide11a72dae5682815a949368fbf751187eb71598 Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java
index 899c9c3c4d..eef79872af 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/Activator.java
@@ -296,8 +296,6 @@ public class Activator extends AbstractUIPlugin implements DebugOptionsListener
@Override
public void start(final BundleContext context) throws Exception {
super.start(context);
- resourceManager = new LocalResourceManager(
- JFaceResources.getResources());
// we want to be notified about debug options changes
Dictionary<String, String> props = new Hashtable<>(4);
props.put(DebugOptions.LISTENER_SYMBOLICNAME, context.getBundle()
@@ -734,7 +732,16 @@ public class Activator extends AbstractUIPlugin implements DebugOptionsListener
*
* @return the {@link ResourceManager} of this plugin
*/
- public ResourceManager getResourceManager() {
+ public synchronized ResourceManager getResourceManager() {
+ if (resourceManager == null) {
+ Display display = PlatformUI.getWorkbench().getDisplay();
+ if (display == null) {
+ // Workbench already closed?
+ throw new IllegalStateException();
+ }
+ resourceManager = new LocalResourceManager(JFaceResources
+ .getResources(display));
+ }
return resourceManager;
}

Back to the top