Java 类com.intellij.psi.formatter.xml.XmlCodeStyleSettings 实例源码

项目:intellij-ce-playground    文件:CodeStyleXmlPanel.java   
@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);
}
项目:intellij-ce-playground    文件:CodeStyleXmlPanel.java   
@Override
protected void resetImpl(final CodeStyleSettings settings) {
  XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
  myKeepBlankLines.setText(String.valueOf(xmlSettings.XML_KEEP_BLANK_LINES));
  myWrapAttributes.setSelectedIndex(getIndexForWrapping(xmlSettings.XML_ATTRIBUTE_WRAP));
  myAlignAttributes.setSelected(xmlSettings.XML_ALIGN_ATTRIBUTES);
  myKeepWhiteSpaces.setSelected(xmlSettings.XML_KEEP_WHITESPACES);
  mySpacesAfterTagName.setSelected(xmlSettings.XML_SPACE_AFTER_TAG_NAME);
  mySpacesAroundEquality.setSelected(xmlSettings.XML_SPACE_AROUND_EQUALITY_IN_ATTRIBUTE);
  myKeepLineBreaks.setSelected(xmlSettings.XML_KEEP_LINE_BREAKS);
  myKeepLineBreaksInText.setSelected(xmlSettings.XML_KEEP_LINE_BREAKS_IN_TEXT);
  myInEmptyTag.setSelected(xmlSettings.XML_SPACE_INSIDE_EMPTY_TAG);
  myWrapText.setSelected(wrapText(settings));
  myWhiteSpaceAroundCDATA.setSelectedIndex(xmlSettings.XML_WHITE_SPACE_AROUND_CDATA);
  myKeepWhitespaceInsideCDATACheckBox.setSelected(xmlSettings.XML_KEEP_WHITE_SPACES_INSIDE_CDATA);
  myRightMarginForm.reset(settings);
}
项目:intellij-ce-playground    文件:XmlFormatterTestCase.java   
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>");
}
项目:intellij-ce-playground    文件:AndroidXmlPredefinedCodeStyle.java   
@Override
public void apply(CodeStyleSettings settings) {
  final CommonCodeStyleSettings.IndentOptions indentOptions = settings.getIndentOptions(XmlFileType.INSTANCE);
  indentOptions.CONTINUATION_INDENT_SIZE = indentOptions.INDENT_SIZE;

  XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
  xmlSettings.XML_ALIGN_ATTRIBUTES = false;
  xmlSettings.XML_SPACE_INSIDE_EMPTY_TAG = true;
  xmlSettings.XML_KEEP_LINE_BREAKS = false;

  final AndroidXmlCodeStyleSettings androidSettings = AndroidXmlCodeStyleSettings.getInstance(settings);
  androidSettings.USE_CUSTOM_SETTINGS = true;

  androidSettings.LAYOUT_SETTINGS = new AndroidXmlCodeStyleSettings.LayoutSettings();
  androidSettings.MANIFEST_SETTINGS = new AndroidXmlCodeStyleSettings.ManifestSettings();
  androidSettings.VALUE_RESOURCE_FILE_SETTINGS = new AndroidXmlCodeStyleSettings.ValueResourceFileSettings();
  androidSettings.OTHER_SETTINGS = new AndroidXmlCodeStyleSettings.OtherSettings();

  // arrangement
  final List<StdArrangementMatchRule> rules = new ArrayList<StdArrangementMatchRule>();
  rules.add(attrArrangementRule("xmlns:android", "", KEEP));
  rules.add(attrArrangementRule("xmlns:.*", "", BY_NAME));
  rules.add(attrArrangementRule(".*:id", SdkConstants.NS_RESOURCES, KEEP));
  rules.add(attrArrangementRule(".*:name", SdkConstants.NS_RESOURCES, KEEP));
  rules.add(attrArrangementRule("name", "^$", KEEP));
  rules.add(attrArrangementRule("style", "^$", KEEP));
  rules.add(attrArrangementRule(".*", "^$", BY_NAME));
  rules.add(attrArrangementRule(".*:layout_width", SdkConstants.NS_RESOURCES, KEEP));
  rules.add(attrArrangementRule(".*:layout_height", SdkConstants.NS_RESOURCES, KEEP));
  rules.add(attrArrangementRule(".*:layout_.*", SdkConstants.NS_RESOURCES, BY_NAME));
  rules.add(attrArrangementRule(".*:width", SdkConstants.NS_RESOURCES, BY_NAME));
  rules.add(attrArrangementRule(".*:height", SdkConstants.NS_RESOURCES, BY_NAME));
  rules.add(attrArrangementRule(".*", SdkConstants.NS_RESOURCES, BY_NAME));
  rules.add(attrArrangementRule(".*", ".*", BY_NAME));
  // TODO: Should sort name:"color",namespace:"" to the end (primarily for color state lists)
  final CommonCodeStyleSettings xmlCommonSettings = settings.getCommonSettings(XMLLanguage.INSTANCE);
  xmlCommonSettings.setArrangementSettings(
    StdArrangementSettings.createByMatchRules(ContainerUtil.<ArrangementGroupingRule>emptyList(), rules));
  xmlCommonSettings.FORCE_REARRANGE_MODE = CommonCodeStyleSettings.REARRANGE_ALWAYS;
}
项目:intellij-ce-playground    文件:AndroidXmlFormatterTest.java   
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");
}
项目:intellij-ce-playground    文件:AndroidXmlFormatterTest.java   
public void testLayout4() throws Exception {
  new AndroidXmlPredefinedCodeStyle().apply(mySettings);
  final XmlCodeStyleSettings xmlSettings = mySettings.getCustomSettings(XmlCodeStyleSettings.class);
  xmlSettings.XML_ALIGN_ATTRIBUTES = true;
  final AndroidXmlCodeStyleSettings androidSettings = mySettings.getCustomSettings(AndroidXmlCodeStyleSettings.class);
  androidSettings.LAYOUT_SETTINGS.INSERT_LINE_BREAK_BEFORE_FIRST_ATTRIBUTE = false;
  androidSettings.LAYOUT_SETTINGS.INSERT_BLANK_LINE_BEFORE_TAG = false;
  doTestLayout("layout1.xml");
}
项目:intellij-ce-playground    文件:AndroidXmlFormatterTest.java   
public void testLayout6() throws Exception {
  new AndroidXmlPredefinedCodeStyle().apply(mySettings);
  final XmlCodeStyleSettings xmlSettings = mySettings.getCustomSettings(XmlCodeStyleSettings.class);
  xmlSettings.XML_ALIGN_ATTRIBUTES = false;
  final AndroidXmlCodeStyleSettings androidSettings = mySettings.getCustomSettings(AndroidXmlCodeStyleSettings.class);
  androidSettings.LAYOUT_SETTINGS.INSERT_LINE_BREAK_BEFORE_FIRST_ATTRIBUTE = false;
  androidSettings.LAYOUT_SETTINGS.INSERT_BLANK_LINE_BEFORE_TAG = false;
  doTestLayout("layout1.xml");
}
项目:intellij-ce-playground    文件:AndroidXmlFormatterTest.java   
public void testLayout7() throws Exception {
  new AndroidXmlPredefinedCodeStyle().apply(mySettings);
  final XmlCodeStyleSettings xmlSettings = mySettings.getCustomSettings(XmlCodeStyleSettings.class);
  xmlSettings.XML_ALIGN_ATTRIBUTES = true;
  final AndroidXmlCodeStyleSettings androidSettings = mySettings.getCustomSettings(AndroidXmlCodeStyleSettings.class);
  androidSettings.LAYOUT_SETTINGS.INSERT_LINE_BREAK_AFTER_LAST_ATTRIBUTE = true;
  doTestLayout("layout1.xml");
}
项目:intellij-ce-playground    文件:AndroidXmlFormatterTest.java   
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");
}
项目:intellij-ce-playground    文件:AndroidXmlFormatterTest.java   
public void testManifest4() throws Exception {
  deleteManifest();
  new AndroidXmlPredefinedCodeStyle().apply(mySettings);
  final XmlCodeStyleSettings xmlSettings = mySettings.getCustomSettings(XmlCodeStyleSettings.class);
  xmlSettings.XML_ALIGN_ATTRIBUTES = true;
  final AndroidXmlCodeStyleSettings androidSettings = mySettings.getCustomSettings(AndroidXmlCodeStyleSettings.class);
  androidSettings.MANIFEST_SETTINGS.INSERT_LINE_BREAK_BEFORE_FIRST_ATTRIBUTE = false;
  doTestManifest("manifest1.xml");
}
项目:intellij-ce-playground    文件:XsltRefactoringTest.java   
@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;
}
项目:intellij-ce-playground    文件:Xslt2RefactoringTest.java   
@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;
}
项目:tools-idea    文件:XmlFormatterTestCase.java   
public void testDontKeepLineBreaksInText() throws Throwable {
  final CodeStyleSettings settings = getSettings();
  final XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
  settings.RIGHT_MARGIN = 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 = CodeStyleSettings.DO_NOT_WRAP;
  xmlSettings.XML_TEXT_WRAP = CodeStyleSettings.DO_NOT_WRAP;
  doTextTest("<tag>aaa\nbbb\nccc\nddd\n</tag>", "<tag>aaa bbb ccc ddd\n</tag>");
}
项目:tools-idea    文件:CodeStyleXmlPanel.java   
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() ? CodeStyleSettings.WRAP_AS_NEEDED : CodeStyleSettings.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();
}
项目:tools-idea    文件:CodeStyleXmlPanel.java   
protected void resetImpl(final CodeStyleSettings settings) {
  XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
  myKeepBlankLines.setText(String.valueOf(xmlSettings.XML_KEEP_BLANK_LINES));
  myWrapAttributes.setSelectedIndex(getIndexForWrapping(xmlSettings.XML_ATTRIBUTE_WRAP));
  myAlignAttributes.setSelected(xmlSettings.XML_ALIGN_ATTRIBUTES);
  myKeepWhiteSpaces.setSelected(xmlSettings.XML_KEEP_WHITESPACES);
  mySpacesAfterTagName.setSelected(xmlSettings.XML_SPACE_AFTER_TAG_NAME);
  mySpacesAroundEquality.setSelected(xmlSettings.XML_SPACE_AROUND_EQUALITY_IN_ATTRIBUTE);
  myKeepLineBreaks.setSelected(xmlSettings.XML_KEEP_LINE_BREAKS);
  myKeepLineBreaksInText.setSelected(xmlSettings.XML_KEEP_LINE_BREAKS_IN_TEXT);
  myInEmptyTag.setSelected(xmlSettings.XML_SPACE_INSIDE_EMPTY_TAG);
  myWrapText.setSelected(wrapText(settings));
  myWhiteSpaceAroundCDATA.setSelectedIndex(xmlSettings.XML_WHITE_SPACE_AROUND_CDATA);
  myKeepWhitespaceInsideCDATACheckBox.setSelected(xmlSettings.XML_KEEP_WHITE_SPACES_INSIDE_CDATA);
}
项目:tools-idea    文件:XsltRefactoringTest.java   
@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;
}
项目:tools-idea    文件:Xslt2RefactoringTest.java   
@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;
}
项目:yiistorm    文件:IdeHelper.java   
public static XmlCodeStyleSettings getXmlSettings(Project project) {
    CodeStyleSettings settings = getSettings(project);
    if (settings != null) {
        return settings.getCustomSettings(XmlCodeStyleSettings.class);
    }
    return null;
}
项目:consulo-xml    文件:CodeStyleXmlPanel.java   
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() ? CodeStyleSettings.WRAP_AS_NEEDED : CodeStyleSettings.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();
}
项目:consulo-xml    文件:CodeStyleXmlPanel.java   
protected void resetImpl(final CodeStyleSettings settings) {
  XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
  myKeepBlankLines.setText(String.valueOf(xmlSettings.XML_KEEP_BLANK_LINES));
  myWrapAttributes.setSelectedIndex(getIndexForWrapping(xmlSettings.XML_ATTRIBUTE_WRAP));
  myAlignAttributes.setSelected(xmlSettings.XML_ALIGN_ATTRIBUTES);
  myKeepWhiteSpaces.setSelected(xmlSettings.XML_KEEP_WHITESPACES);
  mySpacesAfterTagName.setSelected(xmlSettings.XML_SPACE_AFTER_TAG_NAME);
  mySpacesAroundEquality.setSelected(xmlSettings.XML_SPACE_AROUND_EQUALITY_IN_ATTRIBUTE);
  myKeepLineBreaks.setSelected(xmlSettings.XML_KEEP_LINE_BREAKS);
  myKeepLineBreaksInText.setSelected(xmlSettings.XML_KEEP_LINE_BREAKS_IN_TEXT);
  myInEmptyTag.setSelected(xmlSettings.XML_SPACE_INSIDE_EMPTY_TAG);
  myWrapText.setSelected(wrapText(settings));
  myWhiteSpaceAroundCDATA.setSelectedIndex(xmlSettings.XML_WHITE_SPACE_AROUND_CDATA);
  myKeepWhitespaceInsideCDATACheckBox.setSelected(xmlSettings.XML_KEEP_WHITE_SPACES_INSIDE_CDATA);
}
项目:intellij-ce-playground    文件:XmlCodeStyleSettingsProvider.java   
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
  return new XmlCodeStyleSettings(settings);
}
项目:intellij-ce-playground    文件:CodeStyleXmlPanel.java   
@Override
public boolean isModified(CodeStyleSettings settings) {
  XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
  if (myWrapText.isSelected() != wrapText(settings)) {
    return true;
  }
  if (xmlSettings.XML_KEEP_BLANK_LINES != getIntValue(myKeepBlankLines)) {
    return true;
  }
  if (xmlSettings.XML_ATTRIBUTE_WRAP != ourWrappings[myWrapAttributes.getSelectedIndex()]) {
    return true;
  }
  if (xmlSettings.XML_ALIGN_ATTRIBUTES != myAlignAttributes.isSelected()) {
    return true;
  }
  if (xmlSettings.XML_KEEP_WHITESPACES != myKeepWhiteSpaces.isSelected()) {
    return true;
  }

  if (xmlSettings.XML_SPACE_AROUND_EQUALITY_IN_ATTRIBUTE != mySpacesAroundEquality.isSelected()){
    return true;
  }

  if (xmlSettings.XML_SPACE_AFTER_TAG_NAME != mySpacesAfterTagName.isSelected()){
    return true;
  }

  if (xmlSettings.XML_KEEP_LINE_BREAKS != myKeepLineBreaks.isSelected()) {
    return true;
  }

  if (xmlSettings.XML_KEEP_LINE_BREAKS_IN_TEXT != myKeepLineBreaksInText.isSelected()) {
    return true;
  }

  if (xmlSettings.XML_SPACE_INSIDE_EMPTY_TAG != myInEmptyTag.isSelected()){
    return true;
  }
  if (xmlSettings.XML_WHITE_SPACE_AROUND_CDATA != myWhiteSpaceAroundCDATA.getSelectedIndex()) {
    return true;
  }
  if (xmlSettings.XML_KEEP_WHITE_SPACES_INSIDE_CDATA != this.myKeepWhitespaceInsideCDATACheckBox.isSelected()) {
    return true;
  }

  return myRightMarginForm.isModified(settings);
}
项目:intellij-ce-playground    文件:CodeStyleXmlPanel.java   
private boolean wrapText(final CodeStyleSettings settings) {
  XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
  return xmlSettings.XML_TEXT_WRAP == CommonCodeStyleSettings.WRAP_AS_NEEDED;
}
项目:intellij-ce-playground    文件:AndroidXmlFormatterTest.java   
public void testManifest2() throws Exception {
  deleteManifest();
  final XmlCodeStyleSettings xmlSettings = mySettings.getCustomSettings(XmlCodeStyleSettings.class);
  xmlSettings.XML_ATTRIBUTE_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP;
  doTestManifest("manifest1.xml");
}
项目:intellij-ce-playground    文件:AndroidXmlFormatterTest.java   
public void testManifest7() throws Exception {
  deleteManifest();
  final XmlCodeStyleSettings xmlSettings = mySettings.getCustomSettings(XmlCodeStyleSettings.class);
  xmlSettings.XML_ATTRIBUTE_WRAP = CommonCodeStyleSettings.WRAP_ON_EVERY_ITEM;
  doTestManifest("manifest1.xml");
}
项目:intellij-ce-playground    文件:MavenDependencyCompletionAndResolutionTest.java   
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());
}
项目:tools-idea    文件:XmlCodeStyleSettingsProvider.java   
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
  return new XmlCodeStyleSettings(settings);
}
项目:tools-idea    文件:CodeStyleXmlPanel.java   
public boolean isModified(CodeStyleSettings settings) {
  XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
  if (myWrapText.isSelected() != wrapText(settings)) {
    return true;
  }
  if (xmlSettings.XML_KEEP_BLANK_LINES != getIntValue(myKeepBlankLines)) {
    return true;
  }
  if (xmlSettings.XML_ATTRIBUTE_WRAP != ourWrappings[myWrapAttributes.getSelectedIndex()]) {
    return true;
  }
  if (xmlSettings.XML_ALIGN_ATTRIBUTES != myAlignAttributes.isSelected()) {
    return true;
  }
  if (xmlSettings.XML_KEEP_WHITESPACES != myKeepWhiteSpaces.isSelected()) {
    return true;
  }

  if (xmlSettings.XML_SPACE_AROUND_EQUALITY_IN_ATTRIBUTE != mySpacesAroundEquality.isSelected()){
    return true;
  }

  if (xmlSettings.XML_SPACE_AFTER_TAG_NAME != mySpacesAfterTagName.isSelected()){
    return true;
  }

  if (xmlSettings.XML_KEEP_LINE_BREAKS != myKeepLineBreaks.isSelected()) {
    return true;
  }

  if (xmlSettings.XML_KEEP_LINE_BREAKS_IN_TEXT != myKeepLineBreaksInText.isSelected()) {
    return true;
  }

  if (xmlSettings.XML_SPACE_INSIDE_EMPTY_TAG != myInEmptyTag.isSelected()){
    return true;
  }
  if (xmlSettings.XML_WHITE_SPACE_AROUND_CDATA != myWhiteSpaceAroundCDATA.getSelectedIndex()) {
    return true;
  }
  if (xmlSettings.XML_KEEP_WHITE_SPACES_INSIDE_CDATA != this.myKeepWhitespaceInsideCDATACheckBox.isSelected()) {
    return true;
  }

  return false;
}
项目:tools-idea    文件:CodeStyleXmlPanel.java   
private boolean wrapText(final CodeStyleSettings settings) {
  XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
  return xmlSettings.XML_TEXT_WRAP == CodeStyleSettings.WRAP_AS_NEEDED;
}
项目:tools-idea    文件:MavenDependencyCompletionAndResolutionTest.java   
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());
}
项目:consulo-xml    文件:XmlCodeStyleSettingsProvider.java   
@Override
public CustomCodeStyleSettings createCustomSettings(CodeStyleSettings settings) {
  return new XmlCodeStyleSettings(settings);
}
项目:consulo-xml    文件:CodeStyleXmlPanel.java   
public boolean isModified(CodeStyleSettings settings) {
  XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
  if (myWrapText.isSelected() != wrapText(settings)) {
    return true;
  }
  if (xmlSettings.XML_KEEP_BLANK_LINES != getIntValue(myKeepBlankLines)) {
    return true;
  }
  if (xmlSettings.XML_ATTRIBUTE_WRAP != ourWrappings[myWrapAttributes.getSelectedIndex()]) {
    return true;
  }
  if (xmlSettings.XML_ALIGN_ATTRIBUTES != myAlignAttributes.isSelected()) {
    return true;
  }
  if (xmlSettings.XML_KEEP_WHITESPACES != myKeepWhiteSpaces.isSelected()) {
    return true;
  }

  if (xmlSettings.XML_SPACE_AROUND_EQUALITY_IN_ATTRIBUTE != mySpacesAroundEquality.isSelected()){
    return true;
  }

  if (xmlSettings.XML_SPACE_AFTER_TAG_NAME != mySpacesAfterTagName.isSelected()){
    return true;
  }

  if (xmlSettings.XML_KEEP_LINE_BREAKS != myKeepLineBreaks.isSelected()) {
    return true;
  }

  if (xmlSettings.XML_KEEP_LINE_BREAKS_IN_TEXT != myKeepLineBreaksInText.isSelected()) {
    return true;
  }

  if (xmlSettings.XML_SPACE_INSIDE_EMPTY_TAG != myInEmptyTag.isSelected()){
    return true;
  }
  if (xmlSettings.XML_WHITE_SPACE_AROUND_CDATA != myWhiteSpaceAroundCDATA.getSelectedIndex()) {
    return true;
  }
  if (xmlSettings.XML_KEEP_WHITE_SPACES_INSIDE_CDATA != this.myKeepWhitespaceInsideCDATACheckBox.isSelected()) {
    return true;
  }

  return false;
}
项目:consulo-xml    文件:CodeStyleXmlPanel.java   
private boolean wrapText(final CodeStyleSettings settings) {
  XmlCodeStyleSettings xmlSettings = settings.getCustomSettings(XmlCodeStyleSettings.class);
  return xmlSettings.XML_TEXT_WRAP == CodeStyleSettings.WRAP_AS_NEEDED;
}