Search in sources :

Example 1 with WindowManagerEx

use of com.intellij.openapi.wm.ex.WindowManagerEx in project intellij-community by JetBrains.

the class FloatingDecorator method show.

@Override
public final void show() {
    setFocusableWindowState(myInfo.isActive());
    super.show();
    final UISettings uiSettings = UISettings.getInstance();
    if (uiSettings.getEnableAlphaMode()) {
        final WindowManagerEx windowManager = WindowManagerEx.getInstanceEx();
        windowManager.setAlphaModeEnabled(this, true);
        if (myInfo.isActive()) {
            windowManager.setAlphaModeRatio(this, 0.0f);
        } else {
            windowManager.setAlphaModeRatio(this, uiSettings.getAlphaModeRatio());
        }
    }
    // This prevents annoying flick
    paint(getGraphics());
    setFocusableWindowState(true);
    ApplicationManager.getApplication().getMessageBus().connect(myDelayAlarm).subscribe(UISettingsListener.TOPIC, myUISettingsListener);
}
Also used : UISettings(com.intellij.ide.ui.UISettings) WindowManagerEx(com.intellij.openapi.wm.ex.WindowManagerEx)

Example 2 with WindowManagerEx

use of com.intellij.openapi.wm.ex.WindowManagerEx in project android by JetBrains.

the class GradleSyncInvoker method isBuildInProgress.

private static boolean isBuildInProgress(@NotNull Project project) {
    IdeFrame frame = ((WindowManagerEx) WindowManager.getInstance()).findFrameFor(project);
    StatusBarEx statusBar = frame == null ? null : (StatusBarEx) frame.getStatusBar();
    if (statusBar == null) {
        return false;
    }
    for (Pair<TaskInfo, ProgressIndicator> backgroundProcess : statusBar.getBackgroundProcesses()) {
        TaskInfo task = backgroundProcess.getFirst();
        if (task instanceof GradleTasksExecutor) {
            ProgressIndicator second = backgroundProcess.getSecond();
            if (second.isRunning()) {
                return true;
            }
        }
    }
    return false;
}
Also used : TaskInfo(com.intellij.openapi.progress.TaskInfo) GradleTasksExecutor(com.android.tools.idea.gradle.project.build.invoker.GradleTasksExecutor) ProgressIndicator(com.intellij.openapi.progress.ProgressIndicator) IdeFrame(com.intellij.openapi.wm.IdeFrame) WindowManagerEx(com.intellij.openapi.wm.ex.WindowManagerEx) StatusBarEx(com.intellij.openapi.wm.ex.StatusBarEx)

Example 3 with WindowManagerEx

use of com.intellij.openapi.wm.ex.WindowManagerEx in project intellij-community by JetBrains.

the class PlaybackDebugger method activateAndRun.

private void activateAndRun() {
    assert myRunner == null;
    myLog.setText(null);
    final IdeFrameImpl frame = getFrame();
    final Component c = ((WindowManagerEx) WindowManager.getInstance()).getFocusedComponent(frame);
    if (c != null) {
        IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
            IdeFocusManager.getGlobalInstance().requestFocus(c, true);
        });
    } else {
        IdeFocusManager.getGlobalInstance().doWhenFocusSettlesDown(() -> {
            IdeFocusManager.getGlobalInstance().requestFocus(frame, true);
        });
    }
    //noinspection SSBasedInspection
    SwingUtilities.invokeLater(() -> startWhenFrameActive());
}
Also used : IdeFrameImpl(com.intellij.openapi.wm.impl.IdeFrameImpl) WindowManagerEx(com.intellij.openapi.wm.ex.WindowManagerEx)

Example 4 with WindowManagerEx

use of com.intellij.openapi.wm.ex.WindowManagerEx in project intellij-community by JetBrains.

the class AbstractPopup method updateMaskAndAlpha.

private Window updateMaskAndAlpha(Window window) {
    if (window == null)
        return null;
    if (!window.isDisplayable() || !window.isShowing())
        return window;
    final WindowManagerEx wndManager = getWndManager();
    if (wndManager == null)
        return window;
    if (!wndManager.isAlphaModeEnabled(window))
        return window;
    if (myAlpha != myLastAlpha) {
        wndManager.setAlphaModeRatio(window, myAlpha);
        myLastAlpha = myAlpha;
    }
    if (myMaskProvider != null) {
        final Dimension size = window.getSize();
        Shape mask = myMaskProvider.getMask(size);
        wndManager.setWindowMask(window, mask);
    }
    WindowManagerEx.WindowShadowMode mode = myShadowed ? WindowManagerEx.WindowShadowMode.NORMAL : WindowManagerEx.WindowShadowMode.DISABLED;
    WindowManagerEx.getInstanceEx().setWindowShadow(window, mode);
    return window;
}
Also used : WindowManagerEx(com.intellij.openapi.wm.ex.WindowManagerEx)

Example 5 with WindowManagerEx

use of com.intellij.openapi.wm.ex.WindowManagerEx in project intellij-community by JetBrains.

the class IJSwingUtilities method hasFocus2.

/**
   * @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 = windowManager.getMostRecentFocusedWindow();
    }
    if (activeWindow == null) {
        return false;
    }
    Component focusedComponent = windowManager.getFocusedComponent(activeWindow);
    if (focusedComponent == null) {
        return false;
    }
    return SwingUtilities.isDescendingFrom(focusedComponent, component);
}
Also used : WindowManagerEx(com.intellij.openapi.wm.ex.WindowManagerEx)

Aggregations

WindowManagerEx (com.intellij.openapi.wm.ex.WindowManagerEx)7 IdeFrame (com.intellij.openapi.wm.IdeFrame)2 StatusBarEx (com.intellij.openapi.wm.ex.StatusBarEx)2 GradleTasksExecutor (com.android.tools.idea.gradle.project.build.invoker.GradleTasksExecutor)1 UISettings (com.intellij.ide.ui.UISettings)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 TaskInfo (com.intellij.openapi.progress.TaskInfo)1 Pair (com.intellij.openapi.util.Pair)1 IdeFrameImpl (com.intellij.openapi.wm.impl.IdeFrameImpl)1