/*
 * generated by Xtext
 */
package edu.kit.iti.formal.pse.worthwhile.formatting;

import org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter;
import edu.kit.iti.formal.pse.worthwhile.services.WorthwhileGrammarAccess;
import org.eclipse.xtext.formatting.impl.FormattingConfig;
import org.eclipse.xtext.Keyword;
import org.eclipse.xtext.util.Pair;

/**
 * This class contains custom formatting description.
 *
 * see : http://www.eclipse.org/Xtext/documentation/latest/xtext.html#formatting
 * on how and when to use it
 *
 * Also see {@link org.eclipse.xtext.xtext.XtextFormattingTokenSerializer} as an
 * example
 */
public class WorthwhileFormatter extends AbstractDeclarativeFormatter {

    @Override
    protected final void configureFormatting(final FormattingConfig c) {
	WorthwhileGrammarAccess f = (WorthwhileGrammarAccess) getGrammarAccess();
	for (Pair<Keyword, Keyword> pair : f.findKeywordPairs("{", "}")) {
	    c.setIndentation(pair.getFirst(), pair.getSecond());
	    c.setLinewrap(1).after(pair.getFirst());
	    c.setLinewrap(1).before(pair.getSecond());
	    c.setLinewrap(1).after(pair.getSecond());
	}
	for (Keyword comma : f.findKeywords(",")) {
	    c.setNoLinewrap().before(comma);
	    c.setNoSpace().before(comma);
	    c.setLinewrap().after(comma);
	}
	c.setLinewrap(0, 1, 2).before(f.getSL_COMMENTRule());
	c.setLinewrap(0, 1, 2).before(f.getML_COMMENTRule());
	c.setLinewrap(0, 1, 1).after(f.getML_COMMENTRule());
    }
}

@@ -413,16 +413,17 @@
 tion.%0A *
+ 
 %0A * see 
@@ -495,19 +495,16 @@
 rmatting
-%0A *
  on how 
@@ -524,16 +524,17 @@
 se it%0A *
+ 
 %0A * Also
@@ -606,19 +606,16 @@
 r%7D as an
-%0A *
  example
@@ -692,20 +692,17 @@
 tter %7B%0A%0A
-    
+%09
 @Overrid
@@ -703,20 +703,17 @@
 verride%0A
-    
+%09
 protecte
@@ -773,16 +773,17 @@
 ig c) %7B%0A
+%09
 %09Worthwh
@@ -849,16 +849,17 @@
 cess();%0A
+%09
 %09for (Pa
@@ -914,29 +914,28 @@
 %7B%22, %22%7D%22)) %7B%0A
-%09    
+%0A%09%09%09
 c.setIndenta
@@ -968,36 +968,34 @@
 .getSecond());%0A%09
-    
+%09%09
 c.setLinewrap(1)
@@ -1016,28 +1016,26 @@
 tFirst());%0A%09
-    
+%09%09
 c.setLinewra
@@ -1062,28 +1062,26 @@
 Second());%0A%09
-    
+%09%09
 c.setLinewra
@@ -1110,19 +1110,21 @@
 ond());%0A
+%09
 %09%7D%0A
+%09
 %09for (Ke
@@ -1161,20 +1161,18 @@
 ,%22)) %7B%0A%09
-    
+%09%09
 c.setNoL
@@ -1193,28 +1193,26 @@
 re(comma);%0A%09
-    
+%09%09
 c.setNoSpace
@@ -1230,20 +1230,18 @@
 omma);%0A%09
-    
+%09%09
 c.setLin
@@ -1262,19 +1262,21 @@
 comma);%0A
+%09
 %09%7D%0A
+%09
 %09c.setLi
@@ -1314,32 +1314,33 @@
 COMMENTRule());%0A
+%09
 %09c.setLinewrap(0
@@ -1378,16 +1378,17 @@
 ule());%0A
+%09
 %09c.setLi
@@ -1437,12 +1437,9 @@
 ));%0A
-    
+%09
 %7D%0A%7D%0A

Apply formatter to formatter class