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


Java CommonCodeStyleSettings.DO_NOT_WRAP属性代码示例

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


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

示例1: apply

@Override
public void apply(CodeStyleSettings settings) {
  XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
  xmlSettings.XML_KEEP_BLANK_LINES = getIntValue(myKeepBlankLines);
  xmlSettings.XML_KEEP_LINE_BREAKS = myKeepLineBreaks.isSelected();
  xmlSettings.XML_KEEP_LINE_BREAKS_IN_TEXT = myKeepLineBreaksInText.isSelected();
  xmlSettings.XML_ATTRIBUTE_WRAP = ourWrappings[myWrapAttributes.getSelectedIndex()];
  xmlSettings.XML_TEXT_WRAP = myWrapText.isSelected() ? CommonCodeStyleSettings.WRAP_AS_NEEDED : CommonCodeStyleSettings.DO_NOT_WRAP;
  xmlSettings.XML_ALIGN_ATTRIBUTES = myAlignAttributes.isSelected();
  xmlSettings.XML_KEEP_WHITESPACES = myKeepWhiteSpaces.isSelected();
  xmlSettings.XML_SPACE_AROUND_EQUALITY_IN_ATTRIBUTE = mySpacesAroundEquality.isSelected();
  xmlSettings.XML_SPACE_AFTER_TAG_NAME = mySpacesAfterTagName.isSelected();
  xmlSettings.XML_SPACE_INSIDE_EMPTY_TAG = myInEmptyTag.isSelected();
  xmlSettings.XML_WHITE_SPACE_AROUND_CDATA = myWhiteSpaceAroundCDATA.getSelectedIndex();
  xmlSettings.XML_KEEP_WHITE_SPACES_INSIDE_CDATA = myKeepWhitespaceInsideCDATACheckBox.isSelected();
  myRightMarginForm.apply(settings);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CodeStyleXmlPanel.java

示例2: getWrapType

@NotNull
public static WrapType getWrapType(int wrap) {
  switch (wrap) {
    case CommonCodeStyleSettings.WRAP_ALWAYS:
      return WrapType.ALWAYS;
    case CommonCodeStyleSettings.WRAP_AS_NEEDED:
      return WrapType.NORMAL;
    case CommonCodeStyleSettings.DO_NOT_WRAP:
      return WrapType.NONE;
    default:
      return WrapType.CHOP_DOWN_IF_LONG;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:JavaFormatterUtil.java

示例3: getWrapType

public int getWrapType() {
  switch (getEclipseWrap()) {
    case WRAP_WHERE_NECESSARY:
    case WRAP_FIRST_OTHERS_WHERE_NECESSARY:
      return CommonCodeStyleSettings.WRAP_AS_NEEDED;
    case WRAP_ALL_EXCEPT_FIRST:
    case WRAP_ALL_INDENT_EXCEPT_FIRST:
    case WRAP_ALL_ON_NEW_LINE_EACH:
      return CommonCodeStyleSettings.WRAP_AS_NEEDED | CommonCodeStyleSettings.WRAP_ON_EVERY_ITEM;
  }
  return CommonCodeStyleSettings.DO_NOT_WRAP;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:EclipseCodeStyleImportWorker.java

示例4: testIncompleteFieldAndAnnotationWrap

public void testIncompleteFieldAndAnnotationWrap() {
  // Inspired by IDEA-64725

  getSettings().FIELD_ANNOTATION_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP;
  doClassTest(
      "@NotNull Comparable<String>",
      "@NotNull Comparable<String>"
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:JavaFormatterWrapTest.java

示例5: testDontKeepLineBreaksInText

public void testDontKeepLineBreaksInText() throws Throwable {
  final CodeStyleSettings settings = getSettings();
  final XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
  settings.setDefaultRightMargin(15);

  settings.HTML_KEEP_LINE_BREAKS_IN_TEXT = false;
  xmlSettings.XML_KEEP_LINE_BREAKS_IN_TEXT = false;
  doTextTest("<tag>aaa\nbbb\nccc\nddd\n</tag>", "<tag>aaa bbb\n    ccc ddd\n</tag>");

  settings.HTML_TEXT_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP;
  xmlSettings.XML_TEXT_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP;
  doTextTest("<tag>aaa\nbbb\nccc\nddd\n</tag>", "<tag>aaa bbb ccc ddd\n</tag>");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:XmlFormatterTestCase.java

示例6: testLayout3

public void testLayout3() throws Exception {
  new AndroidXmlPredefinedCodeStyle().apply(mySettings);
  final XmlCodeStyleSettings xmlSettings = mySettings.getCustomSettings(XmlCodeStyleSettings.class);
  xmlSettings.XML_ATTRIBUTE_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP;
  xmlSettings.XML_KEEP_BLANK_LINES = 0;
  doTestLayout("layout1.xml");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:AndroidXmlFormatterTest.java

示例7: testManifest3

public void testManifest3() throws Exception {
  deleteManifest();
  new AndroidXmlPredefinedCodeStyle().apply(mySettings);
  final XmlCodeStyleSettings xmlSettings = mySettings.getCustomSettings(XmlCodeStyleSettings.class);
  xmlSettings.XML_ATTRIBUTE_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP;
  xmlSettings.XML_KEEP_BLANK_LINES = 0;
  doTestManifest("manifest1.xml");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:AndroidXmlFormatterTest.java

示例8: testManifest5

public void testManifest5() throws Exception {
  deleteManifest();
  new AndroidXmlPredefinedCodeStyle().apply(mySettings);
  final AndroidXmlCodeStyleSettings androidSettings = mySettings.getCustomSettings(AndroidXmlCodeStyleSettings.class);
  androidSettings.MANIFEST_SETTINGS.WRAP_ATTRIBUTES = CommonCodeStyleSettings.DO_NOT_WRAP;
  doTestManifest("manifest1.xml");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:AndroidXmlFormatterTest.java

示例9: getAnnotationWrapType

private static int getAnnotationWrapType(ASTNode parent, ASTNode child, CommonCodeStyleSettings settings) {
  IElementType nodeType = parent.getElementType();

  if (nodeType == JavaElementType.METHOD) {
    return settings.METHOD_ANNOTATION_WRAP;
  }

  if (nodeType == JavaElementType.CLASS) {
    // There is a possible case that current document state is invalid from language syntax point of view, e.g. the user starts
    // typing field definition and re-formatting is triggered by 'auto insert javadoc' processing. Example:
    //     class Test {
    //         @NotNull Object
    //     }
    // Here '@NotNull' has a 'class' node as a parent but we want to use field annotation setting value.
    // Hence we check if subsequent parsed info is valid.
    for (ASTNode node = child.getTreeNext(); node != null; node = node.getTreeNext()) {
      if (node.getElementType() == TokenType.WHITE_SPACE || node instanceof PsiTypeElement) {
        continue;
      }
      if (node instanceof PsiErrorElement) {
        return settings.FIELD_ANNOTATION_WRAP;
      }
    }
    return settings.CLASS_ANNOTATION_WRAP;
  }

  if (nodeType == JavaElementType.FIELD) {
    return settings.FIELD_ANNOTATION_WRAP;
  }

  if (nodeType == JavaElementType.PARAMETER ||
      nodeType == JavaElementType.RECEIVER_PARAMETER ||
      nodeType == JavaElementType.RESOURCE_VARIABLE) {
    return settings.PARAMETER_ANNOTATION_WRAP;
  }

  if (nodeType == JavaElementType.LOCAL_VARIABLE) {
    return settings.VARIABLE_ANNOTATION_WRAP;
  }

  return CommonCodeStyleSettings.DO_NOT_WRAP;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:JavaChildWrapArranger.java

示例10: testAssertStatementWrapping

public void testAssertStatementWrapping() throws Exception {
    getSettings().ASSERT_STATEMENT_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
    getSettings().BINARY_OPERATION_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP;
    getSettings().RIGHT_MARGIN = 40;
    final JavaPsiFacade facade = getJavaFacade();
    final LanguageLevel effectiveLanguageLevel = LanguageLevelProjectExtension.getInstance(facade.getProject()).getLanguageLevel();
    try {
      LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);

      getSettings().ASSERT_STATEMENT_COLON_ON_NEXT_LINE = false;
      doTextTest("class Foo {\n" +
                 "    void foo() {\n" +
                 "        assert methodWithVeryVeryLongName() : foo;\n" +
                 "        assert i + j + k + l + n + m <= 2 : \"assert description\";\n" +
                 "    }\n" +
"}\n", "class Foo {\n" +
       "    void foo() {\n" +
       "        assert methodWithVeryVeryLongName() :\n" +
       "                foo;\n" +
       "        assert i + j + k + l + n + m <= 2 :\n" +
       "                \"assert description\";\n" +
       "    }\n" +
       "}\n");

      getSettings().ASSERT_STATEMENT_COLON_ON_NEXT_LINE = true;
      doTextTest("class Foo {\n" +
                 "    void foo() {\n" +
                 "        assert methodWithVeryVeryLongName() : foo;\n" +
                 "        assert i + j + k + l + n + m <= 2 : \"assert description\";\n" +
                 "    }\n" +
"}\n", "class Foo {\n" +
       "    void foo() {\n" +
       "        assert methodWithVeryVeryLongName()\n" +
       "                : foo;\n" +
       "        assert i + j + k + l + n + m <= 2\n" +
       "                : \"assert description\";\n" +
       "    }\n" +
       "}\n");

    }
    finally {
      LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(effectiveLanguageLevel);
    }
  }
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:JavaFormatterTest.java

示例11: testAssertStatementWrapping2

public void testAssertStatementWrapping2() throws Exception {
  getSettings().BINARY_OPERATION_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP;
  getSettings().ASSERT_STATEMENT_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
  getSettings().RIGHT_MARGIN = 37;

  final CommonCodeStyleSettings.IndentOptions options = getSettings().getRootSettings().getIndentOptions(StdFileTypes.JAVA);
  options.INDENT_SIZE = 2;
  options.CONTINUATION_INDENT_SIZE = 2;

  getSettings().ASSERT_STATEMENT_COLON_ON_NEXT_LINE = true;

  final JavaPsiFacade facade = getJavaFacade();
  final LanguageLevel effectiveLanguageLevel = LanguageLevelProjectExtension.getInstance(facade.getProject()).getLanguageLevel();
  LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(LanguageLevel.JDK_1_5);

  try {
    doTextTest(
      "class Foo {\n" + "    void foo() {\n" + "        assert i + j + k + l + n + m <= 2 : \"assert description\";" + "    }\n" + "}",
      "class Foo {\n" +
      "  void foo() {\n" +
      "    assert i + j + k + l + n + m <= 2\n" +
      "      : \"assert description\";\n" +
      "  }\n" +
      "}");

    getSettings().ASSERT_STATEMENT_COLON_ON_NEXT_LINE = false;

    doTextTest(
      "class Foo {\n" + "    void foo() {\n" + "        assert i + j + k + l + n + m <= 2 : \"assert description\";" + "    }\n" + "}",
      "class Foo {\n" +
      "  void foo() {\n" +
      "    assert\n" +
      "      i + j + k + l + n + m <= 2 :\n" +
      "      \"assert description\";\n" +
      "  }\n" +
      "}");
  }
  finally {
    LanguageLevelProjectExtension.getInstance(facade.getProject()).setLanguageLevel(effectiveLanguageLevel);
  }

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:JavaFormatterTest.java

示例12: testFieldInColumnsAlignment

public void testFieldInColumnsAlignment() {
  // Inspired by IDEA-55147
  getSettings().ALIGN_GROUP_FIELD_DECLARATIONS = true;
  getSettings().FIELD_ANNOTATION_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP;
  getSettings().VARIABLE_ANNOTATION_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP;

  doTextTest(
    "public class FormattingTest {\n" +
    "\n" +
    "    int start = 1;\n" +
    "    double end = 2;\n" +
    "\n" +
    "    int i2 = 1;\n" +
    "    double dd2,\n" +
    "        dd3 = 2;\n" +
    "\n" +
    "    // asd\n" +
    "    char ccc3 = 'a';\n" +
    "    double ddd31, ddd32 = 1;\n" +
    "\n" +
    "    private\n" +
    "    final String s4 = \"\";\n" +
    "    private\n" +
    "    transient int i4 = 1;\n" +
    "\n" +
    "    private final String s5 = \"xxx\";\n" +
    "    private transient int iiii5 = 1;\n" +
    "    /*sdf*/\n" +
    "    @MyAnnotation(value = 1, text = 2) float f5 = 1;\n" +
    "}",

    "public class FormattingTest {\n" +
    "\n" +
    "    int    start = 1;\n" +
    "    double end   = 2;\n" +
    "\n" +
    "    int    i2   = 1;\n" +
    "    double dd2,\n" +
    "            dd3 = 2;\n" +
    "\n" +
    "    // asd\n" +
    "    char   ccc3         = 'a';\n" +
    "    double ddd31, ddd32 = 1;\n" +
    "\n" +
    "    private\n" +
    "    final     String s4 = \"\";\n" +
    "    private\n" +
    "    transient int    i4 = 1;\n" +
    "\n" +
    "    private final                      String s5    = \"xxx\";\n" +
    "    private transient                  int    iiii5 = 1;\n" +
    "    /*sdf*/\n" +
    "    @MyAnnotation(value = 1, text = 2) float  f5    = 1;\n" +
    "}"
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:56,代码来源:JavaFormatterAlignmentTest.java

示例13: shouldWrap

public static boolean shouldWrap(int setting) {
  return setting != CommonCodeStyleSettings.DO_NOT_WRAP;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:3,代码来源:WrappingUtil.java

示例14: testChooseFileIntentionForSystemDependency

public void testChooseFileIntentionForSystemDependency() throws Throwable {
  createProjectPom("<groupId>test</groupId>" +
                   "<artifactId>project</artifactId>" +
                   "<version>1</version>" +

                   "<dependencies>" +
                   "  <dependency><caret>" +
                   "    <groupId>xxx</groupId>" +
                   "    <artifactId>xxx</artifactId>" +
                   "    <version>xxx</version>" +
                   "    <scope>system</system>" +
                   "  </dependency>" +
                   "</dependencies>");

  IntentionAction action = getIntentionAtCaret("Choose File");
  assertNotNull(action);

  String libPath = myIndicesFixture.getRepositoryHelper().getTestDataPath("local1/junit/junit/4.0/junit-4.0.jar");
  final VirtualFile libFile = LocalFileSystem.getInstance().refreshAndFindFileByPath(libPath);

  ((ChooseFileIntentionAction)((IntentionActionWrapper)action).getDelegate()).setFileChooser(new Producer<VirtualFile[]>() {
    @Override
    public VirtualFile[] produce() {
      return new VirtualFile[]{libFile};
    }
  });
  XmlCodeStyleSettings xmlSettings =
    CodeStyleSettingsManager.getInstance(myProject).getCurrentSettings().getCustomSettings(XmlCodeStyleSettings.class);

  int prevValue = xmlSettings.XML_TEXT_WRAP;
  try {
    // prevent file path from wrapping.
    xmlSettings.XML_TEXT_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP;
    myFixture.launchAction(action);
  }
  finally {
    xmlSettings.XML_TEXT_WRAP = prevValue;
    ((ChooseFileIntentionAction)((IntentionActionWrapper)action).getDelegate()).setFileChooser(null);
  }

  MavenDomProjectModel model = MavenDomUtil.getMavenDomProjectModel(myProject, myProjectPom);
  MavenDomDependency dep = model.getDependencies().getDependencies().get(0);

  assertEquals(findPsiFile(libFile), dep.getSystemPath().getValue());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:45,代码来源:MavenDependencyCompletionAndResolutionTest.java

示例15: getFirstElementWrapType

public int getFirstElementWrapType() {
  return isNewLineBeforeFirst() ? CommonCodeStyleSettings.WRAP_ALWAYS :
         getEclipseWrap() == WRAP_ALL_EXCEPT_FIRST ? CommonCodeStyleSettings.DO_NOT_WRAP :
         CommonCodeStyleSettings.WRAP_AS_NEEDED;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:EclipseCodeStyleImportWorker.java


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