Package my.home.dsl.formatting

Source Code of my.home.dsl.formatting.DeepCloneFormatter

/*
* generated by Xtext
*/
package my.home.dsl.formatting;

import my.home.dsl.services.DeepCloneGrammarAccess;

import org.eclipse.xtext.formatting.impl.AbstractDeclarativeFormatter;
import org.eclipse.xtext.formatting.impl.FormattingConfig;

/**
* 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 DeepCloneFormatter extends AbstractDeclarativeFormatter {

  @Override
  protected void configureFormatting(FormattingConfig c) {
    DeepCloneGrammarAccess f = (DeepCloneGrammarAccess) getGrammarAccess();

//    c.setIndentationIncrement().after(
//        f.getComplexFieldAccess().getLeftCurlyBracketKeyword_1());
   
    c.setIndentation(
        f.getComplexFieldAccess().getLeftCurlyBracketKeyword_1(),
        f.getComplexFieldAccess().getRightCurlyBracketKeyword_3()
      );

    c.setIndentation(
        f.getClassClonerAccess().getLeftCurlyBracketKeyword_2(),
        f.getClassClonerAccess().getRightCurlyBracketKeyword_4()
      );
   
    c.setNoSpace().after(f.getSimpleExcludedFieldAccess().getHyphenMinusKeyword_0());
    c.setNoSpace().after(f.getReferenceFieldAccess().getAmpersandKeyword_0());
   
    c.setLinewrap().after(f.getBodyRule());
    c.setLinewrap().after(f.getHeaderRule());
    c.setLinewrap().after(f.getPackageConfigRule());
    c.setLinewrap().after(f.getFieldClonerRule());
    c.setLinewrap().after(f.getClassClonerRule());
    c.setLinewrap().after(f.getComplexFieldAccess().getLeftCurlyBracketKeyword_1());
    c.setLinewrap().after(f.getClassClonerAccess().getLeftCurlyBracketKeyword_2());
   
    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());
  }
}
TOP

Related Classes of my.home.dsl.formatting.DeepCloneFormatter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.