From c9b8426533aca5f9e6bccbb1fcea960bcc2967fd Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Tue, 18 Nov 2014 15:06:56 +0100 Subject: [PATCH] cleanup --- .../options/SchemesManagerFactoryImpl.java | 10 ++---- .../openapi/options/SchemesManagerImpl.java | 33 +++++-------------- 2 files changed, 11 insertions(+), 32 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerFactoryImpl.java b/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerFactoryImpl.java index fe0ceb4eb63d..dbb3c9530d7c 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerFactoryImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -15,7 +15,6 @@ */ package com.intellij.openapi.options; -import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.impl.ApplicationImpl; import com.intellij.openapi.components.RoamingType; @@ -40,12 +39,7 @@ public class SchemesManagerFactoryImpl extends SchemesManagerFactory implements public SchemesManager createSchemesManager(@NotNull String fileSpec, @NotNull SchemeProcessor processor, @NotNull RoamingType roamingType) { - Application application = ApplicationManager.getApplication(); - if (!(application instanceof ApplicationImpl)) { - return null; - } - - IApplicationStore applicationStore = ((ApplicationImpl)application).getStateStore(); + IApplicationStore applicationStore = ((ApplicationImpl)ApplicationManager.getApplication()).getStateStore(); String baseDirPath = applicationStore.getStateStorageManager().expandMacros(fileSpec); StreamProvider provider = applicationStore.getStateStorageManager().getStreamProvider(); SchemesManagerImpl manager = new SchemesManagerImpl(fileSpec, processor, roamingType, provider, new File(baseDirPath)); diff --git a/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java index 82c7b3b1c6e7..f67c6afb2677 100644 --- a/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/options/SchemesManagerImpl.java @@ -18,7 +18,6 @@ package com.intellij.openapi.options; import com.intellij.openapi.application.AccessToken; import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.application.impl.ApplicationImpl; import com.intellij.openapi.components.RoamingType; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.components.StateStorageException; @@ -379,7 +378,7 @@ public class SchemesManagerImplemptyMap()); if (result != null) { @@ -425,12 +424,6 @@ public class SchemesManagerImpl> loadSharedSchemes(Collection currentSchemeList) { - StreamProvider provider = getProvider(); - if (provider == null || !provider.isEnabled()) { + if (myProvider == null || !myProvider.isEnabled()) { return Collections.emptyList(); } - Collection names = new THashSet(getAllSchemeNames(currentSchemeList)); + Collection names = getAllSchemeNames(currentSchemeList); Map> result = new THashMap>(); - for (String subPath : provider.listSubFiles(myFileSpec, myRoamingType)) { + for (String subPath : myProvider.listSubFiles(myFileSpec, myRoamingType)) { try { - Element element = StorageUtil.loadElement(provider.loadContent(getFileFullPath(subPath), myRoamingType)); + Element element = StorageUtil.loadElement(myProvider.loadContent(getFileFullPath(subPath), myRoamingType)); if (element != null) { SharedSchemeData original = unwrap(element); E scheme = doReadScheme(original.original); @@ -557,19 +549,18 @@ public class SchemesManagerImpl