Search in sources :

Example 1 with ArrangementGroupingRulesControl

use of com.intellij.application.options.codeStyle.arrangement.group.ArrangementGroupingRulesControl in project intellij-community by JetBrains.

the class MoveArrangementGroupingRuleUpAction method update.

@Override
public void update(AnActionEvent e) {
    ArrangementGroupingRulesControl control = ArrangementGroupingRulesControl.KEY.getData(e.getDataContext());
    if (control == null) {
        e.getPresentation().setEnabled(false);
        return;
    }
    int[] rows = control.getSelectedRows();
    e.getPresentation().setEnabled(rows.length == 1 && rows[0] != 0);
}
Also used : ArrangementGroupingRulesControl(com.intellij.application.options.codeStyle.arrangement.group.ArrangementGroupingRulesControl)

Example 2 with ArrangementGroupingRulesControl

use of com.intellij.application.options.codeStyle.arrangement.group.ArrangementGroupingRulesControl in project intellij-community by JetBrains.

the class MoveArrangementGroupingRuleDownAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    ArrangementGroupingRulesControl control = ArrangementGroupingRulesControl.KEY.getData(e.getDataContext());
    if (control == null) {
        return;
    }
    int[] rows = control.getSelectedRows();
    int row = rows[0];
    if (rows.length != 1 || rows[0] == control.getRowCount() - 1) {
        return;
    }
    if (control.isEditing()) {
        control.getCellEditor().stopCellEditing();
    }
    DefaultTableModel model = control.getModel();
    Object value = model.getValueAt(row, 0);
    model.removeRow(row);
    model.insertRow(row + 1, new Object[] { value });
    control.getSelectionModel().setSelectionInterval(row + 1, row + 1);
}
Also used : ArrangementGroupingRulesControl(com.intellij.application.options.codeStyle.arrangement.group.ArrangementGroupingRulesControl) DefaultTableModel(javax.swing.table.DefaultTableModel)

Example 3 with ArrangementGroupingRulesControl

use of com.intellij.application.options.codeStyle.arrangement.group.ArrangementGroupingRulesControl in project intellij-community by JetBrains.

the class MoveArrangementGroupingRuleUpAction method actionPerformed.

@Override
public void actionPerformed(AnActionEvent e) {
    ArrangementGroupingRulesControl control = ArrangementGroupingRulesControl.KEY.getData(e.getDataContext());
    if (control == null) {
        return;
    }
    int[] rows = control.getSelectedRows();
    int row = rows[0];
    if (rows.length != 1 || row == 0) {
        return;
    }
    if (control.isEditing()) {
        control.getCellEditor().stopCellEditing();
    }
    DefaultTableModel model = control.getModel();
    Object value = model.getValueAt(row, 0);
    model.removeRow(row);
    model.insertRow(row - 1, new Object[] { value });
    control.getSelectionModel().setSelectionInterval(row - 1, row - 1);
}
Also used : ArrangementGroupingRulesControl(com.intellij.application.options.codeStyle.arrangement.group.ArrangementGroupingRulesControl) DefaultTableModel(javax.swing.table.DefaultTableModel)

Example 4 with ArrangementGroupingRulesControl

use of com.intellij.application.options.codeStyle.arrangement.group.ArrangementGroupingRulesControl in project intellij-community by JetBrains.

the class MoveArrangementGroupingRuleDownAction method update.

@Override
public void update(AnActionEvent e) {
    ArrangementGroupingRulesControl control = ArrangementGroupingRulesControl.KEY.getData(e.getDataContext());
    if (control == null) {
        e.getPresentation().setEnabled(false);
        return;
    }
    int[] rows = control.getSelectedRows();
    e.getPresentation().setEnabled(rows.length == 1 && rows[0] != control.getRowCount() - 1);
}
Also used : ArrangementGroupingRulesControl(com.intellij.application.options.codeStyle.arrangement.group.ArrangementGroupingRulesControl)

Aggregations

ArrangementGroupingRulesControl (com.intellij.application.options.codeStyle.arrangement.group.ArrangementGroupingRulesControl)4 DefaultTableModel (javax.swing.table.DefaultTableModel)2