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();
}
}
}
});
}
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);
}
});
}
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());
}
}
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;
}
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;
}
}
Aggregations