Wrap (ASTBlock block, CommonCodeStyleSettings settings, JavaCodeStyleSettings javaSettings, ReservedWrapsProvider reservedWrapsProvider) { ASTNode node = block.getNode(); Wrap wrap = block.getWrap(); if (node == null) return null; final IElementType nodeType = node.getElementType(); if (nodeType == JavaElementType.EXTENDS_LIST || nodeType == JavaElementType.IMPLEMENTS_LIST || nodeType == JavaElementType.PERMITS_LIST) { return Wrap.createWrap(settings.EXTENDS_LIST_WRAP, false); } else if (node instanceof PsiPolyadicExpression) { Wrap actualWrap = wrap != null ? wrap : reservedWrapsProvider.getReservedWrap(JavaElementType.BINARY_EXPRESSION); if (actualWrap == null) { return Wrap.createWrap(settings.BINARY_OPERATION_WRAP, false); } else { if (areSamePriorityBinaryExpressions(node, node.getTreeParent())) { return actualWrap; } else { return Wrap.createChildWrap(actualWrap, WrapType.byLegacyRepresentation(settings.BINARY_OPERATION_WRAP), false); } } } else if (nodeType == JavaElementType.CONDITIONAL_EXPRESSION) { return Wrap.createWrap(settings.TERNARY_OPERATION_WRAP, false); } else if (nodeType == JavaElementType.ASSERT_STATEMENT) { return Wrap.createWrap(settings.ASSERT_STATEMENT_WRAP, false); } else if (nodeType == JavaElementType.FOR_STATEMENT) { return Wrap.createWrap(settings.FOR_STATEMENT_WRAP, false); } else if (nodeType == JavaElementType.THROWS_LIST) { return Wrap.createWrap(settings.THROWS_LIST_WRAP, true); } else if (nodeType == JavaElementType.CODE_BLOCK) { if (settings.KEEP_SIMPLE_METHODS_IN_ONE_LINE && node.getPsi().getParent() instanceof PsiMethod && !node.textContains('\n')) { return null; } return Wrap.createWrap(WrapType.NORMAL, false); } else if (isAssignment(node)) { return Wrap.createWrap(settings.ASSIGNMENT_WRAP, true); } else if (isTopLevelTypeInCatchSection(nodeType, node)) { return Wrap.createWrap(javaSettings.MULTI_CATCH_TYPES_WRAP, false); } else { return null; } }