Interface IContextProvider
IContextProvider.class is
used as the adapter key. Adaptable objects must implement
org.eclipse.core.runtime.IAdaptable interface.
Dynamic context providers should be used for providing focused dynamic help that changes depending on the various platform states. State change criteria is defined by bitwise-OR of the individual state change triggers. Each time a registered trigger occurs, the class that implements this interface will be called again to provide the help context for the given target.
Context provider should be used for all visual artifacts that provide context help that handle context help trigger by handling the SWT help event instead of tagging the artifact with a static context Id.
In addition to providing static help context, this interface can also be used to control the query string that is passed to the help search system on context switches. If not provided, the query string is computed based on the current context. Providing the string explicitly gives the context owners better control over the search outcome.
- Since:
- 3.1
- See Also:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiongetContext(Object target) Returns a help context for the given target.intReturns the mask created by combining supported change triggers using the bitwise OR operation.getSearchExpression(Object target) Returns a search expression that should be used to find more information about the current target.
-
Field Details
-
NONE
static final int NONEState change trigger indicating a static context provider.- See Also:
-
SELECTION
static final int SELECTIONState change trigger indicating that the provider should be asked for context help on each selection change.- See Also:
-
-
Method Details
-
getContextChangeMask
int getContextChangeMask()Returns the mask created by combining supported change triggers using the bitwise OR operation.- Returns:
- a bitwise-OR combination of state change triggers or
NONEfor a static provider.
-
getContext
Returns a help context for the given target. The number of times this method will be called depends on the context change mask. Static context providers will be called each time the owner of the target is activated. If change triggers are used, the method will be called each time the trigger occurs.- Parameters:
target- the focus of the context help- Returns:
- context help for the provided target or
nullif none is defined.
-
getSearchExpression
Returns a search expression that should be used to find more information about the current target. If provided, it can be used for background search.- Parameters:
target- the focus of the context help- Returns:
- search expression as defined by the help system search, or
nullif background search is not desired.
-