Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 394336
Collapse All | Expand All

(-)a/bundles/org.eclipse.e4.core.contexts/src/org/eclipse/e4/core/internal/contexts/EclipseContext.java (-23 / +1 lines)
Lines 713-746 Link Here
713
		return null;
713
		return null;
714
	}
714
	}
715
715
716
	/**
717
	 * Prefix used to distinguish active variables
718
	 */
719
	static private final String ACTIVE_VARIABLE = "org.eclipse.ui.active_"; //$NON-NLS-1$
720
721
	public <T> T getActive(Class<T> clazz) {
716
	public <T> T getActive(Class<T> clazz) {
722
		return clazz.cast(getActive(clazz.getName()));
717
		return clazz.cast(getActive(clazz.getName()));
723
	}
718
	}
724
719
725
	public Object getActive(final String name) {
720
	public Object getActive(final String name) {
726
		final String internalName = ACTIVE_VARIABLE + name;
721
		return getActiveLeaf().get(name);
727
		if (containsKey(internalName, true)) {
728
			trackAccess(internalName);
729
			return internalGet(this, internalName, true);
730
		}
731
732
		final EclipseContext originatingContext = this;
733
734
		runAndTrack(new RunAndTrack() {
735
			public boolean changed(IEclipseContext context) {
736
				IEclipseContext activeContext = getActiveLeaf();
737
				Object result = activeContext.get(name);
738
				originatingContext.set(internalName, result);
739
				return true;
740
			}
741
		});
742
		trackAccess(internalName);
743
		return internalGet(this, internalName, true);
744
	}
722
	}
745
723
746
	public WeakReference<Object> trackedWeakReference(Object object) {
724
	public WeakReference<Object> trackedWeakReference(Object object) {

Return to bug 394336