This commit is contained in:
Rustam Vishnyakov
2017-01-18 17:43:52 +03:00
parent 3f6401cdff
commit ae2c890c9b
2 changed files with 11 additions and 34 deletions
@@ -537,19 +537,17 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea
unknownElementCollector.addKnownName(ADDITIONAL_INDENT_OPTIONS);
List<Element> list = element.getChildren(ADDITIONAL_INDENT_OPTIONS);
if (list != null) {
for (Element additionalIndentElement : list) {
String fileTypeId = additionalIndentElement.getAttributeValue(FILETYPE);
if (!StringUtil.isEmpty(fileTypeId)) {
FileType target = FileTypeManager.getInstance().getFileTypeByExtension(fileTypeId);
if (FileTypes.UNKNOWN == target || FileTypes.PLAIN_TEXT == target || target.getDefaultExtension().isEmpty()) {
target = new TempFileType(fileTypeId);
}
IndentOptions options = getDefaultIndentOptions(target);
options.readExternal(additionalIndentElement);
registerAdditionalIndentOptions(target, options);
for (Element additionalIndentElement : list) {
String fileTypeId = additionalIndentElement.getAttributeValue(FILETYPE);
if (!StringUtil.isEmpty(fileTypeId)) {
FileType target = FileTypeManager.getInstance().getFileTypeByExtension(fileTypeId);
if (FileTypes.UNKNOWN == target || FileTypes.PLAIN_TEXT == target || target.getDefaultExtension().isEmpty()) {
target = new TempFileType(fileTypeId);
}
IndentOptions options = getDefaultIndentOptions(target);
options.readExternal(additionalIndentElement);
registerAdditionalIndentOptions(target, options);
}
}
@@ -578,7 +576,7 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea
if (!myAdditionalIndentOptions.isEmpty()) {
FileType[] fileTypes = myAdditionalIndentOptions.keySet().toArray(new FileType[myAdditionalIndentOptions.keySet().size()]);
Arrays.sort(fileTypes, (o1, o2) -> o1.getDefaultExtension().compareTo(o2.getDefaultExtension()));
Arrays.sort(fileTypes, Comparator.comparing(FileType::getDefaultExtension));
for (FileType fileType : fileTypes) {
Element additionalIndentOptions = new Element(ADDITIONAL_INDENT_OPTIONS);
myAdditionalIndentOptions.get(fileType).serialize(additionalIndentOptions, getDefaultIndentOptions(fileType));
@@ -768,14 +766,6 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea
return getIndentOptions(fileType).CONTINUATION_INDENT_SIZE;
}
public int getLabelIndentSize(FileType fileType) {
return getIndentOptions(fileType).LABEL_INDENT_SIZE;
}
public boolean getLabelIndentAbsolute(FileType fileType) {
return getIndentOptions(fileType).LABEL_INDENT_ABSOLUTE;
}
public int getTabSize(FileType fileType) {
return getIndentOptions(fileType).TAB_SIZE;
}
@@ -896,13 +886,6 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea
}
}
public IndentOptions getAdditionalIndentOptions(FileType fileType) {
if (!myLoadedAdditionalIndentOptions) {
loadAdditionalIndentOptions();
}
return myAdditionalIndentOptions.get(fileType);
}
private void loadAdditionalIndentOptions() {
synchronized (myAdditionalIndentOptions) {
myLoadedAdditionalIndentOptions = true;
@@ -344,11 +344,6 @@ public class CommonCodeStyleSettings {
*/
public boolean USE_FLYING_GEESE_BRACES = false;
/**
* Defines number of white spaces between curly braces in case of {@link #USE_FLYING_GEESE_BRACES 'flying geese'} style usage.
*/
public int FLYING_GEESE_BRACES_GAP = 1;
public boolean DO_NOT_INDENT_TOP_LEVEL_CLASS_MEMBERS = false;
/**
@@ -929,7 +924,6 @@ public class CommonCodeStyleSettings {
private FileIndentOptionsProvider myFileIndentOptionsProvider;
private static final Key<CommonCodeStyleSettings.IndentOptions> INDENT_OPTIONS_KEY = Key.create("INDENT_OPTIONS_KEY");
private boolean myInaccurate;
private boolean myOverrideLanguageOptions;
@Override