Java Code Examples for com.intellij.openapi.wm.ex.WindowManagerEx#getInstanceEx()

The following examples show how to use com.intellij.openapi.wm.ex.WindowManagerEx#getInstanceEx() . 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: IJSwingUtilities.java    From consulo with Apache License 2.0 6 votes vote down vote up
/**
 * @return true if window ancestor of component was most recent focused window and most recent focused component
 * in that window was descended from component
 */
public static boolean hasFocus2(Component component) {
  WindowManagerEx windowManager = WindowManagerEx.getInstanceEx();
  Window activeWindow=null;
  if (windowManager != null) {
    activeWindow = TargetAWT.to(windowManager.getMostRecentFocusedWindow());
  }
  if(activeWindow==null){
    return false;
  }
  Component focusedComponent = windowManager.getFocusedComponent(activeWindow);
  if (focusedComponent == null) {
    return false;
  }

  return SwingUtilities.isDescendingFrom(focusedComponent, component);
}
 
Example 2
Source File: DesktopFloatingDecorator.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public final void show() {
  setFocusableWindowState(myInfo.isActive());

  super.show();
  final UISettings uiSettings = UISettings.getInstance();
  if (uiSettings.ENABLE_ALPHA_MODE) {
    final WindowManagerEx windowManager = WindowManagerEx.getInstanceEx();
    windowManager.setAlphaModeEnabled(this, true);
    if (myInfo.isActive()) {
      windowManager.setAlphaModeRatio(this, 0.0f);
    }
    else {
      windowManager.setAlphaModeRatio(this, uiSettings.ALPHA_MODE_RATIO);
    }
  }
  paint(getGraphics()); // This prevents annoying flick

  setFocusableWindowState(true);

  uiSettings.addUISettingsListener(myUISettingsListener, myDelayAlarm);
}
 
Example 3
Source File: DesktopFloatingDecorator.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void uiSettingsChanged(final UISettings uiSettings) {
  LOG.assertTrue(isDisplayable());
  LOG.assertTrue(isShowing());
  final WindowManagerEx windowManager = WindowManagerEx.getInstanceEx();
  myDelayAlarm.cancelAllRequests();
  if (uiSettings.ENABLE_ALPHA_MODE) {
    if (!myInfo.isActive()) {
      windowManager.setAlphaModeEnabled(DesktopFloatingDecorator.this, true);
      windowManager.setAlphaModeRatio(DesktopFloatingDecorator.this, uiSettings.ALPHA_MODE_RATIO);
    }
  }
  else {
    windowManager.setAlphaModeEnabled(DesktopFloatingDecorator.this, false);
  }
}
 
Example 4
Source File: DesktopFloatingDecorator.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public final void run() {
  final WindowManagerEx windowManager = WindowManagerEx.getInstanceEx();
  if (isDisplayable() && isShowing()) {
    windowManager.setAlphaModeRatio(DesktopFloatingDecorator.this, getCurrentAlphaRatio());
  }
  if (myCurrentFrame < TOTAL_FRAME_COUNT) {
    myCurrentFrame++;
    myFrameTicker.addRequest(myAnimator, DELAY);
  }
  else {
    myFrameTicker.cancelAllRequests();
  }
}
 
Example 5
Source File: AbstractPopup.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static WindowManagerEx getWndManager() {
  return ApplicationManager.getApplication() != null ? WindowManagerEx.getInstanceEx() : null;
}
 
Example 6
Source File: IdeHelper.java    From idea-php-symfony2-plugin with MIT License 2 votes vote down vote up
/**
 * Find a window manager
 *
 * @see com.intellij.ui.popup.AbstractPopup
 */
@Nullable
private static WindowManagerEx getWindowManager() {
    return ApplicationManagerEx.getApplicationEx() != null ? WindowManagerEx.getInstanceEx() : null;
}