public interface IFocusService
This service provides 2 variables, activeFocusControl (a Control) and activeFocusControlId (the ID registered with the service).
You can use this service to provide default cut/copy/paste/selectAll for specific text controls outside of the normal workbench part lifecycle, like a control contributed to the trim. For example:
<handler class="org.eclipse.ui.internal.handlers.WidgetMethodHandler:paste" commandId="org.eclipse.ui.edit.paste"> <activeWhen> <with variable="activeFocusControlId"> <equals value="org.eclipse.ui.tests.focusText"/> </with> </activeWhen> </handler>
This service can be acquired from your service locator:
IFocusService service = (IFocusService) getSite().getService(IFocusService.class);
|Modifier and Type||Field and Description|
Use the value to provide default copy behaviour in a handler element class attribute.
Use the value to provide default cut behaviour in a handler element class attribute.
Use the value to provide default paste behaviour in a handler element class attribute.
Use the value to provide default select all behaviour in a handler element class attribute.
static final String COPY_HANDLER
static final String PASTE_HANDLER
static final String CUT_HANDLER
A control must only be registered once, but different controls can be registered with the same ID. Expressions evaluated against the activeFocusControlId would then be true for all of the controls thus registered.
We will remove ourselves as a listener when the Control is disposed.
control- the control. Must not be
null. If the control is already registered with this service this call is a no-op.
id- an ID for this control. Must not be
void removeFocusTracker(Control control)
control- the control registered with the service. Must not be
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.