Support for Distraction Free Mode

This commit is contained in:
Alexander Lobas
2016-05-25 22:40:25 +03:00
parent fce727c8c4
commit c24a545b94
2 changed files with 11 additions and 1 deletions
@@ -449,6 +449,10 @@ public final class ToolWindowsPane extends JBLayeredPane implements Disposable {
return myBottomStripe.isVisible() ? myBottomStripe.getHeight() : 0;
}
public boolean isBottomSideToolWindowsVisible() {
return getComponentAt(ToolWindowAnchor.BOTTOM) != null;
}
@Nullable
Stripe getStripeFor(String id) {
ToolWindow window = myManager.getToolWindow(id);
@@ -37,6 +37,7 @@ import com.intellij.openapi.wm.IdeFrame;
import com.intellij.openapi.wm.StatusBar;
import com.intellij.openapi.wm.StatusBarWidget;
import com.intellij.openapi.wm.ex.ProgressIndicatorEx;
import com.intellij.openapi.wm.impl.ToolWindowsPane;
import com.intellij.ui.BalloonLayoutImpl;
import com.intellij.ui.Gray;
import com.intellij.ui.TabbedPaneWrapper;
@@ -434,7 +435,7 @@ public class InfoAndProgressPanel extends JPanel implements CustomStatusBarWidge
public RelativePoint recalculateLocation(Balloon object) {
Component c = getAnchor(pane);
int y = c.getHeight() - 45;
if (balloonLayout != null) {
if (balloonLayout != null && !isBottomSideToolWindowsVisible(pane)) {
Component component = balloonLayout.getTopBalloonComponent();
if (component != null) {
y = SwingUtilities.convertPoint(component, 0, -45, c).y;
@@ -465,6 +466,11 @@ public class InfoAndProgressPanel extends JPanel implements CustomStatusBarWidge
return ex == null ? pane : ex.getSplitters();
}
private static boolean isBottomSideToolWindowsVisible(@NotNull JRootPane parent) {
ToolWindowsPane pane = UIUtil.findComponentOfType(parent, ToolWindowsPane.class);
return pane != null && pane.isBottomSideToolWindowsVisible();
}
public Couple<String> setText(@Nullable final String text, @Nullable final String requestor) {
if (StringUtil.isEmpty(text) && !Comparing.equal(requestor, myCurrentRequestor) && !EventLog.LOG_REQUESTOR.equals(requestor)) {
return Couple.of(myInfoPanel.getText(), myCurrentRequestor);