本文整理匯總了Java中org.eclipse.xtext.formatting.impl.FormattingConfig.setAutoLinewrap方法的典型用法代碼示例。如果您正苦於以下問題:Java FormattingConfig.setAutoLinewrap方法的具體用法?Java FormattingConfig.setAutoLinewrap怎麽用?Java FormattingConfig.setAutoLinewrap使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.xtext.formatting.impl.FormattingConfig
的用法示例。
在下文中一共展示了FormattingConfig.setAutoLinewrap方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: configureFormatting
import org.eclipse.xtext.formatting.impl.FormattingConfig; //導入方法依賴的package包/類
/** {@inheritDoc} */
@Override
protected void configureFormatting(final FormattingConfig config) {
final ValidGrammarAccess grammarAccess = (ValidGrammarAccess) getGrammarAccess();
config.setAutoLinewrap(MAX_LINE_LENGTH);
// Comments
config.setLinewrap(0, 1, 2).before(grammarAccess.getSL_COMMENTRule());
config.setLinewrap(0, 1, 2).before(grammarAccess.getML_COMMENTRule());
config.setLinewrap(0, 1, 1).after(grammarAccess.getML_COMMENTRule());
configureCategoryFormatting(config, grammarAccess.getCategoryAccess());
configureNativeRuleFormatting(config, grammarAccess.getNativeRuleAccess());
configureNativeContextFormatting(config, grammarAccess.getNativeContextAccess());
configureQuickFixFormatting(config, grammarAccess.getQuickFixAccess());
configureImportFormatting(config, grammarAccess.getImportAccess());
}
示例2: configure
import org.eclipse.xtext.formatting.impl.FormattingConfig; //導入方法依賴的package包/類
/**
* Entry point for Check Configuration formatting.
*
* @param c
* the formatting configuration
* @param g
* the grammar access
*/
private void configure(final FormattingConfig c, final CheckCfgGrammarAccess g) {
super.configure(c, g.getXbaseGrammarAccess());
// Comments
c.setLinewrap(0, 1, 2).before(g.getSL_COMMENTRule());
c.setLinewrap(0, 1, 2).before(g.getML_COMMENTRule());
c.setLinewrap(0, 1, 1).after(g.getML_COMMENTRule());
// AutoLineWrap
c.setAutoLinewrap(LINE_WRAP_LENGTH);
configureCheckConfiguration(c, g.getCheckConfigurationAccess());
configureLanguageValidatorConfiguration(c, g.getConfiguredLanguageValidatorAccess());
configureConfiguredCatalog(c, g.getConfiguredCatalogAccess());
configureConfiguredCheck(c, g.getConfiguredCheckAccess());
// configureConfiguredParameter(c, g.getConfiguredParameterAccess());
}
示例3: configureFormatting
import org.eclipse.xtext.formatting.impl.FormattingConfig; //導入方法依賴的package包/類
@Override
protected void configureFormatting(FormattingConfig config) {
PhdlGrammarAccess access = (PhdlGrammarAccess) getGrammarAccess();
config.setAutoLinewrap(80);
formatImports(config, access);
formatPackages(config, access);
formatDevices(config, access);
formatDesigns(config, access);
// format all comments
config.setLinewrap(0, 1, 2).around(access.getSL_COMMENTRule());
config.setLinewrap(0, 1, 2).around(access.getML_COMMENTRule());
}
示例4: configureFormatting
import org.eclipse.xtext.formatting.impl.FormattingConfig; //導入方法依賴的package包/類
@Override
protected void configureFormatting(FormattingConfig c) {
org.eclipse.xsemantics.example.fj.services.FJGrammarAccess f = (org.eclipse.xsemantics.example.fj.services.FJGrammarAccess) getGrammarAccess();
c.setAutoLinewrap(80);
c.setSpace(" ");
// Fields
// add line breaks after a field declaration
FieldElements fieldAccess = f.getFieldAccess();
c.setLinewrap(1).after(fieldAccess.getSemicolonKeyword_2());
// remove possible spaces before the ; ending a field declaration
c.setNoSpace().before(fieldAccess.getSemicolonKeyword_2());
// Methods
MethodElements methodAccess = f.getMethodAccess();
c.setLinewrap(1).after(methodAccess.getRightCurlyBracketKeyword_7());
c.setNoSpace().around(methodAccess.getLeftParenthesisKeyword_2());
c.setNoSpace().before(methodAccess.getRightParenthesisKeyword_4());
c.setNoSpace().before(methodAccess.getCommaKeyword_3_1_0());
c.setNoSpace().around(f.getExpressionAccess().getFullStopKeyword_1_0_1());
c.setNoSpace().before(f.getMethodBodyAccess().getSemicolonKeyword_2());
// Method and constructor invocations
NewElements newAccess = f.getNewAccess();
c.setNoSpace().before(newAccess.getCommaKeyword_3_1_0());
c.setNoSpace().around(newAccess.getLeftParenthesisKeyword_2());
c.setNoSpace().before(newAccess.getRightParenthesisKeyword_4());
// indentations for { } of classes
ClassElements classAccess = f.getClassAccess();
c.setIndentation(classAccess.getLeftCurlyBracketKeyword_3(),
classAccess.getRightCurlyBracketKeyword_5());
c.setLinewrap().after(classAccess.getLeftCurlyBracketKeyword_3());
c.setLinewrap(2).after(classAccess.getRightCurlyBracketKeyword_5());
}
示例5: configureFormatting
import org.eclipse.xtext.formatting.impl.FormattingConfig; //導入方法依賴的package包/類
protected void configureFormatting(final FormattingConfig c) {
FormattingConfig.LinewrapLocator _setLinewrap = c.setLinewrap(0, 1, 2);
TerminalRule _sL_COMMENTRule = this._kronusGrammarAccess.getSL_COMMENTRule();
_setLinewrap.before(_sL_COMMENTRule);
FormattingConfig.LinewrapLocator _setLinewrap_1 = c.setLinewrap(0, 1, 2);
TerminalRule _mL_COMMENTRule = this._kronusGrammarAccess.getML_COMMENTRule();
_setLinewrap_1.before(_mL_COMMENTRule);
FormattingConfig.LinewrapLocator _setLinewrap_2 = c.setLinewrap(0, 1, 1);
TerminalRule _mL_COMMENTRule_1 = this._kronusGrammarAccess.getML_COMMENTRule();
_setLinewrap_2.after(_mL_COMMENTRule_1);
FormattingConfig.LinewrapLocator _setLinewrap_3 = c.setLinewrap();
ParserRule _iNCLUDERule = this._kronusGrammarAccess.getINCLUDERule();
_setLinewrap_3.before(_iNCLUDERule);
FormattingConfig.LinewrapLocator _setLinewrap_4 = c.setLinewrap();
ParserRule _iMPORTRule = this._kronusGrammarAccess.getIMPORTRule();
_setLinewrap_4.before(_iMPORTRule);
FormattingConfig.LinewrapLocator _setLinewrap_5 = c.setLinewrap();
ParserRule _tYPERule = this._kronusGrammarAccess.getTYPERule();
_setLinewrap_5.before(_tYPERule);
FormattingConfig.LinewrapLocator _setLinewrap_6 = c.setLinewrap();
ParserRule _dEFRule = this._kronusGrammarAccess.getDEFRule();
_setLinewrap_6.before(_dEFRule);
FormattingConfig.LinewrapLocator _setLinewrap_7 = c.setLinewrap();
ParserRule _vALRule = this._kronusGrammarAccess.getVALRule();
_setLinewrap_7.before(_vALRule);
FormattingConfig.LinewrapLocator _setLinewrap_8 = c.setLinewrap();
ParserRule _hashtagCallRule = this._kronusGrammarAccess.getHashtagCallRule();
_setLinewrap_8.before(_hashtagCallRule);
FormattingConfig.LinewrapLocator _setLinewrap_9 = c.setLinewrap();
ParserRule _rETURNRule = this._kronusGrammarAccess.getRETURNRule();
_setLinewrap_9.before(_rETURNRule);
c.setAutoLinewrap(120);
c.setWrappedLineIndentation(2);
List<Pair<Keyword, Keyword>> _findKeywordPairs = this._kronusGrammarAccess.findKeywordPairs("{", "}");
for (final Pair<Keyword, Keyword> pair : _findKeywordPairs) {
{
FormattingConfig.SpaceLocator _setSpace = c.setSpace(" ");
Keyword _first = pair.getFirst();
_setSpace.before(_first);
FormattingConfig.LinewrapLocator _setLinewrap_10 = c.setLinewrap();
Keyword _first_1 = pair.getFirst();
_setLinewrap_10.after(_first_1);
Keyword _first_2 = pair.getFirst();
Keyword _second = pair.getSecond();
c.setIndentation(_first_2, _second);
FormattingConfig.LinewrapLocator _setLinewrap_11 = c.setLinewrap();
Keyword _second_1 = pair.getSecond();
_setLinewrap_11.before(_second_1);
}
}
this.formatBrackets(c, "(", ")");
this.formatBrackets(c, "[", "]");
List<Keyword> _findKeywords = this._kronusGrammarAccess.findKeywords("#");
for (final Keyword k : _findKeywords) {
FormattingConfig.NoSpaceLocator _setNoSpace = c.setNoSpace();
_setNoSpace.after(k);
}
List<Keyword> _findKeywords_1 = this._kronusGrammarAccess.findKeywords(":", ",");
for (final Keyword k_1 : _findKeywords_1) {
FormattingConfig.NoSpaceLocator _setNoSpace_1 = c.setNoSpace();
_setNoSpace_1.before(k_1);
}
List<Keyword> _findKeywords_2 = this._kronusGrammarAccess.findKeywords(".");
for (final Keyword k_2 : _findKeywords_2) {
{
FormattingConfig.NoSpaceLocator _setNoSpace_2 = c.setNoSpace();
_setNoSpace_2.before(k_2);
FormattingConfig.NoSpaceLocator _setNoSpace_3 = c.setNoSpace();
_setNoSpace_3.after(k_2);
}
}
}
示例6: configureFormatting
import org.eclipse.xtext.formatting.impl.FormattingConfig; //導入方法依賴的package包/類
@Override
protected void configureFormatting(FormattingConfig c) {
FormatterTestLanguageGrammarAccess f = (FormatterTestLanguageGrammarAccess) getGrammarAccess();
c.setAutoLinewrap(30);
// indent wrapped lines (lines exceeding autoLineWrap setting above) by one tab stop
c.setWrappedLineIndentation(1);
// TestLinewrap
c.setLinewrap().after(f.getTestLinewrapAccess().getLinewrapKeyword_1());
// Line
c.setLinewrap().after(f.getLineAccess().getSemicolonKeyword_1());
c.setNoSpace().before(f.getLineAccess().getSemicolonKeyword_1());
// TestIndentation
c.setIndentationIncrement().after(f.getTestIndentationAccess().getLeftCurlyBracketKeyword_2());
c.setIndentationDecrement().before(f.getTestIndentationAccess().getRightCurlyBracketKeyword_4());
c.setLinewrap().after(f.getTestIndentationAccess().getLeftCurlyBracketKeyword_2());
c.setLinewrap().after(f.getTestIndentationAccess().getRightCurlyBracketKeyword_4());
c.setLinewrap().after(f.getTestIndentationAccess().getSemiAssignment_5());
c.setNoLinewrap().between(f.getTestIndentationAccess().getRightCurlyBracketKeyword_4(),
f.getTestIndentationAccess().getSemiAssignment_5());
c.setNoSpace().before(f.getTestIndentationAccess().getSemiAssignment_5());
// Assign
c.setNoSpace().around(f.getAssignAccess().getOpAssignment_1());
c.setNoSpace().before(f.getAssignAccess().getCommaKeyword_3_1_0());
// Meth
c.setNoSpace().around(f.getMethAccess().getLeftParenthesisKeyword_2());
c.setNoSpace().before(f.getMethAccess().getRightParenthesisKeyword_4());
c.setNoSpace().before(f.getMethAccess().getCommaKeyword_3_1_0());
c.setNoLinewrap().before(f.getMethAccess().getCommaKeyword_3_1_0());
c.setIndentation(f.getMethAccess().getLeftParenthesisKeyword_2(), f.getMethAccess()
.getRightParenthesisKeyword_4());
// Param
c.setNoLinewrap().around(f.getParamAccess().getColonKeyword_1());
c.setNoSpace().around(f.getParamAccess().getColonKeyword_1());
// Space
c.setSpace(" ").after(f.getSpaceAccess().getSpaceKeyword_0());
// TestLinewrapMinMax
c.setLinewrap(2, 3, 5).after(f.getTestLinewrapMinMaxAccess().getWrapminmaxKeyword_1());
// FqnObj
c.setLinewrap().before(f.getFqnObjAccess().getNameFQNParserRuleCall_1_0());
// FqnRef
c.setLinewrap().before(f.getFqnRefAccess().getRefAssignment_1());
// Enumeration
c.setNoSpace().between(f.getEnumerationAccess().getValAssignment_2_1(),
f.getEnumerationAccess().getCommaKeyword_2_0());
c.setLinewrap().before(f.getEnumerationAccess().getValEnum1EnumRuleCall_2_1_0());
// Datatypes
c.setLinewrap().after(f.getDatatype1Rule());
c.setLinewrap().before(f.getDatatype2Rule());
c.setLinewrap().between(f.getDatatype2Rule(), f.getDatatype3Rule());
c.setLinewrap().between(f.getDatatype3Rule(), f.getDatatypesAccess().getKw3Keyword_5());
// comments
c.setNoLinewrap().before(f.getSL_COMMENTRule());
// saveDebugGraphvizDiagram("Test.dot");
}
示例7: configure
import org.eclipse.xtext.formatting.impl.FormattingConfig; //導入方法依賴的package包/類
/**
* General formatting configuration. Delegates formatting configuration to individual grammar elements.
*
* @param configuration
* formating configuration
* @param access
* grammarAccess
*/
private void configure(final FormattingConfig configuration, final CheckGrammarAccess access) {
super.configure(configuration, access.getXbaseWithAnnotationsGrammarAccess());
// Common curly brackets handling (for check grammar only)
List<Pair<Keyword, Keyword>> curlyPairs = access.findKeywordPairs("{", "}");
for (Pair<Keyword, Keyword> pair : curlyPairs) {
if (EcoreUtil2.getContainerOfType(pair.getFirst(), GrammarImpl.class).getName().equals(CheckConstants.GRAMMAR)) {
configuration.setLinewrap().after(pair.getFirst());
configuration.setIndentation(pair.getFirst(), pair.getSecond());
configuration.setLinewrap().before(pair.getSecond());
}
}
// AutoLineWrap
configuration.setAutoLinewrap(LINE_WRAP_LENGTH);
// Comments
configuration.setLinewrap(0, 1, 2).before(access.getSL_COMMENTRule());
configuration.setLinewrap(1, 1, 2).before(access.getML_COMMENTRule());
configuration.setLinewrap(1, 1, 1).after(access.getML_COMMENTRule());
// Rules
configuration.setLinewrap(1, 1, 2).before(access.getXImportDeclarationRule());
configuration.setLinewrap(1, 2, 2).before(access.getCategoryRule());
configuration.setLinewrap(1, 2, 2).before(access.getImplementationRule());
configuration.setLinewrap(1, 2, 2).before(access.getCheckRule());
configuration.setLinewrap(1, 1, 2).before(access.getXGuardExpressionRule());
configuration.setLinewrap(1, 1, 2).before(access.getXIssueExpressionRule());
configuration.setLinewrap(1, 1, 2).before(access.getXIfExpressionRule());
configuration.setLinewrap(1, 1, 2).before(access.getXVariableDeclarationRule());
// Rule elements
configureFeatureCall(configuration, access.getXMemberFeatureCallAccess());
configureCheckCatalog(configuration, access.getCheckCatalogAccess());
configureSeverityRange(configuration, access.getSeverityRangeAccess());
configureCheck(configuration, access.getCheckAccess());
configureXIssueExpression(configuration, access.getXIssueExpressionAccess());
configureCheckContext(configuration, access.getContextAccess());
}
示例8: configureFormatting
import org.eclipse.xtext.formatting.impl.FormattingConfig; //導入方法依賴的package包/類
@Override
protected void configureFormatting(FormattingConfig c) {
LanguageGrammarAccess f = (LanguageGrammarAccess) getGrammarAccess();
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());
for (Keyword semicolon : f.findKeywords(";")) {
c.setNoSpace().before(semicolon);
}
c.setAutoLinewrap(1000);
// set a newline after each constant, property, type, and variable
c.setLinewrap().after(f.getConstantRule());
c.setLinewrap().after(f.getTypeDefRule());
c.setLinewrap().after(f.getVariableRule());
// do not add spaces between enumeration type values in declarations
c.setNoSpace().before(
f.getEnumerationTypeAccess().getCommaKeyword_2_0());
// do not add spaces after the # enumeration expressions
c.setNoSpace().after(f.getEnumeratorRule());
// do not add spaces after the Unary Op and the sub expression
c.setNoSpace().after(f.getUnaryOpAccess().getHyphenMinusKeyword_0_1());
// do not add spaces in RecordTypes
c.setNoSpace().after(
f.getRecordTypeAccess().getLeftCurlyBracketKeyword_0());
c.setNoSpace().before(
f.getRecordTypeAccess().getRightCurlyBracketKeyword_3());
c.setNoSpace().before(f.getRecordTypeAccess().getCommaKeyword_2_0());
// do not add spaces before and after the = in recordFieldExprs, and
// recordFields
c.setNoSpace().before(
f.getRecordFieldExprAccess().getEqualsSignKeyword_1());
c.setNoSpace().after(
f.getRecordFieldExprAccess().getEqualsSignKeyword_1());
}