Search in sources :

Example 1 with StatusBarEx

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

the class RefreshProgress method updateIndicators.

private void updateIndicators(final boolean start) {
    // wrapping in invokeLater here reduces the number of events posted to EDT in case of multiple IDE frames
    UIUtil.invokeLaterIfNeeded(() -> {
        if (ApplicationManager.getApplication().isDisposed())
            return;
        WindowManager windowManager = WindowManager.getInstance();
        if (windowManager == null)
            return;
        Project[] projects = ProjectManager.getInstance().getOpenProjects();
        if (projects.length == 0)
            projects = NULL_ARRAY;
        for (Project project : projects) {
            StatusBarEx statusBar = (StatusBarEx) windowManager.getStatusBar(project);
            if (statusBar != null) {
                if (start) {
                    statusBar.startRefreshIndication(myMessage);
                } else {
                    statusBar.stopRefreshIndication();
                }
            }
        }
    });
}
Also used : Project(com.intellij.openapi.project.Project) StatusBarEx(com.intellij.openapi.wm.ex.StatusBarEx) WindowManager(com.intellij.openapi.wm.WindowManager)

Example 2 with StatusBarEx

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

the class DumbServiceImpl method showDumbModeNotification.

@Override
public void showDumbModeNotification(@NotNull final String message) {
    UIUtil.invokeLaterIfNeeded(() -> {
        final IdeFrame ideFrame = WindowManager.getInstance().getIdeFrame(myProject);
        if (ideFrame != null) {
            StatusBarEx statusBar = (StatusBarEx) ideFrame.getStatusBar();
            statusBar.notifyProgressByBalloon(MessageType.WARNING, message, null, null);
        }
    });
}
Also used : IdeFrame(com.intellij.openapi.wm.IdeFrame) StatusBarEx(com.intellij.openapi.wm.ex.StatusBarEx)

Example 3 with StatusBarEx

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

the class ProcessPopup method show.

public void show(boolean requestFocus) {
    JComponent toFocus = myRootContent.getTargetComponent() == myActiveContentComponent ? myActiveFocusedContent : myInactiveContentComponent;
    final ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(myRootContent, toFocus);
    builder.addListener(new JBPopupAdapter() {

        public void onClosed(LightweightWindowEvent event) {
            myProgressPanel.hideProcessPopup();
        }
    });
    builder.setMovable(true);
    builder.setResizable(true);
    builder.setTitle(IdeBundle.message("progress.window.title"));
    builder.setDimensionServiceKey(null, "ProcessPopupWindow", true);
    builder.setCancelOnClickOutside(false);
    builder.setRequestFocus(requestFocus);
    builder.setBelongsToGlobalPopupStack(false);
    builder.setLocateByContent(true);
    builder.setCancelButton(new MinimizeButton("Hide"));
    JFrame frame = (JFrame) UIUtil.findUltimateParent(myProgressPanel);
    updateContentUI();
    myActiveContentComponent.setBorder(null);
    if (frame != null) {
        Dimension contentSize = myRootContent.getPreferredSize();
        Rectangle bounds = frame.getBounds();
        int width = Math.max(bounds.width / 4, contentSize.width);
        int height = Math.min(bounds.height / 4, contentSize.height);
        int x = (int) (bounds.getMaxX() - width);
        int y = (int) (bounds.getMaxY() - height);
        myPopup = builder.createPopup();
        StatusBarEx sb = (StatusBarEx) ((IdeFrame) frame).getStatusBar();
        if (sb.isVisible()) {
            y -= sb.getSize().height;
        }
        myPopup.showInScreenCoordinates(myProgressPanel.getRootPane(), new Point(x - 5, y - 5));
    } else {
        myPopup = builder.createPopup();
        myPopup.showInCenterOf(myProgressPanel.getRootPane());
    }
}
Also used : MinimizeButton(com.intellij.openapi.ui.popup.util.MinimizeButton) StatusBarEx(com.intellij.openapi.wm.ex.StatusBarEx)

Example 4 with StatusBarEx

use of com.intellij.openapi.wm.ex.StatusBarEx 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 5 with StatusBarEx

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

the class IdeKeyEventDispatcher method inSecondStrokeInProgressState.

private boolean inSecondStrokeInProgressState() {
    KeyEvent e = myContext.getInputEvent();
    // when any key is released, we stop waiting for the second stroke
    if (KeyEvent.KEY_RELEASED == e.getID()) {
        myFirstKeyStroke = null;
        setState(KeyState.STATE_INIT);
        Project project = CommonDataKeys.PROJECT.getData(myContext.getDataContext());
        StatusBar.Info.set(null, project);
        return false;
    }
    KeyStroke originalKeyStroke = KeyStrokeAdapter.getDefaultKeyStroke(e);
    if (originalKeyStroke == null) {
        return false;
    }
    KeyStroke keyStroke = getKeyStrokeWithoutMouseModifiers(originalKeyStroke);
    updateCurrentContext(myContext.getFoundComponent(), new KeyboardShortcut(myFirstKeyStroke, keyStroke), myContext.isModalContext());
    // consume the wrong second stroke and keep on waiting
    if (myContext.getActions().isEmpty()) {
        return true;
    }
    // finally user had managed to enter the second keystroke, so let it be processed
    Project project = CommonDataKeys.PROJECT.getData(myContext.getDataContext());
    StatusBarEx statusBar = (StatusBarEx) WindowManager.getInstance().getStatusBar(project);
    if (processAction(e, myActionProcessor)) {
        if (statusBar != null) {
            statusBar.setInfo(null);
        }
        return true;
    } else {
        return false;
    }
}
Also used : KeyEvent(java.awt.event.KeyEvent) Project(com.intellij.openapi.project.Project) StatusBarEx(com.intellij.openapi.wm.ex.StatusBarEx)

Aggregations

StatusBarEx (com.intellij.openapi.wm.ex.StatusBarEx)8 Project (com.intellij.openapi.project.Project)3 IdeFrame (com.intellij.openapi.wm.IdeFrame)3 WindowManager (com.intellij.openapi.wm.WindowManager)2 WindowManagerEx (com.intellij.openapi.wm.ex.WindowManagerEx)2 GradleTasksExecutor (com.android.tools.idea.gradle.project.build.invoker.GradleTasksExecutor)1 DescriptiveNameUtil (com.intellij.lang.findUsages.DescriptiveNameUtil)1 ApplicationManager (com.intellij.openapi.application.ApplicationManager)1 ModalityState (com.intellij.openapi.application.ModalityState)1 Logger (com.intellij.openapi.diagnostic.Logger)1 Extensions (com.intellij.openapi.extensions.Extensions)1 ProgressIndicator (com.intellij.openapi.progress.ProgressIndicator)1 ProgressManager (com.intellij.openapi.progress.ProgressManager)1 TaskInfo (com.intellij.openapi.progress.TaskInfo)1 MessageType (com.intellij.openapi.ui.MessageType)1 Messages (com.intellij.openapi.ui.Messages)1 MinimizeButton (com.intellij.openapi.ui.popup.util.MinimizeButton)1 Computable (com.intellij.openapi.util.Computable)1 Pair (com.intellij.openapi.util.Pair)1 Ref (com.intellij.openapi.util.Ref)1