diff --git a/platform/core-impl/src/com/intellij/core/CoreApplicationEnvironment.java b/platform/core-impl/src/com/intellij/core/CoreApplicationEnvironment.java index 92332e673c25..71c7a9e46c68 100644 --- a/platform/core-impl/src/com/intellij/core/CoreApplicationEnvironment.java +++ b/platform/core-impl/src/com/intellij/core/CoreApplicationEnvironment.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.core; import com.intellij.codeInsight.folding.CodeFoldingSettings; @@ -18,10 +18,7 @@ import com.intellij.openapi.command.CommandProcessor; import com.intellij.openapi.command.impl.CoreCommandProcessor; import com.intellij.openapi.components.ExtensionAreas; import com.intellij.openapi.editor.impl.DocumentImpl; -import com.intellij.openapi.extensions.ExtensionPoint; -import com.intellij.openapi.extensions.ExtensionPointName; -import com.intellij.openapi.extensions.Extensions; -import com.intellij.openapi.extensions.ExtensionsArea; +import com.intellij.openapi.extensions.*; import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.fileTypes.FileType; import com.intellij.openapi.fileTypes.FileTypeExtension; @@ -105,7 +102,7 @@ public class CoreApplicationEnvironment { VirtualFileManagerImpl virtualFileManager = new VirtualFileManagerImpl(fs, myApplication.getMessageBus()); registerApplicationComponent(VirtualFileManager.class, virtualFileManager); - //fake EP for cleaning resources after area disposing (otherwise KeyedExtensionCollector listener will be copied to the next area) + //fake EP for cleaning resources after area disposing (otherwise KeyedExtensionCollector listener will be copied to the next area) registerApplicationExtensionPoint(new ExtensionPointName<>("com.intellij.virtualFileSystem"), KeyedLazyInstanceEP.class); registerApplicationService(EncodingManager.class, new CoreEncodingRegistry()); @@ -263,12 +260,16 @@ public class CoreApplicationEnvironment { }); } - public static void registerExtensionPoint(@NotNull ExtensionsArea area, @NotNull ExtensionPointName extensionPointName, @NotNull Class aClass) { - final String name = extensionPointName.getName(); - registerExtensionPoint(area, name, aClass); + registerExtensionPoint(area, extensionPointName.getName(), aClass); + } + + public static void registerExtensionPoint(@NotNull ExtensionsArea area, + @NotNull BaseExtensionPointName extensionPointName, + @NotNull Class aClass) { + registerExtensionPoint(area, extensionPointName.getName(), aClass); } public static void registerExtensionPoint(@NotNull ExtensionsArea area, @NotNull String name, @NotNull Class aClass) { diff --git a/platform/core-impl/src/com/intellij/psi/impl/PsiManagerImpl.java b/platform/core-impl/src/com/intellij/psi/impl/PsiManagerImpl.java index bcbfc00b1dc3..c273b1f9019f 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/PsiManagerImpl.java +++ b/platform/core-impl/src/com/intellij/psi/impl/PsiManagerImpl.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl; @@ -344,7 +344,7 @@ public class PsiManagerImpl extends PsiManagerEx { preprocessor.treeChanged(event); } boolean enableOutOfCodeBlockTracking = ((PsiModificationTrackerImpl)myModificationTracker).isEnableCodeBlockTracker(); - for (PsiTreeChangePreprocessor preprocessor : PsiTreeChangePreprocessor.EP_NAME.getExtensions(myProject)) { + for (PsiTreeChangePreprocessor preprocessor : PsiTreeChangePreprocessor.EP.getExtensions(myProject)) { if (!enableOutOfCodeBlockTracking && preprocessor instanceof PsiTreeChangePreprocessorBase) continue; try { preprocessor.treeChanged(event); @@ -354,7 +354,7 @@ public class PsiManagerImpl extends PsiManagerEx { } } if (!enableOutOfCodeBlockTracking) { - for (PsiTreeChangePreprocessor preprocessor : PsiTreeChangePreprocessor.EP_NAME.getExtensions(myProject)) { + for (PsiTreeChangePreprocessor preprocessor : PsiTreeChangePreprocessor.EP.getExtensions(myProject)) { if (!(preprocessor instanceof PsiTreeChangePreprocessorBase)) continue; try { ((PsiTreeChangePreprocessorBase)preprocessor).onOutOfCodeBlockModification(event); diff --git a/platform/core-impl/src/com/intellij/psi/impl/PsiTreeChangePreprocessor.java b/platform/core-impl/src/com/intellij/psi/impl/PsiTreeChangePreprocessor.java index eba9c1191b9a..7d0ef7dae2e7 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/PsiTreeChangePreprocessor.java +++ b/platform/core-impl/src/com/intellij/psi/impl/PsiTreeChangePreprocessor.java @@ -1,32 +1,25 @@ -/* - * 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-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.psi.impl; import com.intellij.openapi.extensions.ExtensionPointName; +import com.intellij.openapi.extensions.ProjectExtensionPointName; import org.jetbrains.annotations.NotNull; /** * An extension called before notifying {@link com.intellij.psi.PsiTreeChangeListener}s of events.

- * + *

* Try to avoid processing PSI events at all cost! See {@link com.intellij.psi.PsiTreeChangeEvent} documentation for more details. * * @author yole */ public interface PsiTreeChangePreprocessor { + ProjectExtensionPointName EP = new ProjectExtensionPointName<>("com.intellij.psi.treeChangePreprocessor"); + + /** + * @deprecated Use {@link #EP} + */ + @Deprecated ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.psi.treeChangePreprocessor"); void treeChanged(@NotNull PsiTreeChangeEventImpl event); diff --git a/platform/editor-ui-api/src/com/intellij/ide/projectView/TreeStructureProvider.java b/platform/editor-ui-api/src/com/intellij/ide/projectView/TreeStructureProvider.java index e4d285c1ab98..511a4a21d8d2 100644 --- a/platform/editor-ui-api/src/com/intellij/ide/projectView/TreeStructureProvider.java +++ b/platform/editor-ui-api/src/com/intellij/ide/projectView/TreeStructureProvider.java @@ -1,22 +1,9 @@ -/* - * 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-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.projectView; import com.intellij.ide.util.treeView.AbstractTreeNode; import com.intellij.openapi.extensions.ExtensionPointName; +import com.intellij.openapi.extensions.ProjectExtensionPointName; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -26,6 +13,12 @@ import java.util.Collection; * Allows a plugin to modify the structure of a project as displayed in the project view. */ public interface TreeStructureProvider { + ProjectExtensionPointName EP = new ProjectExtensionPointName<>("com.intellij.treeStructureProvider"); + + /** + * @deprecated Use {@link #EP} + */ + @Deprecated ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.treeStructureProvider"); /** diff --git a/platform/lang-impl/src/com/intellij/ide/impl/ProjectViewSelectInTarget.java b/platform/lang-impl/src/com/intellij/ide/impl/ProjectViewSelectInTarget.java index 1d9ab8e96c13..9d0a88ff3d1e 100644 --- a/platform/lang-impl/src/com/intellij/ide/impl/ProjectViewSelectInTarget.java +++ b/platform/lang-impl/src/com/intellij/ide/impl/ProjectViewSelectInTarget.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.impl; import com.intellij.ide.CompositeSelectInTarget; @@ -139,8 +139,7 @@ public abstract class ProjectViewSelectInTarget extends SelectInTargetPsiWrapper } private TreeStructureProvider[] getProvidersDumbAware() { - TreeStructureProvider[] allProviders = TreeStructureProvider.EP_NAME.getExtensions(myProject); - List dumbAware = DumbService.getInstance(myProject).filterByDumbAwareness(allProviders); + List dumbAware = DumbService.getInstance(myProject).filterByDumbAwareness(TreeStructureProvider.EP.getExtensions(myProject)); return dumbAware.toArray(new TreeStructureProvider[0]); } diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/CompoundTreeStructureProvider.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/CompoundTreeStructureProvider.java index 28ef26502383..5ddbe47b817f 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/CompoundTreeStructureProvider.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/CompoundTreeStructureProvider.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.projectView.impl; import com.intellij.ide.projectView.TreeStructureProvider; @@ -14,6 +14,8 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.Collection; +import java.util.Collections; +import java.util.List; import java.util.Objects; /** @@ -22,10 +24,10 @@ import java.util.Objects; * @author Sergey Malenkov */ public final class CompoundTreeStructureProvider implements TreeStructureProvider { - private static final TreeStructureProvider EMPTY = new CompoundTreeStructureProvider(); + private static final TreeStructureProvider EMPTY = new CompoundTreeStructureProvider(Collections.emptyList()); private static final Key KEY = Key.create("TreeStructureProvider"); private static final Logger LOG = Logger.getInstance(CompoundTreeStructureProvider.class); - private final TreeStructureProvider[] providers; + private final List providers; /** * @return a shared instance for the specified project @@ -35,12 +37,12 @@ public final class CompoundTreeStructureProvider implements TreeStructureProvide if (project == null || project.isDisposed()) return EMPTY; TreeStructureProvider provider = project.getUserData(KEY); if (provider != null) return provider; - provider = new CompoundTreeStructureProvider(EP_NAME.getExtensions(project)); + provider = new CompoundTreeStructureProvider(EP.getExtensions(project)); project.putUserData(KEY, provider); return provider; } - public CompoundTreeStructureProvider(@NotNull TreeStructureProvider... providers) { + public CompoundTreeStructureProvider(@NotNull List providers) { this.providers = providers; } diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectAbstractTreeStructureBase.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectAbstractTreeStructureBase.java index 1ed53b3b8b03..d3f4a8071bef 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectAbstractTreeStructureBase.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectAbstractTreeStructureBase.java @@ -1,4 +1,4 @@ -// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package com.intellij.ide.projectView.impl; @@ -19,8 +19,7 @@ public abstract class ProjectAbstractTreeStructureBase extends AbstractTreeStruc @Override public List getProviders() { if (myProviders == null) { - final TreeStructureProvider[] providers = TreeStructureProvider.EP_NAME.getExtensions(myProject); - myProviders = Arrays.asList(providers); + myProviders = TreeStructureProvider.EP.getExtensions(myProject); } return myProviders; } diff --git a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java index 1ed912b04fcf..0fbdac30d2eb 100644 --- a/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/PlatformTestUtil.java @@ -23,10 +23,7 @@ import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.application.impl.ApplicationImpl; import com.intellij.openapi.application.impl.LaterInvocator; import com.intellij.openapi.editor.Document; -import com.intellij.openapi.extensions.ExtensionPoint; -import com.intellij.openapi.extensions.ExtensionPointName; -import com.intellij.openapi.extensions.Extensions; -import com.intellij.openapi.extensions.ExtensionsArea; +import com.intellij.openapi.extensions.*; import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.fileEditor.impl.LoadTextUtil; import com.intellij.openapi.fileTypes.FileTypes; @@ -137,7 +134,7 @@ public class PlatformTestUtil { } public static void registerExtension(@NotNull ExtensionsArea area, - @NotNull ExtensionPointName name, + @NotNull BaseExtensionPointName name, @NotNull T t, @NotNull Disposable parentDisposable) { ExtensionPoint extensionPoint = area.getExtensionPoint(name.getName()); diff --git a/uast/uast-tests/src/org/jetbrains/uast/test/env/TestCoreEnvironment.java b/uast/uast-tests/src/org/jetbrains/uast/test/env/TestCoreEnvironment.java index 4716f44d866b..046c007184de 100644 --- a/uast/uast-tests/src/org/jetbrains/uast/test/env/TestCoreEnvironment.java +++ b/uast/uast-tests/src/org/jetbrains/uast/test/env/TestCoreEnvironment.java @@ -185,8 +185,7 @@ public class TestCoreEnvironment extends AbstractCoreEnvironment { private void registerProjectExtensionPoints() { ExtensionsArea area = Extensions.getArea(myProject); - CoreApplicationEnvironment.registerExtensionPoint( - area, PsiTreeChangePreprocessor.EP_NAME, PsiTreeChangePreprocessor.class); + CoreApplicationEnvironment.registerExtensionPoint(area, PsiTreeChangePreprocessor.EP, PsiTreeChangePreprocessor.class); CoreApplicationEnvironment.registerExtensionPoint( area, PsiElementFinder.EP_NAME, PsiElementFinder.class); }