deprecate Extensions.getExtensions(ExtensionPointName) in favour of ExtensionPointName.getExtensionList()

This commit is contained in:
Vladimir Krivosheev
2018-09-25 15:42:23 +02:00
parent 2476be32bf
commit 4d3eb96aae
404 changed files with 1213 additions and 4571 deletions
@@ -1,22 +1,7 @@
/*
* Copyright 2000-2011 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-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.
package com.intellij.packaging.impl.elements;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModulePointer;
import com.intellij.openapi.module.ModulePointerManager;
@@ -117,7 +102,7 @@ public class PackagingElementFactoryImpl extends PackagingElementFactory {
@NotNull
@Override
public PackagingElementType[] getAllElementTypes() {
final PackagingElementType[] types = Extensions.getExtensions(PackagingElementType.EP_NAME);
final PackagingElementType[] types = PackagingElementType.EP_NAME.getExtensions();
return ArrayUtil.mergeArrays(STANDARD_TYPES, types);
}
@@ -1,25 +1,12 @@
/*
* 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-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.
package com.intellij.packaging.artifacts;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.NonNls;
import java.util.List;
/**
* @author nik
@@ -38,13 +25,14 @@ public abstract class ArtifactPropertiesProvider {
public boolean isAvailableFor(@NotNull ArtifactType type) {
return true;
}
}
@NotNull
@NotNull
public abstract ArtifactProperties<?> createProperties(@NotNull ArtifactType artifactType);
public static ArtifactPropertiesProvider[] getProviders() {
return Extensions.getExtensions(EP_NAME);
@NotNull
public static List<ArtifactPropertiesProvider> getProviders() {
return EP_NAME.getExtensionList();
}
@Nullable
@@ -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-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.
package com.intellij.packaging.artifacts;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.packaging.elements.CompositePackagingElement;
import com.intellij.packaging.elements.PackagingElement;
import com.intellij.packaging.elements.PackagingElementOutputKind;
@@ -50,7 +35,7 @@ public abstract class ArtifactType {
public String getPresentableName() {
return myTitle;
}
}
@NotNull
public abstract Icon getIcon();
@@ -68,7 +53,7 @@ public abstract class ArtifactType {
}
public static ArtifactType[] getAllTypes() {
return Extensions.getExtensions(EP_NAME);
return EP_NAME.getExtensions();
}
@Nullable
@@ -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-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.
package com.intellij.packaging.elements;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.packaging.artifacts.Artifact;
import com.intellij.packaging.ui.ArtifactEditorContext;
@@ -56,7 +41,7 @@ public abstract class PackagingElementType<E extends PackagingElement<?>> {
public abstract boolean canCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact);
@NotNull
@NotNull
public abstract List<? extends PackagingElement<?>> chooseAndCreate(@NotNull ArtifactEditorContext context, @NotNull Artifact artifact,
@NotNull CompositePackagingElement<?> parent);
@@ -64,7 +49,7 @@ public abstract class PackagingElementType<E extends PackagingElement<?>> {
public abstract E createEmpty(@NotNull Project project);
protected static <T extends PackagingElementType<?>> T getInstance(final Class<T> aClass) {
for (PackagingElementType type : Extensions.getExtensions(EP_NAME)) {
for (PackagingElementType type : EP_NAME.getExtensionList()) {
if (aClass.isInstance(type)) {
return aClass.cast(type);
}
@@ -8,7 +8,6 @@ import com.intellij.debugger.engine.SuspendContextImpl;
import com.intellij.debugger.impl.DebuggerContextImpl;
import com.intellij.debugger.impl.DebuggerSession;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.fileEditor.TextEditor;
@@ -33,7 +32,7 @@ public class JvmSmartStepIntoActionHandler extends DebuggerActionHandler {
final VirtualFile file = position != null ? position.getFile().getVirtualFile() : null;
final FileEditor fileEditor = file != null? FileEditorManager.getInstance(project).getSelectedEditor(file) : null;
if (fileEditor instanceof TextEditor) {
for (JvmSmartStepIntoHandler handler : Extensions.getExtensions(JvmSmartStepIntoHandler.EP_NAME)) {
for (JvmSmartStepIntoHandler handler : JvmSmartStepIntoHandler.EP_NAME.getExtensionList()) {
if (handler.isAvailable(position) && handler.doSmartStep(position, session, (TextEditor)fileEditor)) {
return;
}
@@ -41,7 +41,6 @@ import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.JavaSdkType;
@@ -399,7 +398,7 @@ public abstract class DebugProcessImpl extends UserDataHolderBase implements Deb
@NotNull
private static List<ClassFilter> getActiveFilters() {
DebuggerSettings settings = DebuggerSettings.getInstance();
StreamEx<ClassFilter> stream = StreamEx.of(Extensions.getExtensions(DebuggerClassFilterProvider.EP_NAME))
StreamEx<ClassFilter> stream = StreamEx.of(DebuggerClassFilterProvider.EP_NAME.getExtensionList())
.flatCollection(DebuggerClassFilterProvider::getFilters);
if (settings.TRACING_FILTERS_ENABLED) {
stream = stream.prepend(settings.getSteppingFilters());
@@ -27,7 +27,6 @@ import com.intellij.execution.ui.RunnerLayoutUi;
import com.intellij.execution.ui.layout.PlaceInGrid;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.actionSystem.*;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Pair;
@@ -88,7 +87,7 @@ public class JavaDebugProcess extends XDebugProcess {
final DebugProcessImpl process = javaSession.getProcess();
myBreakpointHandlers = StreamEx.of(ourDefaultBreakpointHandlerFactories)
.append(Extensions.getExtensions(JavaBreakpointHandlerFactory.EP_NAME))
.append(JavaBreakpointHandlerFactory.EP_NAME.getExtensionList())
.map(factory -> factory.createHandler(process))
.toArray(XBreakpointHandler[]::new);
@@ -221,7 +221,7 @@ public abstract class JavaTestFrameworkRunnableState<T extends
}
// Append coverage parameters if appropriate
for (RunConfigurationExtension ext : Extensions.getExtensions(RunConfigurationExtension.EP_NAME)) {
for (RunConfigurationExtension ext : RunConfigurationExtension.EP_NAME.getExtensionList()) {
ext.updateJavaParameters(getConfiguration(), javaParameters, getRunnerSettings());
}
@@ -318,7 +318,7 @@ public abstract class JavaTestFrameworkRunnableState<T extends
final Object[] listeners = Extensions.getExtensions(epName);
for (final Object listener : listeners) {
boolean enabled = true;
for (RunConfigurationExtension ext : Extensions.getExtensions(RunConfigurationExtension.EP_NAME)) {
for (RunConfigurationExtension ext : RunConfigurationExtension.EP_NAME.getExtensionList()) {
if (ext.isListenerDisabled(configuration, listener, getRunnerSettings())) {
enabled = false;
break;
@@ -395,7 +395,7 @@ public abstract class JavaTestFrameworkRunnableState<T extends
PathMacroUtil.MODULE_WORKING_DIR.equals(workingDirectory) ||
ProgramParametersConfigurator.MODULE_WORKING_DIR.equals(workingDirectory);
}
protected void createTempFiles(JavaParameters javaParameters) {
try {
myWorkingDirsFile = FileUtil.createTempFile("idea_working_dirs_" + getFrameworkId(), ".tmp", true);
@@ -416,8 +416,8 @@ public abstract class JavaTestFrameworkRunnableState<T extends
? null : javaParameters.getClassPath().getPathsString();
String workingDirectory = getConfiguration().getWorkingDirectory();
//when only classpath should be changed, e.g. for starting tests in IDEA's project when some modules can never appear on the same classpath,
//like plugin and corresponding IDE register the same components twice
//when only classpath should be changed, e.g. for starting tests in IDEA's project when some modules can never appear on the same classpath,
//like plugin and corresponding IDE register the same components twice
boolean toChangeWorkingDirectory = toChangeWorkingDirectory(workingDirectory);
try (PrintWriter wWriter = new PrintWriter(myWorkingDirsFile, CharsetToolkit.UTF8)) {
@@ -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-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.
package com.intellij.execution;
@@ -22,7 +8,6 @@ import com.intellij.execution.configurations.JavaParameters;
import com.intellij.execution.configurations.RunConfigurationBase;
import com.intellij.execution.configurations.RunnerSettings;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.psi.PsiElement;
import com.intellij.refactoring.listeners.RefactoringElementListener;
import org.jetbrains.annotations.NotNull;
@@ -49,7 +34,7 @@ public abstract class RunConfigurationExtension extends RunConfigurationExtensio
public void cleanUserData(RunConfigurationBase runConfigurationBase) {}
public static void cleanExtensionsUserData(RunConfigurationBase runConfigurationBase) {
for (RunConfigurationExtension extension : Extensions.getExtensions(EP_NAME)) {
for (RunConfigurationExtension extension : EP_NAME.getExtensionList()) {
extension.cleanUserData(runConfigurationBase);
}
}
@@ -63,7 +48,7 @@ public abstract class RunConfigurationExtension extends RunConfigurationExtensio
public static RefactoringElementListener wrapRefactoringElementListener(PsiElement element,
RunConfigurationBase runConfigurationBase,
RefactoringElementListener listener) {
for (RunConfigurationExtension extension : Extensions.getExtensions(EP_NAME)) {
for (RunConfigurationExtension extension : EP_NAME.getExtensionList()) {
listener = extension.wrapElementListener(element, runConfigurationBase, listener);
}
return listener;
@@ -9,7 +9,6 @@ import com.intellij.ide.highlighter.JavaFileType;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileChooser.FileChooser;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
@@ -95,7 +94,7 @@ public class AttachSourcesNotificationProvider extends EditorNotifications.Provi
PsiFile clsFile = PsiManager.getInstance(myProject).findFile(file);
boolean hasNonLightAction = false;
for (AttachSourcesProvider each : Extensions.getExtensions(EXTENSION_POINT_NAME)) {
for (AttachSourcesProvider each : EXTENSION_POINT_NAME.getExtensionList()) {
for (AttachSourcesProvider.AttachSourcesAction action : each.getActions(libraries, clsFile)) {
if (hasNonLightAction) {
if (action instanceof AttachSourcesProvider.LightAttachSourcesAction) {
@@ -29,7 +29,7 @@ import java.util.function.Function;
import static java.util.stream.Collectors.*;
public class AddModuleWizard extends AbstractProjectWizard {
private final ProjectImportProvider[] myImportProviders;
private final List<ProjectImportProvider> myImportProviders;
private final ModulesProvider myModulesProvider;
private WizardMode myWizardMode;
@@ -38,7 +38,7 @@ public class AddModuleWizard extends AbstractProjectWizard {
*/
public AddModuleWizard(@Nullable Project project, String filePath, ProjectImportProvider... importProviders) {
super(getImportWizardTitle(project, importProviders), project, filePath);
myImportProviders = importProviders;
myImportProviders = Arrays.asList(importProviders);
myModulesProvider = DefaultModulesProvider.createForProject(project);
initModuleWizard(project, filePath);
}
@@ -48,7 +48,7 @@ public class AddModuleWizard extends AbstractProjectWizard {
*/
public AddModuleWizard(Project project, Component dialogParent, String filePath, ProjectImportProvider... importProviders) {
super(getImportWizardTitle(project, importProviders), project, dialogParent);
myImportProviders = importProviders;
myImportProviders = Arrays.asList(importProviders);
myModulesProvider = DefaultModulesProvider.createForProject(project);
initModuleWizard(project, filePath);
}
@@ -81,8 +81,8 @@ public class AddModuleWizard extends AbstractProjectWizard {
for (ProjectImportProvider provider : myImportProviders) {
provider.getBuilder().setFileToImport(defaultPath);
}
if (myImportProviders.length == 1) {
final ProjectImportBuilder builder = myImportProviders[0].getBuilder();
if (myImportProviders.size() == 1) {
final ProjectImportBuilder builder = myImportProviders.get(0).getBuilder();
myWizardContext.setProjectBuilder(builder);
builder.setUpdate(getWizardContext().getProject() != null);
}
@@ -6,7 +6,6 @@ import com.intellij.ide.util.newProjectWizard.StepSequence;
import com.intellij.ide.util.projectWizard.ProjectBuilder;
import com.intellij.ide.util.projectWizard.WizardContext;
import com.intellij.openapi.application.ApplicationNamesInfo;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.ProjectBundle;
import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
import com.intellij.openapi.util.text.StringUtil;
@@ -16,16 +15,16 @@ import com.intellij.projectImport.ProjectImportProvider;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.List;
public class ImportMode extends WizardMode {
private ProjectImportBuilder myBuilder;
private final ProjectImportProvider[] myProviders;
private final List<ProjectImportProvider> myProviders;
public ImportMode() {
this(Extensions.getExtensions(ProjectImportProvider.PROJECT_IMPORT_PROVIDER));
this(ProjectImportProvider.PROJECT_IMPORT_PROVIDER.getExtensionList());
}
public ImportMode(ProjectImportProvider[] providers) {
public ImportMode(List<ProjectImportProvider> providers) {
myProviders = providers;
}
@@ -40,7 +39,7 @@ public class ImportMode extends WizardMode {
public String getDescription(final WizardContext context) {
final String productName = ApplicationNamesInfo.getInstance().getFullProductName();
return ProjectBundle.message("project.new.wizard.import.description", productName, context.getPresentationName(), StringUtil.join(
Arrays.asList(Extensions.getExtensions(ProjectImportProvider.PROJECT_IMPORT_PROVIDER)),
ProjectImportProvider.PROJECT_IMPORT_PROVIDER.getExtensionList(),
provider -> provider.getName(), ", "));
}
@@ -48,21 +47,21 @@ public class ImportMode extends WizardMode {
@Nullable
protected StepSequence createSteps(@NotNull final WizardContext context, @NotNull final ModulesProvider modulesProvider) {
final StepSequence stepSequence = new StepSequence();
if (myProviders.length > 1) {
if (myProviders.size() > 1) {
stepSequence.addCommonStep(new ImportChooserStep(myProviders, stepSequence, context));
}
for (ProjectImportProvider provider : myProviders) {
provider.addSteps(stepSequence, context, provider.getId());
}
if (myProviders.length == 1) {
stepSequence.setType(myProviders[0].getId());
if (myProviders.size() == 1) {
stepSequence.setType(myProviders.get(0).getId());
}
return stepSequence;
}
@Override
public boolean isAvailable(WizardContext context) {
return Extensions.getExtensions(ProjectImportProvider.PROJECT_IMPORT_PROVIDER).length > 0;
return ProjectImportProvider.PROJECT_IMPORT_PROVIDER.hasAnyExtensions();
}
@Override
@@ -1,18 +1,4 @@
/*
* 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-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.
package com.intellij.ide.util.projectWizard.importSources.impl;
import com.intellij.icons.AllIcons;
@@ -27,7 +13,6 @@ import com.intellij.ide.util.projectWizard.WizardContext;
import com.intellij.ide.util.projectWizard.importSources.*;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.module.*;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.project.Project;
@@ -290,7 +275,7 @@ public class ProjectFromSourcesBuilderImpl extends ProjectImportBuilder implemen
@Override
public boolean hasRootsFromOtherDetectors(ProjectStructureDetector thisDetector) {
for (ProjectStructureDetector projectStructureDetector : Extensions.getExtensions(ProjectStructureDetector.EP_NAME)) {
for (ProjectStructureDetector projectStructureDetector : ProjectStructureDetector.EP_NAME.getExtensionList()) {
if (projectStructureDetector != thisDetector && !getProjectRoots(projectStructureDetector).isEmpty()) {
return true;
}
@@ -1,32 +1,18 @@
/*
* 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-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.
package com.intellij.openapi.roots.ui.configuration;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.roots.OrderRootType;
import com.intellij.openapi.roots.libraries.ui.OrderRoot;
import com.intellij.openapi.roots.libraries.ui.RootDetector;
import com.intellij.openapi.roots.libraries.ui.impl.LibraryRootsDetectorImpl;
import com.intellij.openapi.roots.libraries.ui.impl.RootDetectionUtil;
import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import java.awt.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
@@ -35,7 +21,7 @@ import java.util.List;
* @author Constantine.Plotnikov
*/
public class LibrarySourceRootDetectorUtil {
public static ExtensionPointName<RootDetector> JAVA_SOURCE_ROOT_DETECTOR = ExtensionPointName.create("com.intellij.library.javaSourceRootDetector");
public static final ExtensionPointName<RootDetector> JAVA_SOURCE_ROOT_DETECTOR = ExtensionPointName.create("com.intellij.library.javaSourceRootDetector");
protected LibrarySourceRootDetectorUtil() {
}
@@ -49,12 +35,12 @@ public class LibrarySourceRootDetectorUtil {
*/
public static VirtualFile[] scanAndSelectDetectedJavaSourceRoots(Component parentComponent, final VirtualFile[] rootCandidates) {
final List<OrderRoot> orderRoots = RootDetectionUtil.detectRoots(Arrays.asList(rootCandidates), parentComponent, null,
new LibraryRootsDetectorImpl(Arrays.asList(Extensions.getExtensions(JAVA_SOURCE_ROOT_DETECTOR))),
new LibraryRootsDetectorImpl(JAVA_SOURCE_ROOT_DETECTOR.getExtensionList()),
new OrderRootType[] {OrderRootType.SOURCES});
final List<VirtualFile> result = new ArrayList<>();
for (OrderRoot root : orderRoots) {
result.add(root.getFile());
}
return VfsUtil.toVirtualFileArray(result);
return VfsUtilCore.toVirtualFileArray(result);
}
}
@@ -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-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.
package com.intellij.openapi.roots.ui.configuration.libraryEditor;
import com.intellij.codeInsight.ExternalAnnotationsManager;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
import com.intellij.openapi.fileChooser.FileElement;
import com.intellij.openapi.fileTypes.StdFileTypes;
@@ -74,7 +59,7 @@ public class DefaultLibraryRootsComponentDescriptor extends LibraryRootsComponen
//some libraries store native libraries inside their JAR files and unpack them dynamically so we should detect such JARs as classes roots
|| file.getFileSystem() instanceof JarFileSystem && isNativeLibrary(file)));
results.add(DescendentBasedRootFilter.createFileTypeBasedFilter(OrderRootType.CLASSES, true, StdFileTypes.CLASS, "jar directory"));
ContainerUtil.addAll(results, Extensions.getExtensions(LibrarySourceRootDetectorUtil.JAVA_SOURCE_ROOT_DETECTOR));
ContainerUtil.addAll(results, LibrarySourceRootDetectorUtil.JAVA_SOURCE_ROOT_DETECTOR.getExtensionList());
results.add(DescendentBasedRootFilter.createFileTypeBasedFilter(OrderRootType.SOURCES, true, StdFileTypes.JAVA, "source archive directory"));
results.add(new JavadocRootDetector());
results.add(new DescendentBasedRootFilter(AnnotationOrderRootType.getInstance(), false, "external annotations",
@@ -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-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.
package com.intellij.projectImport;
@@ -44,7 +30,7 @@ import java.util.List;
public class ImportChooserStep extends ProjectImportWizardStep {
private static final String PREFERRED = "create.project.preferred.importer";
private final ProjectImportProvider[] myProviders;
private final List<ProjectImportProvider> myProviders;
private final StepSequence mySequence;
@Nullable
private ProjectImportProvider myFromSourcesProvider;
@@ -54,7 +40,7 @@ public class ImportChooserStep extends ProjectImportWizardStep {
private JBRadioButton myCreateFromSources;
private JBRadioButton myImportFrom;
public ImportChooserStep(final ProjectImportProvider[] providers, final StepSequence sequence, final WizardContext context) {
public ImportChooserStep(final List<ProjectImportProvider> providers, final StepSequence sequence, final WizardContext context) {
super(context);
myProviders = providers;
mySequence = sequence;
@@ -149,9 +135,8 @@ public class ImportChooserStep extends ProjectImportWizardStep {
}
}
private static List<ProjectImportProvider> sorted(ProjectImportProvider[] providers) {
List<ProjectImportProvider> result = new ArrayList<>();
Collections.addAll(result, providers);
private static List<ProjectImportProvider> sorted(List<ProjectImportProvider> providers) {
List<ProjectImportProvider> result = new ArrayList<>(providers);
Collections.sort(result, (l, r) -> l.getName().compareToIgnoreCase(r.getName()));
return result;
}
@@ -9,7 +9,6 @@ import com.intellij.codeInspection.ex.EntryPointsManager;
import com.intellij.codeInspection.ex.EntryPointsManagerBase;
import com.intellij.codeInspection.reference.UnusedDeclarationFixProvider;
import com.intellij.find.findUsages.*;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
@@ -35,7 +34,7 @@ public class UnusedSymbolUtil {
@NotNull PsiModifierListOwner element,
@Nullable ProgressIndicator progress) {
if (isInjected(project, element)) return true;
for (ImplicitUsageProvider provider : Extensions.getExtensions(ImplicitUsageProvider.EP_NAME)) {
for (ImplicitUsageProvider provider : ImplicitUsageProvider.EP_NAME.getExtensionList()) {
ProgressManager.checkCanceled();
if (provider.isImplicitUsage(element)) {
return true;
@@ -50,7 +49,7 @@ public class UnusedSymbolUtil {
}
public static boolean isImplicitRead(@NotNull Project project, @NotNull PsiVariable element, @Nullable ProgressIndicator progress) {
for(ImplicitUsageProvider provider: Extensions.getExtensions(ImplicitUsageProvider.EP_NAME)) {
for(ImplicitUsageProvider provider: ImplicitUsageProvider.EP_NAME.getExtensionList()) {
ProgressManager.checkCanceled();
if (provider.isImplicitRead(element)) {
return true;
@@ -66,7 +65,7 @@ public class UnusedSymbolUtil {
public static boolean isImplicitWrite(@NotNull Project project,
@NotNull PsiVariable element,
@Nullable ProgressIndicator progress) {
for(ImplicitUsageProvider provider: Extensions.getExtensions(ImplicitUsageProvider.EP_NAME)) {
for(ImplicitUsageProvider provider: ImplicitUsageProvider.EP_NAME.getExtensionList()) {
ProgressManager.checkCanceled();
if (provider.isImplicitWrite(element)) {
return true;
@@ -84,8 +83,7 @@ public class UnusedSymbolUtil {
return null; //filtered out
}
UnusedDeclarationFixProvider[] fixProviders = Extensions.getExtensions(UnusedDeclarationFixProvider.EP_NAME);
for (UnusedDeclarationFixProvider provider : fixProviders) {
for (UnusedDeclarationFixProvider provider : UnusedDeclarationFixProvider.EP_NAME.getExtensionList()) {
IntentionAction[] fixes = provider.getQuickFixes(element);
for (IntentionAction fix : fixes) {
QuickFixAction.registerQuickFixAction(info, fix);
@@ -1,18 +1,4 @@
/*
* 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-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.
package com.intellij.codeInsight.daemon.impl.analysis;
import com.intellij.codeInsight.daemon.impl.HighlightInfo;
@@ -24,7 +10,6 @@ import com.intellij.codeInsight.intention.QuickFixFactory;
import com.intellij.codeInsight.intention.impl.PriorityActionWrapper;
import com.intellij.codeInsight.quickfix.ChangeVariableTypeQuickFixProvider;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.*;
@@ -259,7 +244,7 @@ public class HighlightFixUtil {
if (itemType instanceof PsiMethodReferenceType) return Collections.emptyList();
List<IntentionAction> result = new ArrayList<>();
if (itemType != null && PsiTypesUtil.allTypeParametersResolved(variable, itemType)) {
for (ChangeVariableTypeQuickFixProvider fixProvider : Extensions.getExtensions(ChangeVariableTypeQuickFixProvider.EP_NAME)) {
for (ChangeVariableTypeQuickFixProvider fixProvider : ChangeVariableTypeQuickFixProvider.EP_NAME.getExtensionList()) {
Collections.addAll(result, fixProvider.getFixes(variable, itemType));
}
IntentionAction changeFix = getChangeParameterClassFix(variable.getType(), itemType);
@@ -1,4 +1,4 @@
// 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-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.
package com.intellij.codeInsight.daemon.impl.analysis;
import com.intellij.codeInsight.daemon.HighlightDisplayKey;
@@ -23,7 +23,6 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.TransactionGuard;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
@@ -184,8 +183,7 @@ class PostHighlightingVisitor {
HighlightingLevelManager.getInstance(myProject).shouldInspect(myFile)) {
return true;
}
final ImplicitUsageProvider[] implicitUsageProviders = Extensions.getExtensions(ImplicitUsageProvider.EP_NAME);
for (ImplicitUsageProvider provider : implicitUsageProviders) {
for (ImplicitUsageProvider provider : ImplicitUsageProvider.EP_NAME.getExtensionList()) {
if (provider instanceof UnusedImportProvider && ((UnusedImportProvider)provider).isUnusedImportEnabled(myFile)) return true;
}
return false;
@@ -293,7 +291,7 @@ class PostHighlightingVisitor {
HighlightInfo highlightInfo = suggestionsToMakeFieldUsed(field, identifier, message);
if (!field.hasInitializer() && !field.hasModifierProperty(PsiModifier.FINAL)) {
QuickFixAction.registerQuickFixAction(highlightInfo, HighlightMethodUtil.getFixRange(field),
QuickFixAction.registerQuickFixAction(highlightInfo, HighlightMethodUtil.getFixRange(field),
quickFixFactory.createCreateConstructorParameterFromFieldFix(field), myDeadCodeKey);
}
return highlightInfo;
@@ -315,7 +313,7 @@ class PostHighlightingVisitor {
QuickFixAction.registerQuickFixAction(info, quickFixFactory.createCreateGetterOrSetterFix(false, true, field), myDeadCodeKey);
if (!field.hasModifierProperty(PsiModifier.FINAL)) {
QuickFixAction.registerQuickFixAction(info, HighlightMethodUtil.getFixRange(field),
QuickFixAction.registerQuickFixAction(info, HighlightMethodUtil.getFixRange(field),
quickFixFactory.createCreateConstructorParameterFromFieldFix(field), myDeadCodeKey);
}
SpecialAnnotationsUtilBase.createAddToSpecialAnnotationFixes(field, annoName -> {
@@ -1,22 +1,7 @@
/*
* 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-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.
package com.intellij.codeInspection.canBeFinal;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.psi.PsiMember;
public abstract class CanBeFinalHandler {
@@ -25,7 +10,7 @@ public abstract class CanBeFinalHandler {
public abstract boolean canBeFinal(PsiMember member);
public static boolean allowToBeFinal(PsiMember member) {
for (CanBeFinalHandler handler : Extensions.getExtensions(EP_NAME)) {
for (CanBeFinalHandler handler : EP_NAME.getExtensionList()) {
if (!handler.canBeFinal(member)) return false;
}
return true;
@@ -1,18 +1,4 @@
/*
* 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-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.
package com.intellij.codeInspection.dataFlow;
import com.intellij.codeInsight.ExceptionUtil;
@@ -31,7 +17,6 @@ import com.intellij.codeInspection.dataFlow.rangeSet.LongRangeSet;
import com.intellij.codeInspection.dataFlow.value.*;
import com.intellij.codeInspection.dataFlow.value.DfaRelationValue.RelationType;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.psi.*;
@@ -53,7 +38,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import java.util.stream.Stream;
import static com.intellij.psi.CommonClassNames.*;
@@ -99,7 +83,7 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
}
}
if (!isStatic &&
Stream.of(Extensions.getExtensions(ImplicitUsageProvider.EP_NAME)).anyMatch(p -> p.isClassWithCustomizedInitialization(psiClass))) {
ImplicitUsageProvider.EP_NAME.getExtensionList().stream().anyMatch(p -> p.isClassWithCustomizedInitialization(psiClass))) {
addInstruction(new EscapeInstruction(Collections.singleton(getFactory().getVarFactory().createThisValue(psiClass))));
addInstruction(new FlushFieldsInstruction());
}
@@ -994,7 +978,7 @@ public class ControlFlowAnalyzer extends JavaElementVisitor {
if (!shouldHandleException()) {
return;
}
pushUnknown();
final ConditionalGotoInstruction ifNoException = addInstruction(new ConditionalGotoInstruction(null, false, null));
@@ -8,7 +8,6 @@ import com.intellij.codeInsight.daemon.impl.analysis.HighlightControlFlowUtil;
import com.intellij.codeInsight.daemon.impl.analysis.JavaGenericsUtil;
import com.intellij.codeInspection.dataFlow.value.DfaExpressionFactory;
import com.intellij.codeInspection.dataFlow.value.DfaVariableValue;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.PsiSearchHelper;
@@ -91,7 +90,7 @@ public class NullabilityUtil {
}
private static boolean isImplicitlyInitializedNotNull(PsiField field) {
return ContainerUtil.exists(Extensions.getExtensions(ImplicitUsageProvider.EP_NAME), p -> p.isImplicitlyNotNullInitialized(field));
return ContainerUtil.exists(ImplicitUsageProvider.EP_NAME.getExtensionList(), p -> p.isImplicitlyNotNullInitialized(field));
}
private static boolean weAreSureThereAreNoExplicitWrites(PsiField field) {
@@ -7,7 +7,6 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.application.ReadActionProcessor;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.util.Comparing;
@@ -202,7 +201,7 @@ public class JavaFindUsagesHelper {
private static boolean addAliasingUsages(@NotNull PomTarget pomTarget,
@NotNull final FindUsagesOptions options,
@NotNull final Processor<? super UsageInfo> processor) {
for (AliasingPsiTargetMapper aliasingPsiTargetMapper : Extensions.getExtensions(AliasingPsiTargetMapper.EP_NAME)) {
for (AliasingPsiTargetMapper aliasingPsiTargetMapper : AliasingPsiTargetMapper.EP_NAME.getExtensionList()) {
for (final AliasingPsiTarget psiTarget : aliasingPsiTargetMapper.getTargets(pomTarget)) {
boolean success = ReferencesSearch
.search(new ReferencesSearch.SearchParameters(ReadAction.compute(() -> PomService.convertToPsi(psiTarget)), options.searchScope, false, options.fastTrack))
@@ -1,23 +1,8 @@
/*
* Copyright 2000-2010 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-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.
package com.intellij.psi.impl;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
@@ -27,7 +12,7 @@ public abstract class AllowedApiFilterExtension {
public abstract boolean isClassForbidden(@NotNull String fqn, @NotNull PsiElement place);
public static boolean isClassAllowed(@NotNull String fqn, @NotNull PsiElement place) {
for (AllowedApiFilterExtension extension : Extensions.getExtensions(EP_NAME)) {
for (AllowedApiFilterExtension extension : EP_NAME.getExtensionList()) {
if (extension.isClassForbidden(fqn, place)) return false;
}
return true;
@@ -3,7 +3,6 @@ package com.intellij.application.options;
import com.intellij.application.options.codeStyle.arrangement.ArrangementSettingsPanel;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.codeStyle.CodeStyleSettingsProvider;
@@ -22,7 +21,7 @@ public class JavaCodeStyleMainPanel extends TabbedLanguageCodeStylePanel {
addTab(new JavaDocFormattingPanel(settings));
addTab(new CodeStyleImportsPanelWrapper(settings));
addTab(new ArrangementSettingsPanel(settings, JavaLanguage.INSTANCE));
for (CodeStyleSettingsProvider provider : Extensions.getExtensions(CodeStyleSettingsProvider.EXTENSION_POINT_NAME)) {
for (CodeStyleSettingsProvider provider : CodeStyleSettingsProvider.EXTENSION_POINT_NAME.getExtensionList()) {
if (provider.getLanguage() == JavaLanguage.INSTANCE && !provider.hasSettingsPage()) {
createTab(provider);
}
@@ -1,28 +1,12 @@
/*
* 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-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.
package com.intellij.codeInsight.generation;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.psi.PsiClass;
import com.intellij.util.NotNullFunction;
import com.intellij.util.containers.ContainerUtil;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
@@ -36,7 +20,7 @@ public class GenerateAccessorProviderRegistrar {
private static final List<NotNullFunction<PsiClass, Collection<EncapsulatableClassMember>>> ourProviders = new ArrayList<>();
static {
ourProviders.addAll(Arrays.asList(Extensions.getExtensions(EP_NAME)));
ourProviders.addAll(EP_NAME.getExtensionList());
}
/** @see #EP_NAME */
@@ -1,18 +1,4 @@
/*
* 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-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.
package com.intellij.codeInsight.generation;
import com.intellij.CommonBundle;
@@ -21,7 +7,6 @@ import com.intellij.codeInsight.NullableNotNullManager;
import com.intellij.codeInsight.daemon.ImplicitUsageProvider;
import com.intellij.ide.util.MemberChooser;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.psi.*;
@@ -52,7 +37,7 @@ public class GenerateConstructorHandler extends GenerateMembersHandlerBase {
protected ClassMember[] getAllOriginalMembers(PsiClass aClass) {
PsiField[] fields = aClass.getFields();
ArrayList<ClassMember> array = new ArrayList<>();
ImplicitUsageProvider[] implicitUsageProviders = Extensions.getExtensions(ImplicitUsageProvider.EP_NAME);
List<ImplicitUsageProvider> implicitUsageProviders = ImplicitUsageProvider.EP_NAME.getExtensionList();
fieldLoop:
for (PsiField field : fields) {
if (field.hasModifierProperty(PsiModifier.STATIC)) continue;
@@ -1,33 +1,17 @@
/*
* 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-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.
package com.intellij.codeInsight.generation;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiField;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiModifier;
import com.intellij.psi.util.PropertyUtil;
import com.intellij.psi.util.PropertyUtilBase;
public abstract class GetterSetterPrototypeProvider {
public static final ExtensionPointName<GetterSetterPrototypeProvider> EP_NAME = ExtensionPointName.create("com.intellij.getterSetterProvider");
public abstract boolean canGeneratePrototypeFor(PsiField field);
public abstract PsiMethod[] generateGetters(PsiField field);
public abstract PsiMethod[] generateGetters(PsiField field);
public abstract PsiMethod[] generateSetters(PsiField field);
public PsiMethod[] findGetters(PsiClass psiClass, String propertyName) {
return null;
@@ -50,7 +34,7 @@ public abstract class GetterSetterPrototypeProvider {
public static PsiMethod[] generateGetterSetters(PsiField field,
boolean generateGetter,
boolean ignoreInvalidTemplate) {
for (GetterSetterPrototypeProvider provider : Extensions.getExtensions(EP_NAME)) {
for (GetterSetterPrototypeProvider provider : EP_NAME.getExtensionList()) {
if (provider.canGeneratePrototypeFor(field)) {
return generateGetter ? provider.generateGetters(field) : provider.generateSetters(field);
}
@@ -60,7 +44,7 @@ public abstract class GetterSetterPrototypeProvider {
}
public static boolean isReadOnlyProperty(PsiField field) {
for (GetterSetterPrototypeProvider provider : Extensions.getExtensions(EP_NAME)) {
for (GetterSetterPrototypeProvider provider : EP_NAME.getExtensionList()) {
if (provider.canGeneratePrototypeFor(field)) {
return provider.isReadOnly(field);
}
@@ -70,7 +54,7 @@ public abstract class GetterSetterPrototypeProvider {
public static PsiMethod[] findGetters(PsiClass aClass, String propertyName, boolean isStatic) {
if (!isStatic) {
for (GetterSetterPrototypeProvider provider : Extensions.getExtensions(EP_NAME)) {
for (GetterSetterPrototypeProvider provider : EP_NAME.getExtensionList()) {
final PsiMethod[] getterSetter = provider.findGetters(aClass, propertyName);
if (getterSetter != null) return getterSetter;
}
@@ -79,11 +63,11 @@ public abstract class GetterSetterPrototypeProvider {
if (propertyGetterSetter != null) {
return new PsiMethod[] {propertyGetterSetter};
}
return null;
return null;
}
public static String suggestNewGetterName(String oldPropertyName, String newPropertyName, PsiMethod method) {
for (GetterSetterPrototypeProvider provider : Extensions.getExtensions(EP_NAME)) {
for (GetterSetterPrototypeProvider provider : EP_NAME.getExtensionList()) {
if (provider.isSimpleGetter(method, oldPropertyName)) {
return provider.suggestGetterName(newPropertyName);
}
@@ -1,27 +1,15 @@
/*
* 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-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.
package com.intellij.codeInsight.generation;
import com.intellij.codeInsight.MemberImplementorExplorer;
import com.intellij.codeInsight.MethodImplementor;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class MemberImplementorExplorersProviderImpl implements OverrideImplementExploreUtil.MemberImplementorExplorersProvider {
@NotNull
@Override
public MemberImplementorExplorer[] getExplorers() {
public List<MethodImplementor> getExplorers() {
return OverrideImplementUtil.getImplementors();
}
}
@@ -1,4 +1,4 @@
// 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-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.
package com.intellij.codeInsight.generation;
import com.intellij.application.options.CodeStyle;
@@ -25,7 +25,6 @@ import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.ScrollType;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
import com.intellij.openapi.fileTypes.FileType;
@@ -62,8 +61,8 @@ public class OverrideImplementUtil extends OverrideImplementExploreUtil {
private OverrideImplementUtil() { }
@NotNull
protected static MethodImplementor[] getImplementors() {
return Extensions.getExtensions(MethodImplementor.EXTENSION_POINT_NAME);
protected static List<MethodImplementor> getImplementors() {
return MethodImplementor.EXTENSION_POINT_NAME.getExtensionList();
}
/**
@@ -1,10 +1,9 @@
// 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-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.
package com.intellij.codeInsight.generation;
import com.intellij.codeInsight.AnnotationUtil;
import com.intellij.codeInsight.intention.AddAnnotationPsiFix;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleUtilCore;
import com.intellij.openapi.project.Project;
@@ -50,7 +49,7 @@ public interface OverrideImplementsAnnotationsHandler {
Project project = target.getProject();
JavaPsiFacade facade = JavaPsiFacade.getInstance(project);
for (OverrideImplementsAnnotationsHandler each : Extensions.getExtensions(EP_NAME)) {
for (OverrideImplementsAnnotationsHandler each : EP_NAME.getExtensionList()) {
for (String annotation : each.getAnnotations(target.getContainingFile())) {
if (moduleScope != null && facade.findClass(annotation, moduleScope) == null) continue;
@@ -1,25 +1,10 @@
/*
* 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-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.
package com.intellij.codeInsight.generation.surroundWith;
import com.intellij.codeInsight.CodeInsightUtil;
import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.lang.surroundWith.SurroundDescriptor;
import com.intellij.lang.surroundWith.Surrounder;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiExpression;
import com.intellij.psi.PsiFile;
@@ -63,7 +48,7 @@ public class JavaExpressionSurroundDescriptor implements SurroundDescriptor {
if (mySurrounders == null) {
final ArrayList<Surrounder> list = new ArrayList<>();
Collections.addAll(list, SURROUNDERS);
Collections.addAll(list, Extensions.getExtensions(JavaExpressionSurrounder.EP_NAME));
list.addAll(JavaExpressionSurrounder.EP_NAME.getExtensionList());
mySurrounders = list.toArray(Surrounder.EMPTY_ARRAY);
}
return mySurrounders;
@@ -11,7 +11,6 @@ import com.intellij.codeInsight.intention.QuickFixFactory;
import com.intellij.codeInsight.quickfix.ChangeVariableTypeQuickFixProvider;
import com.intellij.codeInspection.*;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.JavaVersionService;
import com.intellij.openapi.util.Pass;
@@ -45,7 +44,7 @@ public class UncheckedWarningLocalInspection extends AbstractBaseJavaLocalInspec
public boolean IGNORE_UNCHECKED_OVERRIDING;
@NotNull
protected LocalQuickFix[] createFixes() {
return new LocalQuickFix[]{new GenerifyFileFix()};
}
@@ -111,7 +110,7 @@ public class UncheckedWarningLocalInspection extends AbstractBaseJavaLocalInspec
LOG.assertTrue(parameter.isValid());
final List<LocalQuickFix> result = new ArrayList<>();
if (itemType != null) {
for (ChangeVariableTypeQuickFixProvider fixProvider : Extensions.getExtensions(ChangeVariableTypeQuickFixProvider.EP_NAME)) {
for (ChangeVariableTypeQuickFixProvider fixProvider : ChangeVariableTypeQuickFixProvider.EP_NAME.getExtensionList()) {
for (IntentionAction action : fixProvider.getFixes(parameter, itemType)) {
if (action instanceof LocalQuickFix) {
result.add((LocalQuickFix)action);
@@ -10,7 +10,6 @@ import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
import com.intellij.codeInspection.util.SpecialAnnotationsUtil;
import com.intellij.codeInspection.util.SpecialAnnotationsUtilBase;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.JDOMExternalizableStringList;
@@ -67,7 +66,7 @@ public class FieldCanBeLocalInspection extends AbstractBaseJavaLocalInspectionTo
removeReadFields(aClass, candidates, usedFields, ignoreFieldsUsedInMultipleMethods);
if (candidates.isEmpty()) return;
final ImplicitUsageProvider[] implicitUsageProviders = Extensions.getExtensions(ImplicitUsageProvider.EP_NAME);
final List<ImplicitUsageProvider> implicitUsageProviders = ImplicitUsageProvider.EP_NAME.getExtensionList();
for (final PsiField field : candidates) {
if (usedFields.contains(field) && !hasImplicitReadOrWriteUsage(field, implicitUsageProviders)) {
@@ -273,7 +272,7 @@ public class FieldCanBeLocalInspection extends AbstractBaseJavaLocalInspectionTo
return writtenVariables.get();
}
private static boolean hasImplicitReadOrWriteUsage(final PsiField field, ImplicitUsageProvider[] implicitUsageProviders) {
private static boolean hasImplicitReadOrWriteUsage(final PsiField field, List<ImplicitUsageProvider> implicitUsageProviders) {
for (ImplicitUsageProvider provider : implicitUsageProviders) {
if (provider.isImplicitRead(field) || provider.isImplicitWrite(field)) {
return true;
@@ -349,7 +348,7 @@ public class FieldCanBeLocalInspection extends AbstractBaseJavaLocalInspectionTo
if (block == null) {
return false;
}
Collection<PsiReference> references = refs.get(block);
if (references == null) {
references = new ArrayList<>();
@@ -9,7 +9,6 @@ import com.intellij.lang.ASTNode;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.module.EffectiveLanguageLevelUtil;
import com.intellij.openapi.module.Module;
@@ -143,7 +142,7 @@ public class JavaPsiImplementationHelperImpl extends JavaPsiImplementationHelper
.filter(entry -> entry instanceof LibraryOrSdkOrderEntry && entry.isValid())
.flatMap(entry -> Stream.of(entry.getFiles(OrderRootType.SOURCES)));
Stream<VirtualFile> synthRoots = Stream.of(Extensions.getExtensions(AdditionalLibraryRootsProvider.EP_NAME))
Stream<VirtualFile> synthRoots = AdditionalLibraryRootsProvider.EP_NAME.getExtensionList().stream()
.flatMap(provider -> provider.getAdditionalProjectLibraries(myProject).stream())
.filter(library -> library.contains(file, false, true))
.flatMap(library -> library.getSourceRoots().stream());
@@ -13,7 +13,6 @@ import com.intellij.openapi.editor.RangeMarker;
import com.intellij.openapi.editor.ScrollType;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.ex.DocumentEx;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringHash;
import com.intellij.psi.PsiDocumentManager;
@@ -81,7 +80,7 @@ class JavaInjectedFileChangesHandler extends BaseInjectedFileChangesHandler {
// run preformat processors
final int hostStartOffset = myAltFullRange.getStartOffset();
myEditor.getCaretModel().moveToOffset(hostStartOffset);
for (CopyPastePreProcessor preProcessor : Extensions.getExtensions(CopyPastePreProcessor.EP_NAME)) {
for (CopyPastePreProcessor preProcessor : CopyPastePreProcessor.EP_NAME.getExtensionList()) {
newText = preProcessor.preprocessOnPaste(myProject, origPsiFile, myEditor, newText, null);
}
myOrigDocument.replaceString(hostStartOffset, myAltFullRange.getEndOffset(), newText);
@@ -1,25 +1,10 @@
/*
* 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-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.
package com.intellij.refactoring.migration;
import com.intellij.application.options.CodeStyle;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.JDOMUtil;
import com.intellij.openapi.util.io.FileFilters;
@@ -38,7 +23,10 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.*;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Set;
import java.util.TreeSet;
public class MigrationMapSet {
private static final Logger LOG = Logger.getInstance("#com.intellij.refactoring.migration.MigrationMapSet");
@@ -105,7 +93,7 @@ public class MigrationMapSet {
}
private static boolean isPredefined(String name) {
for (PredefinedMigrationProvider provider : Extensions.getExtensions(PredefinedMigrationProvider.EP_NAME)) {
for (PredefinedMigrationProvider provider : PredefinedMigrationProvider.EP_NAME.getExtensionList()) {
URL migrationMap = provider.getMigrationMap();
String fileName = FileUtil.getNameWithoutExtension(new File(migrationMap.getFile()));
if (fileName.equals(name)) return true;
@@ -152,7 +140,7 @@ public class MigrationMapSet {
}
}
for (PredefinedMigrationProvider provider : Extensions.getExtensions(PredefinedMigrationProvider.EP_NAME)) {
for (PredefinedMigrationProvider provider : PredefinedMigrationProvider.EP_NAME.getExtensionList()) {
URL migrationMap = provider.getMigrationMap();
String fileName = new File(migrationMap.getFile()).getName();
if (myDeletedMaps.contains(FileUtil.getNameWithoutExtension(fileName))) continue;
@@ -1,24 +1,9 @@
/*
* 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-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.
package com.intellij.refactoring.move.moveClassesOrPackages;
import com.intellij.ide.util.EditorHelper;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.Project;
@@ -491,7 +476,7 @@ public class MoveClassesOrPackagesProcessor extends BaseRefactoringProcessor {
if (allClasses.containsKey(psiClass)) {
continue;
}
for (MoveAllClassesInFileHandler fileHandler : Extensions.getExtensions(MoveAllClassesInFileHandler.EP_NAME)) {
for (MoveAllClassesInFileHandler fileHandler : MoveAllClassesInFileHandler.EP_NAME.getExtensionList()) {
fileHandler.processMoveAllClassesInFile(allClasses, psiClass, myElementsToMove);
}
}
@@ -2,7 +2,6 @@
package com.intellij.refactoring.rename;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.pom.PomTarget;
import com.intellij.pom.PomTargetPsiElement;
import com.intellij.pom.references.PomService;
@@ -32,7 +31,7 @@ public class RenameAliasingPomTargetProcessor extends RenamePsiElementProcessor
}
if (target != null) {
for (AliasingPsiTargetMapper mapper : Extensions.getExtensions(AliasingPsiTargetMapper.EP_NAME)) {
for (AliasingPsiTargetMapper mapper : AliasingPsiTargetMapper.EP_NAME.getExtensionList()) {
for (AliasingPsiTarget psiTarget : mapper.getTargets(target)) {
PsiElement psiElement = PomService.convertToPsi(psiTarget);
String name = psiTarget.getNameAlias(newName);
@@ -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-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.
package com.intellij.refactoring.typeMigration;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.impl.LibraryScopeCache;
import com.intellij.openapi.util.Pair;
@@ -35,8 +32,8 @@ public class TypeMigrationRules {
public TypeMigrationRules(@NotNull Project project) {
myProject = project;
final TypeConversionRule[] extensions = Extensions.getExtensions(TypeConversionRule.EP_NAME);
myConversionRules = new ArrayList<>(extensions.length + 2);
final List<TypeConversionRule> extensions = TypeConversionRule.EP_NAME.getExtensionList();
myConversionRules = new ArrayList<>(extensions.size() + 2);
myConversionRules.add(new RootTypeConversionRule());
myConversionRules.add(new DisjunctionTypeConversionRule());
ContainerUtil.addAll(myConversionRules, extensions);
@@ -1,18 +1,4 @@
/*
* 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-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.
package com.intellij.testIntegration;
import com.intellij.codeInsight.TestFrameworks;
@@ -29,7 +15,6 @@ import com.intellij.ide.fileTemplates.FileTemplateManager;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
@@ -294,7 +279,7 @@ public class TestIntegrationUtils {
}
public static List<TestFramework> findSuitableFrameworks(PsiClass targetClass) {
TestFramework[] frameworks = Extensions.getExtensions(TestFramework.EXTENSION_NAME);
List<TestFramework> frameworks = TestFramework.EXTENSION_NAME.getExtensionList();
Project project = targetClass.getProject();
List<TestFramework> result = new SmartList<>();
@@ -1,18 +1,4 @@
/*
* 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-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.
package com.intellij.testIntegration.createTest;
import com.intellij.codeInsight.CodeInsightBundle;
@@ -21,7 +7,6 @@ import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction;
import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.module.ModuleUtilCore;
@@ -81,7 +66,7 @@ public class CreateTestAction extends PsiElementBaseIntentionAction {
}
public static boolean isAvailableForElement(PsiElement element) {
if (Extensions.getExtensions(TestFramework.EXTENSION_NAME).length == 0) return false;
if (!TestFramework.EXTENSION_NAME.hasAnyExtensions()) return false;
if (element == null) return false;
@@ -96,7 +81,7 @@ public class CreateTestAction extends PsiElementBaseIntentionAction {
psiClass instanceof PsiAnonymousClass) {
return false;
}
return TestFrameworks.detectFramework(psiClass) == null;
}
@@ -15,7 +15,6 @@ import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.editor.event.DocumentListener;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.project.DumbService;
@@ -363,7 +362,7 @@ public class CreateTestDialog extends DialogWrapper {
final DefaultComboBoxModel<TestFramework> model = (DefaultComboBoxModel<TestFramework>)myLibrariesCombo.getModel();
final List<TestFramework> descriptors = new SmartList<>(Extensions.getExtensions(TestFramework.EXTENSION_NAME));
final List<TestFramework> descriptors = new SmartList<>(TestFramework.EXTENSION_NAME.getExtensionList());
descriptors.sort((d1, d2) -> Comparing.compare(d1.getName(), d2.getName()));
for (final TestFramework descriptor : descriptors) {
@@ -1,18 +1,4 @@
/*
* 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-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.
package com.intellij.testIntegration.createTest;
import com.intellij.codeInsight.CodeInsightUtil;
@@ -23,7 +9,6 @@ import com.intellij.codeInsight.intention.PsiElementBaseIntentionAction;
import com.intellij.ide.util.PsiClassListCellRenderer;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.JBPopupFactory;
import com.intellij.psi.PsiClass;
@@ -55,7 +40,7 @@ public class GenerateMissedTestsAction extends PsiElementBaseIntentionAction {
@Override
public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) {
if (Extensions.getExtensions(TestFramework.EXTENSION_NAME).length == 0) return false;
if (!TestFramework.EXTENSION_NAME.hasAnyExtensions()) return false;
final PsiElement parent = element.getParent();
if (!(parent instanceof PsiMethod)) return false;
@@ -3,7 +3,6 @@ package com.intellij.psi.impl.search;
import com.intellij.openapi.application.QueryExecutorBase;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.psi.PsiClass;
import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.search.SearchScope;
@@ -25,7 +24,7 @@ public class ClassesWithAnnotatedMembersSearcher extends QueryExecutorBase<PsiCl
public void processQuery(@NotNull ClassesWithAnnotatedMembersSearch.Parameters queryParameters,
@NotNull final Processor<? super PsiClass> consumer) {
SearchScope scope = queryParameters.getScope();
for (QueryExecutor executor : Extensions.getExtensions(ClassesWithAnnotatedMembersSearch.EP_NAME)) {
for (QueryExecutor executor : ClassesWithAnnotatedMembersSearch.EP_NAME.getExtensionList()) {
if (executor instanceof ScopedQueryExecutor) {
scope = scope.intersectWith(GlobalSearchScope.notScope(((ScopedQueryExecutor) executor).getScope(queryParameters)));
}
@@ -2,7 +2,6 @@
package com.intellij.psi.impl.search;
import com.intellij.openapi.application.QueryExecutorBase;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMethod;
@@ -36,7 +35,7 @@ public class SimpleAccessorReferenceSearcher extends QueryExecutorBase<PsiRefere
final String propertyName = PropertyUtilBase.getPropertyName(method);
if (StringUtil.isNotEmpty(propertyName)) {
SearchScope additional = GlobalSearchScope.EMPTY_SCOPE;
for (CustomPropertyScopeProvider provider : Extensions.getExtensions(CustomPropertyScopeProvider.EP_NAME)) {
for (CustomPropertyScopeProvider provider : CustomPropertyScopeProvider.EP_NAME.getExtensionList()) {
additional = additional.union(provider.getScope(method.getProject()));
}
@@ -1,22 +1,7 @@
/*
* 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-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.
package com.intellij.codeInsight;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.util.CachedValueProvider;
@@ -50,13 +35,13 @@ public abstract class TestFrameworks {
public abstract PsiMethod findTearDownMethod(PsiClass psiClass);
protected abstract boolean hasConfigMethods(PsiClass psiClass);
public abstract boolean isTestMethod(PsiMethod method);
public boolean isTestOrConfig(PsiClass psiClass) {
return isTestClass(psiClass) || hasConfigMethods(psiClass);
}
@Nullable
public static TestFramework detectFramework(@NotNull final PsiClass psiClass) {
return CachedValuesManager.getCachedValue(psiClass, () -> CachedValueProvider.Result
@@ -71,13 +56,13 @@ public abstract class TestFrameworks {
private static Set<TestFramework> computeFrameworks(PsiClass psiClass) {
Set<TestFramework> frameworks = new LinkedHashSet<>();
for (TestFramework framework : Extensions.getExtensions(TestFramework.EXTENSION_NAME)) {
for (TestFramework framework : TestFramework.EXTENSION_NAME.getExtensionList()) {
if (framework.isTestClass(psiClass)) {
frameworks.add(framework);
}
}
for (TestFramework framework : Extensions.getExtensions(TestFramework.EXTENSION_NAME)) {
for (TestFramework framework : TestFramework.EXTENSION_NAME.getExtensionList()) {
if (frameworks.contains(framework)) continue;;
if (framework.findSetUpMethod(psiClass) != null || framework.findTearDownMethod(psiClass) != null) {
frameworks.add(framework);
@@ -88,13 +73,13 @@ public abstract class TestFrameworks {
@Nullable
private static TestFramework computeFramework(PsiClass psiClass) {
for (TestFramework framework : Extensions.getExtensions(TestFramework.EXTENSION_NAME)) {
for (TestFramework framework : TestFramework.EXTENSION_NAME.getExtensionList()) {
if (framework.isTestClass(psiClass)) {
return framework;
}
}
for (TestFramework framework : Extensions.getExtensions(TestFramework.EXTENSION_NAME)) {
for (TestFramework framework : TestFramework.EXTENSION_NAME.getExtensionList()) {
if (framework.findSetUpMethod(psiClass) != null || framework.findTearDownMethod(psiClass) != null) {
return framework;
}
@@ -1,23 +1,8 @@
/*
* 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-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.
package com.intellij.psi.augment;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.DumbService;
@@ -128,7 +113,7 @@ public abstract class PsiAugmentProvider {
private static void forEach(Project project, Processor<? super PsiAugmentProvider> processor) {
boolean dumb = DumbService.isDumb(project);
for (PsiAugmentProvider provider : Extensions.getExtensions(EP_NAME)) {
for (PsiAugmentProvider provider : EP_NAME.getExtensionList()) {
if (!dumb || DumbService.isDumbAware(provider)) {
try {
boolean goOn = processor.process(provider);
@@ -1,31 +1,18 @@
/*
* 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-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.
package com.intellij.psi.util;
import com.intellij.codeInsight.runner.JavaMainMethodProvider;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.util.Condition;
import com.intellij.psi.*;
import org.jetbrains.annotations.Nullable;
import java.util.List;
/**
* @author mike
*/
public class PsiMethodUtil {
private static final JavaMainMethodProvider[] myProviders = Extensions.getExtensions(JavaMainMethodProvider.EP_NAME);
private static final List<JavaMainMethodProvider> myProviders = JavaMainMethodProvider.EP_NAME.getExtensionList();
public static final Condition<PsiClass> MAIN_CLASS = psiClass -> {
if (psiClass instanceof PsiAnonymousClass) return false;
@@ -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.
package com.intellij.codeInsight;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.util.Pair;
import com.intellij.psi.*;
import com.intellij.psi.controlFlow.*;
@@ -819,7 +818,7 @@ public class ExceptionUtil {
return HandlePlace.fromBoolean(areAllConstructorsThrow(aClass, exceptionType));
}
} else {
for (CustomExceptionHandler exceptionHandler : Extensions.getExtensions(CustomExceptionHandler.KEY)) {
for (CustomExceptionHandler exceptionHandler : CustomExceptionHandler.KEY.getExtensionList()) {
if (exceptionHandler.isHandled(element, exceptionType, topElement)) return HandlePlace.UNKNOWN;
}
}
@@ -1,22 +1,7 @@
/*
* 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-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.
package com.intellij.codeInsight;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiMethod;
import com.intellij.testIntegration.TestFramework;
@@ -29,8 +14,7 @@ public class TestFrameworksImpl extends TestFrameworks {
@Override
public boolean isTestClass(final PsiClass psiClass) {
final TestFramework[] testFrameworks = Extensions.getExtensions(TestFramework.EXTENSION_NAME);
for (TestFramework framework : testFrameworks) {
for (TestFramework framework : TestFramework.EXTENSION_NAME.getExtensionList()) {
if (framework.isTestClass(psiClass)) {
return true;
}
@@ -40,8 +24,7 @@ public class TestFrameworksImpl extends TestFrameworks {
@Override
public boolean isPotentialTestClass(PsiClass psiClass) {
final TestFramework[] testFrameworks = Extensions.getExtensions(TestFramework.EXTENSION_NAME);
for (TestFramework framework : testFrameworks) {
for (TestFramework framework : TestFramework.EXTENSION_NAME.getExtensionList()) {
if (framework.isPotentialTestClass(psiClass)) {
return true;
}
@@ -52,8 +35,7 @@ public class TestFrameworksImpl extends TestFrameworks {
@Override
@Nullable
public PsiMethod findOrCreateSetUpMethod(final PsiClass psiClass) {
final TestFramework[] testFrameworks = Extensions.getExtensions(TestFramework.EXTENSION_NAME);
for (TestFramework framework : testFrameworks) {
for (TestFramework framework : TestFramework.EXTENSION_NAME.getExtensionList()) {
if (framework.isTestClass(psiClass)) {
try {
final PsiMethod setUpMethod = (PsiMethod)framework.findOrCreateSetUpMethod(psiClass);
@@ -72,8 +54,7 @@ public class TestFrameworksImpl extends TestFrameworks {
@Override
@Nullable
public PsiMethod findSetUpMethod(final PsiClass psiClass) {
final TestFramework[] testFrameworks = Extensions.getExtensions(TestFramework.EXTENSION_NAME);
for (TestFramework framework : testFrameworks) {
for (TestFramework framework : TestFramework.EXTENSION_NAME.getExtensionList()) {
if (framework.isTestClass(psiClass)) {
final PsiMethod setUpMethod = (PsiMethod)framework.findSetUpMethod(psiClass);
if (setUpMethod != null) {
@@ -83,12 +64,11 @@ public class TestFrameworksImpl extends TestFrameworks {
}
return null;
}
@Override
@Nullable
public PsiMethod findTearDownMethod(final PsiClass psiClass) {
final TestFramework[] testFrameworks = Extensions.getExtensions(TestFramework.EXTENSION_NAME);
for (TestFramework framework : testFrameworks) {
for (TestFramework framework : TestFramework.EXTENSION_NAME.getExtensionList()) {
if (framework.isTestClass(psiClass)) {
final PsiMethod setUpMethod = (PsiMethod)framework.findTearDownMethod(psiClass);
if (setUpMethod != null) {
@@ -101,8 +81,7 @@ public class TestFrameworksImpl extends TestFrameworks {
@Override
protected boolean hasConfigMethods(PsiClass psiClass) {
final TestFramework[] testFrameworks = Extensions.getExtensions(TestFramework.EXTENSION_NAME);
for (TestFramework framework : testFrameworks) {
for (TestFramework framework : TestFramework.EXTENSION_NAME.getExtensionList()) {
if (framework.findSetUpMethod(psiClass) != null || framework.findTearDownMethod(psiClass) != null) return true;
}
return false;
@@ -110,8 +89,7 @@ public class TestFrameworksImpl extends TestFrameworks {
@Override
public boolean isTestMethod(PsiMethod method) {
final TestFramework[] testFrameworks = Extensions.getExtensions(TestFramework.EXTENSION_NAME);
for (TestFramework framework : testFrameworks) {
for (TestFramework framework : TestFramework.EXTENSION_NAME.getExtensionList()) {
if (framework.isTestMethod(method)) return true;
}
return false;
@@ -1,3 +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.
package com.intellij.codeInsight.generation;
import com.intellij.codeInsight.MemberImplementorExplorer;
@@ -121,7 +122,7 @@ public class OverrideImplementExploreUtil {
@FunctionalInterface
public interface MemberImplementorExplorersProvider {
@NotNull
MemberImplementorExplorer[] getExplorers();
List<? extends MemberImplementorExplorer> getExplorers();
}
private static final NullableLazyValue<MemberImplementorExplorersProvider> ourExplorersProvider = new VolatileNullableLazyValue<MemberImplementorExplorersProvider>() {
@@ -1,25 +1,10 @@
/*
* 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-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.
package com.intellij.psi.impl;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInsight.TestFrameworks;
import com.intellij.icons.AllIcons;
import com.intellij.ide.IconLayerProvider;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.util.Iconable;
import com.intellij.openapi.util.Key;
@@ -200,7 +185,7 @@ public class ElementPresentationUtil implements PlatformIcons {
private static String getFlagsDescription(final PsiModifierListOwner aClass) {
int flags = getFlags(aClass, false);
String adj = "";
for (IconLayerProvider provider : Extensions.getExtensions(IconLayerProvider.EP_NAME)) {
for (IconLayerProvider provider : IconLayerProvider.EP_NAME.getExtensionList()) {
if (provider.getLayerIcon(aClass, false) != null) {
adj += " " + provider.getLayerDescription();
}
@@ -3,7 +3,6 @@ package com.intellij.psi.impl.compiled;
import com.intellij.navigation.ItemPresentation;
import com.intellij.navigation.ItemPresentationProviders;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.ui.Queryable;
import com.intellij.openapi.util.Key;
@@ -83,7 +82,7 @@ public class ClsClassImpl extends ClsMemberImpl<PsiClassStub<?>> implements PsiE
return stub instanceof PsiClassStubImpl &&
((PsiClassStubImpl)stub).isAnonymousInner();
}
private boolean isAnonymousOrLocalClass() {
return isAnonymousClass() || isLocalClass();
}
@@ -210,7 +209,7 @@ public class ClsClassImpl extends ClsMemberImpl<PsiClassStub<?>> implements PsiE
public List<PsiClass> getOwnInnerClasses() {
PsiClass[] classes = getStub().getChildrenByType(JavaStubElementTypes.CLASS, PsiClass.ARRAY_FACTORY);
if (classes.length == 0) return Collections.emptyList();
int anonymousOrLocalClassesCount = 0;
for(PsiClass aClass:classes) {
if (aClass instanceof ClsClassImpl && ((ClsClassImpl)aClass).isAnonymousOrLocalClass()) {
@@ -218,7 +217,7 @@ public class ClsClassImpl extends ClsMemberImpl<PsiClassStub<?>> implements PsiE
}
}
if (anonymousOrLocalClassesCount == 0) return asList(classes);
ArrayList<PsiClass> result = new ArrayList<>(classes.length - anonymousOrLocalClassesCount);
for(PsiClass aClass:classes) {
if (!(aClass instanceof ClsClassImpl) || !((ClsClassImpl)aClass).isAnonymousOrLocalClass()) {
@@ -537,7 +536,7 @@ public class ClsClassImpl extends ClsMemberImpl<PsiClassStub<?>> implements PsiE
@Override
@NotNull
public PsiElement getNavigationElement() {
for (ClsCustomNavigationPolicy navigationPolicy : Extensions.getExtensions(ClsCustomNavigationPolicy.EP_NAME)) {
for (ClsCustomNavigationPolicy navigationPolicy : ClsCustomNavigationPolicy.EP_NAME.getExtensionList()) {
try {
PsiElement navigationElement = navigationPolicy.getNavigationElement(this);
if (navigationElement != null) return navigationElement;
@@ -3,7 +3,6 @@ package com.intellij.psi.impl.compiled;
import com.intellij.navigation.ItemPresentation;
import com.intellij.navigation.ItemPresentationProviders;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.util.*;
import com.intellij.psi.*;
@@ -175,7 +174,7 @@ public class ClsFieldImpl extends ClsMemberImpl<PsiFieldStub> implements PsiFiel
@Override
@NotNull
public PsiElement getNavigationElement() {
for (ClsCustomNavigationPolicy navigationPolicy : Extensions.getExtensions(ClsCustomNavigationPolicy.EP_NAME)) {
for (ClsCustomNavigationPolicy navigationPolicy : ClsCustomNavigationPolicy.EP_NAME.getExtensionList()) {
try {
PsiElement navigationElement = navigationPolicy.getNavigationElement(this);
if (navigationElement != null) return navigationElement;
@@ -9,7 +9,6 @@ import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.extensions.PluginId;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.progress.ProgressManager;
@@ -308,7 +307,7 @@ public class ClsFileImpl extends PsiBinaryFileImpl
@Override
@NotNull
public PsiElement getNavigationElement() {
for (ClsCustomNavigationPolicy navigationPolicy : Extensions.getExtensions(ClsCustomNavigationPolicy.EP_NAME)) {
for (ClsCustomNavigationPolicy navigationPolicy : ClsCustomNavigationPolicy.EP_NAME.getExtensionList()) {
try {
PsiElement navigationElement =
navigationPolicy instanceof ClsCustomNavigationPolicyEx ? ((ClsCustomNavigationPolicyEx)navigationPolicy).getFileNavigationElement(this) :
@@ -3,7 +3,6 @@ package com.intellij.psi.impl.compiled;
import com.intellij.navigation.ItemPresentation;
import com.intellij.navigation.ItemPresentationProviders;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.roots.FileIndexFacade;
import com.intellij.openapi.util.*;
@@ -289,7 +288,7 @@ public class ClsMethodImpl extends ClsMemberImpl<PsiMethodStub> implements PsiAn
@Override
@NotNull
public PsiElement getNavigationElement() {
for (ClsCustomNavigationPolicy navigationPolicy : Extensions.getExtensions(ClsCustomNavigationPolicy.EP_NAME)) {
for (ClsCustomNavigationPolicy navigationPolicy : ClsCustomNavigationPolicy.EP_NAME.getExtensionList()) {
try {
PsiElement navigationElement = navigationPolicy.getNavigationElement(this);
if (navigationElement != null) return navigationElement;
@@ -1,4 +1,4 @@
// 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-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.
package com.intellij.psi.impl.source.javadoc;
import com.intellij.codeInspection.SuppressionUtilCore;
@@ -60,7 +60,7 @@ public class JavadocManagerImpl implements JavadocManager {
Collections.addAll(myInfos, Extensions.getExtensions(JavadocTagInfo.EP_NAME, project));
for (CustomJavadocTagProvider extension : Extensions.getExtensions(CustomJavadocTagProvider.EP_NAME)) {
for (CustomJavadocTagProvider extension : CustomJavadocTagProvider.EP_NAME.getExtensionList()) {
myInfos.addAll(extension.getSupportedTags());
}
}
@@ -1,18 +1,4 @@
/*
* 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-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.
package com.intellij.ide.structureView.impl.java;
import com.intellij.ide.structureView.impl.common.PsiTreeElementBase;
@@ -23,7 +9,6 @@ import com.intellij.ide.util.treeView.smartTree.TreeElement;
import com.intellij.navigation.AnonymousElementProvider;
import com.intellij.openapi.actionSystem.KeyboardShortcut;
import com.intellij.openapi.actionSystem.Shortcut;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.util.PropertyOwner;
import com.intellij.openapi.util.SystemInfo;
@@ -51,7 +36,7 @@ public class JavaAnonymousClassesNodeProvider
if (node instanceof PsiMethodTreeElement || node instanceof PsiFieldTreeElement || node instanceof ClassInitializerTreeElement) {
final PsiElement el = ((PsiTreeElementBase)node).getElement();
if (el != null) {
for (AnonymousElementProvider provider : Extensions.getExtensions(AnonymousElementProvider.EP_NAME)) {
for (AnonymousElementProvider provider : AnonymousElementProvider.EP_NAME.getExtensionList()) {
final PsiElement[] elements = provider.getAnonymousElements(el);
if (elements.length > 0) {
List<JavaAnonymousClassTreeElement> result = new ArrayList<>(elements.length);
@@ -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-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.
package com.intellij.java.refactoring;
import com.intellij.JavaTestUtil;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.psi.PsiClass;
@@ -59,7 +44,7 @@ public class RenameClassTest extends MultiFileTestCase {
public void testInSameFile() {
doTest("Two", "Object");
}
public void testConstructorJavadoc() {
doTest("Test", "Test1");
}
@@ -90,7 +75,7 @@ public class RenameClassTest extends MultiFileTestCase {
assertNotNull("Class XX not found", aClass);
final RenameProcessor processor = new RenameProcessor(myProject, aClass, newName, true, true);
for (AutomaticRenamerFactory factory : Extensions.getExtensions(AutomaticRenamerFactory.EP_NAME)) {
for (AutomaticRenamerFactory factory : AutomaticRenamerFactory.EP_NAME.getExtensionList()) {
processor.addRenamerFactory(factory);
}
processor.run();
@@ -1,23 +1,8 @@
/*
* 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-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.
package com.intellij.java.refactoring;
import com.intellij.JavaTestUtil;
import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileEditor.FileDocumentManager;
import com.intellij.psi.JavaPsiFacade;
import com.intellij.psi.PsiClass;
@@ -135,7 +120,7 @@ public class RenameMethodMultiTest extends MultiFileTestCase {
assertNotNull(methodBySignature);
final RenameProcessor processor = new RenameProcessor(myProject, methodBySignature, newName, false, false);
for (AutomaticRenamerFactory factory : Extensions.getExtensions(AutomaticRenamerFactory.EP_NAME)) {
for (AutomaticRenamerFactory factory : AutomaticRenamerFactory.EP_NAME.getExtensionList()) {
processor.addRenamerFactory(factory);
}
processor.run();
@@ -25,7 +25,6 @@
package org.jetbrains.lang.manifest.header;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.util.NotNullLazyValue;
import com.intellij.psi.PsiReference;
import com.intellij.psi.util.PsiTreeUtil;
@@ -52,7 +51,7 @@ public class HeaderParserRepository {
@Override
protected Map<String, HeaderParser> compute() {
Map<String, HeaderParser> map = new THashMap<>(CaseInsensitiveStringHashingStrategy.INSTANCE);
for (HeaderParserProvider provider : Extensions.getExtensions(HeaderParserProvider.EP_NAME)) {
for (HeaderParserProvider provider : HeaderParserProvider.EP_NAME.getExtensionList()) {
map.putAll(provider.getHeaderParsers());
}
return map;
@@ -1,28 +1,14 @@
/*
* 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-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.
package com.intellij.util.xml.converters.values;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Pair;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTypesUtil;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.CommonClassNames;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiClassType;
import com.intellij.psi.PsiType;
import com.intellij.util.xml.Converter;
import com.intellij.util.xml.GenericDomValue;
import org.jetbrains.annotations.NotNull;
@@ -41,8 +27,7 @@ public class GenericDomValueConvertersRegistry {
}
public void registerFromExtensions(ExtensionPointName<Provider> extensionPointName) {
Provider[] providers = Extensions.getExtensions(extensionPointName);
for (Provider provider : providers) {
for (Provider provider : extensionPointName.getExtensionList()) {
registerConverter(provider.getConverter(), provider.getCondition());
}
}
@@ -52,7 +37,7 @@ public class GenericDomValueConvertersRegistry {
public void registerDefaultConverters() {
registerBooleanConverters();
registerCharacterConverter();
registerNumberValueConverters();
@@ -1,18 +1,4 @@
/*
* 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-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.
package com.intellij.codeInsight.daemon;
import com.intellij.codeHighlighting.Pass;
@@ -40,7 +26,6 @@ import com.intellij.openapi.application.ex.PathManagerEx;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ModuleRootManager;
@@ -105,11 +90,11 @@ public abstract class DaemonAnalyzerTestCase extends CodeInsightTestCase {
LanguageAnnotators.INSTANCE.allForLanguage(JavaLanguage.INSTANCE); // pile of annotator classes loads
LanguageAnnotators.INSTANCE.allForLanguage(StdLanguages.XML);
ProblemHighlightFilter.EP_NAME.getExtensions();
Extensions.getExtensions(ImplicitUsageProvider.EP_NAME);
Extensions.getExtensions(XmlSchemaProvider.EP_NAME);
Extensions.getExtensions(XmlFileNSInfoProvider.EP_NAME);
Extensions.getExtensions(ExternalAnnotatorsFilter.EXTENSION_POINT_NAME);
Extensions.getExtensions(IndexPatternBuilder.EP_NAME);
ImplicitUsageProvider.EP_NAME.getExtensionList();
XmlSchemaProvider.EP_NAME.getExtensionList();
XmlFileNSInfoProvider.EP_NAME.getExtensionList();
ExternalAnnotatorsFilter.EXTENSION_POINT_NAME.getExtensionList();
IndexPatternBuilder.EP_NAME.getExtensionList();
}
}
@@ -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.
package com.jetbrains.jsonSchema.extension;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
@@ -14,7 +13,6 @@ import com.jetbrains.jsonSchema.impl.JsonSchemaVariantsTreeBuilder;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
@@ -54,7 +52,7 @@ public interface JsonLikePsiWalker {
static JsonLikePsiWalker getWalker(@NotNull final PsiElement element, JsonSchemaObject schemaObject) {
if (JSON_ORIGINAL_PSI_WALKER.handles(element)) return JSON_ORIGINAL_PSI_WALKER;
return Arrays.stream(Extensions.getExtensions(JsonLikePsiWalkerFactory.EXTENSION_POINT_NAME))
return JsonLikePsiWalkerFactory.EXTENSION_POINT_NAME.getExtensionList().stream()
.filter(extension -> extension.handles(element))
.findFirst()
.map(extension -> extension.create(schemaObject))
@@ -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-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.
package com.intellij.codeInspection.ex;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.util.ArrayUtilRt;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -38,7 +23,7 @@ public abstract class InspectionElementsMerger {
public static synchronized InspectionElementsMerger getMerger(String shortName) {
if (ourMergers == null) {
ourMergers = new HashMap<>();
for (InspectionElementsMerger merger : Extensions.getExtensions(EP_NAME)) {
for (InspectionElementsMerger merger : EP_NAME.getExtensionList()) {
ourMergers.put(merger.getMergedToolName(), merger);
}
}
@@ -1,23 +1,8 @@
/*
* 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-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.
package com.intellij.codeInspection.reference;
import com.intellij.codeInsight.daemon.ImplicitUsageProvider;
import com.intellij.codeInspection.ex.EntryPointsManager;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.util.Comparing;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
@@ -38,8 +23,7 @@ public class RefUtil {
if (element == null) {
return false;
}
final ImplicitUsageProvider[] implicitUsageProviders = Extensions.getExtensions(ImplicitUsageProvider.EP_NAME);
for (ImplicitUsageProvider provider : implicitUsageProviders) {
for (ImplicitUsageProvider provider : ImplicitUsageProvider.EP_NAME.getExtensionList()) {
if (provider.isImplicitUsage(element)) return true;
}
return false;
@@ -49,8 +33,7 @@ public class RefUtil {
if (element == null) {
return false;
}
final ImplicitUsageProvider[] implicitUsageProviders = Extensions.getExtensions(ImplicitUsageProvider.EP_NAME);
for (ImplicitUsageProvider provider : implicitUsageProviders) {
for (ImplicitUsageProvider provider : ImplicitUsageProvider.EP_NAME.getExtensionList()) {
if (provider.isImplicitRead(element)) return true;
}
return false;
@@ -69,8 +52,7 @@ public class RefUtil {
if (element == null) {
return false;
}
final ImplicitUsageProvider[] implicitUsageProviders = Extensions.getExtensions(ImplicitUsageProvider.EP_NAME);
for (ImplicitUsageProvider provider : implicitUsageProviders) {
for (ImplicitUsageProvider provider : ImplicitUsageProvider.EP_NAME.getExtensionList()) {
if (provider.isImplicitWrite(element)) return true;
}
return EntryPointsManager.getInstance(element.getProject()).isImplicitWrite(element);
@@ -1,18 +1,4 @@
/*
* 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-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.
package com.intellij.codeInsight.daemon.impl;
import com.intellij.codeInsight.daemon.impl.analysis.ErrorQuickFixProvider;
@@ -156,7 +142,7 @@ class DefaultHighlightVisitor implements HighlightVisitor, DumbAware {
}
final HighlightInfo info = builder.create();
if (info != null) {
for(ErrorQuickFixProvider provider: Extensions.getExtensions(ErrorQuickFixProvider.EP_NAME)) {
for(ErrorQuickFixProvider provider: ErrorQuickFixProvider.EP_NAME.getExtensionList()) {
provider.registerErrorQuickFix(element, info);
}
}
@@ -440,7 +440,7 @@ public class GeneralHighlightingPass extends ProgressableTextEditorHighlightingP
private boolean forceHighlightParents() {
boolean forceHighlightParents = false;
for(HighlightRangeExtension extension: Extensions.getExtensions(HighlightRangeExtension.EP_NAME)) {
for(HighlightRangeExtension extension: HighlightRangeExtension.EP_NAME.getExtensionList()) {
if (extension.isForceHighlightParents(getFile())) {
forceHighlightParents = true;
break;
@@ -6,7 +6,6 @@ import com.intellij.codeHighlighting.HighlightDisplayLevel;
import com.intellij.lang.annotation.HighlightSeverity;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.JDOMExternalizableStringList;
import com.intellij.profile.codeInspection.InspectionProfileManager;
@@ -24,8 +23,8 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
import java.util.*;
import java.util.List;
import java.util.*;
import java.util.stream.Collectors;
public class SeverityRegistrar implements Comparator<HighlightSeverity> {
@@ -341,7 +340,7 @@ public class SeverityRegistrar implements Comparator<HighlightSeverity> {
}
static boolean isGotoBySeverityEnabled(@NotNull HighlightSeverity minSeverity) {
for (SeveritiesProvider provider : Extensions.getExtensions(SeveritiesProvider.EP_NAME)) {
for (SeveritiesProvider provider : SeveritiesProvider.EP_NAME.getExtensionList()) {
if (provider.isGotoBySeverityEnabled(minSeverity)) return true;
}
return minSeverity != HighlightSeverity.INFORMATION;
@@ -1,23 +1,8 @@
/*
* 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-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.
package com.intellij.codeInsight.quickfix;
import com.intellij.codeInsight.daemon.QuickFixActionRegistrar;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.DumbService;
import com.intellij.psi.PsiReference;
import com.intellij.util.ReflectionUtil;
@@ -32,9 +17,8 @@ import org.jetbrains.annotations.NotNull;
public abstract class UnresolvedReferenceQuickFixProvider<T extends PsiReference> {
public static <T extends PsiReference> void registerReferenceFixes(@NotNull T ref, @NotNull QuickFixActionRegistrar registrar) {
final boolean dumb = DumbService.getInstance(ref.getElement().getProject()).isDumb();
UnresolvedReferenceQuickFixProvider[] fixProviders = Extensions.getExtensions(EXTENSION_NAME);
Class<? extends PsiReference> referenceClass = ref.getClass();
for (UnresolvedReferenceQuickFixProvider each : fixProviders) {
for (UnresolvedReferenceQuickFixProvider each : EXTENSION_NAME.getExtensionList()) {
if (dumb && !DumbService.isDumbAware(each)) {
continue;
}
@@ -1,18 +1,4 @@
/*
* 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-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.
package com.intellij.codeInspection;
@@ -21,7 +7,6 @@ import com.intellij.lang.Commenter;
import com.intellij.lang.Language;
import com.intellij.lang.LanguageCommenters;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Couple;
import com.intellij.openapi.util.text.StringUtil;
@@ -178,7 +163,7 @@ public class SuppressionUtil extends SuppressionUtilCore {
}
public static boolean isSuppressed(@NotNull PsiElement psiElement, @NotNull String id) {
for (InspectionExtensionsFactory factory : Extensions.getExtensions(InspectionExtensionsFactory.EP_NAME)) {
for (InspectionExtensionsFactory factory : InspectionExtensionsFactory.EP_NAME.getExtensionList()) {
if (!factory.isToCheckMember(psiElement, id)) {
return true;
}
@@ -1,18 +1,4 @@
/*
* 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-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.
package com.intellij.codeInspection.ex;
@@ -24,7 +10,6 @@ import com.intellij.codeInspection.reference.*;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.progress.*;
import com.intellij.openapi.progress.util.ProgressWrapper;
import com.intellij.openapi.project.DumbService;
@@ -39,7 +24,6 @@ import com.intellij.psi.*;
import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.search.scope.packageSet.NamedScope;
import com.intellij.util.containers.ContainerUtil;
import java.util.HashMap;
import gnu.trove.THashMap;
import gnu.trove.THashSet;
import gnu.trove.TObjectHashingStrategy;
@@ -84,7 +68,7 @@ public class GlobalInspectionContextBase extends UserDataHolderBase implements G
public GlobalInspectionContextBase(@NotNull Project project) {
myProject = project;
for (InspectionExtensionsFactory factory : Extensions.getExtensions(InspectionExtensionsFactory.EP_NAME)) {
for (InspectionExtensionsFactory factory : InspectionExtensionsFactory.EP_NAME.getExtensionList()) {
final GlobalInspectionContextExtension extension = factory.createGlobalInspectionContextExtension();
myExtensions.put(extension.getID(), extension);
}
@@ -1,25 +1,10 @@
/*
* 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-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.
package com.intellij.codeInspection.ex;
import com.intellij.codeInspection.GlobalInspectionContext;
import com.intellij.codeInspection.lang.InspectionExtensionsFactory;
import com.intellij.codeInspection.reference.RefElement;
import com.intellij.lang.injection.InjectedLanguageManager;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
@@ -37,7 +22,7 @@ public class GlobalInspectionContextUtil {
}
public static boolean canRunInspections(@NotNull Project project, final boolean online) {
for (InspectionExtensionsFactory factory : Extensions.getExtensions(InspectionExtensionsFactory.EP_NAME)) {
for (InspectionExtensionsFactory factory : InspectionExtensionsFactory.EP_NAME.getExtensionList()) {
if (!factory.isProjectConfiguredToRunInspections(project, online)) {
return false;
}
@@ -1,18 +1,4 @@
/*
* 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-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.
package com.intellij.codeInspection.ex;
@@ -23,7 +9,6 @@ import com.intellij.codeInspection.lang.HTMLComposerExtension;
import com.intellij.codeInspection.lang.InspectionExtensionsFactory;
import com.intellij.codeInspection.reference.*;
import com.intellij.lang.Language;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.ProjectUtilCore;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Key;
@@ -60,7 +45,7 @@ public abstract class HTMLComposerImpl extends HTMLComposer {
protected HTMLComposerImpl() {
myListStack = new int[5];
myListStackTop = -1;
for (InspectionExtensionsFactory factory : Extensions.getExtensions(InspectionExtensionsFactory.EP_NAME)) {
for (InspectionExtensionsFactory factory : InspectionExtensionsFactory.EP_NAME.getExtensionList()) {
final HTMLComposerExtension extension = factory.createHTMLComposerExtension(this);
if (extension != null) {
myExtensions.put(extension.getID(), extension);
@@ -91,7 +91,7 @@ public class RefManagerImpl extends RefManager {
myContext = context;
myPsiManager = PsiManager.getInstance(project);
myRefProject = new RefProjectImpl(this);
for (InspectionExtensionsFactory factory : Extensions.getExtensions(InspectionExtensionsFactory.EP_NAME)) {
for (InspectionExtensionsFactory factory : InspectionExtensionsFactory.EP_NAME.getExtensionList()) {
final RefManagerExtension<?> extension = factory.createRefManagerExtension(this);
if (extension != null) {
myExtensions.put(extension.getID(), extension);
@@ -169,7 +169,7 @@ public class RefManagerImpl extends RefManager {
annotator.onMarkReferenced(refWhat, refFrom, referencedFromClassInitializer, forReading, forWriting);
}
}
void fireNodeMarkedReferenced(RefElement refWhat,
RefElement refFrom,
boolean referencedFromClassInitializer,
@@ -364,7 +364,7 @@ public class RefManagerImpl extends RefManager {
public boolean isOfflineView() {
return myOfflineView;
}
public boolean isInProcess() {
return myIsInProcess;
}
@@ -619,9 +619,9 @@ public class RefManagerImpl extends RefManager {
@Nullable
<T extends RefElement> T getFromRefTableOrCache(final PsiElement element, @NotNull NullableFactory<? extends T> factory) {
return getFromRefTableOrCache(element, factory, null);
return getFromRefTableOrCache(element, factory, null);
}
@Nullable
private <T extends RefElement> T getFromRefTableOrCache(@NotNull PsiElement element,
@NotNull NullableFactory<? extends T> factory,
@@ -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-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.
package com.intellij.psi.impl.source.resolve.reference.impl.providers;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFileSystemItem;
@@ -34,7 +19,7 @@ public class FileReferenceHelperRegistrar {
@NotNull
public static FileReferenceHelper[] getHelpers() {
return Extensions.getExtensions(FileReferenceHelper.EP_NAME);
return FileReferenceHelper.EP_NAME.getExtensions();
}
/**
@@ -1,23 +1,8 @@
/*
* 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-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.
package com.intellij.codeInsight.highlighting;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiReference;
import org.jetbrains.annotations.NotNull;
@@ -39,7 +24,7 @@ public abstract class ReadWriteAccessDetector {
@Nullable
public static ReadWriteAccessDetector findDetector(@NotNull PsiElement element) {
ReadWriteAccessDetector detector = null;
for(ReadWriteAccessDetector accessDetector: Extensions.getExtensions(EP_NAME)) {
for(ReadWriteAccessDetector accessDetector: EP_NAME.getExtensionList()) {
if (accessDetector.isReadWriteAccessible(element)) {
detector = accessDetector;
break;
@@ -2,12 +2,11 @@
package com.intellij.lang;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.stream.Stream;
/**
@@ -24,14 +23,14 @@ public abstract class MetaLanguage extends Language {
}
@NotNull
public static MetaLanguage[] all() {
return Extensions.getExtensions(EP_NAME);
public static List<MetaLanguage> all() {
return EP_NAME.getExtensionList();
}
@NotNull
public static Stream<MetaLanguage> getAllMatchingMetaLanguages(@NotNull Language language) {
if (language instanceof MetaLanguage) return Stream.empty();
return Arrays.stream(all()).filter(l -> l.matchesLanguage(language));
return all().stream().filter(l -> l.matchesLanguage(language));
}
/**
@@ -1,18 +1,4 @@
/*
* 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-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.
package com.intellij.lang.folding;
import com.intellij.lang.ASTNode;
@@ -34,7 +20,7 @@ import java.util.Set;
/**
* Builds custom folding regions. If custom folding is supported for a language, its FoldingBuilder must be inherited from this class.
*
*
* @author Rustam Vishnyakov
*/
public abstract class CustomFoldingBuilder extends FoldingBuilderEx implements PossiblyDumbAware {
@@ -48,7 +34,7 @@ public abstract class CustomFoldingBuilder extends FoldingBuilderEx implements P
ourCustomRegionElements.set(new HashSet<>());
List<FoldingDescriptor> descriptors = new ArrayList<>();
try {
if (CustomFoldingProvider.getAllProviders().length > 0) {
if (CustomFoldingProvider.getAllProviders().size() > 0) {
myDefaultProvider = null;
ASTNode rootNode = root.getNode();
if (rootNode != null) {
@@ -123,7 +109,7 @@ public abstract class CustomFoldingBuilder extends FoldingBuilderEx implements P
}
return getLanguagePlaceholderText(node, range);
}
protected abstract String getLanguagePlaceholderText(@NotNull ASTNode node, @NotNull TextRange range);
@@ -152,7 +138,7 @@ public abstract class CustomFoldingBuilder extends FoldingBuilderEx implements P
protected abstract boolean isRegionCollapsedByDefault(@NotNull ASTNode node);
/**
* Returns true if the node corresponds to custom region start. The node must be a custom folding candidate and match custom folding
* Returns true if the node corresponds to custom region start. The node must be a custom folding candidate and match custom folding
* start pattern.
*
* @param node The node which may contain custom region start.
@@ -1,23 +1,11 @@
/*
* 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-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.
package com.intellij.lang.folding;
import com.intellij.codeInsight.folding.CodeFoldingSettings;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* Base class and extension point for custom folding providers.
@@ -27,8 +15,9 @@ import com.intellij.openapi.extensions.Extensions;
public abstract class CustomFoldingProvider {
public static final ExtensionPointName<CustomFoldingProvider> EP_NAME = ExtensionPointName.create("com.intellij.customFoldingProvider");
public static CustomFoldingProvider[] getAllProviders() {
return Extensions.getExtensions(EP_NAME);
@NotNull
public static List<CustomFoldingProvider> getAllProviders() {
return EP_NAME.getExtensionList();
}
public abstract boolean isCustomRegionStart(String elementText);
@@ -39,10 +28,10 @@ public abstract class CustomFoldingProvider {
* @return A description string shown in "Surround With" action.
*/
public abstract String getDescription();
public abstract String getStartString();
public abstract String getEndString();
public boolean isCollapsedByDefault(String text) {
return CodeFoldingSettings.getInstance().COLLAPSE_CUSTOM_FOLDING_REGIONS;
}
@@ -1,24 +1,9 @@
/*
* 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-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.
package com.intellij.openapi.components;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.extensions.PluginAware;
import com.intellij.openapi.extensions.PluginDescriptor;
import com.intellij.util.xmlb.annotations.Attribute;
@@ -38,7 +23,7 @@ public class ServiceBean implements PluginAware {
public static <T> List<T> loadServicesFromBeans(final ExtensionPointName<? extends ServiceBean> epName, Class<T> componentClass) {
final List<T> components = new ArrayList<>();
for (ServiceBean exportableBean : Extensions.getExtensions(epName)) {
for (ServiceBean exportableBean : epName.getExtensionList()) {
final String serviceClass = exportableBean.serviceInterface;
if (serviceClass == null) {
LOG.error("Service interface not specified in " + epName);
@@ -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-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.
package com.intellij.psi;
import com.intellij.openapi.extensions.Extensions;
import org.jetbrains.annotations.NotNull;
/**
@@ -26,7 +11,7 @@ public class ElementDescriptionUtil {
@NotNull
public static String getElementDescription(@NotNull PsiElement element, @NotNull ElementDescriptionLocation location) {
for (ElementDescriptionProvider provider : Extensions.getExtensions(ElementDescriptionProvider.EP_NAME)) {
for (ElementDescriptionProvider provider : ElementDescriptionProvider.EP_NAME.getExtensionList()) {
String result = provider.getElementDescription(element, location);
if (result != null) {
return result;
@@ -6,7 +6,6 @@ import com.intellij.icons.AllIcons;
import com.intellij.ide.IconLayerProvider;
import com.intellij.navigation.ItemPresentation;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.INativeFileType;
import com.intellij.openapi.fileTypes.UnknownFileType;
@@ -114,7 +113,7 @@ public abstract class ElementBase extends UserDataHolderBase implements Iconable
protected Icon computeBaseIcon(@Iconable.IconFlags int flags) {
Icon baseIcon = isVisibilitySupported() ? getAdjustedBaseIcon(getBaseIcon(), flags) : getBaseIcon();
// to prevent blinking, base icon should be created with the layers
// to prevent blinking, base icon should be created with the layers
if (this instanceof PsiElement) {
PsiFile file = ((PsiElement)this).getContainingFile();
if (file != null) {
@@ -232,7 +231,7 @@ public abstract class ElementBase extends UserDataHolderBase implements Iconable
@NotNull
public static RowIcon createLayeredIcon(@NotNull Iconable instance, Icon icon, int flags) {
List<Icon> layersFromProviders = new SmartList<>();
for (IconLayerProvider provider : Extensions.getExtensions(IconLayerProvider.EP_NAME)) {
for (IconLayerProvider provider : IconLayerProvider.EP_NAME.getExtensionList()) {
final Icon layerIcon = provider.getLayerIcon(instance, BitUtil.isSet(flags, FLAGS_LOCKED));
if (layerIcon != null) {
layersFromProviders.add(layerIcon);
@@ -1,18 +1,4 @@
/*
* 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-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.
/*
* @author max
@@ -22,7 +8,6 @@ package com.intellij.psi.stubs;
import com.intellij.lang.ASTNode;
import com.intellij.lang.Language;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.psi.PsiElement;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NonNls;
@@ -34,7 +19,7 @@ import java.util.Arrays;
public abstract class IStubElementType<StubT extends StubElement, PsiT extends PsiElement> extends IElementType implements StubSerializer<StubT> {
private static volatile boolean ourInitializedStubs;
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.stubs.IStubElementType");
public IStubElementType(@NotNull @NonNls final String debugName, @Nullable final Language language) {
super(debugName, language);
if (ourInitializedStubs) {
@@ -45,7 +30,7 @@ public abstract class IStubElementType<StubT extends StubElement, PsiT extends P
}
static void loadRegisteredStubElementTypes() {
for (StubElementTypeHolderEP holderEP : Extensions.getExtensions(StubElementTypeHolderEP.EP_NAME)) {
for (StubElementTypeHolderEP holderEP : StubElementTypeHolderEP.EP_NAME.getExtensionList()) {
holderEP.initialize();
}
ourInitializedStubs = true;
@@ -5,7 +5,6 @@ import com.intellij.icons.AllIcons;
import com.intellij.ide.FileIconPatcher;
import com.intellij.ide.FileIconProvider;
import com.intellij.ide.TypePresentationService;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileTypes.DirectoryFileType;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.project.DumbService;
@@ -28,6 +27,7 @@ import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.awt.image.RGBImageFilter;
import java.lang.ref.WeakReference;
import java.util.List;
import static com.intellij.util.ui.JBUI.ScaleType.OBJ_SCALE;
import static com.intellij.util.ui.JBUI.ScaleType.USR_SCALE;
@@ -220,20 +220,20 @@ public class IconUtil {
}
private static class FileIconProviderHolder {
private static final FileIconProvider[] myProviders = Extensions.getExtensions(FileIconProvider.EP_NAME);
private static final List<FileIconProvider> myProviders = FileIconProvider.EP_NAME.getExtensionList();
}
@NotNull
private static FileIconProvider[] getProviders() {
private static List<FileIconProvider> getProviders() {
return FileIconProviderHolder.myProviders;
}
private static class FileIconPatcherHolder {
private static final FileIconPatcher[] ourPatchers = Extensions.getExtensions(FileIconPatcher.EP_NAME);
private static final List<FileIconPatcher> ourPatchers = FileIconPatcher.EP_NAME.getExtensionList();
}
@NotNull
private static FileIconPatcher[] getPatchers() {
private static List<FileIconPatcher> getPatchers() {
return FileIconPatcherHolder.ourPatchers;
}
@@ -1,18 +1,4 @@
/*
* 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-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.
/*
* @author max
@@ -20,7 +6,6 @@
package com.intellij.util;
import com.intellij.ide.IconProvider;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.util.Iconable;
import com.intellij.psi.PsiElement;
@@ -28,9 +13,9 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.List;
public class PsiIconUtil {
@Nullable
public static Icon getProvidersIcon(@NotNull PsiElement element, @Iconable.IconFlags int flags) {
final boolean dumb = DumbService.getInstance(element.getProject()).isDumb();
@@ -46,12 +31,11 @@ public class PsiIconUtil {
}
private static class IconProviderHolder {
private static final IconProvider[] ourIconProviders = Extensions.getExtensions(IconProvider.EXTENSION_POINT_NAME);
private static final List<IconProvider> ourIconProviders = IconProvider.EXTENSION_POINT_NAME.getExtensionList();
}
@NotNull
private static IconProvider[] getIconProviders() {
private static List<IconProvider> getIconProviders() {
return IconProviderHolder.ourIconProviders;
}
}
@@ -1,24 +1,9 @@
/*
* 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-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.
package com.intellij.codeInsight.daemon.impl;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.progress.ProgressIndicatorProvider;
import com.intellij.openapi.util.Condition;
import com.intellij.psi.PsiElement;
@@ -71,7 +56,7 @@ public class CollectHighlightsUtil {
private static List<PsiElement> getElementsToHighlight(@NotNull PsiElement parent, final int startOffset, final int endOffset) {
final List<PsiElement> result = new ArrayList<>();
final int currentOffset = parent.getTextRange().getStartOffset();
final Condition<PsiElement>[] filters = Extensions.getExtensions(EP_NAME);
final List<Condition<PsiElement>> filters = EP_NAME.getExtensionList();
int offset = currentOffset;
@@ -1,27 +1,12 @@
/*
* 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-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.
package com.intellij.codeInsight.highlighting;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.psi.PsiElement;
import org.jetbrains.annotations.NotNull;
public class ReadWriteUtil {
public static ReadWriteAccessDetector.Access getReadWriteAccess(@NotNull PsiElement[] primaryElements, @NotNull PsiElement element) {
for (ReadWriteAccessDetector detector : Extensions.getExtensions(ReadWriteAccessDetector.EP_NAME)) {
for (ReadWriteAccessDetector detector : ReadWriteAccessDetector.EP_NAME.getExtensionList()) {
if (isReadWriteAccessibleElements(primaryElements, detector)) {
return detector.getExpressionAccess(element);
}
@@ -1,23 +1,8 @@
/*
* 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-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.
package com.intellij.psi.impl.file;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.psi.PsiFile;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
@@ -35,7 +20,7 @@ public abstract class UpdateAddedFileProcessor {
@Nullable
public static UpdateAddedFileProcessor forElement(@NotNull PsiFile element) {
for(UpdateAddedFileProcessor processor: Extensions.getExtensions(EP_NAME)) {
for(UpdateAddedFileProcessor processor: EP_NAME.getExtensionList()) {
if (processor.canProcessElement(element)) {
return processor;
}
@@ -1,24 +1,9 @@
/*
* 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-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.
package com.intellij.psi.impl.meta;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.progress.ProgressIndicatorProvider;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Key;
@@ -99,7 +84,7 @@ public class MetaRegistry extends MetaDataRegistrar {
if (!ourContributorsLoaded) {
synchronized (ourBindings) {
if (!ourContributorsLoaded) {
for (MetaDataContributor contributor : Extensions.getExtensions(MetaDataContributor.EP_NAME)) {
for (MetaDataContributor contributor : MetaDataContributor.EP_NAME.getExtensionList()) {
contributor.contributeMetaData(MetaDataRegistrar.getInstance());
}
ourContributorsLoaded = true;
@@ -4,7 +4,6 @@ package com.intellij.psi.impl.source.tree;
import com.intellij.lang.ASTFactory;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.pom.PomManager;
import com.intellij.pom.PomModel;
import com.intellij.pom.event.PomModelEvent;
@@ -40,7 +39,7 @@ public class ChangeUtil {
}
private static void encodeInformation(TreeElement element, ASTNode original, Map<Object, Object> state) {
for (TreeCopyHandler handler : Extensions.getExtensions(TreeCopyHandler.EP_NAME)) {
for (TreeCopyHandler handler : TreeCopyHandler.EP_NAME.getExtensionList()) {
handler.encodeInformation(element, original, state);
}
@@ -66,7 +65,7 @@ public class ChangeUtil {
child = child.getTreeNext();
}
for (TreeCopyHandler handler : Extensions.getExtensions(TreeCopyHandler.EP_NAME)) {
for (TreeCopyHandler handler : TreeCopyHandler.EP_NAME.getExtensionList()) {
final TreeElement handled = handler.decodeInformation(element, state);
if (handled != null) return handled;
}
@@ -131,7 +130,7 @@ public class ChangeUtil {
return copyElement((TreeElement)SourceTreeToPsiMap.psiElementToTree(original), table);
}
else {
for (TreeGenerator generator : Extensions.getExtensions(TreeGenerator.EP_NAME)) {
for (TreeGenerator generator : TreeGenerator.EP_NAME.getExtensionList()) {
final TreeElement element = generator.generateTreeFor(original, table, manager);
if (element != null) return element;
}
@@ -20,12 +20,13 @@ import com.intellij.dupLocator.treeHash.FragmentsCollector;
import com.intellij.dupLocator.util.PsiFragment;
import com.intellij.lang.Language;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.psi.PsiElement;
import com.intellij.util.indexing.FileContent;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
public abstract class DuplicatesProfile {
public static final ExtensionPointName<DuplicatesProfile> EP_NAME = ExtensionPointName.create("com.intellij.duplicates.profile");
@@ -75,16 +76,16 @@ public abstract class DuplicatesProfile {
@Nullable
public static DuplicatesProfile findProfileForLanguage(@NotNull Language language) {
return findProfileForLanguage(EP_NAME.getExtensions(), language);
return findProfileForLanguage(EP_NAME.getExtensionList(), language);
}
@NotNull
public static DuplicatesProfile[] getAllProfiles() {
return Extensions.getExtensions(EP_NAME);
public static List<DuplicatesProfile> getAllProfiles() {
return EP_NAME.getExtensionList();
}
@Nullable
public static DuplicatesProfile findProfileForLanguage(DuplicatesProfile[] profiles, @NotNull Language language) {
public static DuplicatesProfile findProfileForLanguage(List<DuplicatesProfile> profiles, @NotNull Language language) {
for (DuplicatesProfile profile : profiles) {
if (profile.isMyLanguage(language)) {
return profile;
@@ -2,7 +2,6 @@ package com.intellij.dupLocator;
import com.intellij.dupLocator.treeHash.FragmentsCollector;
import com.intellij.lang.Language;
import com.intellij.openapi.extensions.Extensions;
import gnu.trove.TIntObjectHashMap;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -29,9 +28,8 @@ public class DuplicatesProfileCache {
}
DuplicatesProfile result = patternCache.get(index);
if (result == null) {
DuplicatesProfile[] profiles = Extensions.getExtensions(DuplicatesProfile.EP_NAME);
DuplicatesProfile theProfile = null;
for (DuplicatesProfile profile : profiles) {
for (DuplicatesProfile profile : DuplicatesProfile.EP_NAME.getExtensionList()) {
if (profile.isMyDuplicate(dupInfo, index)) {
theProfile = profile;
break;
@@ -1,21 +1,6 @@
/*
* Copyright 2000-2010 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-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.
package com.intellij.ide.todo;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.psi.search.IndexPattern;
import com.intellij.psi.search.IndexPatternProvider;
import org.jetbrains.annotations.NotNull;
@@ -27,8 +12,7 @@ public class TodoIndexPatternProvider implements IndexPatternProvider {
private final TodoConfiguration myConfiguration;
public static TodoIndexPatternProvider getInstance() {
final IndexPatternProvider[] providers = Extensions.getExtensions(EP_NAME);
for (IndexPatternProvider provider : providers) {
for (IndexPatternProvider provider : EP_NAME.getExtensionList()) {
if (provider instanceof TodoIndexPatternProvider) {
return (TodoIndexPatternProvider) provider;
}
@@ -7,7 +7,6 @@ import com.intellij.lang.LanguageParserDefinitions;
import com.intellij.lang.ParserDefinition;
import com.intellij.lexer.Lexer;
import com.intellij.openapi.application.QueryExecutorBase;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.SyntaxHighlighter;
import com.intellij.openapi.fileTypes.SyntaxHighlighterFactory;
@@ -114,7 +113,7 @@ public class IndexPatternSearcher extends QueryExecutorBase<IndexPatternOccurren
Lexer lexer = syntaxHighlighter.getHighlightingLexer();
TokenSet commentTokens = null;
IndexPatternBuilder builderForFile = null;
for (IndexPatternBuilder builder : Extensions.getExtensions(IndexPatternBuilder.EP_NAME)) {
for (IndexPatternBuilder builder : IndexPatternBuilder.EP_NAME.getExtensionList()) {
Lexer lexerFromBuilder = builder.getIndexingLexer(file);
if (lexerFromBuilder != null) {
lexer = lexerFromBuilder;
@@ -1,18 +1,4 @@
/*
* 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-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.
package com.intellij.openapi.extensions;
import com.intellij.openapi.Disposable;
@@ -88,6 +74,10 @@ public class Extensions {
return getExtensions(extensionPointName, null);
}
/**
* @deprecated Use {@link ExtensionPointName#getExtensionList()}
*/
@Deprecated
@NotNull
public static <T> T[] getExtensions(@NotNull ExtensionPointName<T> extensionPointName) {
return getExtensions(extensionPointName, null);
@@ -107,7 +97,7 @@ public class Extensions {
@NotNull
public static <T, U extends T> U findExtension(@NotNull ExtensionPointName<T> extensionPointName, @NotNull Class<U> extClass) {
for (T t : getExtensions(extensionPointName)) {
for (T t : extensionPointName.getExtensionList()) {
if (extClass.isInstance(t)) {
//noinspection unchecked
return (U) t;
@@ -2,9 +2,9 @@
package com.intellij.openapi.util;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.extensions.KeyedFactoryEPBean;
import com.intellij.util.ExceptionUtil;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.picocontainer.PicoContainer;
@@ -13,11 +13,9 @@ import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
import java.util.List;
import java.util.Set;
import static java.util.Arrays.stream;
import static java.util.stream.Collectors.toSet;
/**
* @author yole
*/
@@ -35,7 +33,7 @@ public abstract class KeyedExtensionFactory<T, KeyT> {
@NotNull
public T get() {
final KeyedFactoryEPBean[] epBeans = Extensions.getExtensions(myEpName);
final List<KeyedFactoryEPBean> epBeans = myEpName.getExtensionList();
InvocationHandler handler = new InvocationHandler() {
@Override
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
@@ -54,7 +52,7 @@ public abstract class KeyedExtensionFactory<T, KeyT> {
}
public T getByKey(@NotNull KeyT key) {
final KeyedFactoryEPBean[] epBeans = Extensions.getExtensions(myEpName);
final List<KeyedFactoryEPBean> epBeans = myEpName.getExtensionList();
for (KeyedFactoryEPBean epBean : epBeans) {
if (Comparing.strEqual(getKey(key), epBean.key)) {
try {
@@ -72,10 +70,15 @@ public abstract class KeyedExtensionFactory<T, KeyT> {
@NotNull
public Set<String> getAllKeys() {
return stream(Extensions.getExtensions(myEpName)).map(epBean -> epBean.key).collect(toSet());
List<KeyedFactoryEPBean> list = myEpName.getExtensionList();
Set<String> set = new THashSet<>();
for (KeyedFactoryEPBean epBean : list) {
set.add(epBean.key);
}
return set;
}
private T getByKey(final KeyedFactoryEPBean[] epBeans, final String key, final Method method, final Object[] args) {
private T getByKey(final List<KeyedFactoryEPBean> epBeans, final String key, final Method method, final Object[] args) {
Object result = null;
for(KeyedFactoryEPBean epBean: epBeans) {
if (Comparing.strEqual(epBean.key, key, true)) {
@@ -1,6 +1,4 @@
/*
* 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-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.
package com.intellij.openapi.externalSystem.service.execution;
import com.intellij.build.*;
@@ -37,7 +35,6 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.FoldRegion;
import com.intellij.openapi.editor.FoldingModel;
import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.externalSystem.ExternalSystemManager;
import com.intellij.openapi.externalSystem.execution.ExternalSystemExecutionConsoleManager;
import com.intellij.openapi.externalSystem.model.ProjectSystemId;
@@ -449,8 +446,7 @@ public class ExternalSystemRunConfiguration extends LocatableConfigurationBase i
if(!ExternalSystemApiUtil.isJavaCompatibleIde()) return null;
final JavaParameters extensionsJP = new JavaParameters();
final RunConfigurationExtension[] extensions = Extensions.getExtensions(RunConfigurationExtension.EP_NAME);
for (RunConfigurationExtension ext : extensions) {
for (RunConfigurationExtension ext : RunConfigurationExtension.EP_NAME.getExtensionList()) {
ext.updateJavaParameters(myConfiguration, extensionsJP, myEnv.getRunnerSettings());
}
@@ -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-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.
package com.intellij.openapi.externalSystem.service.project.settings
import com.intellij.openapi.extensions.Extensions
import com.intellij.openapi.externalSystem.model.project.settings.ConfigurationData
import com.intellij.openapi.externalSystem.service.project.IdeModifiableModelsProvider
import com.intellij.openapi.project.Project
@@ -87,6 +72,6 @@ class CodeStyleConfigurationHandler: ConfigurationHandler {
class CodeStyleImporterExtensionManager {
companion object {
fun importerForLang(langName: String): CodeStyleConfigurationImporter<CustomCodeStyleSettings>? =
Extensions.getExtensions(CodeStyleConfigurationImporter.EP_NAME).firstOrNull { it.canImport(langName) }
CodeStyleConfigurationImporter.EP_NAME.extensionList.firstOrNull { it.canImport(langName) }
}
}

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