mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IJPL-310 cleanup
GitOrigin-RevId: a4141c965c10f095f501b862dc03d4e7d6d26dac
This commit is contained in:
committed by
intellij-monorepo-bot
parent
42442067a6
commit
bf212a3aab
@@ -81,8 +81,9 @@ class ExtensionPointName<T : Any>(name: @NonNls String) : BaseExtensionPointName
|
||||
}
|
||||
|
||||
/**
|
||||
* Consider using [ProjectExtensionPointName.getExtensions]
|
||||
* Do not use project-level or module-level extensions.
|
||||
*/
|
||||
@Obsolete
|
||||
fun getExtensionList(areaInstance: AreaInstance?): List<T> = getPointImpl(areaInstance).extensionList
|
||||
|
||||
/**
|
||||
@@ -97,9 +98,7 @@ class ExtensionPointName<T : Any>(name: @NonNls String) : BaseExtensionPointName
|
||||
return getPointImpl(areaInstance).extensionList.stream()
|
||||
}
|
||||
|
||||
@Suppress("DeprecatedCallableAddReplaceWith")
|
||||
@Deprecated("""use {@link #getPoint()} to access application-level extensions and {@link ProjectExtensionPointName#getPoint(AreaInstance)}
|
||||
to access project-level and module-level extensions""")
|
||||
@Deprecated("Do not use project-level or module-level extensions.")
|
||||
fun getPoint(areaInstance: AreaInstance?): ExtensionPoint<T> = getPointImpl(areaInstance)
|
||||
|
||||
val point: ExtensionPoint<T>
|
||||
|
||||
@@ -1,42 +1,47 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.extensions;
|
||||
package com.intellij.openapi.extensions
|
||||
|
||||
import com.intellij.openapi.extensions.impl.ExtensionPointImpl;
|
||||
import org.jetbrains.annotations.*;
|
||||
|
||||
import java.util.Map;
|
||||
import com.intellij.openapi.extensions.impl.ExtensionPointImpl
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.annotations.NonNls
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
import org.jetbrains.annotations.Unmodifiable
|
||||
|
||||
@ApiStatus.Internal
|
||||
public interface ExtensionsArea {
|
||||
interface ExtensionsArea {
|
||||
@TestOnly
|
||||
void registerExtensionPoint(@NonNls @NotNull String extensionPointName,
|
||||
@NotNull String extensionPointBeanClass,
|
||||
@NotNull ExtensionPoint.Kind kind,
|
||||
boolean isDynamic);
|
||||
fun registerExtensionPoint(extensionPointName: @NonNls String,
|
||||
extensionPointBeanClass: String,
|
||||
kind: ExtensionPoint.Kind,
|
||||
isDynamic: Boolean)
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #registerExtensionPoint(String, String, ExtensionPoint.Kind, boolean)}
|
||||
*/
|
||||
@TestOnly
|
||||
@Deprecated
|
||||
default void registerExtensionPoint(@NonNls @NotNull String extensionPointName,
|
||||
@NotNull String extensionPointBeanClass,
|
||||
@NotNull ExtensionPoint.Kind kind) {
|
||||
registerExtensionPoint(extensionPointName, extensionPointBeanClass, kind, false);
|
||||
@Deprecated(message = "Do not use", replaceWith = ReplaceWith("registerExtensionPoint(String, String, ExtensionPoint.Kind, boolean)"))
|
||||
fun registerExtensionPoint(extensionPointName: @NonNls String,
|
||||
extensionPointBeanClass: String,
|
||||
kind: ExtensionPoint.Kind) {
|
||||
registerExtensionPoint(extensionPointName = extensionPointName,
|
||||
extensionPointBeanClass = extensionPointBeanClass,
|
||||
kind = kind,
|
||||
isDynamic = false)
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
void unregisterExtensionPoint(@NonNls @NotNull String extensionPointName);
|
||||
fun unregisterExtensionPoint(extensionPointName: @NonNls String)
|
||||
|
||||
boolean hasExtensionPoint(@NonNls @NotNull String extensionPointName);
|
||||
fun hasExtensionPoint(extensionPointName: @NonNls String): Boolean
|
||||
|
||||
boolean hasExtensionPoint(@NotNull ExtensionPointName<?> extensionPointName);
|
||||
fun hasExtensionPoint(extensionPointName: ExtensionPointName<*>): Boolean
|
||||
|
||||
@NotNull <T> ExtensionPoint<@NotNull T> getExtensionPoint(@NonNls @NotNull String extensionPointName);
|
||||
fun <T : Any> getExtensionPoint(extensionPointName: @NonNls String): ExtensionPoint<T>
|
||||
|
||||
<T> @Nullable ExtensionPoint<@NotNull T> getExtensionPointIfRegistered(@NotNull String extensionPointName);
|
||||
fun <T : Any> getExtensionPointIfRegistered(extensionPointName: String): ExtensionPoint<T>?
|
||||
|
||||
@NotNull <T> ExtensionPoint<@NotNull T> getExtensionPoint(@NotNull ExtensionPointName<T> extensionPointName);
|
||||
fun <T : Any> getExtensionPoint(extensionPointName: ExtensionPointName<T>): ExtensionPoint<T>
|
||||
|
||||
@NotNull @Unmodifiable Map<String, ExtensionPointImpl<?>> getNameToPointMap();
|
||||
val nameToPointMap: @Unmodifiable Map<String, ExtensionPointImpl<*>>
|
||||
|
||||
@TestOnly
|
||||
fun processExtensionPoints(consumer: (ExtensionPointImpl<*>) -> Unit)
|
||||
}
|
||||
|
||||
@@ -16,7 +16,6 @@ import org.jdom.Element
|
||||
import org.jetbrains.annotations.ApiStatus.Internal
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
import java.lang.reflect.Modifier
|
||||
import java.util.function.Consumer
|
||||
|
||||
private val LOG: Logger
|
||||
get() = logger<ExtensionsAreaImpl>()
|
||||
@@ -57,7 +56,8 @@ class ExtensionsAreaImpl(private val componentManager: ComponentManager) : Exten
|
||||
|
||||
private val epTraces = if (DEBUG_REGISTRATION) HashMap<String, Throwable>() else null
|
||||
|
||||
override fun getNameToPointMap(): Map<String, ExtensionPointImpl<*>> = extensionPoints
|
||||
override val nameToPointMap: Map<String, ExtensionPointImpl<*>>
|
||||
get() = extensionPoints
|
||||
|
||||
private val lock = Any()
|
||||
|
||||
@@ -179,7 +179,7 @@ class ExtensionsAreaImpl(private val componentManager: ComponentManager) : Exten
|
||||
registerExtensionPoint(extensionPointName = extensionPointName,
|
||||
extensionPointBeanClass = extensionPointBeanClass,
|
||||
kind = kind,
|
||||
dynamic = false)
|
||||
isDynamic = false)
|
||||
Disposer.register(parentDisposable) { unregisterExtensionPoint(extensionPointName) }
|
||||
}
|
||||
|
||||
@@ -187,13 +187,13 @@ class ExtensionsAreaImpl(private val componentManager: ComponentManager) : Exten
|
||||
override fun registerExtensionPoint(extensionPointName: String,
|
||||
extensionPointBeanClass: String,
|
||||
kind: ExtensionPoint.Kind,
|
||||
dynamic: Boolean) {
|
||||
isDynamic: Boolean) {
|
||||
val pluginDescriptor = DefaultPluginDescriptor(PluginId.getId("fakeIdForTests"))
|
||||
doRegisterExtensionPoint<Any>(name = extensionPointName,
|
||||
extensionClass = extensionPointBeanClass,
|
||||
pluginDescriptor = pluginDescriptor,
|
||||
isInterface = kind == ExtensionPoint.Kind.INTERFACE,
|
||||
dynamic = dynamic)
|
||||
dynamic = isDynamic)
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
@@ -289,7 +289,7 @@ class ExtensionsAreaImpl(private val componentManager: ComponentManager) : Exten
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
fun processExtensionPoints(consumer: Consumer<ExtensionPointImpl<*>>) {
|
||||
override fun processExtensionPoints(consumer: (ExtensionPointImpl<*>) -> Unit) {
|
||||
extensionPoints.values.forEach(consumer)
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.roots
|
||||
|
||||
import com.intellij.openapi.Disposable
|
||||
@@ -35,6 +35,7 @@ class ModuleExtensionRegistrationTest : HeavyPlatformTestCase() {
|
||||
}
|
||||
})
|
||||
for (module in ModuleManager.getInstance(myProject).modules) {
|
||||
@Suppress("DEPRECATION")
|
||||
ModuleRootManagerEx.MODULE_EXTENSION_NAME.getPoint(module).registerExtension(MockModuleExtension(), moduleTypeDisposable)
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -1,4 +1,4 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.internal.performance;
|
||||
|
||||
import com.intellij.ide.DataManager;
|
||||
@@ -29,6 +29,7 @@ import com.intellij.util.TimeoutUtil;
|
||||
import com.intellij.util.concurrency.AppExecutorUtil;
|
||||
import com.intellij.util.ui.EDT;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import kotlin.Unit;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -271,6 +272,7 @@ public final class ActionUpdatesBenchmarkAction extends DumbAwareAction {
|
||||
catch (Throwable e) {
|
||||
LOG.warn(e);
|
||||
}
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
+2
-17
@@ -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-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.roots;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
@@ -22,8 +8,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@ApiStatus.NonExtendable
|
||||
public abstract class JavaModuleExternalPaths extends ModuleExtension {
|
||||
|
||||
public static JavaModuleExternalPaths getInstance(Module module) {
|
||||
public static JavaModuleExternalPaths getInstance(@NotNull Module module) {
|
||||
return ModuleRootManager.getInstance(module).getModuleExtension(JavaModuleExternalPaths.class);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.openapi.roots;
|
||||
|
||||
import com.intellij.openapi.extensions.ProjectExtensionPointName;
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.roots.impl.RootConfigurationAccessor;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -9,7 +9,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
public abstract class ModuleRootManagerEx extends ModuleRootManager {
|
||||
public static final ProjectExtensionPointName<ModuleExtension> MODULE_EXTENSION_NAME = new ProjectExtensionPointName<>("com.intellij.moduleExtension");
|
||||
public static final ExtensionPointName<ModuleExtension> MODULE_EXTENSION_NAME = new ExtensionPointName<>("com.intellij.moduleExtension");
|
||||
|
||||
@NotNull
|
||||
public abstract ModifiableRootModel getModifiableModel(@NotNull RootConfigurationAccessor accessor);
|
||||
|
||||
+1
@@ -51,6 +51,7 @@ class ModuleRootComponentBridge(
|
||||
}
|
||||
|
||||
init {
|
||||
@Suppress("DEPRECATION")
|
||||
MODULE_EXTENSION_NAME.getPoint(moduleBridge).addExtensionPointListener(object : ExtensionPointListener<ModuleExtension> {
|
||||
override fun extensionAdded(extension: ModuleExtension, pluginDescriptor: PluginDescriptor) {
|
||||
dropRootModelCache()
|
||||
|
||||
+1
-1
@@ -142,7 +142,7 @@ internal class RootModelBridgeImpl(internal val moduleEntity: ModuleEntity?,
|
||||
if (parentDisposable is RootModelBridgeImpl && parentDisposable.isDisposed.get()) {
|
||||
parentDisposable.throwDisposed()
|
||||
}
|
||||
for (extension in ModuleRootManagerEx.MODULE_EXTENSION_NAME.getExtensions(module)) {
|
||||
for (extension in ModuleRootManagerEx.MODULE_EXTENSION_NAME.getExtensionList(module)) {
|
||||
val readOnlyExtension = loadExtension(extension, parentDisposable, rootManagerElement)
|
||||
|
||||
if (writable) {
|
||||
|
||||
+1
-1
@@ -378,7 +378,7 @@ abstract class ComponentManagerImpl(
|
||||
|
||||
// register services before registering extensions because plugins can access services in their extensions,
|
||||
// which can be invoked right away if the plugin is loaded dynamically
|
||||
val extensionPoints = if (precomputedExtensionModel == null) HashMap(extensionArea.getNameToPointMap()) else null
|
||||
val extensionPoints = if (precomputedExtensionModel == null) HashMap(extensionArea.nameToPointMap) else null
|
||||
for (rootModule in modules) {
|
||||
executeRegisterTask(rootModule) { module ->
|
||||
val containerDescriptor = getContainerDescriptor(module)
|
||||
|
||||
@@ -126,7 +126,7 @@ public final class DynamicExtensionPointsTester {
|
||||
@NotNull Map<ExtensionPointImpl<?>, Collection<WeakReference<Object>>> extensions) {
|
||||
area.processExtensionPoints(ep -> {
|
||||
if (!ep.isDynamic() || (useWhiteList && !EXTENSION_POINTS_WHITE_LIST.contains(ep.name))) {
|
||||
return;
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
|
||||
List<WeakReference<Object>> list = new ArrayList<>();
|
||||
@@ -137,6 +137,7 @@ public final class DynamicExtensionPointsTester {
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
extensions.put(ep, list);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user