Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTom Schindl2014-03-24 16:25:45 +0000
committerTom Schindl2014-03-24 16:25:45 +0000
commite4c45b0407edb8035d19535d67ea0857de762c8a (patch)
tree1c90752c46c49969c4a676edd16ea55d806811f5 /bundles/runtime/org.eclipse.fx.ui.di/src/org/eclipse/fx
parenta0740a824634f9e86d08260a7574aef66e8c68a6 (diff)
downloadorg.eclipse.efxclipse-e4c45b0407edb8035d19535d67ea0857de762c8a.tar.gz
org.eclipse.efxclipse-e4c45b0407edb8035d19535d67ea0857de762c8a.tar.xz
org.eclipse.efxclipse-e4c45b0407edb8035d19535d67ea0857de762c8a.zip
fixed javadoc
Diffstat (limited to 'bundles/runtime/org.eclipse.fx.ui.di/src/org/eclipse/fx')
-rwxr-xr-xbundles/runtime/org.eclipse.fx.ui.di/src/org/eclipse/fx/ui/di/CachingContextFunction.java25
1 files changed, 17 insertions, 8 deletions
diff --git a/bundles/runtime/org.eclipse.fx.ui.di/src/org/eclipse/fx/ui/di/CachingContextFunction.java b/bundles/runtime/org.eclipse.fx.ui.di/src/org/eclipse/fx/ui/di/CachingContextFunction.java
index c33897f6e..ccec56b15 100755
--- a/bundles/runtime/org.eclipse.fx.ui.di/src/org/eclipse/fx/ui/di/CachingContextFunction.java
+++ b/bundles/runtime/org.eclipse.fx.ui.di/src/org/eclipse/fx/ui/di/CachingContextFunction.java
@@ -14,21 +14,30 @@ import org.eclipse.e4.core.contexts.ContextFunction;
import org.eclipse.e4.core.contexts.ContextInjectionFactory;
import org.eclipse.e4.core.contexts.IEclipseContext;
-@SuppressWarnings("restriction")
+/**
+ * A context function which caches the value so that child contexts don't create
+ * an instance them selfes
+ */
public abstract class CachingContextFunction extends ContextFunction {
private final Class<?> clazz;
-
+
+ /**
+ * Create a instance
+ *
+ * @param clazz
+ * the class to create an instance of
+ */
public CachingContextFunction(Class<?> clazz) {
this.clazz = clazz;
}
-
+
@Override
public Object compute(IEclipseContext context) {
- Object rv = context.get("cached_" + clazz.getName());
- if( rv == null ) {
- rv = ContextInjectionFactory.make(clazz, context);
- context.set("cached_" + clazz.getName(), rv);
+ Object rv = context.get("cached_" + this.clazz.getName()); //$NON-NLS-1$
+ if (rv == null) {
+ rv = ContextInjectionFactory.make(this.clazz, context);
+ context.set("cached_" + this.clazz.getName(), rv); //$NON-NLS-1$
}
return rv;
- }
+ }
} \ No newline at end of file

Back to the top