diff --git a/platform/editor-ui-ex/src/com/intellij/ide/todo/TodoIndexPatternProvider.java b/platform/editor-ui-ex/src/com/intellij/ide/todo/TodoIndexPatternProvider.java index ba3338f5f8b9..459daa06495b 100644 --- a/platform/editor-ui-ex/src/com/intellij/ide/todo/TodoIndexPatternProvider.java +++ b/platform/editor-ui-ex/src/com/intellij/ide/todo/TodoIndexPatternProvider.java @@ -1,32 +1,17 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.todo; import com.intellij.psi.search.IndexPattern; import com.intellij.psi.search.IndexPatternProvider; import org.jetbrains.annotations.NotNull; -/** - * @author yole - */ -public class TodoIndexPatternProvider implements IndexPatternProvider { - private final TodoConfiguration myConfiguration; - +public final class TodoIndexPatternProvider implements IndexPatternProvider { public static TodoIndexPatternProvider getInstance() { - for (IndexPatternProvider provider : EP_NAME.getExtensionList()) { - if (provider instanceof TodoIndexPatternProvider) { - return (TodoIndexPatternProvider) provider; - } - } - assert false: "Couldn't find self in extensions list"; - return null; - } - - public TodoIndexPatternProvider(TodoConfiguration configuration) { - myConfiguration = configuration; + return EP_NAME.findExtensionOrFail(TodoIndexPatternProvider.class); } @Override @NotNull public IndexPattern[] getIndexPatterns() { - return myConfiguration.getIndexPatterns(); + return TodoConfiguration.getInstance().getIndexPatterns(); } } diff --git a/platform/lang-impl/src/com/intellij/execution/console/SubstringConsoleFolding.java b/platform/lang-impl/src/com/intellij/execution/console/SubstringConsoleFolding.java index a9c468028f13..c7b50649f653 100644 --- a/platform/lang-impl/src/com/intellij/execution/console/SubstringConsoleFolding.java +++ b/platform/lang-impl/src/com/intellij/execution/console/SubstringConsoleFolding.java @@ -1,3 +1,4 @@ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.execution.console; import com.intellij.execution.ConsoleFolding; @@ -7,19 +8,10 @@ import org.jetbrains.annotations.NotNull; import java.util.List; -/** - * @author peter - */ -public class SubstringConsoleFolding extends ConsoleFolding { - private final ConsoleFoldingSettings mySettings; - - public SubstringConsoleFolding(ConsoleFoldingSettings settings) { - mySettings = settings; - } - +final class SubstringConsoleFolding extends ConsoleFolding { @Override public boolean shouldFoldLine(@NotNull Project project, @NotNull String line) { - return mySettings.shouldFoldLine(line); + return ConsoleFoldingSettings.getSettings().shouldFoldLine(line); } @Override diff --git a/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.java b/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.java index 06956496b574..b49d27c59fb0 100644 --- a/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.java +++ b/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.java @@ -78,11 +78,11 @@ public final class ScopeViewPane extends AbstractProjectViewPane { return project; } - public ScopeViewPane(@NotNull Project project, @NotNull DependencyValidationManager dvm, @NotNull NamedScopeManager nsm) { + public ScopeViewPane(@NotNull Project project) { super(checkApplicability(project)); - myDependencyValidationManager = dvm; - myNamedScopeManager = nsm; + myDependencyValidationManager = DependencyValidationManager.getInstance(project); + myNamedScopeManager = NamedScopeManager.getInstance(project); myFilters = map(myDependencyValidationManager, myNamedScopeManager); NamedScopesHolder.ScopeListener scopeListener = new NamedScopesHolder.ScopeListener() { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/SaveCommittingDocumentsVetoer.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/SaveCommittingDocumentsVetoer.java index dedb8cbe2554..55796fcc1619 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/SaveCommittingDocumentsVetoer.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/SaveCommittingDocumentsVetoer.java @@ -1,20 +1,7 @@ -/* - * Copyright 2000-2011 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. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.openapi.vcs.changes; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.editor.Document; import com.intellij.openapi.fileEditor.FileDocumentSynchronizationVetoer; import com.intellij.openapi.project.Project; @@ -26,13 +13,7 @@ import java.util.Collections; /** * @author yole */ -public class SaveCommittingDocumentsVetoer extends FileDocumentSynchronizationVetoer { - private final VetoSavingCommittingDocumentsAdapter myAdapter; - - public SaveCommittingDocumentsVetoer(VetoSavingCommittingDocumentsAdapter adapter) { - myAdapter = adapter; - } - +final class SaveCommittingDocumentsVetoer extends FileDocumentSynchronizationVetoer { @Override public boolean maySaveDocument(@NotNull Document document, boolean isSaveExplicit) { final Object beingCommitted = document.getUserData(AbstractCommitter.DOCUMENT_BEING_COMMITTED_KEY); @@ -40,9 +21,9 @@ public class SaveCommittingDocumentsVetoer extends FileDocumentSynchronizationVe return false; } if (beingCommitted instanceof Project) { - return myAdapter.showAllowSaveDialog(Collections.singletonMap(document, (Project)beingCommitted)); + return ApplicationManager.getApplication().getComponent(VetoSavingCommittingDocumentsAdapter.class) + .showAllowSaveDialog(Collections.singletonMap(document, (Project)beingCommitted)); } return true; } - } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SvnBranchStateProvider.kt b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SvnBranchStateProvider.kt index e047e0e0923e..ac8f180f95f8 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SvnBranchStateProvider.kt +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/branchConfig/SvnBranchStateProvider.kt @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.idea.svn.branchConfig import com.intellij.openapi.project.Project @@ -13,15 +13,15 @@ import org.jetbrains.idea.svn.SvnVcs private fun join(s1: String, s2: String?) = listOfNotNull(s1, s2.nullize()).joinToString("/") -class SvnBranchStateProvider(val project: Project, val vcsManager: ProjectLevelVcsManager) : BranchStateProvider { - // do not inject in constructor as SvnBranchConfigurationManager.getInstance() has custom logic - private val branchManager = SvnBranchConfigurationManager.getInstance(project) - +class SvnBranchStateProvider(val project: Project) : BranchStateProvider { override fun getCurrentBranch(path: FilePath): BranchData? { - if (!vcsManager.checkVcsIsActive(SvnVcs.VCS_NAME)) return null + val vcsManager = ProjectLevelVcsManager.getInstance(project) + if (!vcsManager.checkVcsIsActive(SvnVcs.VCS_NAME)) { + return null + } val wcRoot = (vcsManager.getVcsFor(path) as? SvnVcs)?.svnFileUrlMapping?.getWcRootForFilePath(path) ?: return null - val configuration = branchManager.svnBranchConfigManager.getConfigOrNull(wcRoot.virtualFile) ?: return null + val configuration = SvnBranchConfigurationManager.getInstance(project).svnBranchConfigManager.getConfigOrNull(wcRoot.virtualFile) ?: return null val branchUrl = configuration.getWorkingBranch(wcRoot.url) ?: return null val presentableRootName = join(wcRoot.root.presentableName, getRelativePath(wcRoot.virtualFile, wcRoot.root))