| java.lang.Object org.eclipse.ui.internal.services.ExpressionAuthority org.eclipse.ui.internal.contexts.ContextAuthority
ContextAuthority | final public class ContextAuthority extends ExpressionAuthority (Code) | |
A central authority for deciding activation of contexts. This authority
listens to a variety of incoming sources, and updates the underlying context
manager if changes occur.
since: 3.1 |
Constructor Summary | |
| ContextAuthority(ContextManager contextManager, IContextService contextService) Constructs a new instance of ContextAuthority .
Parameters: contextManager - The context manager from which contexts can be retrieved (toupdate their active state); must not be null . Parameters: contextService - The workbench context service for which this authority isacting. |
Method Summary | |
final void | activateContext(IContextActivation activation) Activates a context on the workbench. | final void | deactivateContext(IContextActivation activation) Removes an activation for a context on the workbench. | final Shell | getActiveShell() Returns the currently active shell. | final public int | getShellType(Shell shell) Returns the shell type for the given shell.
Parameters: shell - The shell for which the type should be determined. | final public boolean | registerShell(Shell shell, int type)
Registers a shell to automatically promote or demote some basic types of
contexts. | final protected void | sourceChanged(int sourcePriority) Carries out the actual source change notification. | final public boolean | unregisterShell(Shell shell)
Unregisters a shell that was previously registered. | final protected void | updateEvaluationContext(String name, Object value) Updates this authority's evaluation context. | final void | updateShellKludge()
Bug 95792. |
ContextAuthority | ContextAuthority(ContextManager contextManager, IContextService contextService)(Code) | | Constructs a new instance of ContextAuthority .
Parameters: contextManager - The context manager from which contexts can be retrieved (toupdate their active state); must not be null . Parameters: contextService - The workbench context service for which this authority isacting. This allows the authority to manage shell-specificcontexts. This value must not be null . |
activateContext | final void activateContext(IContextActivation activation)(Code) | | Activates a context on the workbench. This will add it to a master list.
Parameters: activation - The activation; must not be null . |
deactivateContext | final void deactivateContext(IContextActivation activation)(Code) | | Removes an activation for a context on the workbench. This will remove it
from the master list, and update the appropriate context, if necessary.
Parameters: activation - The activation; must not be null . |
getActiveShell | final Shell getActiveShell()(Code) | | Returns the currently active shell.
The currently active shell; may be null . |
getShellType | final public int getShellType(Shell shell)(Code) | | Returns the shell type for the given shell.
Parameters: shell - The shell for which the type should be determined. If thisvalue is null , thenIWorkbenchContextSupport.TYPE_NONE is returned. IWorkbenchContextSupport.TYPE_WINDOW ,IWorkbenchContextSupport.TYPE_DIALOG , orIWorkbenchContextSupport.TYPE_NONE . |
registerShell | final public boolean registerShell(Shell shell, int type)(Code) | |
Registers a shell to automatically promote or demote some basic types of
contexts. The "In Dialogs" and "In Windows" contexts are provided by the
system. This a convenience method to ensure that these contexts are
promoted when the given is shell is active.
If a shell is registered as a window, then the "In Windows" context is
enabled when that shell is active. If a shell is registered as a dialog --
or is not registered, but has a parent shell -- then the "In Dialogs"
context is enabled when that shell is active. If the shell is registered
as none -- or is not registered, but has no parent shell -- then the
neither of the contexts will be enabled (by us -- someone else can always
enabled them).
If the provided shell has already been registered, then this method will
change the registration.
Parameters: shell - The shell to register for key bindings; must not benull . Parameters: type - The type of shell being registered. This value must be one ofthe constants given in this interface. true if the shell had already been registered(i.e., the registration has changed); false otherwise. |
sourceChanged | final protected void sourceChanged(int sourcePriority)(Code) | | Carries out the actual source change notification. It assumed that by the
time this method is called, context is up-to-date with the
current state of the application.
Parameters: sourcePriority - A bit mask of all the source priorities that have changed. |
unregisterShell | final public boolean unregisterShell(Shell shell)(Code) | |
Unregisters a shell that was previously registered. After this method
completes, the shell will be treated as if it had never been registered
at all. If you have registered a shell, you should ensure that this
method is called when the shell is disposed. Otherwise, a potential
memory leak will exist.
If the shell was never registered, or if the shell is null ,
then this method returns false and does nothing.
Parameters: shell - The shell to be unregistered; does nothing if this value isnull . true if the shell had been registered;false otherwise. |
updateEvaluationContext | final protected void updateEvaluationContext(String name, Object value)(Code) | | Updates this authority's evaluation context. If the changed variable is
the ISources.ACTIVE_SHELL_NAME variable, then this also
triggers an update of the shell-specific contexts. For example, if a
dialog becomes active, then the dialog context will be activated by this
method.
Parameters: name - The name of the variable to update; must not benull . Parameters: value - The new value of the variable. If this value isnull , then the variable is removed. |
updateShellKludge | final void updateShellKludge()(Code) | |
Bug 95792. A mechanism by which the key binding architecture can force an
update of the contexts (based on the active shell) before trying to
execute a command. This mechanism is required for GTK+ only.
DO NOT CALL THIS METHOD.
|
|
|