use of com.intellij.psi.formatter.xml.XmlCodeStyleSettings in project intellij-community by JetBrains.
the class XmlFormatterTestCase method 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>");
}
use of com.intellij.psi.formatter.xml.XmlCodeStyleSettings in project intellij-community by JetBrains.
the class XsltRefactoringTest method setUp.
@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;
}
use of com.intellij.psi.formatter.xml.XmlCodeStyleSettings in project intellij-community by JetBrains.
the class MavenDependencyCompletionAndResolutionTest method 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 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());
}
use of com.intellij.psi.formatter.xml.XmlCodeStyleSettings in project intellij-community by JetBrains.
the class CodeStyleXmlPanel method 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);
}
use of com.intellij.psi.formatter.xml.XmlCodeStyleSettings in project intellij-community by JetBrains.
the class CodeStyleXmlPanel method resetImpl.
@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);
}
Aggregations