diff options
author | Roman Shevchenko <roman.shevchenko@jetbrains.com> | 2014-05-30 15:44:27 +0400 |
---|---|---|
committer | Roman Shevchenko <roman.shevchenko@jetbrains.com> | 2014-05-30 15:44:27 +0400 |
commit | 7189d18bfe46bd5d9bcfc1c4c60b1438d0580e5b (patch) | |
tree | eb4e7ba2480742847b82ef5828cec203989c568e /src | |
parent | 0a5a2c671e22ceb250c32838388896c8118a59f7 (diff) | |
download | fernflower-7189d18bfe46bd5d9bcfc1c4c60b1438d0580e5b.tar fernflower-7189d18bfe46bd5d9bcfc1c4c60b1438d0580e5b.tar.gz fernflower-7189d18bfe46bd5d9bcfc1c4c60b1438d0580e5b.tar.lz fernflower-7189d18bfe46bd5d9bcfc1c4c60b1438d0580e5b.tar.xz fernflower-7189d18bfe46bd5d9bcfc1c4c60b1438d0580e5b.zip |
adjustable indentation
Diffstat (limited to 'src')
-rw-r--r-- | src/de/fernflower/main/DecompilerContext.java | 5 | ||||
-rw-r--r-- | src/de/fernflower/main/extern/IFernflowerPreferences.java | 3 | ||||
-rw-r--r-- | src/de/fernflower/util/InterpreterUtil.java | 10 |
3 files changed, 11 insertions, 7 deletions
diff --git a/src/de/fernflower/main/DecompilerContext.java b/src/de/fernflower/main/DecompilerContext.java index 213898a..813f4ab 100644 --- a/src/de/fernflower/main/DecompilerContext.java +++ b/src/de/fernflower/main/DecompilerContext.java @@ -87,13 +87,14 @@ public class DecompilerContext { mapDefault.put(IFernflowerPreferences.REMOVE_EMPTY_RANGES, "1"); mapDefault.put(IFernflowerPreferences.NEW_LINE_SEPARATOR, "0"); - + mapDefault.put(IFernflowerPreferences.INDENT_STRING, " "); + mapDefault.put(IFernflowerPreferences.IDEA_NOT_NULL_ANNOTATION, "1"); if(propertiesCustom != null) { mapDefault.putAll(propertiesCustom); } - + currentContext.set(new DecompilerContext(mapDefault)); } diff --git a/src/de/fernflower/main/extern/IFernflowerPreferences.java b/src/de/fernflower/main/extern/IFernflowerPreferences.java index 3b923e7..2cc0cea 100644 --- a/src/de/fernflower/main/extern/IFernflowerPreferences.java +++ b/src/de/fernflower/main/extern/IFernflowerPreferences.java @@ -50,7 +50,8 @@ public interface IFernflowerPreferences { public static final String NEW_LINE_SEPARATOR = "nls"; public static final String IDEA_NOT_NULL_ANNOTATION = "inn"; public static final String LAMBDA_TO_ANONYMOUS_CLASS = "lac"; - + public static final String INDENT_STRING = "ind"; + public static final String LINE_SEPARATOR_WIN = "\r\n"; public static final String LINE_SEPARATOR_LIN = "\n"; } diff --git a/src/de/fernflower/util/InterpreterUtil.java b/src/de/fernflower/util/InterpreterUtil.java index b4ebbcc..ffba76a 100644 --- a/src/de/fernflower/util/InterpreterUtil.java +++ b/src/de/fernflower/util/InterpreterUtil.java @@ -25,10 +25,11 @@ import java.util.Collection; import java.util.HashSet; import java.util.List; +import de.fernflower.main.DecompilerContext; +import de.fernflower.main.extern.IFernflowerPreferences; + public class InterpreterUtil { - public static final String INDENT_STRING = " "; - public static void copyFile(File in, File out) throws IOException { FileChannel inChannel = new FileInputStream(in).getChannel(); FileChannel outChannel = new FileOutputStream(out).getChannel(); @@ -65,9 +66,10 @@ public class InterpreterUtil { } public static String getIndentString(int length) { - StringBuffer buf = new StringBuffer(); + String indent = (String) DecompilerContext.getProperty(IFernflowerPreferences.INDENT_STRING); + StringBuilder buf = new StringBuilder(); while(length-->0) { - buf.append(INDENT_STRING); + buf.append(indent); } return buf.toString(); } |