From 7c3e5247643de01777ea35b3b14faee66366bcb1 Mon Sep 17 00:00:00 2001 From: Denis Zhdanov Date: Thu, 22 Apr 2010 16:25:53 +0400 Subject: [PATCH] IDEA-43962 Indentation error on deep nesting levels 1. Convenient factory method is introduced; 2. Legacy constants are marked as deprecated; --- .../src/com/intellij/formatting/Wrap.java | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/platform/lang-api/src/com/intellij/formatting/Wrap.java b/platform/lang-api/src/com/intellij/formatting/Wrap.java index 54a311f4f76b..cbc633ce12c8 100644 --- a/platform/lang-api/src/com/intellij/formatting/Wrap.java +++ b/platform/lang-api/src/com/intellij/formatting/Wrap.java @@ -15,8 +15,6 @@ */ package com.intellij.formatting; -import com.intellij.openapi.diagnostic.Logger; - /** * The wrap setting for a formatting model block. Indicates the conditions under which a line break * is inserted before the block when formatting, if the block extends beyond the @@ -34,15 +32,46 @@ public abstract class Wrap { private static WrapFactory myFactory; + /** + * @deprecated use {@link WrapType#ALWAYS} instead + */ + @Deprecated public static WrapType ALWAYS = WrapType.ALWAYS; + + /** + * @deprecated use {@link WrapType#NORMAL} instead + */ + @Deprecated public static WrapType NORMAL = WrapType.NORMAL; + + /** + * @deprecated use {@link WrapType#NONE} instead + */ + @Deprecated public static WrapType NONE = WrapType.NONE; + + /** + * @deprecated use {@link WrapType#CHOP_DOWN_IF_LONG} instead + */ + @SuppressWarnings({"UnusedDeclaration"}) + @Deprecated public static WrapType CHOP_DOWN_IF_LONG = WrapType.CHOP_DOWN_IF_LONG; static void setFactory(WrapFactory factory) { myFactory = factory; } + /** + * Creates a block wrap setting of the legacy representation of specified wrap type (see {@link WrapType#getLegacyRepresentation()}). + * + * @param type the type of the wrap setting. + * @param wrapFirstElement if true, the first element in a sequence of elements of the same type is also wrapped. + * @return the wrap setting instance. + */ + public static Wrap createWrap(final int type, final boolean wrapFirstElement) { + return myFactory.createWrap(WrapType.byLegacyRepresentation(type), wrapFirstElement); + } + /** * Creates a block wrap setting of the specified type. *