diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsManager.java b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsManager.java index a76cd191b018..3ffaafd60826 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsManager.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsManager.java @@ -67,9 +67,6 @@ public class CodeStyleSettingsManager implements PersistentStateComponent mySettingsMap = ContainerUtil.newHashMap(); - private final static NotificationGroup NOTIFICATION_GROUP = + private static final NotificationGroup NOTIFICATION_GROUP = new NotificationGroup("Code style settings migration", NotificationDisplayType.STICKY_BALLOON, true); - @SuppressWarnings("unused") - public ProjectCodeStyleSettingsManager(Project project) { - this(); - } - public ProjectCodeStyleSettingsManager() { setMainProjectCodeStyle(null); } @@ -89,7 +80,6 @@ public class ProjectCodeStyleSettingsManager extends CodeStyleSettingsManager { @Override public void setMainProjectCodeStyle(@Nullable CodeStyleSettings settings) { // TODO: Remove the assignment below when there are no direct usages of PER_PROJECT_SETTINGS. - //noinspection deprecation PER_PROJECT_SETTINGS = settings; mySettingsMap.put(MAIN_PROJECT_CODE_STYLE_NAME, settings != null ? settings : new CodeStyleSettings()); } @@ -101,13 +91,12 @@ public class ProjectCodeStyleSettingsManager extends CodeStyleSettingsManager { } private void initDefaults() { - @SuppressWarnings("deprecation") CodeStyleSettingsManager appCodeStyleSettingsManager = CodeStyleSettingsManager.getInstance(); if (appCodeStyleSettingsManager != null) { CodeStyleSettings defaultProjectSettings = appCodeStyleSettingsManager.getMainProjectCodeStyle(); setMainProjectCodeStyle(defaultProjectSettings != null ? defaultProjectSettings.clone() : null); - this.USE_PER_PROJECT_SETTINGS = appCodeStyleSettingsManager.USE_PER_PROJECT_SETTINGS; - this.PREFERRED_PROJECT_CODE_STYLE = appCodeStyleSettingsManager.PREFERRED_PROJECT_CODE_STYLE; + USE_PER_PROJECT_SETTINGS = appCodeStyleSettingsManager.USE_PER_PROJECT_SETTINGS; + PREFERRED_PROJECT_CODE_STYLE = appCodeStyleSettingsManager.PREFERRED_PROJECT_CODE_STYLE; } myIsLoaded = true; } @@ -116,8 +105,8 @@ public class ProjectCodeStyleSettingsManager extends CodeStyleSettingsManager { public void loadState(@NotNull Element state) { super.loadState(state); updateFromOldProjectSettings(); - for (Element subStyle : state.getChildren(CODE_STYLE_TAG_NAME)) { - String name = subStyle.getAttributeValue(CODE_STYLE_NAME_ATTR); + for (Element subStyle : state.getChildren(CodeStyleScheme.CODE_STYLE_TAG_NAME)) { + String name = subStyle.getAttributeValue(CodeStyleScheme.CODE_STYLE_NAME_ATTR); CodeStyleSettings settings = new CodeStyleSettings(); settings.readExternal(subStyle); if (MAIN_PROJECT_CODE_STYLE_NAME.equals(name)) { @@ -130,7 +119,6 @@ public class ProjectCodeStyleSettingsManager extends CodeStyleSettingsManager { myIsLoaded = true; } - @SuppressWarnings("deprecation") private void updateFromOldProjectSettings() { CodeStyleSettings oldProjectSettings = PER_PROJECT_SETTINGS; if (oldProjectSettings != null) oldProjectSettings.resetDeprecatedFields(); @@ -143,8 +131,8 @@ public class ProjectCodeStyleSettingsManager extends CodeStyleSettingsManager { if (e != null) { for (String name : mySettingsMap.keySet()) { CodeStyleSettings settings = mySettingsMap.get(name); - Element codeStyle = new Element(CODE_STYLE_TAG_NAME); - codeStyle.setAttribute(CODE_STYLE_NAME_ATTR, name); + Element codeStyle = new Element(CodeStyleScheme.CODE_STYLE_TAG_NAME); + codeStyle.setAttribute(CodeStyleScheme.CODE_STYLE_NAME_ATTR, name); settings.writeExternal(codeStyle); if (!codeStyle.getContent().isEmpty()) { e.addContent(codeStyle); @@ -155,7 +143,7 @@ public class ProjectCodeStyleSettingsManager extends CodeStyleSettingsManager { } private static class CodeStyleMigrationNotification extends Notification { - public CodeStyleMigrationNotification(@NotNull String projectName) { + CodeStyleMigrationNotification(@NotNull String projectName) { super(NOTIFICATION_GROUP.getDisplayId(), ApplicationBundle.message("project.code.style.migration.title"), ApplicationBundle.message("project.code.style.migration.message", projectName), @@ -165,7 +153,7 @@ public class ProjectCodeStyleSettingsManager extends CodeStyleSettingsManager { } private static class ShowMoreInfoAction extends DumbAwareAction { - public ShowMoreInfoAction() { + ShowMoreInfoAction() { super("More info"); } @@ -190,13 +178,13 @@ public class ProjectCodeStyleSettingsManager extends CodeStyleSettingsManager { @NotNull @Override protected String getSubStateTagName() { - return CODE_STYLE_TAG_NAME; + return CodeStyleScheme.CODE_STYLE_TAG_NAME; } @NotNull @Override protected String getSubStateFileName(@NotNull Element element) { - return element.getAttributeValue(CODE_STYLE_NAME_ATTR); + return element.getAttributeValue(CodeStyleScheme.CODE_STYLE_NAME_ATTR); } } }