IDEA-362773 Add registry key for logical structure floating action icon

(cherry picked from commit 1999ea56ec8d665e2ad5e6bd19bec6320cfed732)

IJ-CR-148759

GitOrigin-RevId: 636e09f637275b15782192b7109624b42b58bdc5
This commit is contained in:
Anton Kozub
2024-11-07 01:48:57 +01:00
committed by intellij-monorepo-bot
parent b95c1b84e7
commit cc45672e28
2 changed files with 17 additions and 6 deletions

View File

@@ -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

View File

@@ -689,6 +689,10 @@
description="Show logical structure in Structure View"
defaultValue="true"
restartRequired="false"/>
<registryKey key="logical.structure.actions.enabled"
description="Show action icons for logical structure nodes"
defaultValue="false"
restartRequired="false"/>
<idIndexer filetype="PLAIN_TEXT" implementationClass="com.intellij.psi.impl.cache.impl.id.PlainTextIdIndexer"/>
<todoIndexer filetype="PLAIN_TEXT" implementationClass="com.intellij.psi.impl.cache.impl.todo.PlainTextTodoIndexer"/>