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


Java CodeStyleSettings.getCommonSettings方法代码示例

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


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

示例1: createSpacingBuilder

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
/**
 * Create spacing builder using given settings.
 */
public static SpacingBuilder createSpacingBuilder(CodeStyleSettings settings) {
    CommonCodeStyleSettings protoSettings = settings.getCommonSettings(ProtoLanguage.INSTANCE);
    SpacingBuilder builder = new SpacingBuilder(settings, ProtoLanguage.INSTANCE);
    builder.around(ASSIGN).spacing(1, 1, 0, false, 0);
    builder.before(SEMICOLON).spacing(0, 0, 0, false, 0);
    builder.after(LINE_COMMENT).spacing(0, 0, 1, true, 2);
    builder.after(LCURLY).spacing(0, 0, 1, true, 2);
    builder.before(RCURLY).spacing(0, 0, 1, true, 2);
    builder.after(LPAREN).spacing(0, 0, 0, false, 0);
    builder.before(RPAREN).spacing(0, 0, 0, false, 0);
    builder.after(LSQUARE).spacing(0, 0, 0, false, 0);
    builder.before(RSQUARE).spacing(0, 0, 0, false, 0);
    builder.before(LT).spacing(0, 0, 0, false, 0);
    builder.after(LT).spacing(0, 0, 0, false, 0);
    builder.before(GT).spacing(0, 0, 0, false, 0);
    builder.before(COMMA).spacing(0, 0, 0, false, 0);
    builder.before(SEMICOLON).spacing(0, 0, 0, false, 0);
    builder.after(COMMA).spacing(1, 1, 0, false, 0);
    return builder;
}
 
开发者ID:protostuff,项目名称:protobuf-jetbrains-plugin,代码行数:24,代码来源:FormattingModelBuilder.java

