IDEA-138180 Push Dialog: last target is invisible (if it has no commits to push)

* scroll bar sometimes doesn't appear when needed, and only a part of last commit is visible->collapse and re-expand or resize  helps
This commit is contained in:
Nadya Zabrodina
2015-04-14 17:04:24 +04:00
parent dfc2bc2a5f
commit 429fd1dec6
@@ -29,6 +29,7 @@ import com.intellij.openapi.vcs.changes.ui.EditSourceForDialogAction;
import com.intellij.openapi.vcs.history.VcsRevisionNumber;
import com.intellij.ui.*;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.ui.components.JBViewport;
import com.intellij.ui.components.labels.LinkLabel;
import com.intellij.ui.components.labels.LinkListener;
import com.intellij.util.ArrayUtil;
@@ -233,6 +234,10 @@ public class PushLog extends JPanel implements DataProvider {
}
}
};
if (syncStrategyPanel != null) {
myScrollPane.setViewport(new MyTreeViewPort(myTree, syncStrategyPanel.getPreferredSize().height));
}
myScrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE);
myScrollPane.setOpaque(false);
if (syncStrategyPanel != null) {
myScrollPane.add(syncStrategyPanel);
@@ -653,6 +658,23 @@ public class PushLog extends JPanel implements DataProvider {
};
}
}
private static class MyTreeViewPort extends JBViewport {
final int myHeightToReduce;
public MyTreeViewPort(@Nullable Component view, int heightToReduce) {
super();
setView(view);
myHeightToReduce = heightToReduce;
}
@Override
public Dimension getExtentSize() {
Dimension defaultSize = super.getExtentSize();
return new Dimension(defaultSize.width, defaultSize.height - myHeightToReduce);
}
}
}