diff options
author | cvs2svn | 2009-02-04 22:59:54 +0000 |
---|---|---|
committer | cvs2svn | 2009-02-04 22:59:54 +0000 |
commit | 8093f2800933da2c0a7b49ac27acb978dda5bd20 (patch) | |
tree | f7b55344dc07292afbe933805649a02fe4a63fe9 | |
parent | b0be10e1d8c5e1b6d0516691f78d98dcdd6c0dff (diff) | |
download | eclipse.platform.runtime-8093f2800933da2c0a7b49ac27acb978dda5bd20.tar.gz eclipse.platform.runtime-8093f2800933da2c0a7b49ac27acb978dda5bd20.tar.xz eclipse.platform.runtime-8093f2800933da2c0a7b49ac27acb978dda5bd20.zip |
This commit was manufactured by cvs2svn to create tag 'v20090204-1930'.v20090204-1930
Sprout from master 2009-02-04 22:59:53 UTC Boris Bokowski <bbokowski> 'Had to fix problems after merge with Paul's changes - Bug 263710 Get rid of weird IHasInput interface'
Cherrypick from master 2009-02-04 18:56:24 UTC John Arthorne <johna> 'API cleanup':
bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/internal/context/ActiveChildValue.java
-rw-r--r-- | bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/internal/context/ActiveChildValue.java | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/internal/context/ActiveChildValue.java b/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/internal/context/ActiveChildValue.java new file mode 100644 index 000000000..89d49f3b5 --- /dev/null +++ b/bundles/org.eclipse.e4.core.services/src/org/eclipse/e4/core/services/internal/context/ActiveChildValue.java @@ -0,0 +1,38 @@ +/******************************************************************************* + * Copyright (c) 2009 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 + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + *******************************************************************************/ + +package org.eclipse.e4.core.services.internal.context; + +import org.eclipse.e4.core.services.context.IEclipseContext; +import org.eclipse.e4.core.services.context.spi.IComputedValue; + +/** + * A computed value that delegates lookup to a child context. + * TODO: There might be different bundles with their own notion of "active child", + * so to make this more reusable the "activeChild" constant should likely be pulled + * out and live in the UI ("activeChildControl" or some such), allowing others to store + * their own notion of child under a different key. + */ +public final class ActiveChildValue implements IComputedValue { + private final String attr; + + public ActiveChildValue(String attr) { + this.attr = attr; + } + + public Object compute(IEclipseContext context, String[] arguments) { + if (context.isSet("activeChild")) { + IEclipseContext childContext = (IEclipseContext) context.get("activeChild"); + return childContext.get(attr); + } + return null; + } +}
\ No newline at end of file |