public abstract class IdeFocusManager extends java.lang.Object implements FocusRequestor
All focus requests should be done through this class.
For example, to request focus on a component:
IdeFocusManager.getInstance(project).requestFocus(comp, true);This is the preferred way to request focus on components to
comp.requestFocus();
This class is also responsible for delivering key events while focus transferring is in progress.
IdeFocusManager
instance can be received per project or the global instance. The preferred way is
to use instance IdeFocusManager.getInstance(project)
. If no project instance is available, then
IdeFocusManager.getGlobalInstance()
can be used.
Disposable.Parent
Constructor and Description |
---|
IdeFocusManager() |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Usually not invoked directly, see class javadoc.
|
abstract void |
doWhenFocusSettlesDown(ExpirableRunnable runnable)
Executes given runnable after all focus activities are finished.
|
abstract void |
doWhenFocusSettlesDown(java.lang.Runnable runnable)
Executes given runnable after all focus activities are finished.
|
abstract void |
doWhenFocusSettlesDown(java.lang.Runnable runnable,
ModalityState modality)
Executes given runnable after all focus activities are finished, immediately or later with the given modality state.
|
static IdeFocusManager |
findInstance() |
static IdeFocusManager |
findInstanceByComponent(java.awt.Component component) |
static IdeFocusManager |
findInstanceByContext(DataContext context) |
abstract java.awt.Component |
getFocusedDescendantFor(java.awt.Component comp)
Finds focused component among descendants of the given component.
|
abstract java.awt.Component |
getFocusOwner()
Computes effective focus owner.
|
abstract javax.swing.JComponent |
getFocusTargetFor(javax.swing.JComponent comp)
Finds most suitable component to request focus to.
|
FocusRequestor |
getFurtherRequestor()
Deprecated.
|
static IdeFocusManager |
getGlobalInstance() |
static IdeFocusManager |
getInstance(Project project) |
abstract java.awt.Component |
getLastFocusedFor(java.awt.Window frame)
Returns last focused component for the given IDE
Window . |
abstract IdeFrame |
getLastFocusedFrame()
Returns last focused
IdeFrame . |
abstract java.awt.Window |
getLastFocusedIdeWindow() |
abstract boolean |
isFocusTransferEnabled()
Reports of focus transfer is enabled right now.
|
ActionCallback |
requestDefaultFocus(boolean forced)
Requests default focus.
|
ActionCallback |
requestFocusInProject(java.awt.Component c,
Project project) |
abstract void |
runOnOwnContext(DataContext context,
java.lang.Runnable runnable)
Runs runnable for which
DataContext will not be computed from the current focus owner,
but using given one. |
abstract void |
setTypeaheadEnabled(boolean enabled)
Enables or disables typeahead.
|
abstract void |
toFront(javax.swing.JComponent c)
Put the container window to front.
|
void |
typeAheadUntil(ActionCallback done)
Deprecated.
use
typeAheadUntil(ActionCallback, String) instead |
void |
typeAheadUntil(ActionCallback done,
java.lang.String cause)
Aggregates all key events until given callback object is processed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
requestFocus
public ActionCallback requestFocusInProject(java.awt.Component c, Project project)
public abstract javax.swing.JComponent getFocusTargetFor(javax.swing.JComponent comp)
public abstract void doWhenFocusSettlesDown(java.lang.Runnable runnable)
public abstract void doWhenFocusSettlesDown(java.lang.Runnable runnable, ModalityState modality)
public abstract void doWhenFocusSettlesDown(ExpirableRunnable runnable)
public abstract java.awt.Component getFocusedDescendantFor(java.awt.Component comp)
@Deprecated public void typeAheadUntil(ActionCallback done)
typeAheadUntil(ActionCallback, String)
insteadpublic void typeAheadUntil(ActionCallback done, java.lang.String cause)
done
- action callbackpublic ActionCallback requestDefaultFocus(boolean forced)
public abstract boolean isFocusTransferEnabled()
FocusCommand
can be executed on an inactive app.public abstract void setTypeaheadEnabled(boolean enabled)
typeAheadUntil(ActionCallback)
public abstract java.awt.Component getFocusOwner()
public abstract void runOnOwnContext(DataContext context, java.lang.Runnable runnable)
DataContext
will not be computed from the current focus owner,
but using given one.public abstract java.awt.Component getLastFocusedFor(java.awt.Window frame)
Window
.
Only IDE window (that's implementing IdeFrame
).public abstract IdeFrame getLastFocusedFrame()
IdeFrame
.public abstract java.awt.Window getLastFocusedIdeWindow()
public abstract void toFront(javax.swing.JComponent c)
window.toFront()
.public static IdeFocusManager getInstance(Project project)
public static IdeFocusManager findInstanceByContext(DataContext context)
public static IdeFocusManager findInstanceByComponent(java.awt.Component component)
public static IdeFocusManager findInstance()
@Deprecated public FocusRequestor getFurtherRequestor()
public static IdeFocusManager getGlobalInstance()
public void dispose()
Disposable
dispose
in interface Disposable