removed unused ctr

This commit is contained in:
Alexey Kudravtsev
2018-03-23 19:36:03 +03:00
parent 13a00272c3
commit b733a8fb65
2 changed files with 14 additions and 29 deletions
@@ -67,9 +67,6 @@ public class CodeStyleSettingsManager implements PersistentStateComponent<Elemen
return ServiceManager.getService(AppCodeStyleSettingsManager.class);
}
@SuppressWarnings({"UnusedDeclaration"})
public CodeStyleSettingsManager(Project project) {
}
public CodeStyleSettingsManager() {}
/**
@@ -25,10 +25,6 @@ import org.jetbrains.annotations.Nullable;
import java.util.Map;
import static com.intellij.psi.codeStyle.CodeStyleScheme.CODE_STYLE_NAME_ATTR;
import static com.intellij.psi.codeStyle.CodeStyleScheme.CODE_STYLE_TAG_NAME;
@State(
name = "ProjectCodeStyleConfiguration",
storages = @Storage(value = "codeStyles", stateSplitter = ProjectCodeStyleSettingsManager.StateSplitter.class)
@@ -36,21 +32,16 @@ import static com.intellij.psi.codeStyle.CodeStyleScheme.CODE_STYLE_TAG_NAME;
public class ProjectCodeStyleSettingsManager extends CodeStyleSettingsManager {
private static final Logger LOG = Logger.getInstance("#" + ProjectCodeStyleSettingsManager.class);
public static final String MAIN_PROJECT_CODE_STYLE_NAME = "Project";
public static final String PROJECT_CODE_STYLE_CONFIG_FILE_NAME = "codeStyleConfig";
private static final String MAIN_PROJECT_CODE_STYLE_NAME = "Project";
private static final String PROJECT_CODE_STYLE_CONFIG_FILE_NAME = "codeStyleConfig";
private volatile boolean myIsLoaded;
private final static Object LEGACY_SETTINGS_IMPORT_LOCK = new Object();
private static final Object LEGACY_SETTINGS_IMPORT_LOCK = new Object();
private final Map<String,CodeStyleSettings> 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<rv>: 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);
}
}
}