mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
one more fix about data context
This commit is contained in:
@@ -52,13 +52,12 @@ public class NavBarModel {
|
||||
private final Project myProject;
|
||||
private final NavBarModelListener myNotificator;
|
||||
private boolean myChanged = true;
|
||||
private boolean shouldSkipUpdateFromDataContext = false;
|
||||
private final boolean myIsFloatingModeModel;
|
||||
private boolean updated = false;
|
||||
private boolean isFixedComponent = false;
|
||||
|
||||
public NavBarModel(final Project project) {
|
||||
myProject = project;
|
||||
myNotificator = project.getMessageBus().syncPublisher(NavBarModelListener.NAV_BAR);
|
||||
myIsFloatingModeModel = !UISettings.getInstance().SHOW_NAVIGATION_BAR;
|
||||
}
|
||||
|
||||
public int getSelectedIndex() {
|
||||
@@ -93,7 +92,7 @@ public class NavBarModel {
|
||||
}
|
||||
|
||||
protected void updateModel(DataContext dataContext) {
|
||||
if (LaterInvocator.isInModalContext() || (shouldSkipUpdateFromDataContext && myIsFloatingModeModel)) return;
|
||||
if (LaterInvocator.isInModalContext() || (updated && !isFixedComponent)) return;
|
||||
|
||||
PsiElement psiElement = LangDataKeys.PSI_FILE.getData(dataContext);
|
||||
if (psiElement == null) {
|
||||
@@ -120,7 +119,7 @@ public class NavBarModel {
|
||||
}
|
||||
setChanged(false);
|
||||
|
||||
shouldSkipUpdateFromDataContext = !UISettings.getInstance().SHOW_NAVIGATION_BAR;
|
||||
updated = true;
|
||||
}
|
||||
|
||||
protected void updateModel(final PsiElement psiElement) {
|
||||
@@ -373,6 +372,10 @@ public class NavBarModel {
|
||||
}
|
||||
}
|
||||
|
||||
public void setFixedComponent(boolean fixedComponent) {
|
||||
isFixedComponent = fixedComponent;
|
||||
}
|
||||
|
||||
private static final class SiblingsComparator implements Comparator<Object> {
|
||||
public int compare(final Object o1, final Object o2) {
|
||||
final Pair<Integer, String> w1 = getWeightedName(o1);
|
||||
|
||||
@@ -127,6 +127,7 @@ public class NavBarRootPaneExtension extends IdeRootPaneNorthExtension {
|
||||
final JComponent result = new OpaquePanel.List(new BorderLayout());
|
||||
result.setBackground(UIUtil.isUnderGTKLookAndFeel() ? Color.WHITE : UIUtil.getListBackground());
|
||||
myNavigationBar = new NavBarPanel(myProject);
|
||||
myNavigationBar.getModel().setFixedComponent(true);
|
||||
|
||||
JScrollPane scroller = ScrollPaneFactory.createScrollPane(myNavigationBar);
|
||||
scroller.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
|
||||
|
||||
Reference in New Issue
Block a user