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


Java CodeStyleSettings.isSmartTabs方法代码示例

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


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

示例1: 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

示例2: 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

示例3: testSCR3493

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

示例4: testSCR3493a

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

示例5: testSCR3493b

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

示例6: testSCR3493c

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

示例7: testSCR3493d

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

示例8: testSCR3493e

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

示例9: fillIndent

import com.intellij.psi.codeStyle.CodeStyleSettings; //导入方法依赖的package包/类
public static String fillIndent(Project project, FileType fileType, int indent) {
  final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(project);
  int indentLevel = (indent + INDENT_FACTOR / 2) / INDENT_FACTOR;
  int spaceCount = indent - indentLevel * INDENT_FACTOR;
  int indentLevelSize = indentLevel * settings.getIndentSize(fileType);
  int totalSize = indentLevelSize + spaceCount;

  StringBuilder buffer = new StringBuilder();
  if (settings.useTabCharacter(fileType)) {
    if (settings.isSmartTabs(fileType)) {
      int tabCount = indentLevelSize / settings.getTabSize(fileType);
      int leftSpaces = indentLevelSize - tabCount * settings.getTabSize(fileType);
      for (int i = 0; i < tabCount; i++) {
        buffer.append('\t');
      }
      for (int i = 0; i < leftSpaces + spaceCount; i++) {
        buffer.append(' ');
      }
    }
    else {
      int size = totalSize;
      while (size > 0) {
        if (size >= settings.getTabSize(fileType)) {
          buffer.append('\t');
          size -= settings.getTabSize(fileType);
        }
        else {
          buffer.append(' ');
          size--;
        }
      }
    }
  }
  else {
    for (int i = 0; i < totalSize; i++) {
      buffer.append(' ');
    }
  }

  return buffer.toString();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:IndentHelperImpl.java


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