deprecate ServiceManager.getService(project)

GitOrigin-RevId: 3805c3aac4e084c828558bf1b1570339f7f3b4a3
This commit is contained in:
Vladimir Krivosheev
2021-03-26 22:16:00 +01:00
committed by intellij-monorepo-bot
parent 75b5dfce25
commit 809b7ca201
347 changed files with 912 additions and 2096 deletions

View File

@@ -1,8 +1,7 @@
// 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-2021 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.intellij.images.search;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
@@ -24,7 +23,7 @@ public class ImageTagManager implements PersistentStateComponent<ImageTagManager
private State myState = new State();
public static ImageTagManager getInstance(Project project) {
return ServiceManager.getService(project, ImageTagManager.class);
return project.getService(ImageTagManager.class);
}
public boolean hasTag(String tag, VirtualFile file) {

View File

@@ -15,9 +15,8 @@
*/
package org.intellij.images.thumbnail;
import org.jetbrains.annotations.NotNull;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.components.ServiceManager;
import org.jetbrains.annotations.NotNull;
/**
* Thumbnail manager.
@@ -27,7 +26,7 @@ import com.intellij.openapi.components.ServiceManager;
public abstract class ThumbnailManager {
public static ThumbnailManager getManager(final Project project) {
return ServiceManager.getService(project, ThumbnailManager.class);
return project.getService(ThumbnailManager.class);
}
/**

View File

@@ -1,23 +1,8 @@
/*
* Copyright 2000-2015 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-2021 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.compiler;
import com.intellij.ide.IconLayerProvider;
import com.intellij.openapi.compiler.JavaCompilerBundle;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.FileIndexFacade;
import com.intellij.openapi.util.Iconable;
@@ -61,7 +46,7 @@ public class CompilerIconLayerProvider implements IconLayerProvider {
public static boolean isExcluded(final VirtualFile vFile, final Project project) {
return vFile != null
&& ServiceManager.getService(project, FileIndexFacade.class).isInSource(vFile)
&& project.getService(FileIndexFacade.class).isInSource(vFile)
&& CompilerConfiguration.getInstance(project).isExcludedFromCompilation(vFile);
}
}

View File

@@ -1,8 +1,7 @@
// 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-2021 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.compiler.impl.javaCompiler.eclipse;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
@@ -26,5 +25,5 @@ public class EclipseCompilerConfiguration implements PersistentStateComponent<Ec
}
public static EclipseCompilerOptions getOptions(Project project, Class<? extends EclipseCompilerConfiguration> aClass) {
return ServiceManager.getService(project, aClass).getState();
return project.getService(aClass).getState();
}}

View File

@@ -1,7 +1,10 @@
// 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-2021 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.compiler.impl.javaCompiler.javac;
import com.intellij.openapi.components.*;
import com.intellij.openapi.components.PathMacroManager;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
import com.intellij.util.xmlb.XmlSerializerUtil;
import org.jetbrains.annotations.NotNull;
@@ -39,7 +42,7 @@ public class JavacConfiguration implements PersistentStateComponent<JpsJavaCompi
}
public static JpsJavaCompilerOptions getOptions(Project project, Class<? extends JavacConfiguration> aClass) {
JavacConfiguration configuration = ServiceManager.getService(project, aClass);
JavacConfiguration configuration = project.getService(aClass);
return configuration.mySettings;
}
}

View File

@@ -1,8 +1,7 @@
// 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-2021 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.compiler.impl.rmiCompiler;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
@@ -26,6 +25,6 @@ public class RmicConfiguration implements PersistentStateComponent<RmicCompilerO
}
public static RmicCompilerOptions getOptions(Project project) {
return ServiceManager.getService(project, RmicConfiguration.class).getState();
return project.getService(RmicConfiguration.class).getState();
}
}

View File

@@ -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-2021 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.compiler.options;
import com.intellij.openapi.compiler.CompilerManager;
@@ -6,7 +6,6 @@ import com.intellij.openapi.compiler.Validator;
import com.intellij.openapi.compiler.options.ExcludedEntriesConfiguration;
import com.intellij.openapi.compiler.options.ExcludesConfiguration;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
@@ -64,11 +63,11 @@ public class ValidationConfiguration implements PersistentStateComponent<JpsVali
}
public static ValidationConfiguration getInstance(Project project) {
return ServiceManager.getService(project, ValidationConfiguration.class);
return project.getService(ValidationConfiguration.class);
}
public static ExcludesConfiguration getExcludedEntriesConfiguration(Project project) {
return ServiceManager.getService(project, ExcludedFromValidationConfiguration.class);
return project.getService(ExcludedFromValidationConfiguration.class);
}
@Override

View File

@@ -1,9 +1,8 @@
// 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-2021 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.compiler.server.impl;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.diagnostic.Logger;
@@ -40,7 +39,7 @@ public class BuildProcessCustomPluginsConfiguration implements PersistentStateCo
}
public static BuildProcessCustomPluginsConfiguration getInstance(@NotNull Project project) {
return ServiceManager.getService(project, BuildProcessCustomPluginsConfiguration.class);
return project.getService(BuildProcessCustomPluginsConfiguration.class);
}
public List<String> getProjectLibraries() {

View File

@@ -1,21 +1,6 @@
/*
* Copyright 2000-2009 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-2021 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.packaging.impl.artifacts;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.packaging.artifacts.Artifact;
@@ -25,7 +10,7 @@ import java.util.Collection;
public abstract class ArtifactBySourceFileFinder {
public static ArtifactBySourceFileFinder getInstance(@NotNull Project project) {
return ServiceManager.getService(project, ArtifactBySourceFileFinder.class);
return project.getService(ArtifactBySourceFileFinder.class);
}
public abstract Collection<? extends Artifact> findArtifacts(@NotNull VirtualFile sourceFile);

View File

@@ -1,7 +1,10 @@
// Copyright 2000-2020 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-2021 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.packaging.impl.compiler;
import com.intellij.openapi.components.*;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.components.StoragePathMacros;
import com.intellij.openapi.project.Project;
import com.intellij.packaging.artifacts.Artifact;
import com.intellij.packaging.artifacts.ArtifactManager;
@@ -24,7 +27,7 @@ public final class ArtifactsWorkspaceSettings implements PersistentStateComponen
}
public static ArtifactsWorkspaceSettings getInstance(@NotNull Project project) {
return ServiceManager.getService(project, ArtifactsWorkspaceSettings.class);
return project.getService(ArtifactsWorkspaceSettings.class);
}
public List<Artifact> getArtifactsToBuild() {

View File

@@ -1,21 +1,6 @@
/*
* Copyright 2000-2012 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-2021 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.compiler;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.util.Chunk;
@@ -27,7 +12,7 @@ import java.util.Collection;
public abstract class CompilerEncodingService {
public static CompilerEncodingService getInstance(@NotNull Project project) {
return ServiceManager.getService(project, CompilerEncodingService.class);
return project.getService(CompilerEncodingService.class);
}
@Nullable

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 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-2021 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.
/*
* @author Eugene Zhuravlev
@@ -6,7 +6,10 @@
package com.intellij.compiler;
import com.intellij.build.BuildWorkspaceConfiguration;
import com.intellij.openapi.components.*;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.components.StoragePathMacros;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.registry.Registry;
@@ -42,7 +45,7 @@ public final class CompilerWorkspaceConfiguration implements PersistentStateComp
public boolean COMPILE_AFFECTED_UNLOADED_MODULES_BEFORE_COMMIT = true;
public static CompilerWorkspaceConfiguration getInstance(Project project) {
return ServiceManager.getService(project, CompilerWorkspaceConfiguration.class);
return project.getService(CompilerWorkspaceConfiguration.class);
}
@Override

View File

@@ -1,8 +1,7 @@
// Copyright 2000-2020 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-2021 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.debugger.settings;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
@@ -21,7 +20,7 @@ public class DebuggerProjectSettings implements PersistentStateComponent<Debugge
public String[] myAsyncExecuteAnnotations = ArrayUtilRt.EMPTY_STRING_ARRAY;
public static DebuggerProjectSettings getInstance(@NotNull Project project) {
return ServiceManager.getService(project, DebuggerProjectSettings.class);
return project.getService(DebuggerProjectSettings.class);
}
@Nullable

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 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-2021 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.testDiscovery;
import com.intellij.execution.testframework.autotest.AbstractAutoTestManager;
@@ -7,7 +7,6 @@ import com.intellij.openapi.Disposable;
import com.intellij.openapi.compiler.CompilationStatusListener;
import com.intellij.openapi.compiler.CompileContext;
import com.intellij.openapi.compiler.CompilerTopics;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.components.StoragePathMacros;
@@ -26,7 +25,7 @@ import org.jetbrains.annotations.NotNull;
)
public class JavaAutoRunManager extends AbstractAutoTestManager implements Disposable {
public static @NotNull JavaAutoRunManager getInstance(Project project) {
return ServiceManager.getService(project, JavaAutoRunManager.class);
return project.getService(JavaAutoRunManager.class);
}
public JavaAutoRunManager(@NotNull Project project) {
@@ -75,7 +74,7 @@ public class JavaAutoRunManager extends AbstractAutoTestManager implements Dispo
@Override
public void finished(ProjectTaskManager.@NotNull Result result) {
if (result.anyTaskMatches((task, state) -> task instanceof ModuleBuildTask)) {
if (result.getContext().getGeneratedFilesRoots().isEmpty() &&
if (result.getContext().getGeneratedFilesRoots().isEmpty() &&
result.getContext().getDirtyOutputPaths().isEmpty()) return;
myHasErrors = result.hasErrors() || result.isAborted();
if (!result.hasErrors() && !result.isAborted()) {

View File

@@ -1,30 +1,15 @@
/*
* Copyright 2000-2009 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-2021 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.facet.impl.ui;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.facet.FacetType;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public abstract class FacetEditorsStateManager {
public static FacetEditorsStateManager getInstance(@NotNull Project project) {
return ServiceManager.getService(project, FacetEditorsStateManager.class);
return project.getService(FacetEditorsStateManager.class);
}
public abstract <T> void saveState(@NotNull FacetType<?, ?> type, @Nullable T state);

View File

@@ -8,7 +8,6 @@ import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.application.AccessToken;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.options.Configurable;
@@ -580,7 +579,7 @@ public class ProjectStructureConfigurable implements SearchableConfigurable, Pla
}
public static ProjectStructureConfigurable getInstance(@NotNull final Project project) {
return ServiceManager.getService(project, ProjectStructureConfigurable.class);
return project.getService(ProjectStructureConfigurable.class);
}
@NotNull

View File

@@ -1,14 +1,13 @@
// Copyright 2000-2020 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-2021 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.roots.ui.configuration.projectRoot.daemon;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
public abstract class ProjectStructureProblemsSettings {
public static ProjectStructureProblemsSettings getProjectInstance(@NotNull Project project) {
return ServiceManager.getService(project, ProjectStructureProblemsSettings.class);
return project.getService(ProjectStructureProblemsSettings.class);
}
public static ProjectStructureProblemsSettings getGlobalInstance() {

View File

@@ -1,22 +1,7 @@
/*
* Copyright 2000-2009 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-2021 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.codeInsight.guess;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiExpression;
@@ -28,14 +13,14 @@ import java.util.List;
public abstract class GuessManager {
public static GuessManager getInstance(Project project) {
return ServiceManager.getService(project, GuessManager.class);
return project.getService(GuessManager.class);
}
public abstract PsiType @NotNull [] guessContainerElementType(PsiExpression containerExpr, TextRange rangeToIgnore);
public abstract PsiType @NotNull [] guessTypeToCast(PsiExpression expr);
@NotNull
@NotNull
public abstract MultiMap<PsiExpression, PsiType> getControlFlowExpressionTypes(@NotNull PsiExpression forPlace, boolean honorAssignments);
@NotNull

View File

@@ -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-2021 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.codeInspection.bytecodeAnalysis;
import com.intellij.codeInsight.NullableNotNullManager;
@@ -7,7 +7,6 @@ import com.intellij.codeInspection.dataFlow.JavaMethodContractUtil;
import com.intellij.codeInspection.dataFlow.MutationSignature;
import com.intellij.codeInspection.dataFlow.StandardMethodContract;
import com.intellij.codeInspection.dataFlow.StandardMethodContract.ValueConstraint;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
@@ -62,7 +61,7 @@ public class ProjectBytecodeAnalysis {
private final NullableNotNullManager myNullabilityManager;
public static ProjectBytecodeAnalysis getInstance(@NotNull Project project) {
return ServiceManager.getService(project, ProjectBytecodeAnalysis.class);
return project.getService(ProjectBytecodeAnalysis.class);
}
public ProjectBytecodeAnalysis(Project project) {
@@ -532,7 +531,7 @@ public class ProjectBytecodeAnalysis {
/**
* Returns true if the method is pure except calling the delegate that has failing contract in the form other than null->fail.
* Allows handling methods like
* <pre>{@code
* <pre>{@code
* void assertNotNull(Object obj) {
* assertTrue(obj != null);
* }}</pre>

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 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-2021 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.codeInspection.ex;
import com.intellij.codeInsight.AnnotationUtil;
@@ -10,7 +10,6 @@ import com.intellij.codeInspection.reference.*;
import com.intellij.configurationStore.XmlSerializer;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.extensions.ExtensionPointName;
@@ -87,7 +86,7 @@ public abstract class EntryPointsManagerBase extends EntryPointsManager implemen
}
public static EntryPointsManagerBase getInstance(Project project) {
return (EntryPointsManagerBase)ServiceManager.getService(project, EntryPointsManager.class);
return (EntryPointsManagerBase)project.getService(EntryPointsManager.class);
}
@Override

View File

@@ -8,7 +8,6 @@ import com.intellij.codeInsight.completion.JavaMethodCallElement;
import com.intellij.codeInsight.daemon.impl.analysis.LambdaHighlightingUtil;
import com.intellij.codeInsight.hints.ParameterHintsPass;
import com.intellij.codeInsight.lookup.CommaTailType;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
@@ -48,7 +47,7 @@ public final class ExpectedTypesProvider {
private static final Logger LOG = Logger.getInstance(ExpectedTypesProvider.class);
public static ExpectedTypesProvider getInstance(@NotNull Project project) {
return ServiceManager.getService(project, ExpectedTypesProvider.class);
return project.getService(ExpectedTypesProvider.class);
}
private static final int MAX_COUNT = 50;

View File

@@ -1,9 +1,8 @@
// 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.
// Copyright 2000-2021 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.codeInsight;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
@@ -34,7 +33,7 @@ public class JavaProjectCodeInsightSettings implements PersistentStateComponent<
public List<String> excludedNames = new ArrayList<>();
public static JavaProjectCodeInsightSettings getSettings(@NotNull Project project) {
return ServiceManager.getService(project, JavaProjectCodeInsightSettings.class);
return project.getService(JavaProjectCodeInsightSettings.class);
}
public boolean isExcluded(@NotNull String name) {

View File

@@ -1,9 +1,8 @@
// Copyright 2000-2020 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-2021 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.codeInsight.daemon.problems
import com.intellij.openapi.Disposable
import com.intellij.openapi.components.Service
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.LowMemoryWatcher
import com.intellij.psi.PsiFile
@@ -18,7 +17,7 @@ class FileStateCache : Disposable {
private val cache: SLRUMap<SmartPsiElementPointer<PsiFile>, PrivateFileState> = SLRUMap(100, 50)
object SERVICE {
fun getInstance(project: Project): FileStateCache = ServiceManager.getService(project, FileStateCache::class.java)
fun getInstance(project: Project): FileStateCache = project.getService(FileStateCache::class.java)
}
init {

View File

@@ -1,8 +1,7 @@
// 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-2021 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.jarRepository;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
@@ -34,7 +33,7 @@ public class RemoteRepositoriesConfiguration implements PersistentStateComponent
@NotNull
public static RemoteRepositoriesConfiguration getInstance(Project project) {
return ServiceManager.getService(project, RemoteRepositoriesConfiguration.class);
return project.getService(RemoteRepositoriesConfiguration.class);
}
@NotNull

View File

@@ -1,4 +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.
// Copyright 2000-2021 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.jarRepository.services;
import com.intellij.jarRepository.RemoteRepositoryDescription;
@@ -7,7 +7,6 @@ import com.intellij.jarRepository.services.artifactory.ArtifactoryRepositoryServ
import com.intellij.jarRepository.services.bintray.BintrayRepositoryService;
import com.intellij.jarRepository.services.nexus.NexusRepositoryService;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.diagnostic.Logger;
@@ -44,7 +43,7 @@ public class MavenRepositoryServicesManager implements PersistentStateComponent<
@NotNull
public static MavenRepositoryServicesManager getInstance(Project project) {
return ServiceManager.getService(project, MavenRepositoryServicesManager.class);
return project.getService(MavenRepositoryServicesManager.class);
}
public static MavenRepositoryService @NotNull [] getServices() {

View File

@@ -1,6 +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-2021 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.javadoc;
import com.intellij.CommonBundle;
@@ -10,7 +8,6 @@ import com.intellij.execution.executors.DefaultRunExecutor;
import com.intellij.execution.runners.ExecutionEnvironmentBuilder;
import com.intellij.execution.util.ExecutionErrorDialog;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
@@ -21,7 +18,7 @@ public final class JavadocGenerationManager implements PersistentStateComponent<
private final Project myProject;
public static JavadocGenerationManager getInstance(@NotNull Project project) {
return ServiceManager.getService(project, JavadocGenerationManager.class);
return project.getService(JavadocGenerationManager.class);
}
JavadocGenerationManager(Project project) {

View File

@@ -1,21 +1,6 @@
/*
* Copyright 2000-2017 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-2021 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.roots;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.libraries.Library;
@@ -36,7 +21,7 @@ import java.util.Collections;
*/
public abstract class JavaProjectModelModificationService {
public static JavaProjectModelModificationService getInstance(@NotNull Project project) {
return ServiceManager.getService(project, JavaProjectModelModificationService.class);
return project.getService(JavaProjectModelModificationService.class);
}
public Promise<Void> addDependency(@NotNull Module from, @NotNull Module to) {

View File

@@ -1,8 +1,7 @@
// Copyright 2000-2020 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-2021 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.psi.impl.migration;
import com.intellij.openapi.components.Service;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.psi.JavaPsiFacade;
@@ -16,7 +15,7 @@ public final class PsiMigrationManager {
private static final Logger LOG = Logger.getInstance(PsiMigrationManager.class);
public static PsiMigrationManager getInstance(Project project) {
return ServiceManager.getService(project, PsiMigrationManager.class);
return project.getService(PsiMigrationManager.class);
}
private final Project myProject;

View File

@@ -1,7 +1,6 @@
// Copyright 2000-2020 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-2021 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.psi.util;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.Pair;
@@ -48,7 +47,7 @@ public class ProjectIconsAccessor {
}
public static ProjectIconsAccessor getInstance(Project project) {
return ServiceManager.getService(project, ProjectIconsAccessor.class);
return project.getService(ProjectIconsAccessor.class);
}
@Nullable

View File

@@ -1,21 +1,6 @@
/*
* Copyright 2000-2009 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-2021 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.refactoring;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.refactoring.migration.MigrationManager;
@@ -23,7 +8,7 @@ public class RefactoringManager {
private final MigrationManager myMigrateManager;
public static RefactoringManager getInstance(Project project) {
return ServiceManager.getService(project, RefactoringManager.class);
return project.getService(RefactoringManager.class);
}
public RefactoringManager(Project project) {

View File

@@ -1,9 +1,8 @@
// Copyright 2000-2020 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-2021 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.refactoring.extractMethod.preview;
import com.intellij.ide.impl.ContentManagerWatcher;
import com.intellij.openapi.components.Service;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.wm.ToolWindow;
@@ -50,6 +49,6 @@ public final class ExtractMethodPreviewManager {
}
public static ExtractMethodPreviewManager getInstance(Project project) {
return ServiceManager.getService(project, ExtractMethodPreviewManager.class);
return project.getService(ExtractMethodPreviewManager.class);
}
}

View File

@@ -1,9 +1,8 @@
// Copyright 2000-2020 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-2021 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.testIntegration;
import com.intellij.codeInsight.TestFrameworks;
import com.intellij.execution.TestStateStorage;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.fileEditor.FileEditorManagerListener;
@@ -25,7 +24,7 @@ public class TestFailedLineManager implements FileEditorManagerListener {
private final Map<VirtualFile, Map<String, TestInfo>> myMap;
public static TestFailedLineManager getInstance(@NotNull Project project) {
return ServiceManager.getService(project, TestFailedLineManager.class);
return project.getService(TestFailedLineManager.class);
}
public TestFailedLineManager(@NotNull Project project) {

View File

@@ -1,7 +1,6 @@
// Copyright 2000-2020 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-2021 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.psi.search;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiClass;
@@ -27,7 +26,7 @@ public abstract class PsiShortNamesCache {
* @return the cache instance.
*/
public static PsiShortNamesCache getInstance(Project project) {
return ServiceManager.getService(project, PsiShortNamesCache.class);
return project.getService(PsiShortNamesCache.class);
}
public static final ExtensionPointName<PsiShortNamesCache> EP_NAME = ExtensionPointName.create("com.intellij.java.shortNamesCache");

View File

@@ -2,7 +2,6 @@
package com.intellij.codeInsight;
import com.intellij.openapi.components.Service;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.util.containers.ContainerUtil;
@@ -54,7 +53,7 @@ public final class ConcurrencyAnnotationsManager {
}
public static ConcurrencyAnnotationsManager getInstance(Project project) {
return ServiceManager.getService(project, ConcurrencyAnnotationsManager.class);
return project.getService(ConcurrencyAnnotationsManager.class);
}
public List<String> getImmutableAnnotations() {

View File

@@ -1,7 +1,6 @@
// 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.
// Copyright 2000-2021 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.codeInsight;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Ref;
@@ -42,13 +41,13 @@ public abstract class NullableNotNullManager {
abstract @NotNull List<String> getDefaultNotNulls();
public abstract @NotNull Optional<Nullability> getAnnotationNullability(String name);
public abstract boolean isTypeUseAnnotationLocationRestricted(String name);
public abstract boolean canAnnotateLocals(String name);
public static NullableNotNullManager getInstance(Project project) {
return ServiceManager.getService(project, NullableNotNullManager.class);
return project.getService(NullableNotNullManager.class);
}
public abstract void setNotNulls(String @NotNull ... annotations);
@@ -142,8 +141,8 @@ public abstract class NullableNotNullManager {
}
/**
* Returns information about explicit nullability annotation (without looking into external/inferred annotations,
* but looking into container annotations). This method is rarely useful in client code, it's designed mostly
* Returns information about explicit nullability annotation (without looking into external/inferred annotations,
* but looking into container annotations). This method is rarely useful in client code, it's designed mostly
* to aid the inference procedure.
*
* @param owner element to get the info about
@@ -220,7 +219,7 @@ public abstract class NullableNotNullManager {
* @return an annotation (if any) with the given nullability semantics on the given declaration or its type. In case of conflicts,
* type annotations are preferred.
*/
public @Nullable PsiAnnotation findExplicitNullabilityAnnotation(@NotNull PsiModifierListOwner owner,
public @Nullable PsiAnnotation findExplicitNullabilityAnnotation(@NotNull PsiModifierListOwner owner,
@NotNull Collection<Nullability> nullabilities) {
NullabilityAnnotationDataHolder holder = getAllNullabilityAnnotationsWithNickNames();
Set<String> filteredSet =
@@ -252,7 +251,7 @@ public abstract class NullableNotNullManager {
memberAnno = annotation == null ? null : new AnnotationAndOwner(owner, annotation);
}
PsiType type = getOwnerType(owner);
if (memberAnno != null && type instanceof PsiArrayType && !isInferredAnnotation(memberAnno.annotation) &&
if (memberAnno != null && type instanceof PsiArrayType && !isInferredAnnotation(memberAnno.annotation) &&
!isExternalAnnotation(memberAnno.annotation) && AnnotationTargetUtil.isTypeAnnotation(memberAnno.annotation)) {
// Ambiguous TYPE_USE annotation on array type: we consider that it annotates an array component instead.
// ignore inferred/external annotations here, as they are applicable to PsiModifierListOwner only, regardless of target
@@ -317,7 +316,7 @@ public abstract class NullableNotNullManager {
/**
* @param context place in PSI tree
* @return default nullability for type-use elements at given place
* @return default nullability for type-use elements at given place
*/
public @Nullable NullabilityAnnotationInfo findDefaultTypeUseNullability(@Nullable PsiElement context) {
if (context == null) return null;
@@ -406,7 +405,7 @@ public abstract class NullableNotNullManager {
}
public abstract @NotNull List<String> getInstrumentedNotNulls();
public abstract void setInstrumentedNotNulls(@NotNull List<String> names);
/**
@@ -425,7 +424,7 @@ public abstract class NullableNotNullManager {
* @return found type annotation, or null if not found. For type parameter types upper bound annotations are also checked
*/
@Contract("null, _ -> null")
private @Nullable NullabilityAnnotationInfo findAnnotationInTypeHierarchy(@Nullable PsiType type,
private @Nullable NullabilityAnnotationInfo findAnnotationInTypeHierarchy(@Nullable PsiType type,
@NotNull NullabilityAnnotationDataHolder qualifiedNames) {
if (type == null) return null;
Ref<NullabilityAnnotationInfo> result = Ref.create(null);

View File

@@ -1,22 +1,7 @@
/*
* Copyright 2000-2017 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-2021 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.lang.jvm.facade;
import com.intellij.lang.jvm.JvmClass;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.search.GlobalSearchScope;
@@ -32,7 +17,7 @@ public interface JvmFacade {
@NotNull
static JvmFacade getInstance(@NotNull Project project) {
return ServiceManager.getService(project, JvmFacade.class);
return project.getService(JvmFacade.class);
}
/**

View File

@@ -1,7 +1,6 @@
// 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.
// Copyright 2000-2021 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.psi;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import org.intellij.lang.annotations.MagicConstant;
import org.jetbrains.annotations.NotNull;
@@ -9,9 +8,9 @@ import org.jetbrains.annotations.Nullable;
public abstract class JavaCodeFragmentFactory {
public static JavaCodeFragmentFactory getInstance(Project project) {
return ServiceManager.getService(project, JavaCodeFragmentFactory.class);
return project.getService(JavaCodeFragmentFactory.class);
}
/**
* Creates a Java expression code fragment from the text of the expression.
*

View File

@@ -1,7 +1,6 @@
// Copyright 2000-2020 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-2021 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.psi;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.javadoc.PsiDocTag;
@@ -38,7 +37,7 @@ public interface PsiElementFactory extends PsiJavaParserFacade, JVMElementFactor
}
static PsiElementFactory getInstance(Project project) {
return ServiceManager.getService(project, PsiElementFactory.class);
return project.getService(PsiElementFactory.class);
}
/**

View File

@@ -1,7 +1,6 @@
// 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.
// Copyright 2000-2021 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.psi;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.NlsSafe;
import com.intellij.openapi.util.text.StringUtil;
@@ -22,7 +21,7 @@ import java.util.regex.Pattern;
public abstract class PsiNameHelper {
public static PsiNameHelper getInstance(Project project) {
return ServiceManager.getService(project, PsiNameHelper.class);
return project.getService(PsiNameHelper.class);
}
/**
@@ -139,7 +138,7 @@ public abstract class PsiNameHelper {
/**
* @param referenceText text of the inner class reference (without annotations), e.g. {@code A.B<C>.D<E, F.G>}
* @return outer class reference (e.g. {@code A.B<C>}); empty string if the original reference is unqualified
* @return outer class reference (e.g. {@code A.B<C>}); empty string if the original reference is unqualified
*/
@Contract(pure = true)
public static @NotNull String getOuterClassReference(String referenceText) {
@@ -163,7 +162,7 @@ public abstract class PsiNameHelper {
/**
* @param referenceText text of the class reference (without annotations), e.g. {@code A.B<C>.D<E, F.G>}
* @return qualified class name (e.g. {@code A.B.D}).
* @return qualified class name (e.g. {@code A.B.D}).
*/
@Contract(pure = true)
public static @NotNull String getQualifiedClassName(@NotNull String referenceText, boolean removeWhitespace) {

View File

@@ -1,31 +1,16 @@
/*
* Copyright 2000-2009 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-2021 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.
/*
* @author max
*/
package com.intellij.psi;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
public abstract class SmartTypePointerManager {
public static SmartTypePointerManager getInstance(Project project) {
return ServiceManager.getService(project, SmartTypePointerManager.class);
return project.getService(SmartTypePointerManager.class);
}
@NotNull

View File

@@ -1,7 +1,6 @@
// Copyright 2000-2020 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-2021 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.psi.codeStyle;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.*;
import com.intellij.util.IncorrectOperationException;
@@ -17,7 +16,7 @@ import java.util.function.Predicate;
public abstract class JavaCodeStyleManager {
public static JavaCodeStyleManager getInstance(Project project) {
return ServiceManager.getService(project, JavaCodeStyleManager.class);
return project.getService(JavaCodeStyleManager.class);
}
public static final int DO_NOT_ADD_IMPORTS = 0x1000;

View File

@@ -1,21 +1,6 @@
/*
* 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-2021 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.psi.codeStyle;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiFile;
@@ -43,6 +28,6 @@ public abstract class JavaCodeStyleSettingsFacade {
*/
@Deprecated
public static JavaCodeStyleSettingsFacade getInstance(Project project) {
return ServiceManager.getService(project, JavaCodeStyleSettingsFacade.class);
return project.getService(JavaCodeStyleSettingsFacade.class);
}
}

View File

@@ -1,7 +1,6 @@
// Copyright 2000-2020 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-2021 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.psi.javadoc;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
@@ -12,7 +11,7 @@ public interface JavadocManager {
private SERVICE() { }
public static JavadocManager getInstance(@NotNull Project project) {
return ServiceManager.getService(project, JavadocManager.class);
return project.getService(JavadocManager.class);
}
}

View File

@@ -1,9 +1,8 @@
// 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.
// Copyright 2000-2021 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.psi.util;
import com.intellij.core.JavaPsiBundle;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.Project;
@@ -710,7 +709,7 @@ public final class PsiUtil extends PsiUtilCore {
}
return false;
}
/**
@@ -1070,7 +1069,7 @@ public final class PsiUtil extends PsiUtilCore {
}
}
PsiResolveHelper instance = ServiceManager.getService(element.getProject(), PsiResolveHelper.class);
PsiResolveHelper instance = element.getProject().getService(PsiResolveHelper.class);
return instance != null ? instance.getEffectiveLanguageLevel(getVirtualFile(file)) : LanguageLevel.HIGHEST;
}

View File

@@ -1,11 +1,11 @@
// Copyright 2000-2021 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.codeInsight.javadoc;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
public abstract class JavaDocCodeStyle {
public static JavaDocCodeStyle getInstance(Project project) {
return ServiceManager.getService(project, JavaDocCodeStyle.class);
return project.getService(JavaDocCodeStyle.class);
}
public abstract boolean spaceBeforeComma();

View File

@@ -1,21 +1,6 @@
/*
* 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-2021 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.core;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.roots.FileIndexFacade;
import com.intellij.openapi.vfs.VirtualFile;
@@ -39,7 +24,7 @@ public class CoreJavaDirectoryService extends JavaDirectoryService {
@Override
public PsiPackage getPackage(@NotNull PsiDirectory dir) {
return ServiceManager.getService(dir.getProject(), CoreJavaFileManager.class).getPackage(dir);
return dir.getProject().getService(CoreJavaFileManager.class).getPackage(dir);
}
@Nullable

View File

@@ -1,9 +1,8 @@
// Copyright 2000-2020 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-2021 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.psi;
import com.intellij.lang.Language;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.Project;
@@ -37,7 +36,7 @@ public class ClassFileViewProvider extends SingleRootFileViewProvider {
@Override
protected PsiFile createFile(@NotNull Project project, @NotNull VirtualFile file, @NotNull FileType fileType) {
FileIndexFacade fileIndex = ServiceManager.getService(project, FileIndexFacade.class);
FileIndexFacade fileIndex = project.getService(FileIndexFacade.class);
if (!fileIndex.isInLibraryClasses(file) && fileIndex.isInSource(file)) {
return new PsiBinaryFileImpl((PsiManagerImpl)getManager(), this);
}

View File

@@ -1,22 +1,7 @@
/*
* Copyright 2000-2017 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-2021 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.psi.impl;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.java.LanguageLevel;
@@ -29,7 +14,7 @@ import org.jetbrains.annotations.Nullable;
*/
public abstract class JavaPsiImplementationHelper {
public static JavaPsiImplementationHelper getInstance(@NotNull Project project) {
return ServiceManager.getService(project, JavaPsiImplementationHelper.class);
return project.getService(JavaPsiImplementationHelper.class);
}
@NotNull

View File

@@ -1,8 +1,7 @@
// Copyright 2000-2020 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-2021 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.psi.impl;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicatorProvider;
@@ -1105,8 +1104,8 @@ public final class PsiClassImplUtil {
return true;
}
FileIndexFacade fileIndex = ServiceManager.getService(file1.getProject(), FileIndexFacade.class);
FileIndexFacade fileIndex2 = ServiceManager.getService(file2.getProject(), FileIndexFacade.class);
FileIndexFacade fileIndex = file1.getProject().getService(FileIndexFacade.class);
FileIndexFacade fileIndex2 = file2.getProject().getService(FileIndexFacade.class);
VirtualFile vfile1 = file1.getViewProvider().getVirtualFile();
VirtualFile vfile2 = file2.getViewProvider().getVirtualFile();
boolean lib1 = fileIndex.isInLibraryClasses(vfile1);

View File

@@ -1,9 +1,8 @@
// 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.
// Copyright 2000-2021 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.java.psi;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.projectRoots.impl.ProjectRootUtil;
@@ -24,8 +23,8 @@ import com.intellij.psi.search.searches.ClassInheritorsSearch;
import com.intellij.psi.text.BlockSupport;
import com.intellij.psi.util.PsiUtil;
import com.intellij.refactoring.rename.RenameProcessor;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.HeavyPlatformTestCase;
import com.intellij.testFramework.IdeaTestUtil;
import com.intellij.testFramework.JavaPsiTestCase;
import com.intellij.testFramework.PsiTestUtil;
@@ -649,7 +648,7 @@ public class SrcRepositoryUseTest extends JavaPsiTestCase {
TextRange classRange = aClass.getTextRange();
String text = aClass.getText();
BlockSupport blockSupport = ServiceManager.getService(myProject, BlockSupport.class);
BlockSupport blockSupport = myProject.getService(BlockSupport.class);
final PsiFile psiFile = aClass.getContainingFile();
ApplicationManager.getApplication().runWriteAction(() -> blockSupport.reparseRange(psiFile, classRange.getStartOffset(), classRange.getEndOffset(), ""));

View File

@@ -1,8 +1,7 @@
// 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.
// Copyright 2000-2021 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.psi.impl.source.jsp;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiFile;
import com.intellij.psi.jsp.BaseJspFile;
@@ -15,7 +14,7 @@ import java.util.HashSet;
public abstract class JspContextManager {
public static JspContextManager getInstance(Project project) {
return ServiceManager.getService(project, JspContextManager.class);
return project.getService(JspContextManager.class);
}
public abstract BaseJspFile[] getSuitableContextFiles(@NotNull PsiFile file);

View File

@@ -1,23 +1,8 @@
/*
* Copyright 2000-2013 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-2021 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.psi.impl.source.jsp;
import com.intellij.lang.jsp.IBaseJspManager;
import com.intellij.lang.jsp.JspVersion;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
@@ -39,7 +24,7 @@ import java.util.Set;
public abstract class JspManager implements IBaseJspManager {
public static JspManager getInstance(@NotNull Project project) {
return ServiceManager.getService(project, JspManager.class);
return project.getService(JspManager.class);
}
@NotNull

View File

@@ -1,21 +1,6 @@
/*
* Copyright 2000-2009 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-2021 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.util;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
@@ -29,7 +14,7 @@ import org.jetbrains.annotations.Nullable;
public abstract class TreeClassChooserFactory {
public static TreeClassChooserFactory getInstance(Project project) {
return ServiceManager.getService(project, TreeClassChooserFactory.class);
return project.getService(TreeClassChooserFactory.class);
}

View File

@@ -1,9 +1,6 @@
/*
* Copyright 2000-2017 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-2021 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.refactoring;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
@@ -15,7 +12,7 @@ import org.jetbrains.annotations.Nullable;
*/
public abstract class JavaRefactoringFactory extends RefactoringFactory {
public static JavaRefactoringFactory getInstance(Project project) {
return (JavaRefactoringFactory) ServiceManager.getService(project, RefactoringFactory.class);
return (JavaRefactoringFactory)project.getService(RefactoringFactory.class);
}
@Override

View File

@@ -1,21 +1,6 @@
/*
* Copyright 2000-2009 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-2021 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.refactoring.listeners;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
@@ -36,6 +21,6 @@ public abstract class JavaRefactoringListenerManager {
public abstract void removeMoveMembersListener(@NotNull MoveMemberListener moveMembersListener);
public static JavaRefactoringListenerManager getInstance(Project project) {
return ServiceManager.getService(project, JavaRefactoringListenerManager.class);
return project.getService(JavaRefactoringListenerManager.class);
}
}

View File

@@ -1,8 +1,8 @@
// Copyright 2000-2021 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.psi;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.FileTypeRegistry;
import com.intellij.psi.impl.DebugUtil;
@@ -75,7 +75,7 @@ public abstract class AbstractReparseTestCase extends LightJavaCodeInsightFixtur
protected void doReparse(final String s, final int length) {
CommandProcessor.getInstance().executeCommand(getProject(), () -> ApplicationManager.getApplication().runWriteAction(() -> {
BlockSupport blockSupport = ServiceManager.getService(getProject(), BlockSupport.class);
BlockSupport blockSupport = getProject().getService(BlockSupport.class);
blockSupport.reparseRange(myDummyFile, myInsertOffset - length, myInsertOffset, s);
}), "asd", null);
}

View File

@@ -1,8 +1,7 @@
// 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-2021 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.jetbrains.jsonSchema;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
@@ -33,7 +32,7 @@ public class JsonSchemaCatalogProjectConfiguration implements PersistentStateCom
}
public static JsonSchemaCatalogProjectConfiguration getInstance(@NotNull final Project project) {
return ServiceManager.getService(project, JsonSchemaCatalogProjectConfiguration.class);
return project.getService(JsonSchemaCatalogProjectConfiguration.class);
}
public JsonSchemaCatalogProjectConfiguration() {

View File

@@ -1,10 +1,7 @@
/*
* 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-2021 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.jetbrains.jsonSchema;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
@@ -66,7 +63,7 @@ public class JsonSchemaMappingsProjectConfiguration implements PersistentStateCo
}
public static JsonSchemaMappingsProjectConfiguration getInstance(@NotNull final Project project) {
return ServiceManager.getService(project, JsonSchemaMappingsProjectConfiguration.class);
return project.getService(JsonSchemaMappingsProjectConfiguration.class);
}
public JsonSchemaMappingsProjectConfiguration(@NotNull Project project) {

View File

@@ -1,7 +1,6 @@
// Copyright 2000-2020 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-2021 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.jetbrains.jsonSchema.ide;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
@@ -20,7 +19,7 @@ import java.util.List;
public interface JsonSchemaService {
final class Impl {
public static JsonSchemaService get(@NotNull Project project) {
return ServiceManager.getService(project, JsonSchemaService.class);
return project.getService(JsonSchemaService.class);
}
}

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2013 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-2021 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.
/*
* User: anna
@@ -22,14 +8,13 @@ package com.intellij.codeInspection.ex;
import com.intellij.codeInspection.reference.RefElement;
import com.intellij.codeInspection.reference.RefManager;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
public abstract class EntryPointsManager implements Disposable {
public static EntryPointsManager getInstance(Project project) {
return ServiceManager.getService(project, EntryPointsManager.class);
return project.getService(EntryPointsManager.class);
}
public abstract void resolveEntryPoints(@NotNull RefManager manager);

View File

@@ -1,28 +1,13 @@
/*
* 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.
* 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-2021 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.editor;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
public abstract class LazyRangeMarkerFactory {
public static LazyRangeMarkerFactory getInstance(Project project) {
return ServiceManager.getService(project, LazyRangeMarkerFactory.class);
return project.getService(LazyRangeMarkerFactory.class);
}
@NotNull

View File

@@ -1,28 +1,13 @@
/*
* Copyright 2000-2013 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-2021 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.codeInsight.daemon.impl.analysis;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
public abstract class HighlightingLevelManager {
public static HighlightingLevelManager getInstance(Project project) {
return ServiceManager.getService(project, HighlightingLevelManager.class);
return project.getService(HighlightingLevelManager.class);
}
/**

View File

@@ -1,9 +1,8 @@
// Copyright 2000-2020 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-2021 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.codeInsight.lookup;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.impl.source.tree.injected.InjectedLanguageEditorUtil;
@@ -16,7 +15,7 @@ import java.beans.PropertyChangeListener;
public abstract class LookupManager {
public static LookupManager getInstance(@NotNull Project project){
return ServiceManager.getService(project, LookupManager.class);
return project.getService(LookupManager.class);
}
@Nullable

View File

@@ -1,7 +1,6 @@
// Copyright 2000-2020 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-2021 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.application.options.codeStyle.cache;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.UserDataHolder;
import com.intellij.openapi.vfs.VirtualFile;
@@ -13,7 +12,7 @@ import org.jetbrains.annotations.Nullable;
public interface CodeStyleCachingService {
static CodeStyleCachingService getInstance(@NotNull Project project) {
return ServiceManager.getService(project, CodeStyleCachingService.class);
return project.getService(CodeStyleCachingService.class);
}
@Nullable

View File

@@ -1,9 +1,8 @@
// Copyright 2000-2020 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-2021 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.codeStyle;
import com.intellij.lang.Language;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.fileTypes.FileType;
@@ -26,7 +25,7 @@ public abstract class CodeStyleFacade {
public static CodeStyleFacade getInstance(@Nullable Project project) {
if (project == null) return getInstance();
return ServiceManager.getService(project, CodeStyleFacade.class);
return project.getService(CodeStyleFacade.class);
}
/**

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 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-2021 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.psi.codeStyle;
import com.intellij.application.options.CodeStyle;
@@ -6,7 +6,6 @@ import com.intellij.lang.Language;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.PersistentStateComponentWithModificationTracker;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.Project;
@@ -302,7 +301,7 @@ public class CodeStyleSettingsManager implements PersistentStateComponentWithMod
}
else {
if (!project.isDisposed()) {
CodeStyleSettingsManager projectInstance = ServiceManager.getService(project, ProjectCodeStyleSettingsManager.class);
CodeStyleSettingsManager projectInstance = project.getService(ProjectCodeStyleSettingsManager.class);
if (projectInstance != null) {
projectInstance.removeListener(listener);
}

View File

@@ -1,21 +1,6 @@
/*
* Copyright 2000-2009 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-2021 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;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
@@ -24,7 +9,7 @@ import com.intellij.openapi.vfs.VirtualFile;
*/
public abstract class SelectInEditorManager{
public static SelectInEditorManager getInstance(Project project) {
return ServiceManager.getService(project, SelectInEditorManager.class);
return project.getService(SelectInEditorManager.class);
}
/** Do selection in Editor. This selection is removed automatically, then caret position is changed,

View File

@@ -1,21 +1,6 @@
/*
* 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-2021 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.roots;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.ModificationTracker;
@@ -31,7 +16,7 @@ public abstract class ProjectRootModificationTracker implements ModificationTrac
};
public static ProjectRootModificationTracker getInstance(Project project) {
ProjectRootModificationTracker instance = ServiceManager.getService(project, ProjectRootModificationTracker.class);
ProjectRootModificationTracker instance = project.getService(ProjectRootModificationTracker.class);
if (instance == null) return NEVER_CHANGED;
return instance;
}

View File

@@ -1,21 +1,6 @@
/*
* 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.
* 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-2021 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.pom.references;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.pom.PomTarget;
import com.intellij.psi.PsiElement;
@@ -28,7 +13,7 @@ import org.jetbrains.annotations.NotNull;
public abstract class PomService {
private static PomService getInstance(Project project) {
return ServiceManager.getService(project, PomService.class);
return project.getService(PomService.class);
}
@NotNull

View File

@@ -1,8 +1,7 @@
// Copyright 2000-2020 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-2021 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.psi;
import com.intellij.lang.Language;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
@@ -16,7 +15,7 @@ public abstract class PsiFileFactory {
public static final Key<PsiFile> ORIGINAL_FILE = Key.create("ORIGINAL_FILE");
public static PsiFileFactory getInstance(Project project) {
return ServiceManager.getService(project, PsiFileFactory.class);
return project.getService(PsiFileFactory.class);
}
/**

View File

@@ -1,9 +1,8 @@
// Copyright 2000-2020 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-2021 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.psi;
import com.intellij.lang.Language;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.fileTypes.LanguageFileType;
import com.intellij.openapi.project.Project;
import com.intellij.util.IncorrectOperationException;
@@ -53,7 +52,7 @@ public interface PsiParserFacade {
}
public static PsiParserFacade getInstance(Project project) {
return ServiceManager.getService(project, PsiParserFacade.class);
return project.getService(PsiParserFacade.class);
}
}
}

View File

@@ -1,9 +1,8 @@
// 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.
// Copyright 2000-2021 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.psi.codeStyle;
import com.intellij.formatting.FormattingMode;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.Project;
@@ -37,7 +36,7 @@ public abstract class CodeStyleManager {
* @return the code style manager instance.
*/
public static CodeStyleManager getInstance(@NotNull Project project) {
return ServiceManager.getService(project, CodeStyleManager.class);
return project.getService(CodeStyleManager.class);
}
/**

View File

@@ -1,21 +1,6 @@
/*
* 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.
* 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-2021 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.psi.impl;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
@@ -38,7 +23,7 @@ public abstract class ResolveScopeManager {
@NotNull
public static ResolveScopeManager getInstance(@NotNull Project project) {
return ServiceManager.getService(project, ResolveScopeManager.class);
return project.getService(ResolveScopeManager.class);
}
@NotNull

View File

@@ -1,22 +1,7 @@
/*
* Copyright 2000-2009 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-2021 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.psi.impl.file;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.NlsSafe;
import com.intellij.openapi.vfs.VirtualFile;
@@ -30,7 +15,7 @@ import org.jetbrains.annotations.Nullable;
*/
public abstract class PsiDirectoryFactory {
public static PsiDirectoryFactory getInstance(Project project) {
return ServiceManager.getService(project, PsiDirectoryFactory.class);
return project.getService(PsiDirectoryFactory.class);
}
@NotNull
@@ -38,7 +23,7 @@ public abstract class PsiDirectoryFactory {
@NotNull
public abstract @NlsSafe String getQualifiedName(@NotNull PsiDirectory directory, final boolean presentable);
@Nullable
public abstract PsiDirectoryContainer getDirectoryContainer(@NotNull PsiDirectory directory);

View File

@@ -1,24 +1,9 @@
/*
* Copyright 2000-2016 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-2021 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.psi.text;
import com.intellij.lang.ASTNode;
import com.intellij.lang.FileASTNode;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.ControlFlowException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.Project;
@@ -35,7 +20,7 @@ import org.jetbrains.annotations.NotNull;
public abstract class BlockSupport {
public static BlockSupport getInstance(Project project) {
return ServiceManager.getService(project, BlockSupport.class);
return project.getService(BlockSupport.class);
}
public abstract void reparseRange(@NotNull PsiFile file, int startOffset, int endOffset, @NonNls @NotNull CharSequence newText) throws IncorrectOperationException;

View File

@@ -1,24 +1,9 @@
/*
* 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-2021 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.diff;
import com.intellij.ide.diff.DiffElement;
import com.intellij.ide.diff.DirDiffModel;
import com.intellij.ide.diff.DirDiffSettings;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -28,9 +13,9 @@ import org.jetbrains.annotations.Nullable;
*/
public abstract class DirDiffManager {
public static DirDiffManager getInstance(@NotNull Project project) {
return ServiceManager.getService(project, DirDiffManager.class);
return project.getService(DirDiffManager.class);
}
public abstract void showDiff(@NotNull DiffElement dir1, @NotNull DiffElement dir2, DirDiffSettings settings, @Nullable Runnable onWindowClosing);
public abstract void showDiff(@NotNull DiffElement dir1, @NotNull DiffElement dir2, DirDiffSettings settings);

View File

@@ -1,9 +1,8 @@
// Copyright 2000-2020 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-2021 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.dvcs.cherrypick;
import com.intellij.dvcs.ui.DvcsBundle;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.BackgroundTaskQueue;
import com.intellij.openapi.progress.ProgressIndicator;
@@ -145,6 +144,6 @@ public final class VcsCherryPickManager {
}
public static VcsCherryPickManager getInstance(@NotNull Project project) {
return ServiceManager.getService(project, VcsCherryPickManager.class);
return project.getService(VcsCherryPickManager.class);
}
}

View File

@@ -8,7 +8,6 @@ import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonShortcuts;
import com.intellij.openapi.actionSystem.DataProvider;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vcs.VcsDataKeys;
@@ -37,7 +36,10 @@ import com.intellij.vcs.log.ui.VcsLogActionPlaces;
import com.intellij.vcs.log.ui.details.commit.CommitDetailsPanel;
import kotlin.Unit;
import one.util.streamex.StreamEx;
import org.jetbrains.annotations.*;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.border.Border;
@@ -756,7 +758,7 @@ public final class PushLog extends JPanel implements DataProvider {
MyShowDetailsAction(@NotNull Project project, @NotNull Consumer<Boolean> onUpdate) {
super(DvcsBundle.message("push.show.details"), AllIcons.Actions.PreviewDetailsVertically);
mySettings = ServiceManager.getService(project, PushSettings.class);
mySettings = project.getService(PushSettings.class);
myOnUpdate = onUpdate;
}

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 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-2021 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;
@@ -12,7 +12,6 @@ import com.intellij.ide.errorTreeView.NewErrorTreeViewPanel;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
@@ -230,7 +229,7 @@ public final class ExecutionHelper {
@NotNull final @NlsContexts.TabTitle String tabDisplayName) {
CommandProcessor commandProcessor = CommandProcessor.getInstance();
commandProcessor.executeCommand(myProject, () -> {
final MessageView messageView = ServiceManager.getService(myProject, MessageView.class);
final MessageView messageView = myProject.getService(MessageView.class);
final Content content = ContentFactory.SERVICE.getInstance().createContent(errorTreeView, tabDisplayName, true);
messageView.getContentManager().addContent(content);
Disposer.register(content, errorTreeView);

View File

@@ -1,9 +1,8 @@
// 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.
// Copyright 2000-2021 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;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.NlsSafe;
@@ -66,7 +65,7 @@ public class TestStateStorage implements Disposable {
private volatile ScheduledFuture<?> myMapFlusher;
public static TestStateStorage getInstance(@NotNull Project project) {
return ServiceManager.getService(project, TestStateStorage.class);
return project.getService(TestStateStorage.class);
}
public TestStateStorage(Project project) {

View File

@@ -1,8 +1,7 @@
// 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.
// Copyright 2000-2021 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.externalSystem.autoimport
import com.intellij.openapi.Disposable
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.Disposer
import org.jetbrains.annotations.ApiStatus
@@ -58,7 +57,7 @@ interface ExternalSystemProjectTracker {
companion object {
@JvmStatic
fun getInstance(project: Project): ExternalSystemProjectTracker {
return ServiceManager.getService(project, ExternalSystemProjectTracker::class.java)
return project.getService(ExternalSystemProjectTracker::class.java)
}
}
}

View File

@@ -1,7 +1,6 @@
// Copyright 2000-2020 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-2021 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.externalSystem.autoimport
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.project.Project
interface ExternalSystemProjectTrackerSettings {
@@ -28,7 +27,7 @@ interface ExternalSystemProjectTrackerSettings {
companion object {
@JvmStatic
fun getInstance(project: Project): ExternalSystemProjectTrackerSettings {
return ServiceManager.getService(project, ExternalSystemProjectTrackerSettings::class.java)
return project.getService(ExternalSystemProjectTrackerSettings::class.java)
}
}
}

View File

@@ -1,21 +1,6 @@
/*
* Copyright 2000-2016 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-2021 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.externalSystem.service.project.manage;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.externalSystem.importing.ImportSpec;
import com.intellij.openapi.externalSystem.model.DataNode;
import com.intellij.openapi.externalSystem.model.ProjectSystemId;
@@ -29,7 +14,7 @@ import org.jetbrains.annotations.NotNull;
public interface ExternalProjectsManager {
static ExternalProjectsManager getInstance(@NotNull Project project) {
return ServiceManager.getService(project, ExternalProjectsManager.class);
return project.getService(ExternalProjectsManager.class);
}
@NotNull

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 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-2021 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.externalSystem.service.execution;
import com.intellij.build.*;
@@ -23,7 +23,6 @@ import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.externalSystem.execution.ExternalSystemExecutionConsoleManager;
import com.intellij.openapi.externalSystem.model.ProjectSystemId;
import com.intellij.openapi.externalSystem.model.execution.ExternalSystemTaskExecutionSettings;
@@ -210,7 +209,7 @@ public class ExternalSystemRunnableState extends UserDataHolderBase implements R
Filter[] filters = consoleManager.getCustomExecutionFilters(myProject, task, myEnv);
Arrays.stream(filters).forEach(buildDescriptor::withExecutionFilter);
final BuildProgressListener progressListener =
progressListenerClazz != null ? ServiceManager.getService(myProject, progressListenerClazz)
progressListenerClazz != null ? myProject.getService(progressListenerClazz)
: createBuildView(buildDescriptor, consoleView);
ExternalSystemRunConfiguration.EP_NAME

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 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-2021 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.externalSystem.service.notification;
import com.intellij.build.issue.BuildIssue;
@@ -9,11 +9,9 @@ import com.intellij.notification.Notification;
import com.intellij.notification.NotificationGroup;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.DataProvider;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.externalSystem.issue.BuildIssueException;
import com.intellij.openapi.externalSystem.model.LocationAwareExternalSystemException;
@@ -53,7 +51,10 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.PrintStream;
import java.util.*;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
/**
@@ -87,7 +88,7 @@ public class ExternalSystemNotificationManager implements Disposable {
}
public static @NotNull ExternalSystemNotificationManager getInstance(@NotNull Project project) {
return ServiceManager.getService(project, ExternalSystemNotificationManager.class);
return project.getService(ExternalSystemNotificationManager.class);
}
/**
@@ -273,7 +274,7 @@ public class ExternalSystemNotificationManager implements Disposable {
final ToolWindow toolWindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.MESSAGES_WINDOW);
if (toolWindow == null) return;
final MessageView messageView = ServiceManager.getService(project, MessageView.class);
final MessageView messageView = project.getService(MessageView.class);
UIUtil.invokeLaterIfNeeded(() -> {
if (project.isDisposed()) return;
for (Content content: messageView.getContentManager().getContents()) {
@@ -381,7 +382,7 @@ public class ExternalSystemNotificationManager implements Disposable {
Content targetContent = findContent(contentIdPair, contentDisplayName);
assert myProject != null;
final MessageView messageView = ServiceManager.getService(myProject, MessageView.class);
final MessageView messageView = myProject.getService(MessageView.class);
if (targetContent == null || !contentIdPair.equals(targetContent.getUserData(CONTENT_ID_KEY))) {
errorTreeView = new NewEditableErrorTreeViewPanel(myProject, null, true, true, null);
targetContent = ContentFactory.SERVICE.getInstance().createContent(errorTreeView, contentDisplayName, true);
@@ -406,7 +407,7 @@ public class ExternalSystemNotificationManager implements Disposable {
private @Nullable Content findContent(@NotNull Pair<NotificationSource, ProjectSystemId> contentIdPair, @NotNull String contentDisplayName) {
Content targetContent = null;
assert myProject != null;
final MessageView messageView = ServiceManager.getService(myProject, MessageView.class);
final MessageView messageView = myProject.getService(MessageView.class);
for (Content content: messageView.getContentManager().getContents()) {
if (contentIdPair.equals(content.getUserData(CONTENT_ID_KEY))
&& StringUtil.equals(content.getDisplayName(), contentDisplayName) && !content.isPinned()) {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 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-2021 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.externalSystem.service.project;
import com.intellij.facet.ModifiableFacetModel;
@@ -6,7 +6,6 @@ import com.intellij.ide.highlighter.ModuleFileType;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.externalSystem.ExternalSystemManager;
import com.intellij.openapi.externalSystem.model.DataNode;
@@ -267,9 +266,8 @@ public abstract class AbstractIdeModifiableModelsProvider extends IdeModelsProvi
}
private ModifiableWorkspace doGetModifiableWorkspace() {
return ReadAction.compute(() ->
ServiceManager.getService(myProject, ExternalProjectsWorkspaceImpl.class)
.createModifiableWorkspace(this));
return ReadAction.compute(() -> myProject.getService(ExternalProjectsWorkspaceImpl.class)
.createModifiableWorkspace(this));
}
private Graph<Module> getModuleGraph() {

View File

@@ -1,4 +1,4 @@
// Copyright 2000-2020 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-2021 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.externalSystem.service.project.manage;
import com.intellij.concurrency.ConcurrentCollectionFactory;
@@ -8,7 +8,10 @@ import com.intellij.ide.plugins.DynamicPluginListener;
import com.intellij.ide.plugins.IdeaPluginDescriptor;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.PathManagerEx;
import com.intellij.openapi.components.*;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.components.StoragePathMacros;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.externalSystem.ExternalSystemManager;
import com.intellij.openapi.externalSystem.model.*;
@@ -75,7 +78,7 @@ public final class ExternalProjectsDataStorage extends SimpleModificationTracker
private State myState = new State();
public static ExternalProjectsDataStorage getInstance(@NotNull Project project) {
return ServiceManager.getService(project, ExternalProjectsDataStorage.class);
return project.getService(ExternalProjectsDataStorage.class);
}
public ExternalProjectsDataStorage(@NotNull Project project) {

View File

@@ -35,7 +35,6 @@ import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.application.*;
import com.intellij.openapi.application.ex.ApplicationEx;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.externalSystem.ExternalSystemManager;
import com.intellij.openapi.externalSystem.execution.ExternalSystemExecutionConsoleManager;
@@ -456,7 +455,7 @@ public final class ExternalSystemUtil {
}
Ref<Supplier<? extends FinishBuildEvent>> finishSyncEventSupplier = Ref.create();
SyncViewManager syncViewManager = ServiceManager.getService(project, SyncViewManager.class);
SyncViewManager syncViewManager = project.getService(SyncViewManager.class);
try (BuildEventDispatcher eventDispatcher = new ExternalSystemEventDispatcher(resolveProjectTask.getId(), syncViewManager, false)) {
ExternalSystemTaskNotificationListenerAdapter taskListener = new ExternalSystemTaskNotificationListenerAdapter() {
@Override

View File

@@ -1,8 +1,7 @@
// Copyright 2000-2020 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-2021 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.psi.impl.cache;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
@@ -38,13 +37,13 @@ public interface CacheManager {
@Deprecated
@ApiStatus.ScheduledForRemoval(inVersion = "2021.3")
public static CacheManager getInstance(Project project) {
return ServiceManager.getService(project, CacheManager.class);
return project.getService(CacheManager.class);
}
}
@NotNull
static CacheManager getInstance(Project project) {
return ServiceManager.getService(project, CacheManager.class);
return project.getService(CacheManager.class);
}
PsiFile @NotNull [] getFilesWithWord(@NotNull String word,

View File

@@ -1,7 +1,6 @@
// Copyright 2000-2020 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-2021 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.psi.impl.cache;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
@@ -15,7 +14,7 @@ public interface TodoCacheManager {
}
public static TodoCacheManager getInstance(Project project) {
return ServiceManager.getService(project, TodoCacheManager.class);
return project.getService(TodoCacheManager.class);
}
}

View File

@@ -1,8 +1,7 @@
// Copyright 2000-2020 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-2021 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.psi.search;
import com.intellij.concurrency.AsyncFuture;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
@@ -36,7 +35,7 @@ public interface PsiSearchHelper {
@NotNull
static PsiSearchHelper getInstance(@NotNull Project project) {
return ServiceManager.getService(project, PsiSearchHelper.class);
return project.getService(PsiSearchHelper.class);
}
/**

View File

@@ -1,7 +1,6 @@
// Copyright 2000-2020 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-2021 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.psi.search;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
@@ -15,7 +14,7 @@ public interface PsiTodoSearchHelper {
}
public static PsiTodoSearchHelper getInstance(Project project) {
return ServiceManager.getService(project, PsiTodoSearchHelper.class);
return project.getService(PsiTodoSearchHelper.class);
}
}

View File

@@ -1,7 +1,6 @@
// 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-2021 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.codeInsight.highlighting;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.editor.markup.RangeHighlighter;
@@ -25,7 +24,7 @@ import java.util.Collection;
*/
public abstract class HighlightManager {
public static HighlightManager getInstance(Project project) {
return ServiceManager.getService(project, HighlightManager.class);
return project.getService(HighlightManager.class);
}
/**

View File

@@ -1,11 +1,8 @@
/*
* 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-2021 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.diagnostic.logging;
import com.intellij.execution.process.ProcessOutputTypes;
import com.intellij.execution.ui.ConsoleViewContentType;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.components.StoragePathMacros;
@@ -102,7 +99,7 @@ public class LogConsolePreferences extends LogFilterRegistrar {
private static final Logger LOG = Logger.getInstance(LogConsolePreferences.class);
public static LogConsolePreferences getInstance(Project project) {
return ServiceManager.getService(project, LogConsolePreferences.class);
return project.getService(LogConsolePreferences.class);
}
public void updateCustomFilter(String customFilter) {

View File

@@ -1,9 +1,8 @@
// Copyright 2000-2020 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-2021 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;
import com.intellij.execution.configurations.RunConfiguration;
import com.intellij.execution.runners.ExecutionEnvironment;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.messages.Topic;
@@ -19,7 +18,7 @@ public abstract class ExecutionTargetManager {
@NotNull
public static ExecutionTargetManager getInstance(@NotNull Project project) {
return ServiceManager.getService(project, ExecutionTargetManager.class);
return project.getService(ExecutionTargetManager.class);
}
@NotNull

View File

@@ -17,7 +17,6 @@ package com.intellij.execution;
import com.intellij.execution.actions.RunConfigurationProducer;
import com.intellij.openapi.components.PersistentStateComponent;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.components.State;
import com.intellij.openapi.components.Storage;
import com.intellij.openapi.project.Project;
@@ -51,7 +50,7 @@ public final class RunConfigurationProducerService implements PersistentStateCom
@NotNull
public static RunConfigurationProducerService getInstance(@NotNull Project project) {
return ServiceManager.getService(project, RunConfigurationProducerService.class);
return project.getService(RunConfigurationProducerService.class);
}
public void addIgnoredProducer(@NotNull Class<? extends RunConfigurationProducer<?>> ignoredProducer) {

View File

@@ -1,7 +1,10 @@
// Copyright 2000-2020 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-2021 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.target
import com.intellij.openapi.components.*
import com.intellij.openapi.components.BaseState
import com.intellij.openapi.components.PersistentStateComponent
import com.intellij.openapi.components.State
import com.intellij.openapi.components.Storage
import com.intellij.openapi.project.Project
import com.intellij.util.text.UniqueNameGenerator
import com.intellij.util.xmlb.annotations.Property
@@ -13,7 +16,7 @@ class TargetEnvironmentsManager : PersistentStateComponent<TargetEnvironmentsMan
companion object {
@JvmStatic
fun getInstance(project: Project): TargetEnvironmentsManager =
ServiceManager.getService(project, TargetEnvironmentsManager::class.java)
project.getService(TargetEnvironmentsManager::class.java)
}
val targets: ContributedConfigurationsList<TargetEnvironmentConfiguration, TargetEnvironmentType<*>> = TargetsList()

View File

@@ -1,18 +1,4 @@
/*
* Copyright 2000-2009 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-2021 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.ui;
@@ -20,7 +6,6 @@ import com.intellij.execution.ui.layout.LayoutStateDefaults;
import com.intellij.execution.ui.layout.LayoutViewOptions;
import com.intellij.execution.ui.layout.PlaceInGrid;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ComponentWithActions;
import com.intellij.openapi.util.ActionCallback;
@@ -99,7 +84,7 @@ public interface RunnerLayoutUi {
}
public static Factory getInstance(Project project) {
return ServiceManager.getService(project, Factory.class);
return project.getService(Factory.class);
}
@NotNull

View File

@@ -1,22 +1,7 @@
/*
* Copyright 2000-2009 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-2021 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.facet;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.ModificationTracker;
import com.intellij.openapi.vfs.VirtualFile;
@@ -30,7 +15,7 @@ import java.util.Collection;
public abstract class FacetFinder {
public static FacetFinder getInstance(Project project) {
return ServiceManager.getService(project, FacetFinder.class);
return project.getService(FacetFinder.class);
}
@Nullable

View File

@@ -1,8 +1,7 @@
// Copyright 2000-2020 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-2021 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.find;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.NlsSafe;
import org.jetbrains.annotations.NotNull;
@@ -12,7 +11,7 @@ import java.util.List;
public interface FindInProjectSettings {
static FindInProjectSettings getInstance(Project project) {
return ServiceManager.getService(project, FindInProjectSettings.class);
return project.getService(FindInProjectSettings.class);
}
void addStringToFind(@NotNull String s);

Some files were not shown because too many files have changed in this diff Show More