본문으로 바로가기

[이클립스] enum 멤버 자동 정렬 정지

category 개발 2021. 9. 16. 00:30

이클립스에서 컨트롤 + 시프트 + 에프(Ctrl + Shift + F)를 함께 누르면 소스를 정렬한다. 첫 화면처럼 작성했지만 자동 정렬이 가독성을 떨어뜨리는 결과를 만든다. 가독성을 좋게 하기 위해 자동 정렬을 수정 할 필요가 있다. 열거형 멤버들에 대해 한 행에 멤버들을 하나씩 두도록 한다.

 

1. Window> Preferences

2. Edit

3. Line Wrapping 확장> Wrapping settings 확장> 'enum' declaration> 확장
4. 첫 번째 아이콘 선택
5. "Wrap all elements, every element on a new line" 선택
6. 두 번째 아이콘 선택
7. 본문 아래쪽의 마지막 이미지인 Preview 와 함께 변한 것을 확인 후 Apply

Preferences 선택
Edit 선택 (Active profile은 사용자에 따라 다르다)
왼쪽 빨강 박스 선택 후 아래 메뉴 선택, 두 번째 빨강 박스 클릭 후 오른쪽 프리뷰 확인
프리뷰 확인 후 Apply 선택

출처 : https://stackoverflow.com/questions/6676305/how-to-stop-eclipse-formatter-from-placing-all-enums-on-one-line

 

How to stop Eclipse formatter from placing all enums on one line

I have enums like: public static enum Command { login, register, logout, newMessage } When formatting the file, the output becomes: public static enum Command { login, register, logout, newMess...

stackoverflow.com