Java Code Examples for com.intellij.psi.codeStyle.CodeStyleSettings#setDefaultRightMargin()

The following examples show how to use com.intellij.psi.codeStyle.CodeStyleSettings#setDefaultRightMargin() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CypherFormattingTest.java    From jetbrains-plugin-graph-database-support with Apache License 2.0 5 votes vote down vote up
public void ignoreNestedWhereOnNewLineAndIndented() {
    CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());

    settings.setDefaultRightMargin(26);

    doTest("return [x in range(0,10) where x + 2 = 0 | x^3] as result",
            "RETURN [x IN range(0, 10)\n" +
            "         WHERE x + 2 = 0 | x ^ 3]\n" +
            "       AS result");
}
 
Example 2
Source File: GeneralCodeStylePanel.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void apply(CodeStyleSettings settings) throws ConfigurationException {
  myVisualGuides.validateContent();
  myRightMarginField.validateContent();
  settings.setDefaultSoftMargins(myVisualGuides.getValue());
  myExcludedFilesList.apply(settings);

  settings.LINE_SEPARATOR = getSelectedLineSeparator();

  settings.setDefaultRightMargin(getRightMargin());
  settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = myCbWrapWhenTypingReachesRightMargin.isSelected();

  settings.FORMATTER_TAGS_ENABLED = myEnableFormatterTags.isSelected();
  settings.FORMATTER_TAGS_ACCEPT_REGEXP = myAcceptRegularExpressionsCheckBox.isSelected();

  settings.FORMATTER_OFF_TAG = getTagText(myFormatterOffTagField, settings.FORMATTER_OFF_TAG);
  settings.setFormatterOffPattern(compilePattern(settings, myFormatterOffTagField, settings.FORMATTER_OFF_TAG));

  settings.FORMATTER_ON_TAG = getTagText(myFormatterOnTagField, settings.FORMATTER_ON_TAG);
  settings.setFormatterOnPattern(compilePattern(settings, myFormatterOnTagField, settings.FORMATTER_ON_TAG));

  settings.AUTODETECT_INDENTS = myAutodetectIndentsBox.isSelected();

  for (GeneralCodeStyleOptionsProvider option : myAdditionalOptions) {
    option.apply(settings);
  }
}