Eclipse does not format this if statement

This should be easy to answer:

I have an Eclipse kit to wrap my 80 character Java code to enforce my field.

This code never wraps around:

    if (expressionItem.type.isTypeCompatibleWith(containingNameLink.type) == false) {
      reportParsingError("expression type incompatible with containing "
          + "context.");
    }

      

Question: How do I set my code formatting preferences so that the margin is respected?

+2


a source to share


2 answers


Did you press CTRL+ SHIFT+ F(or right click> source> format)? It works fine here. The code will not be automatically formatted as you type, you need to tell eclipse to format it.



+1


a source


Click Windows > Preferences

. Go to Java > Editor > Save Action

Enable Perform selected action on save, then enable the Formatt source code option.



See below fig. enter image description here Click the Formatter link to change the settings for the Formatter.

0


a source







All Articles