当前位置: 首页>>代码示例>>Java>>正文


Java CodeStyleSettings.getCustomSettings方法代码示例

本文整理汇总了Java中com.intellij.psi.codeStyle.CodeStyleSettings.getCustomSettings方法的典型用法代码示例。如果您正苦于以下问题:Java CodeStyleSettings.getCustomSettings方法的具体用法?Java CodeStyleSettings.getCustomSettings怎么用?Java CodeStyleSettings.getCustomSettings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.codeStyle.CodeStyleSettings的用法示例。


在下文中一共展示了CodeStyleSettings.getCustomSettings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldInsertFqnInJavadoc

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
private static boolean shouldInsertFqnInJavadoc(@NotNull JavaPsiClassReferenceElement item,
                                                @NotNull PsiFile file,
                                                @NotNull Project project) 
{
  CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(project);
  JavaCodeStyleSettings javaSettings = settings.getCustomSettings(JavaCodeStyleSettings.class);
  
  switch (javaSettings.CLASS_NAMES_IN_JAVADOC) {
    case FULLY_QUALIFY_NAMES_ALWAYS:
      return true;
    case SHORTEN_NAMES_ALWAYS_AND_ADD_IMPORT:
      return false;
    case FULLY_QUALIFY_NAMES_IF_NOT_IMPORTED:
      if (file instanceof PsiJavaFile) {
        PsiJavaFile javaFile = ((PsiJavaFile)file);
        return item.getQualifiedName() != null && !ImportHelper.isAlreadyImported(javaFile, item.getQualifiedName());
      }
    default:
      return false;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:JavaClassNameInsertHandler.java

示例2: getTextLength

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
public static int getTextLength(ASTNode node, CodeStyleSettings codeStyleSettings) {
    CsvCodeStyleSettings csvCodeStyleSettings = codeStyleSettings.getCustomSettings(CsvCodeStyleSettings.class);
    String text = node.getText();
    int length = node.getTextLength();
    if (csvCodeStyleSettings.TABULARIZE && !csvCodeStyleSettings.WHITE_SPACES_OUTSIDE_QUOTES && text.startsWith("\"")) {
        text = text.substring(1, text.length() - 1);
        text = BEGIN_WHITE_SPACE_PATTERN.matcher(text).replaceFirst("");
        text = END_WHITE_SPACE_PATTERN.matcher(text).replaceFirst("");
        length = text.length() + 2;
    }
    return length;
}
 
开发者ID:SeeSharpSoft,项目名称:intellij-csv-validator,代码行数:13,代码来源:CsvFormatHelper.java

示例3: createSpaceBuilder

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
public static SpacingBuilder createSpaceBuilder(CodeStyleSettings settings) {
    CsvCodeStyleSettings csvCodeStyleSettings = settings.getCustomSettings(CsvCodeStyleSettings.class);
    SpacingBuilder builder = new SpacingBuilder(settings, CsvLanguage.INSTANCE);
    if (csvCodeStyleSettings.TRIM_LEADING_WHITE_SPACES || csvCodeStyleSettings.TABULARIZE) {
        builder
                .after(CsvTypes.COMMA).spaceIf(csvCodeStyleSettings.SPACE_AFTER_SEPARATOR)
                .after(CsvTypes.CRLF).spaces(0);
        if (csvCodeStyleSettings.TABULARIZE && !csvCodeStyleSettings.WHITE_SPACES_OUTSIDE_QUOTES) {
            builder.before(CsvTypes.QUOTE).spaces(0);
        }
    } else if (csvCodeStyleSettings.SPACE_AFTER_SEPARATOR) {
        builder.after(CsvTypes.COMMA).spaces(1);
    }

    if (csvCodeStyleSettings.TRIM_TRAILING_WHITE_SPACES || csvCodeStyleSettings.TABULARIZE) {
        builder
                .before(CsvTypes.COMMA).spaceIf(csvCodeStyleSettings.SPACE_BEFORE_SEPARATOR)
                .before(CsvTypes.CRLF).spaces(0);
        if (csvCodeStyleSettings.TABULARIZE && !csvCodeStyleSettings.WHITE_SPACES_OUTSIDE_QUOTES) {
            builder.after(CsvTypes.QUOTE).spaces(0);
        }
    } else if (csvCodeStyleSettings.SPACE_BEFORE_SEPARATOR) {
        builder.before(CsvTypes.COMMA).spaces(1);
    }
    
    return builder;
}
 
开发者ID:SeeSharpSoft,项目名称:intellij-csv-validator,代码行数:28,代码来源:CsvFormatHelper.java

示例4: getCurrentSeparator

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
public static String getCurrentSeparator(@Nullable Project project) {
    if (ApplicationManager.getApplication().isUnitTestMode()) {
        return DEFAULT_SEPARATOR;
    }
    if (project != null) {
        CodeStyleSettings codeStyleSettings = CodeStyleSettingsManager.getInstance(project).getCurrentSettings();
        if (codeStyleSettings != null) {
            CsvCodeStyleSettings csvCodeStyleSettings = codeStyleSettings.getCustomSettings(CsvCodeStyleSettings.class);
            if (csvCodeStyleSettings != null) {
                return csvCodeStyleSettings.getSeparator();
            }
        }
    }
    return DEFAULT_SEPARATOR;
}
 
开发者ID:SeeSharpSoft,项目名称:intellij-csv-validator,代码行数:16,代码来源:CsvCodeStyleSettings.java

示例5: setUp

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();
  final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(myFixture.getProject()).getCurrentSettings();
  XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
  xmlSettings.XML_SPACE_INSIDE_EMPTY_TAG = true;
  settings.getIndentOptions(StdFileTypes.XML).INDENT_SIZE = 2;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:Xslt2RefactoringTest.java

示例6: doTestWithFqnInJavadocSetting

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
private void doTestWithFqnInJavadocSetting(String dirPath, int classNamesInJavadoc) {
  final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
  JavaCodeStyleSettings javaSettings = settings.getCustomSettings(JavaCodeStyleSettings.class);

  int oldClassNamesInJavadoc = javaSettings.CLASS_NAMES_IN_JAVADOC;
  try {
    javaSettings.CLASS_NAMES_IN_JAVADOC = classNamesInJavadoc;
    doTest(dirPath, new UnnecessaryFullyQualifiedNameInspection());
  }
  finally {
    javaSettings.CLASS_NAMES_IN_JAVADOC = oldClassNamesInJavadoc;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:UnnecessaryFullyQualifiedNameInspectionTest.java

示例7: createModel

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
@Override
@NotNull
  public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
  final FileElement fileElement = TreeUtil.getFileElement((TreeElement)SourceTreeToPsiMap.psiElementToTree(element));
  LOG.assertTrue(fileElement != null, "File element should not be null for " + element);
  CommonCodeStyleSettings commonSettings = settings.getCommonSettings(JavaLanguage.INSTANCE);
  JavaCodeStyleSettings customJavaSettings = settings.getCustomSettings(JavaCodeStyleSettings.class);
  Block block = AbstractJavaBlock.newJavaBlock(fileElement, commonSettings, customJavaSettings);
  FormattingDocumentModelImpl model = FormattingDocumentModelImpl.createOn(element.getContainingFile());
  return new PsiBasedFormatterModelWithShiftIndentInside (element.getContainingFile(), block, model);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:JavaFormattingModelBuilder.java

示例8: apply

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
@Override
public void apply(CodeStyleSettings settings) {
  final CommonCodeStyleSettings.IndentOptions indentOptions = settings.getIndentOptions(XmlFileType.INSTANCE);
  indentOptions.CONTINUATION_INDENT_SIZE = indentOptions.INDENT_SIZE;

  XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
  xmlSettings.XML_ALIGN_ATTRIBUTES = false;
  xmlSettings.XML_SPACE_INSIDE_EMPTY_TAG = true;
  xmlSettings.XML_KEEP_LINE_BREAKS = false;

  final AndroidXmlCodeStyleSettings androidSettings = AndroidXmlCodeStyleSettings.getInstance(settings);
  androidSettings.USE_CUSTOM_SETTINGS = true;

  androidSettings.LAYOUT_SETTINGS = new AndroidXmlCodeStyleSettings.LayoutSettings();
  androidSettings.MANIFEST_SETTINGS = new AndroidXmlCodeStyleSettings.ManifestSettings();
  androidSettings.VALUE_RESOURCE_FILE_SETTINGS = new AndroidXmlCodeStyleSettings.ValueResourceFileSettings();
  androidSettings.OTHER_SETTINGS = new AndroidXmlCodeStyleSettings.OtherSettings();

  // arrangement
  final List<StdArrangementMatchRule> rules = new ArrayList<StdArrangementMatchRule>();
  rules.add(attrArrangementRule("xmlns:android", "", KEEP));
  rules.add(attrArrangementRule("xmlns:.*", "", BY_NAME));
  rules.add(attrArrangementRule(".*:id", SdkConstants.NS_RESOURCES, KEEP));
  rules.add(attrArrangementRule(".*:name", SdkConstants.NS_RESOURCES, KEEP));
  rules.add(attrArrangementRule("name", "^$", KEEP));
  rules.add(attrArrangementRule("style", "^$", KEEP));
  rules.add(attrArrangementRule(".*", "^$", BY_NAME));
  rules.add(attrArrangementRule(".*:layout_width", SdkConstants.NS_RESOURCES, KEEP));
  rules.add(attrArrangementRule(".*:layout_height", SdkConstants.NS_RESOURCES, KEEP));
  rules.add(attrArrangementRule(".*:layout_.*", SdkConstants.NS_RESOURCES, BY_NAME));
  rules.add(attrArrangementRule(".*:width", SdkConstants.NS_RESOURCES, BY_NAME));
  rules.add(attrArrangementRule(".*:height", SdkConstants.NS_RESOURCES, BY_NAME));
  rules.add(attrArrangementRule(".*", SdkConstants.NS_RESOURCES, BY_NAME));
  rules.add(attrArrangementRule(".*", ".*", BY_NAME));
  // TODO: Should sort name:"color",namespace:"" to the end (primarily for color state lists)
  final CommonCodeStyleSettings xmlCommonSettings = settings.getCommonSettings(XMLLanguage.INSTANCE);
  xmlCommonSettings.setArrangementSettings(
    StdArrangementSettings.createByMatchRules(ContainerUtil.<ArrangementGroupingRule>emptyList(), rules));
  xmlCommonSettings.FORCE_REARRANGE_MODE = CommonCodeStyleSettings.REARRANGE_ALWAYS;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:AndroidXmlPredefinedCodeStyle.java

示例9: setValue

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
@Override
public void setValue(CodeStyleSettings settings, Boolean aBoolean) {
  final CustomCodeStyleSettings customSettings = settings.getCustomSettings(mySettingsClass);
  try {
    field.set(customSettings, aBoolean);
  }
  catch (IllegalAccessException e) {
    LOG.error(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:OptionTreeWithPreviewPanel.java

示例10: createSpaceBuilder

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
private static SpacingBuilder createSpaceBuilder(final CodeStyleSettings settings) {
        final ImpexCodeStyleSettings impexSettings = settings.getCustomSettings(ImpexCodeStyleSettings.class);

        return new SpacingBuilder(settings, ImpexLanguage.getInstance())
            .before(ImpexTypes.VALUE_GROUP)
            .spaceIf(impexSettings.SPACE_BEFORE_FIELD_VALUE_SEPARATOR)

            .after(ImpexTypes.FIELD_VALUE_SEPARATOR)
            .spaceIf(impexSettings.SPACE_AFTER_FIELD_VALUE_SEPARATOR)

            .before(ImpexTypes.PARAMETERS_SEPARATOR)
            .spaceIf(impexSettings.SPACE_BEFORE_PARAMETERS_SEPARATOR)

            .after(ImpexTypes.PARAMETERS_SEPARATOR)
            .spaceIf(impexSettings.SPACE_AFTER_PARAMETERS_SEPARATOR)

            .before(ImpexTypes.ATTRIBUTE_SEPARATOR)
            .spaceIf(impexSettings.SPACE_BEFORE_ATTRIBUTE_SEPARATOR)

            .after(ImpexTypes.COMMA)
            .spaceIf(impexSettings.SPACE_AFTER_COMMA)

            .before(ImpexTypes.COMMA)
            .spaceIf(impexSettings.SPACE_BEFORE_COMMA)

            .after(ImpexTypes.ATTRIBUTE_SEPARATOR)
            .spaceIf(impexSettings.SPACE_AFTER_ATTRIBUTE_SEPARATOR)

            .before(ImpexTypes.FIELD_LIST_ITEM_SEPARATOR)
            .spaceIf(impexSettings.SPACE_BEFORE_FIELD_LIST_ITEM_SEPARATOR)

            .after(ImpexTypes.FIELD_LIST_ITEM_SEPARATOR)
            .spaceIf(impexSettings.SPACE_AFTER_FIELD_LIST_ITEM_SEPARATOR)

            .after(ImpexTypes.ASSIGN_VALUE)
            .spaceIf(impexSettings.SPACE_AFTER_ASSIGN_VALUE)

            .before(ImpexTypes.ASSIGN_VALUE)
            .spaceIf(impexSettings.SPACE_BEFORE_ASSIGN_VALUE)

            .after(ImpexTypes.LEFT_ROUND_BRACKET)
            .spaceIf(impexSettings.SPACE_AFTER_LEFT_ROUND_BRACKET)

//                .before(ImpexTypes.LEFT_ROUND_BRACKET)
//                .spaceIf(impexSettings.SPACE_BEFORE_LEFT_ROUND_BRACKET)

//                .after(ImpexTypes.RIGHT_ROUND_BRACKET)
//                .spaceIf(impexSettings.SPACE_AFTER_RIGHT_ROUND_BRACKET)

            .before(ImpexTypes.RIGHT_ROUND_BRACKET)
            .spaceIf(impexSettings.SPACE_BEFORE_RIGHT_ROUND_BRACKET)

            .after(ImpexTypes.LEFT_SQUARE_BRACKET)
            .spaceIf(impexSettings.SPACE_AFTER_LEFT_SQUARE_BRACKET)

//                .before(ImpexTypes.LEFT_SQUARE_BRACKET)
//                .spaceIf(impexSettings.SPACE_BEFORE_LEFT_SQUARE_BRACKET)

//                .after(ImpexTypes.RIGHT_SQUARE_BRACKET)
//                .spaceIf(impexSettings.SPACE_AFTER_RIGHT_SQUARE_BRACKET)

            .before(ImpexTypes.RIGHT_SQUARE_BRACKET)
            .spaceIf(impexSettings.SPACE_BEFORE_RIGHT_SQUARE_BRACKET)

            .after(ImpexTypes.ALTERNATIVE_PATTERN)
            .spaceIf(impexSettings.SPACE_AFTER_ALTERNATIVE_PATTERN)

            .before(ImpexTypes.ALTERNATIVE_PATTERN)
            .spaceIf(impexSettings.SPACE_BEFORE_ALTERNATIVE_PATTERN)
            ;
    }
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:72,代码来源:ImpexFormattingModelBuilder.java

示例11: isModified

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
@Override
public boolean isModified(CodeStyleSettings settings) {
  final PropertiesCodeStyleSettings propertiesCodeStyleSettings = settings.getCustomSettings(PropertiesCodeStyleSettings.class);
  return propertiesCodeStyleSettings.KEY_VALUE_DELIMITER != getSelectedChar();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:PropertiesCodeStyleSettingsPanel.java

示例12: adjustWhiteSpaceIfNecessary

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
/**
 * Python uses backslashes at the end of the line as indication that next line is an extension of the current one.
 * <p/>
 * Hence, we need to preserve them during white space manipulation.
 *
 *
 * @param whiteSpaceText    white space text to use by default for replacing sub-sequence of the given text
 * @param text              target text which region is to be replaced by the given white space symbols
 * @param startOffset       start offset to use with the given text (inclusive)
 * @param endOffset         end offset to use with the given text (exclusive)
 * @param codeStyleSettings the code style settings
 * @param nodeAfter
 * @return                  symbols to use for replacing <code>[startOffset; endOffset)</code> sub-sequence of the given text
 */
@NotNull
@Override
public CharSequence adjustWhiteSpaceIfNecessary(@NotNull CharSequence whiteSpaceText,
                                                @NotNull CharSequence text,
                                                int startOffset,
                                                int endOffset,
                                                CodeStyleSettings codeStyleSettings, ASTNode nodeAfter)
{
  // The general idea is that '\' symbol before line feed should be preserved.
  TIntIntHashMap initialBackSlashes = countBackSlashes(text, startOffset, endOffset);
  if (initialBackSlashes.isEmpty()) {
    if (nodeAfter != null && whiteSpaceText.length() > 0 && whiteSpaceText.charAt(0) == '\n' &&
      PythonEnterHandler.needInsertBackslash(nodeAfter, false)) {
      return addBackslashPrefix(whiteSpaceText, codeStyleSettings);
    }
    return whiteSpaceText;
  }

  final TIntIntHashMap newBackSlashes = countBackSlashes(whiteSpaceText, 0, whiteSpaceText.length());
  final AtomicBoolean continueProcessing = new AtomicBoolean();
  initialBackSlashes.forEachKey(new TIntProcedure() {
    @Override
    public boolean execute(int key) {
      if (!newBackSlashes.containsKey(key)) {
        continueProcessing.set(true);
        return false;
      }
      return true;
    }
  });
  if (!continueProcessing.get()) {
    return whiteSpaceText;
  }

  PyCodeStyleSettings settings = codeStyleSettings.getCustomSettings(PyCodeStyleSettings.class);
  StringBuilder result = new StringBuilder();
  int line = 0;
  for (int i = 0; i < whiteSpaceText.length(); i++) {
    char c = whiteSpaceText.charAt(i);
    if (c != '\n') {
      result.append(c);
      continue;
    }
    if (!newBackSlashes.contains(line++)) {
      if ((i == 0 || (i > 0 && whiteSpaceText.charAt(i - 1) != ' ')) && settings.SPACE_BEFORE_BACKSLASH) {
        result.append(' ');
      }
      result.append('\\');
    }
    result.append(c);
  }
  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:68,代码来源:PyWhiteSpaceFormattingStrategy.java

示例13: createSpacingBuilder

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
protected SpacingBuilder createSpacingBuilder(CodeStyleSettings settings) {
  final IFileElementType file = LanguageParserDefinitions.INSTANCE.forLanguage(PythonLanguage.getInstance()).getFileNodeType();
  final PyCodeStyleSettings pySettings = settings.getCustomSettings(PyCodeStyleSettings.class);

  final CommonCodeStyleSettings commonSettings = settings.getCommonSettings(PythonLanguage.getInstance());
  return new SpacingBuilder(commonSettings)
    .between(CLASS_DECLARATION, STATEMENT_OR_DECLARATION).blankLines(commonSettings.BLANK_LINES_AROUND_CLASS)
    .between(STATEMENT_OR_DECLARATION, CLASS_DECLARATION).blankLines(commonSettings.BLANK_LINES_AROUND_CLASS)
    .between(FUNCTION_DECLARATION, STATEMENT_OR_DECLARATION).blankLines(commonSettings.BLANK_LINES_AROUND_METHOD)
    .between(STATEMENT_OR_DECLARATION, FUNCTION_DECLARATION).blankLines(commonSettings.BLANK_LINES_AROUND_METHOD)
    .after(FUNCTION_DECLARATION).blankLines(commonSettings.BLANK_LINES_AROUND_METHOD)
    .after(CLASS_DECLARATION).blankLines(commonSettings.BLANK_LINES_AROUND_CLASS)
    // Remove excess blank lines between imports, because ImportOptimizer gets rid of them anyway.
    // Empty lines between import groups are handles in PyBlock#getSpacing
    .between(IMPORT_STATEMENTS, IMPORT_STATEMENTS).spacing(0, Integer.MAX_VALUE, 1, false, 0)
    .between(STATEMENT_OR_DECLARATION, STATEMENT_OR_DECLARATION).spacing(0, Integer.MAX_VALUE, 1, false, 1)

    .between(COLON, STATEMENT_LIST).spacing(1, Integer.MAX_VALUE, 0, true, 0)
    .afterInside(COLON, TokenSet.create(KEY_VALUE_EXPRESSION, LAMBDA_EXPRESSION)).spaceIf(pySettings.SPACE_AFTER_PY_COLON)

    .afterInside(GT, ANNOTATION).spaces(1)
    .betweenInside(MINUS, GT, ANNOTATION).none()
    .beforeInside(ANNOTATION, FUNCTION_DECLARATION).spaces(1)
    .beforeInside(ANNOTATION, NAMED_PARAMETER).none()
    .afterInside(COLON, ANNOTATION).spaces(1)
    .afterInside(RARROW, ANNOTATION).spaces(1)

    .between(allButLambda(), PARAMETER_LIST).spaceIf(commonSettings.SPACE_BEFORE_METHOD_PARENTHESES)

    .before(COLON).spaceIf(pySettings.SPACE_BEFORE_PY_COLON)
    .after(COMMA).spaceIf(commonSettings.SPACE_AFTER_COMMA)
    .before(COMMA).spaceIf(commonSettings.SPACE_BEFORE_COMMA)
    .between(FROM_KEYWORD, DOT).spaces(1)
    .between(DOT, IMPORT_KEYWORD).spaces(1)
    .around(DOT).spaces(0)
    .aroundInside(AT, DECORATOR_CALL).none()
    .before(SEMICOLON).spaceIf(commonSettings.SPACE_BEFORE_SEMICOLON)
    .withinPairInside(LPAR, RPAR, ARGUMENT_LIST).spaceIf(commonSettings.SPACE_WITHIN_METHOD_CALL_PARENTHESES)
    .withinPairInside(LPAR, RPAR, PARAMETER_LIST).spaceIf(commonSettings.SPACE_WITHIN_METHOD_PARENTHESES)
    .withinPairInside(LPAR, RPAR, FROM_IMPORT_STATEMENT).spaces(0)
    .withinPairInside(LPAR, RPAR, GENERATOR_EXPRESSION).spaces(0)
    .withinPairInside(LPAR, RPAR, PARENTHESIZED_EXPRESSION).spaces(0)
    .before(LBRACKET).spaceIf(pySettings.SPACE_BEFORE_LBRACKET)

    .afterInside(LBRACE, DICT_LITERAL_EXPRESSION).spaceIf(pySettings.SPACE_WITHIN_BRACES, pySettings.DICT_NEW_LINE_AFTER_LEFT_BRACE)
    .beforeInside(RBRACE, DICT_LITERAL_EXPRESSION).spaceIf(pySettings.SPACE_WITHIN_BRACES, pySettings.DICT_NEW_LINE_BEFORE_RIGHT_BRACE)
    .withinPair(LBRACE, RBRACE).spaceIf(pySettings.SPACE_WITHIN_BRACES)
    .withinPair(LBRACKET, RBRACKET).spaceIf(commonSettings.SPACE_WITHIN_BRACKETS)

    .before(ARGUMENT_LIST).spaceIf(commonSettings.SPACE_BEFORE_METHOD_CALL_PARENTHESES)

    .around(DECORATOR_CALL).spacing(1, Integer.MAX_VALUE, 0, true, 0)
    .after(DECORATOR_LIST).spacing(1, Integer.MAX_VALUE, 0, true, 0)

    .aroundInside(EQ, ASSIGNMENT_STATEMENT).spaceIf(commonSettings.SPACE_AROUND_ASSIGNMENT_OPERATORS)
    .aroundInside(EQ, NAMED_PARAMETER).spaceIf(pySettings.SPACE_AROUND_EQ_IN_NAMED_PARAMETER)
    .aroundInside(EQ, KEYWORD_ARGUMENT_EXPRESSION).spaceIf(pySettings.SPACE_AROUND_EQ_IN_KEYWORD_ARGUMENT)

    .around(AUG_ASSIGN_OPERATIONS).spaceIf(commonSettings.SPACE_AROUND_ASSIGNMENT_OPERATORS)
    .aroundInside(ADDITIVE_OPERATIONS, BINARY_EXPRESSION).spaceIf(commonSettings.SPACE_AROUND_ADDITIVE_OPERATORS)
    .aroundInside(MULTIPLICATIVE_OR_EXP, STAR_PARAMETERS).none()
    .around(MULTIPLICATIVE_OR_EXP).spaceIf(commonSettings.SPACE_AROUND_MULTIPLICATIVE_OPERATORS)
    .around(SHIFT_OPERATIONS).spaceIf(commonSettings.SPACE_AROUND_SHIFT_OPERATORS)
    .around(BITWISE_OPERATIONS).spaceIf(commonSettings.SPACE_AROUND_BITWISE_OPERATORS)
    .around(EQUALITY_OPERATIONS).spaceIf(commonSettings.SPACE_AROUND_EQUALITY_OPERATORS)
    .around(RELATIONAL_OPERATIONS).spaceIf(commonSettings.SPACE_AROUND_RELATIONAL_OPERATORS)
    .around(SINGLE_SPACE_KEYWORDS).spaces(1);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:69,代码来源:PythonFormattingModelBuilder.java

示例14: getBlankLines

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
@Override
public int getBlankLines(@NotNull CodeStyleSettings settings,
                         @Nullable JavaElementArrangementEntry parent,
                         @Nullable JavaElementArrangementEntry previous,
                         @NotNull JavaElementArrangementEntry target)
{
  if (previous == null) {
    return -1;
  }

  CommonCodeStyleSettings commonSettings = settings.getCommonSettings(JavaLanguage.INSTANCE);
  JavaCodeStyleSettings javaSettings = settings.getCustomSettings(JavaCodeStyleSettings.class);
  if (FIELD.equals(target.getType())) {
    if (parent != null && parent.getType() == INTERFACE) {
      return commonSettings.BLANK_LINES_AROUND_FIELD_IN_INTERFACE;
    }
    else if (INIT_BLOCK.equals(previous.getType())) {
      return javaSettings.BLANK_LINES_AROUND_INITIALIZER;
    }
    else {
      return commonSettings.BLANK_LINES_AROUND_FIELD;
    }
  }
  else if (METHOD.equals(target.getType())) {
    if (parent != null && parent.getType() == INTERFACE) {
      return commonSettings.BLANK_LINES_AROUND_METHOD_IN_INTERFACE;
    }
    else {
      return commonSettings.BLANK_LINES_AROUND_METHOD;
    }
  }
  else if (CLASS.equals(target.getType())) {
    return commonSettings.BLANK_LINES_AROUND_CLASS;
  }
  else if (INIT_BLOCK.equals(target.getType())) {
    return javaSettings.BLANK_LINES_AROUND_INITIALIZER;
  }
  else {
    return -1;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:JavaRearranger.java

示例15: XmlPolicy

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
public XmlPolicy(final CodeStyleSettings settings, final FormattingDocumentModel documentModel) {
  super(documentModel);
  mySettings = settings;
  myXmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:XmlPolicy.java


注:本文中的com.intellij.psi.codeStyle.CodeStyleSettings.getCustomSettings方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。