mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
editor: do not ignore initial state of "Hide tabs if there is not space" flag
We should update layout after changing the "mySupportsCompression" flag, just like we update it on "hideTabsIfNeed" settings change. JBEditorTabs sets `mySupportsCompression` flag in constructor, but it is used in super constructor via `createSingleRowLayout` method. Thus, initial state of "hideTabsIfNeed" flag was ignored as "unsupported".
This commit is contained in:
@@ -320,22 +320,26 @@ public class JBTabsImpl extends JComponent
|
||||
}
|
||||
boolean oldHideTabsIfNeed = mySingleRowLayout instanceof ScrollableSingleRowLayout;
|
||||
boolean newHideTabsIfNeed = UISettings.getInstance().getHideTabsIfNeed();
|
||||
boolean wasSingleRow = isSingleRow();
|
||||
if (oldHideTabsIfNeed != newHideTabsIfNeed) {
|
||||
if (mySingleRowLayout != null) {
|
||||
remove(mySingleRowLayout.myLeftGhost);
|
||||
remove(mySingleRowLayout.myRightGhost);
|
||||
}
|
||||
mySingleRowLayout = createSingleRowLayout();
|
||||
if (wasSingleRow) {
|
||||
myLayout = mySingleRowLayout;
|
||||
}
|
||||
add(mySingleRowLayout.myLeftGhost);
|
||||
add(mySingleRowLayout.myRightGhost);
|
||||
relayout(true, true);
|
||||
updateRowLayout();
|
||||
}
|
||||
}
|
||||
|
||||
private void updateRowLayout() {
|
||||
boolean wasSingleRow = isSingleRow();
|
||||
if (mySingleRowLayout != null) {
|
||||
remove(mySingleRowLayout.myLeftGhost);
|
||||
remove(mySingleRowLayout.myRightGhost);
|
||||
}
|
||||
mySingleRowLayout = createSingleRowLayout();
|
||||
if (wasSingleRow) {
|
||||
myLayout = mySingleRowLayout;
|
||||
}
|
||||
add(mySingleRowLayout.myLeftGhost);
|
||||
add(mySingleRowLayout.myRightGhost);
|
||||
relayout(true, true);
|
||||
}
|
||||
|
||||
protected SingleRowLayout createSingleRowLayout() {
|
||||
return new SingleRowLayout(this);
|
||||
}
|
||||
@@ -3292,6 +3296,7 @@ public class JBTabsImpl extends JComponent
|
||||
@Override
|
||||
public JBTabsPresentation setSupportsCompression(boolean supportsCompression) {
|
||||
mySupportsCompression = supportsCompression;
|
||||
updateRowLayout();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user