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


Java CommonCodeStyleSettings.IndentOptions方法代码示例

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


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

示例1: saveIndents

import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
@Override
public void saveIndents(final FormattingModel model, final TextRange affectedRange,
                        IndentInfoStorage storage,
                        final CodeStyleSettings settings,
                        final CommonCodeStyleSettings.IndentOptions indentOptions) {
  try {
    validateModel(model);
    final Block block = model.getRootBlock();

    final FormatProcessor processor = buildProcessorAndWrapBlocks(
      model.getDocumentModel(), block, settings, indentOptions, new FormatTextRanges(affectedRange, true)
    );
    LeafBlockWrapper current = processor.getFirstTokenBlock();
    while (current != null) {
      WhiteSpace whiteSpace = current.getWhiteSpace();

      if (!whiteSpace.isReadOnly() && whiteSpace.containsLineFeeds()) {
        storage.saveIndentInfo(current.calcIndentFromParent(), current.getStartOffset());
      }
      current = current.getNextBlock();
    }
  }
  catch (FormattingModelInconsistencyException e) {
    LOG.error(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:FormatterImpl.java

示例2: getCodeStyleIntent

import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
@NotNull
public static String getCodeStyleIntent(InsertionContext insertionContext) {
  final CodeStyleSettings currentSettings =
      CodeStyleSettingsManager.getSettings(insertionContext.getProject());
  final CommonCodeStyleSettings.IndentOptions indentOptions =
      currentSettings.getIndentOptions(insertionContext.getFile().getFileType());
  return indentOptions.USE_TAB_CHARACTER ?
      "\t" :
      StringUtil.repeatSymbol(' ', indentOptions.INDENT_SIZE);
}
 
开发者ID:1tontech,项目名称:intellij-spring-assistant,代码行数:11,代码来源:Util.java

示例3: getDefaultCommonSettings

import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
@Override
public CommonCodeStyleSettings getDefaultCommonSettings() {
  CommonCodeStyleSettings defaultSettings = new CommonCodeStyleSettings(getLanguage());
  CommonCodeStyleSettings.IndentOptions indentOptions = defaultSettings.initIndentOptions();
  indentOptions.INDENT_SIZE = 2;
  indentOptions.CONTINUATION_INDENT_SIZE = 4;
  indentOptions.TAB_SIZE = 2;
  return defaultSettings;
}
 
开发者ID:ant-druha,项目名称:AppleScript-IDEA,代码行数:10,代码来源:AppleScriptLanguageCodeStyleSettingsProvider.java

示例4: testSmartTabsInFileWithoutBinaryExpressionMultilineAlignment

import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
public void testSmartTabsInFileWithoutBinaryExpressionMultilineAlignment() {
  final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
  final CommonCodeStyleSettings.IndentOptions options = settings.getIndentOptions(JavaFileType.INSTANCE);
  options.USE_TAB_CHARACTER = true;
  options.SMART_TABS = true;
  doTest("class X {{\n" +
         "\tSystem.out.println(\"asdf\" +\n" +
         "\t\t\t                   \"asdf\");\n" +
         "}}");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:ProblematicWhitespaceInspectionTest.java

示例5: getIndentOptionsToUse

import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
@Nullable
@Override
public CommonCodeStyleSettings.IndentOptions getIndentOptionsToUse(@NotNull PsiFile file,
                                                                   @NotNull FormatTextRanges ranges,
                                                                   @NotNull CodeStyleSettings settings) {
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PythonFormattingModelBuilder.java

示例6: getIndentOptions

import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
public CommonCodeStyleSettings.IndentOptions getIndentOptions() {
  if (myIndentOptions == null) {
    CodeStyleSettings codeStyleSettings = CodeStyleSettingsManager.getInstance(project).getCurrentSettings();
    myIndentOptions = codeStyleSettings.getIndentOptions(file.getFileType());
  }
  
  return myIndentOptions;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:PyEmacsHandler.java

示例7: getIndentOptionsToUse

import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
@Nullable
@Override
public CommonCodeStyleSettings.IndentOptions getIndentOptionsToUse(@NotNull PsiFile file,
                                                                   @NotNull FormatTextRanges ranges,
                                                                   @NotNull CodeStyleSettings settings)
{
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:RestFormattingModelBuilder.java

示例8: getDefaultCommonSettings

import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
@Nullable
@Override
public CommonCodeStyleSettings getDefaultCommonSettings() {
  CommonCodeStyleSettings defaultSettings =
      new CommonCodeStyleSettings(BuildFileLanguage.INSTANCE);
  CommonCodeStyleSettings.IndentOptions indentOptions = defaultSettings.initIndentOptions();
  indentOptions.TAB_SIZE = 2;
  indentOptions.INDENT_SIZE = 2;
  indentOptions.CONTINUATION_INDENT_SIZE = 4;
  return defaultSettings;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:12,代码来源:BuildLanguageCodeStyleSettingsProvider.java

示例9: reset

import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
@Override
public void reset(@NotNull final CodeStyleSettings settings, @NotNull final CommonCodeStyleSettings.IndentOptions options) {
  super.reset(settings, options);
  myContinuationIndentField.setText(String.valueOf(options.CONTINUATION_INDENT_SIZE));
  myCbSmartTabs.setSelected(options.SMART_TABS);
  myCbKeepIndentsOnEmptyLines.setSelected(options.KEEP_INDENTS_ON_EMPTY_LINES);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:SmartIndentOptionsEditor.java

示例10: setUp

import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
  super.setUp();
  ExtensionPoint<FileIndentOptionsProvider> extensionPoint =
    Extensions.getRootArea().getExtensionPoint(FileIndentOptionsProvider.EP_NAME);
  extensionPoint.registerExtension(TEST_FILE_INDENT_OPTIONS_PROVIDER);
  myTestIndentOptions = new CommonCodeStyleSettings.IndentOptions();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:FileIndentProviderTest.java

示例11: setCodeStyleOption

import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
private void setCodeStyleOption(@NotNull CodeStyleSettings settings, @NotNull String key, @NotNull String value)
  throws SchemeImportException {
  EclipseImportMap.ImportDescriptor importDescriptor = myImportMap.getImportDescriptor(key);
  if (importDescriptor != null) {
    try {
      if (importDescriptor.isLanguageSpecific()) {
        CommonCodeStyleSettings languageSettings = settings.getCommonSettings(importDescriptor.getLanguage());
        if (languageSettings != null) {
          if (importDescriptor.isIndentOptions()) {
            CommonCodeStyleSettings.IndentOptions indentOptions = languageSettings.getIndentOptions();
            if (indentOptions != null) {
              setValue(indentOptions, key, importDescriptor.getFieldName(), value);
            }
          }
          else {
            setValue(languageSettings, key, importDescriptor.getFieldName(), value);
          }
        }
      }
      else {
        setValue(settings, key, importDescriptor.getFieldName(), value);
      }
    }
    catch (Exception e) {
      throw new SchemeImportException(e);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:EclipseCodeStyleImportWorker.java

示例12: prepareToBuildBlocksSequentially

import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
protected static InitialInfoBuilder prepareToBuildBlocksSequentially(Block root,
                                                                  FormattingDocumentModel model,
                                                                  @Nullable final FormatTextRanges affectedRanges,
                                                                  @NotNull CodeStyleSettings settings,
                                                                  final CommonCodeStyleSettings.IndentOptions options,
                                                                  int interestingOffset,
                                                                  @NotNull FormattingProgressCallback progressCallback)
{
  InitialInfoBuilder builder = new InitialInfoBuilder(root, model, affectedRanges, settings, options, interestingOffset, progressCallback);
  builder.buildFrom(root, 0, null, null, null, true);
  return builder;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:InitialInfoBuilder.java

示例13: getWhiteSpaceBefore

import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
@Override
public IndentInfo getWhiteSpaceBefore(final FormattingDocumentModel model,
                                      final Block block,
                                      final CodeStyleSettings settings,
                                      final CommonCodeStyleSettings.IndentOptions indentOptions,
                                      final TextRange affectedRange, final boolean mayChangeLineFeeds)
{
  disableFormatting();
  try {
    final FormatProcessor processor = buildProcessorAndWrapBlocks(
      model, block, settings, indentOptions, new FormatTextRanges(affectedRange, true)
    );
    final LeafBlockWrapper blockBefore = processor.getBlockAtOrAfter(affectedRange.getStartOffset());
    LOG.assertTrue(blockBefore != null);
    WhiteSpace whiteSpace = blockBefore.getWhiteSpace();
    LOG.assertTrue(whiteSpace != null);
    if (!mayChangeLineFeeds) {
      whiteSpace.setLineFeedsAreReadOnly();
    }
    processor.setAllWhiteSpacesAreReadOnly();
    whiteSpace.setReadOnly(false);
    processor.formatWithoutRealModifications();
    return new IndentInfo(whiteSpace.getLineFeeds(), whiteSpace.getIndentOffset(), whiteSpace.getSpaces());
  }
  finally {
    enableFormatting();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:FormatterImpl.java

示例14: getDefaultCommonSettings

import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
@Override
public CommonCodeStyleSettings getDefaultCommonSettings() {
  CommonCodeStyleSettings defaultSettings = new CommonCodeStyleSettings(PythonLanguage.getInstance());
  CommonCodeStyleSettings.IndentOptions indentOptions = defaultSettings.initIndentOptions();
  indentOptions.INDENT_SIZE = 4;
  defaultSettings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS = true;
  defaultSettings.KEEP_BLANK_LINES_IN_DECLARATIONS = 1;
  defaultSettings.KEEP_BLANK_LINES_IN_CODE = 1;
  return defaultSettings;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:PyLanguageCodeStyleSettingsProvider.java

示例15: createWhiteSpace

import com.intellij.psi.codeStyle.CommonCodeStyleSettings; //导入方法依赖的package包/类
private void createWhiteSpace(final int whiteSpaceLength, StringBuilder buffer) {
  if (whiteSpaceLength < 0) return;
  final CommonCodeStyleSettings.IndentOptions indentOptions = getIndentOptions();
  if (indentOptions.USE_TAB_CHARACTER) {
    int tabs = whiteSpaceLength / indentOptions.TAB_SIZE;
    int spaces = whiteSpaceLength - tabs * indentOptions.TAB_SIZE;
    StringUtil.repeatSymbol(buffer, '\t', tabs);
    StringUtil.repeatSymbol(buffer, ' ', spaces);
  }
  else {
    StringUtil.repeatSymbol(buffer, ' ', whiteSpaceLength);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:DocumentBasedFormattingModel.java


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