當前位置: 首頁>>代碼示例>>Java>>正文


Java CodeStyleSettings.getIndentOptions方法代碼示例

本文整理匯總了Java中com.intellij.psi.codeStyle.CodeStyleSettings.getIndentOptions方法的典型用法代碼示例。如果您正苦於以下問題:Java CodeStyleSettings.getIndentOptions方法的具體用法?Java CodeStyleSettings.getIndentOptions怎麽用?Java CodeStyleSettings.getIndentOptions使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.psi.codeStyle.CodeStyleSettings的用法示例。


在下文中一共展示了CodeStyleSettings.getIndentOptions方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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: getOptions

import com.intellij.psi.codeStyle.CodeStyleSettings; //導入方法依賴的package包/類
private static Map<String, Object> getOptions() {
  Map<String, Object> options = ContainerUtil.newHashMap();

  options.put(IFernflowerPreferences.HIDE_DEFAULT_CONSTRUCTOR, "0");
  options.put(IFernflowerPreferences.DECOMPILE_GENERIC_SIGNATURES, "1");
  options.put(IFernflowerPreferences.REMOVE_SYNTHETIC, "1");
  options.put(IFernflowerPreferences.REMOVE_BRIDGE, "1");
  options.put(IFernflowerPreferences.LITERALS_AS_IS, "1");
  options.put(IFernflowerPreferences.NEW_LINE_SEPARATOR, "1");
  options.put(IFernflowerPreferences.BANNER, BANNER);
  options.put(IFernflowerPreferences.MAX_PROCESSING_METHOD, 60);

  Project project = DefaultProjectFactory.getInstance().getDefaultProject();
  CodeStyleSettings settings = CodeStyleSettingsManager.getInstance(project).getCurrentSettings();
  CommonCodeStyleSettings.IndentOptions indentOptions = settings.getIndentOptions(JavaFileType.INSTANCE);
  options.put(IFernflowerPreferences.INDENT_STRING, StringUtil.repeat(" ", indentOptions.INDENT_SIZE));

  if (ApplicationManager.getApplication().isUnitTestMode()) {
    options.put(IFernflowerPreferences.UNIT_TEST_MODE, "1");
  }

  return Collections.unmodifiableMap(options);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:24,代碼來源:IdeaDecompiler.java

示例3: getCodeStyleIntent

import com.intellij.psi.codeStyle.CodeStyleSettings; //導入方法依賴的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

示例4: 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,代碼來源:XsltRefactoringTest.java

示例5: testSmartTabsInFile3

import com.intellij.psi.codeStyle.CodeStyleSettings; //導入方法依賴的package包/類
public void testSmartTabsInFile3() {
  final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
  final CommonCodeStyleSettings.IndentOptions options = settings.getIndentOptions(JavaFileType.INSTANCE);
  options.USE_TAB_CHARACTER = true;
  options.SMART_TABS = true;
  doTest("/*File 'X.java' uses spaces for indentation*/class X {\n" +
         "\tvoid aaa(boolean a, boolean b, boolean c) {\n" +
         "\t\taaa(true,\n" +
         "\t \t    true,\n" +
         "\t\t    true);\n" +
         "\t}\n" +
         "}\n/**/");
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:ProblematicWhitespaceInspectionTest.java

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

示例7: testSmartTabsInFile2

import com.intellij.psi.codeStyle.CodeStyleSettings; //導入方法依賴的package包/類
public void testSmartTabsInFile2() {
  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" +
         "\tvoid aaa(boolean a, boolean b, boolean c) {\n" +
         "\t\taaa(true,\n" +
         "\t\t    true,\n" +
         "\t\t    true);\n" +
         "\t}\n" +
         "}\n");
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:14,代碼來源:ProblematicWhitespaceInspectionTest.java

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

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

示例10: testSuppression2

import com.intellij.psi.codeStyle.CodeStyleSettings; //導入方法依賴的package包/類
public void testSuppression2() {
  final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
  settings.getIndentOptions(JavaFileType.INSTANCE).USE_TAB_CHARACTER = false;
  myFixture.configureByText("x.css", "/*noinspection ProblematicWhitespace*/\n" +
                                     "div {\n" +
                                     " font-family: arial, helvetica;\n" +
                                     "}");
  myFixture.testHighlighting(true, false, false);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:ProblematicWhitespaceInspectionTest.java

示例11: testSmartTabsInFileWithoutBinaryExpressionMultilineAlignment

import com.intellij.psi.codeStyle.CodeStyleSettings; //導入方法依賴的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

示例12: testSpacesInFile

import com.intellij.psi.codeStyle.CodeStyleSettings; //導入方法依賴的package包/類
public void testSpacesInFile() {
  final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
  settings.getIndentOptions(JavaFileType.INSTANCE).USE_TAB_CHARACTER = true;
  doTest("/*File 'X.java' uses spaces for indentation*/class X {\n" +
         "  String s;\n" +
         "}\n/**/");
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:ProblematicWhitespaceInspectionTest.java

示例13: testSuppression1

import com.intellij.psi.codeStyle.CodeStyleSettings; //導入方法依賴的package包/類
public void testSuppression1() {
  final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
  settings.getIndentOptions(JavaFileType.INSTANCE).USE_TAB_CHARACTER = false;
  myFixture.configureByText("X.html", "<!--suppress ProblematicWhitespace --><html>\n" +
                                      "\t<body></body>\n" +
                                      "</html>");
  myFixture.testHighlighting(true, false, false);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:ProblematicWhitespaceInspectionTest.java

示例14: getIndentOptions

import com.intellij.psi.codeStyle.CodeStyleSettings; //導入方法依賴的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

示例15: testSpacesInFile2

import com.intellij.psi.codeStyle.CodeStyleSettings; //導入方法依賴的package包/類
public void testSpacesInFile2() {
  final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
  settings.getIndentOptions(JavaFileType.INSTANCE).USE_TAB_CHARACTER = false;
  doTest("class X {\n" +
         "  String s;\n" +
         "}\n");
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:8,代碼來源:ProblematicWhitespaceInspectionTest.java


注:本文中的com.intellij.psi.codeStyle.CodeStyleSettings.getIndentOptions方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。