mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-129447 Arrangement: scroll UI into view when editing rule
This commit is contained in:
+1
-12
@@ -35,17 +35,6 @@ public abstract class AbstractArrangementRuleAction extends AnAction {
|
||||
}
|
||||
|
||||
protected void scrollRowToVisible(@NotNull ArrangementMatchingRulesControl control, int row) {
|
||||
final Rectangle rect = control.getCellRect(row, 0, false);
|
||||
if (row != control.getEditingRow() - 1) {
|
||||
control.scrollRectToVisible(rect);
|
||||
}
|
||||
else {
|
||||
final Rectangle editorRect = control.getCellRect(row + 1, 0, false);
|
||||
if(!rect.isEmpty() && !editorRect.isEmpty()) {
|
||||
final int height = (int)(rect.getHeight() + editorRect.getHeight());
|
||||
final Rectangle visibleRect = new Rectangle((int)rect.getX(), (int)rect.getY(), (int)rect.getWidth(), height);
|
||||
control.scrollRectToVisible(visibleRect);
|
||||
}
|
||||
}
|
||||
control.scrollRowToVisible(row);
|
||||
}
|
||||
}
|
||||
|
||||
+15
@@ -329,6 +329,21 @@ public class ArrangementMatchingRulesControl extends JBTable {
|
||||
showEditor(myEditor, rowToEdit);
|
||||
}
|
||||
|
||||
public void scrollRowToVisible(int row) {
|
||||
final Rectangle rect = getCellRect(row, 0, false);
|
||||
if (row != getEditingRow() - 1) {
|
||||
scrollRectToVisible(rect);
|
||||
}
|
||||
else {
|
||||
final Rectangle editorRect = getCellRect(row + 1, 0, false);
|
||||
if(!rect.isEmpty() && !editorRect.isEmpty()) {
|
||||
final int height = (int)(rect.getHeight() + editorRect.getHeight());
|
||||
final Rectangle visibleRect = new Rectangle((int)rect.getX(), (int)rect.getY(), (int)rect.getWidth(), height);
|
||||
scrollRectToVisible(visibleRect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void showEditor(@NotNull ArrangementMatchingRuleEditor editor, int rowToEdit) {
|
||||
if (myEditorRow == rowToEdit + 1) {
|
||||
return;
|
||||
|
||||
+1
@@ -214,6 +214,7 @@ public class ArrangementListRowDecorator extends JPanel implements ArrangementUi
|
||||
int row = myControl.getRowByRenderer(this);
|
||||
if (row >= 0) {
|
||||
myControl.showEditor(row);
|
||||
myControl.scrollRowToVisible(row);
|
||||
myBeingEdited = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user