在 Eclipse 中打印时制表符对齐包装的代码行?

Tab Align Wrapped Line of Code upon Printing in Eclipse?

假设我正在 Eclipse 中打印一些代码。默认情况下,Eclipse 在行首打印换行(第一个示例),这会使代码难以阅读。有什么方法可以让 Eclipse 在打印时将换行与正确的缩进对齐(第二个示例)?

默认 Eclipse 打印格式

     for (List<String> text in data.rows()){
          if (text =="this string" || text =="that string" || text =="some other
     this string"{//do something }

    }

我能否让 Eclipse 将换行与正确的缩进对齐?

    for (List<String> text in data.rows()){
        if (text =="this string" || text =="that string" || text =="some   other       
        this string"
        {//do something }

    }

您可以通过 Window ->Preferences->Java->Code Style->Formatter 让 Eclipse 格式化您的代码,然后在右侧单击 "Edit" ,它会带来如下内容:

您可以使用它来设置您的风格。