diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java index 1d0aff0a2374..3ccf34ea77c8 100644 --- a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java +++ b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java @@ -1200,10 +1200,15 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre this.mainComponent = mainComponent; this.isLogical = isLogical; - floatingToolbar = new StructureViewFloatingToolbar(this, StructureViewComponent.this); add(mainComponent, DEFAULT_LAYER); - add(floatingToolbar, POPUP_LAYER); - mainComponent.getVerticalScrollBar().addAdjustmentListener(event -> floatingToolbar.setScrollingDy(event.getValue())); + if (Registry.is("logical.structure.actions.enabled", true)) { + floatingToolbar = new StructureViewFloatingToolbar(this, StructureViewComponent.this); + add(floatingToolbar, POPUP_LAYER); + mainComponent.getVerticalScrollBar().addAdjustmentListener(event -> floatingToolbar.setScrollingDy(event.getValue())); + } + else { + floatingToolbar = null; + } } @Override @@ -1211,14 +1216,16 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre Rectangle bounds = getBounds(); for (Component component : getComponents()) { if (component == mainComponent) { - component.setBounds(isLogical ? 12 : 0, 0, bounds.width, bounds.height); + component.setBounds(isLogical && floatingToolbar != null ? 12 : 0, 0, bounds.width, bounds.height); } } } public void repaintFloatingToolbar(int y) { - int scrollDy = mainComponent.getVerticalScrollBar().getValue(); - floatingToolbar.repaintOnYWithDy(y, scrollDy); + if (floatingToolbar != null) { + int scrollDy = mainComponent.getVerticalScrollBar().getValue(); + floatingToolbar.repaintOnYWithDy(y, scrollDy); + } } @Override diff --git a/platform/platform-resources/src/META-INF/LangExtensions.xml b/platform/platform-resources/src/META-INF/LangExtensions.xml index b2c7405a2386..74e612a23844 100644 --- a/platform/platform-resources/src/META-INF/LangExtensions.xml +++ b/platform/platform-resources/src/META-INF/LangExtensions.xml @@ -689,6 +689,10 @@ description="Show logical structure in Structure View" defaultValue="true" restartRequired="false"/> +