mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 15:09:39 +07:00
IJPL-310 simplify code (DumbService does isDumb check, no need to repeat code)
GitOrigin-RevId: 7f70f172018a4ee18085c15d8552182d9f03b36a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a93e09d7e2
commit
c59d76eb32
@@ -14,6 +14,7 @@ import com.intellij.openapi.progress.ProgressManager
|
||||
import com.intellij.openapi.util.*
|
||||
import com.intellij.util.ThrowableRunnable
|
||||
import com.intellij.util.messages.Topic
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.annotations.ApiStatus.Experimental
|
||||
import org.jetbrains.annotations.ApiStatus.Obsolete
|
||||
@@ -170,7 +171,7 @@ abstract class DumbService {
|
||||
* @see isDumbAware
|
||||
*/
|
||||
fun <T> filterByDumbAwareness(array: Array<T>): List<T> {
|
||||
return filterByDumbAwareness(listOf(*array))
|
||||
return filterByDumbAwareness(array.toList())
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -408,11 +409,13 @@ abstract class DumbService {
|
||||
val point = extensionPoint.point
|
||||
val size = point.size()
|
||||
if (size == 0) {
|
||||
return emptyList()
|
||||
return persistentListOf()
|
||||
}
|
||||
|
||||
if (!getInstance(project).isDumb) {
|
||||
return point.extensionList
|
||||
}
|
||||
|
||||
val result = ArrayList<T>(size)
|
||||
for (item in extensionPoint.filterableLazySequence()) {
|
||||
val aClass = item.implementationClass ?: continue
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.intellij.openapi.extensions.impl.ExtensionProcessingHelper.findFirstS
|
||||
import com.intellij.openapi.extensions.impl.ExtensionProcessingHelper.forEachExtensionSafe
|
||||
import com.intellij.openapi.extensions.impl.ExtensionProcessingHelper.getByGroupingKey
|
||||
import com.intellij.openapi.extensions.impl.ExtensionProcessingHelper.getByKey
|
||||
import com.intellij.openapi.progress.ProcessCanceledException
|
||||
import com.intellij.util.ThreeState
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.annotations.ApiStatus.Obsolete
|
||||
@@ -291,6 +292,9 @@ private fun <T : Any> createOrError(adapter: ExtensionComponentAdapter, point: E
|
||||
catch (e: CancellationException) {
|
||||
throw e
|
||||
}
|
||||
catch (e: ProcessCanceledException) {
|
||||
throw e
|
||||
}
|
||||
catch (e: Throwable) {
|
||||
logger<ExtensionPointName<T>>().error(point.componentManager.createError(e, adapter.pluginDescriptor.pluginId))
|
||||
return null
|
||||
|
||||
@@ -87,14 +87,7 @@ public final class HighlightingSettingsPerFile extends HighlightingLevelManager
|
||||
}
|
||||
|
||||
private static @NotNull FileHighlightingSetting getDefaultHighlightingSetting(@NotNull Project project, @NotNull VirtualFile virtualFile) {
|
||||
List<DefaultHighlightingSettingProvider> providers;
|
||||
if (DumbService.isDumb(project)) {
|
||||
providers = DumbService.getDumbAwareExtensions(project, DefaultHighlightingSettingProvider.EP_NAME);
|
||||
}
|
||||
else {
|
||||
providers = DefaultHighlightingSettingProvider.EP_NAME.getExtensionList();
|
||||
}
|
||||
for (DefaultHighlightingSettingProvider p : providers) {
|
||||
for (DefaultHighlightingSettingProvider p : DumbService.getDumbAwareExtensions(project, DefaultHighlightingSettingProvider.EP_NAME)) {
|
||||
FileHighlightingSetting setting = p.getDefaultSetting(project, virtualFile);
|
||||
if (setting != null) {
|
||||
return setting;
|
||||
|
||||
Reference in New Issue
Block a user