示例2: getForceBraceSetting

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
private static int getForceBraceSetting(PsiElement statement) {
  CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(statement.getProject());
  final CommonCodeStyleSettings codeStyleSettings = settings.getCommonSettings(JavaLanguage.INSTANCE);
  if (statement instanceof PsiIfStatement) {
    return codeStyleSettings.IF_BRACE_FORCE;
  }
  if (statement instanceof PsiWhileStatement) {
    return codeStyleSettings.WHILE_BRACE_FORCE;
  }
  if (statement instanceof PsiForStatement) {
    return codeStyleSettings.FOR_BRACE_FORCE;
  }
  if (statement instanceof PsiDoWhileStatement) {
    return codeStyleSettings.DOWHILE_BRACE_FORCE;
  }
  return CommonCodeStyleSettings.DO_NOT_FORCE;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:BlockJoinLinesHandler.java

示例3: testResultExceedsRightMargin

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
public void testResultExceedsRightMargin() {
  final CodeStyleSettings settings = getCodeStyleSettings();
  final CommonCodeStyleSettings commonSettings = settings.getCommonSettings(PythonLanguage.getInstance());

  final int oldRightMargin = settings.getRightMargin(PythonLanguage.getInstance());
  final boolean oldWrapLongLines = commonSettings.WRAP_LONG_LINES;

  settings.setRightMargin(PythonLanguage.getInstance(), 80);
  commonSettings.WRAP_LONG_LINES = true;
  try {
    doTest();
  }
  finally {
    commonSettings.WRAP_LONG_LINES = oldWrapLongLines;
    settings.setRightMargin(PythonLanguage.getInstance(), oldRightMargin);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PyInlineLocalTest.java

示例4: testUnwrapCodeBlock1

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
public void testUnwrapCodeBlock1() throws Exception {
  CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
  boolean use_tab_character = settings.useTabCharacter(null);
  boolean smart_tabs = settings.isSmartTabs(null);
  int old = settings.IF_BRACE_FORCE;
  try {
    settings.getIndentOptions(StdFileTypes.JAVA).USE_TAB_CHARACTER = true;
    settings.getIndentOptions(StdFileTypes.JAVA).SMART_TABS = true;
    settings.getCommonSettings(JavaLanguage.INSTANCE).IF_BRACE_FORCE = CommonCodeStyleSettings.FORCE_BRACES_IF_MULTILINE;
    doTest();
  } finally {
    settings.getIndentOptions(StdFileTypes.JAVA).USE_TAB_CHARACTER = use_tab_character;
    settings.getIndentOptions(StdFileTypes.JAVA).SMART_TABS = smart_tabs;
    settings.getCommonSettings(JavaLanguage.INSTANCE).IF_BRACE_FORCE = old;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JoinLinesTest.java

示例5: testUnwrapCodeBlock2

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
public void testUnwrapCodeBlock2() throws Exception {
  CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
  boolean use_tab_character = settings.useTabCharacter(null);
  boolean smart_tabs = settings.isSmartTabs(null);
  int old = settings.IF_BRACE_FORCE;
  try {
    settings.getIndentOptions(StdFileTypes.JAVA).USE_TAB_CHARACTER = true;
    settings.getIndentOptions(StdFileTypes.JAVA).SMART_TABS = true;
    settings.getCommonSettings(JavaLanguage.INSTANCE).IF_BRACE_FORCE = CommonCodeStyleSettings.FORCE_BRACES_ALWAYS;
    doTest();
  } finally {
    settings.getIndentOptions(StdFileTypes.JAVA).USE_TAB_CHARACTER = use_tab_character;
    settings.getIndentOptions(StdFileTypes.JAVA).SMART_TABS = smart_tabs;
    settings.getCommonSettings(JavaLanguage.INSTANCE).IF_BRACE_FORCE = old;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JoinLinesTest.java

示例6: testCommentAfterDeclaration

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
public void testCommentAfterDeclaration() throws Exception {
  CodeStyleSettings codeStyleSettings = CodeStyleSettingsManager.getSettings(getProject());
  CommonCodeStyleSettings javaSettings = codeStyleSettings.getCommonSettings(JavaLanguage.INSTANCE);

  int oldMargin = codeStyleSettings.getDefaultRightMargin();
  int oldWrap = javaSettings.ASSIGNMENT_WRAP;

  try {
    codeStyleSettings.setDefaultRightMargin(20);
    javaSettings.ASSIGNMENT_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
    doMethodTest(
      "int i=0; //comment comment",
      "int i =\n" +
      "        0; //comment comment"
    );

  }
  finally {
    codeStyleSettings.setDefaultRightMargin(oldMargin);
    javaSettings.ASSIGNMENT_WRAP = oldWrap;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:JavaFormatterTest.java

示例7: AppleScriptBlock

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
AppleScriptBlock(ASTNode node, @Nullable Wrap wrap, @Nullable Alignment alignment, CodeStyleSettings settings) {
  super(node, wrap, alignment);
  mySettings = settings;
  myIndentProcessor = new AppleScriptIndentProcessor(settings.getCommonSettings(AppleScriptLanguage.INSTANCE));
  myIndent = myIndentProcessor.getChildIndent(myNode);
  mySpacingProcessor = new AppleScriptSpacingProcessor(node, settings.getCommonSettings(AppleScriptLanguage.INSTANCE));
  myWrappingProcessor = new AppleScriptWrappingProcessor(node, settings.getCommonSettings(AppleScriptLanguage.INSTANCE));
}
 
开发者ID:ant-druha,项目名称:AppleScript-IDEA,代码行数:9,代码来源:AppleScriptBlock.java

示例8: disableWrapOnType

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
private void disableWrapOnType(final Language impexLanguage) {
    final CodeStyleScheme currentScheme = CodeStyleSchemes.getInstance().getCurrentScheme();
    final CodeStyleSettings codeStyleSettings = currentScheme.getCodeStyleSettings();
    if (impexLanguage != null) {
        CommonCodeStyleSettings langSettings = codeStyleSettings.getCommonSettings(impexLanguage);
        if (langSettings != null) {
            langSettings.WRAP_ON_TYPING = CommonCodeStyleSettings.WrapOnTyping.NO_WRAP.intValue;
        }
    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:11,代码来源:ImportProjectProgressModalWindow.java

示例9: setUp

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();
  final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(myFixture.getProject()).getCurrentSettings();
  final CommonCodeStyleSettings pythonSettings = settings.getCommonSettings(PythonLanguage.getInstance());
  myOldWrap = settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN;
  myOldMargin = pythonSettings.RIGHT_MARGIN;
  settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = true;
  pythonSettings.RIGHT_MARGIN = 80;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:PyWrapTest.java

示例10: apply

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
public void apply(@NotNull CodeStyleSettings settings) {
  CommonCodeStyleSettings langSettings = settings.getCommonSettings(myLanguage);
  if (langSettings != settings) {
    if (myDefaultGeneralCheckBox.isSelected()) {
      langSettings.RIGHT_MARGIN = -1;
    }
    else {
      langSettings.RIGHT_MARGIN = getFieldRightMargin(settings.getDefaultRightMargin());
    }
  }
  langSettings.WRAP_ON_TYPING = getSelectedWrapOnTypingValue();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:RightMarginForm.java

示例11: setValue

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

示例12: apply

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
public void apply(final CodeStyleSettings settings, final CommonCodeStyleSettings.IndentOptions options) {
  super.apply(settings, options);
  options.LABEL_INDENT_SIZE = getFieldValue(myLabelIndent, Integer.MIN_VALUE, options.LABEL_INDENT_SIZE);

  options.LABEL_INDENT_ABSOLUTE = myLabelIndentAbsolute.isSelected();
  CommonCodeStyleSettings javaSettings = settings.getCommonSettings(JavaLanguage.INSTANCE);
  javaSettings.DO_NOT_INDENT_TOP_LEVEL_CLASS_MEMBERS = myCbDontIndentTopLevelMembers.isSelected();
  options.USE_RELATIVE_INDENTS = myCbUseRelativeIndent.isSelected();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:JavaIndentOptionsEditor.java

示例13: reset

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
public void reset(@NotNull final CodeStyleSettings settings, @NotNull final CommonCodeStyleSettings.IndentOptions options) {
  super.reset(settings, options);
  myLabelIndent.setText(Integer.toString(options.LABEL_INDENT_SIZE));
  myLabelIndentAbsolute.setSelected(options.LABEL_INDENT_ABSOLUTE);
  CommonCodeStyleSettings javaSettings = settings.getCommonSettings(JavaLanguage.INSTANCE);
  myCbDontIndentTopLevelMembers.setSelected(javaSettings.DO_NOT_INDENT_TOP_LEVEL_CLASS_MEMBERS);
  myCbUseRelativeIndent.setSelected(options.USE_RELATIVE_INDENTS);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:JavaIndentOptionsEditor.java

示例14: tearDown

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
@Override
protected void tearDown() throws Exception {
  final CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(myFixture.getProject()).getCurrentSettings();
  final CommonCodeStyleSettings pythonSettings = settings.getCommonSettings(PythonLanguage.getInstance());
  settings.WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = myOldWrap;
  pythonSettings.RIGHT_MARGIN = myOldMargin;
  super.tearDown();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:PyWrapTest.java

示例15: apply

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
public void apply(CodeStyleSettings settings) throws ConfigurationException {
  CommonCodeStyleSettings javaCommonSettings = settings.getCommonSettings(JavaLanguage.INSTANCE);
  settings.PREFER_LONGER_NAMES = myCbPreferLongerNames.isSelected();

  settings.FIELD_NAME_PREFIX = setPrefixSuffix(myFieldPrefixField.getText(), true);
  settings.STATIC_FIELD_NAME_PREFIX = setPrefixSuffix(myStaticFieldPrefixField.getText(), true);
  settings.PARAMETER_NAME_PREFIX = setPrefixSuffix(myParameterPrefixField.getText(), true);
  settings.LOCAL_VARIABLE_NAME_PREFIX = setPrefixSuffix(myLocalVariablePrefixField.getText(), true);

  settings.FIELD_NAME_SUFFIX = setPrefixSuffix(myFieldSuffixField.getText(), false);
  settings.STATIC_FIELD_NAME_SUFFIX = setPrefixSuffix(myStaticFieldSuffixField.getText(), false);
  settings.PARAMETER_NAME_SUFFIX = setPrefixSuffix(myParameterSuffixField.getText(), false);
  settings.LOCAL_VARIABLE_NAME_SUFFIX = setPrefixSuffix(myLocalVariableSuffixField.getText(), false);

  javaCommonSettings.LINE_COMMENT_AT_FIRST_COLUMN = myCbLineCommentAtFirstColumn.isSelected();
  javaCommonSettings.BLOCK_COMMENT_AT_FIRST_COLUMN = myCbBlockCommentAtFirstColumn.isSelected();

  settings.GENERATE_FINAL_LOCALS = myCbGenerateFinalLocals.isSelected();
  settings.GENERATE_FINAL_PARAMETERS = myCbGenerateFinalParameters.isSelected();

  settings.USE_EXTERNAL_ANNOTATIONS = myCbUseExternalAnnotations.isSelected();
  settings.INSERT_OVERRIDE_ANNOTATION = myInsertOverrideAnnotationCheckBox.isSelected();
  settings.REPEAT_SYNCHRONIZED = myRepeatSynchronizedCheckBox.isSelected();
  
  settings.VISIBILITY = myJavaVisibilityPanel.getVisibility();

  myMembersOrderList.apply(settings);

  for (Project project : ProjectManager.getInstance().getOpenProjects()) {
    DaemonCodeAnalyzer.getInstance(project).settingsChanged();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:CodeStyleGenerationConfigurable.java


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