Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 


Eclipse Platform
Release 3.5

org.eclipse.ui.swt
Interface IFocusService


public interface IFocusService

Tracks focusGained and focusLost events for a Control registered with this service, and provides the control and its registered ID as variables to the application evaluation context for evaluation by the various services.

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);
 
  • This service is available globally.

Since:
3.3
See Also:
ISources
Restriction:
This interface is not intended to be implemented by clients.

Field Summary
static  String COPY_HANDLER
          Use the value to provide default copy behaviour in a handler element class attribute.
static  String CUT_HANDLER
          Use the value to provide default cut behaviour in a handler element class attribute.
static  String PASTE_HANDLER
          Use the value to provide default paste behaviour in a handler element class attribute.
static  String SELECT_ALL_HANDLER
          Use the value to provide default select all behaviour in a handler element class attribute.
 
Method Summary
 void addFocusTracker ( Control control, String id)
          A Control for which the service will track focus.
 void removeFocusTracker ( Control control)
          No longer track focus events for this control.
 

Field Detail

COPY_HANDLER

static final 
String COPY_HANDLER
Use the value to provide default copy behaviour in a handler element class attribute.

See Also:
Constant Field Values

PASTE_HANDLER

static final 
String PASTE_HANDLER
Use the value to provide default paste behaviour in a handler element class attribute.

See Also:
Constant Field Values

CUT_HANDLER

static final 
String CUT_HANDLER
Use the value to provide default cut behaviour in a handler element class attribute.

See Also:
Constant Field Values

SELECT_ALL_HANDLER

static final 
String SELECT_ALL_HANDLER
Use the value to provide default select all behaviour in a handler element class attribute.

See Also:
Constant Field Values
Method Detail

addFocusTracker

void addFocusTracker(
Control control,
                     
String id)
A Control for which the service will track focus. When in focus, this Control and its ID will be provided as variables to core expressions for the various services, as activeFocusControl and activeFocusControlId respectively.

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.

Parameters:
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 null.

removeFocusTracker

void removeFocusTracker(
Control control)
No longer track focus events for this control. Use this method when the control should no longer be tracked, but is not disposed.

Parameters:
control - the control registered with the service. Must not be null.

Eclipse Platform
Release 3.5

Guidelines for using Eclipse APIs.

Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire