boolean (int oldIndex, int newIndex, @NotNull Position position) { TreePath target = myActionsTree.getPathForRow(newIndex); TreePath sourcePath = myActionsTree.getPathForRow(oldIndex); if (sourcePath.getParentPath().equals(target.getParentPath())) { if (oldIndex == newIndex - 1 && position == ABOVE) return false; if (oldIndex == newIndex + 1 && position == BELOW) return false; } if (sourcePath.getParentPath().equals(target) && position == INTO) return false; return sourcePath.getPath().length > 2 && (target.getPath().length > 2 || target.getPath().length > 1 && isGroupPath(target)); }