Java Code Examples for com.intellij.util.ui.UIUtil#isFocusAncestor()

The following examples show how to use com.intellij.util.ui.UIUtil#isFocusAncestor() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: IdeMouseEventDispatcher.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static void requestFocusInNonFocusedWindow(@Nullable Component component) {
  Window window = UIUtil.getWindow(component);
  if (window != null && !UIUtil.isFocusAncestor(window)) {
    Component focusable = UIUtil.isFocusable(component) ? component : findDefaultFocusableComponent(component);
    if (focusable != null) focusable.requestFocus();
  }
}
 
Example 2
Source File: DesktopContentManagerImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean isSelectionHoldsFocus() {
  boolean focused = false;
  final Content[] selection = getSelectedContents();
  for (Content each : selection) {
    if (UIUtil.isFocusAncestor(each.getComponent())) {
      focused = true;
      break;
    }
  }
  return focused;
}
 
Example 3
Source File: NavBarItem.java    From consulo with Apache License 2.0 5 votes vote down vote up
public boolean isFocused() {
  if (myPanel.allowNavItemsFocus()) {
    return UIUtil.isFocusAncestor(myPanel) && !myPanel.isNodePopupActive();
  }
  else {
    return myPanel.hasFocus() && !myPanel.isNodePopupActive();
  }
}
 
Example 4
Source File: NavBarPanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
public boolean isFocused() {
  if (allowNavItemsFocus()) {
    return UIUtil.isFocusAncestor(this);
  }
  else {
    return hasFocus();
  }
}