diff --git a/platform/configuration-store-impl/src/SaveAndSyncHandlerImpl.kt b/platform/configuration-store-impl/src/SaveAndSyncHandlerImpl.kt index 4be1fb5c37c0..ffe534c3feb9 100644 --- a/platform/configuration-store-impl/src/SaveAndSyncHandlerImpl.kt +++ b/platform/configuration-store-impl/src/SaveAndSyncHandlerImpl.kt @@ -70,52 +70,52 @@ internal class SaveAndSyncHandlerImpl(private val coroutineScope: CoroutineScope private val forceExecuteImmediatelyState = AtomicBoolean() init { + coroutineScope.launch(CoroutineName("refresh requests flow processing") + ModalityState.nonModal().asContextElement()) { + // not collectLatest - wait for previous execution + refreshRequests + .debounce(300.milliseconds) + .collect { + val eventPublisher = eventPublisher + withContext(Dispatchers.EDT) { + blockingContext { + eventPublisher.beforeRefresh() + refreshOpenFiles() + maybeRefresh(ModalityState.nonModal()) + } + } + } + } + + coroutineScope.launch(CoroutineName("save requests flow processing")) { + // not collectLatest - wait for previous execution + saveRequests + .collect { + val forceExecuteImmediately = forceExecuteImmediatelyState.compareAndSet(true, false) + if (!forceExecuteImmediately) { + delay(300.milliseconds) + } + + if (blockSaveOnFrameDeactivationCount.get() != 0) { + return@collect + } + + val job = currentJob.updateAndGet { oldJob -> + oldJob?.cancel() + launch(start = CoroutineStart.LAZY) { processTasks(forceExecuteImmediately = forceExecuteImmediately) } + }!! + try { + if (job.start()) { + job.join() + } + } + catch (_: CancellationException) { } + finally { + currentJob.compareAndSet(job, null) + } + } + } + coroutineScope.launch { - launch(CoroutineName("refresh requests flow processing") + ModalityState.nonModal().asContextElement()) { - // not collectLatest - wait for previous execution - refreshRequests - .debounce(300.milliseconds) - .collect { - val eventPublisher = eventPublisher - withContext(Dispatchers.EDT) { - blockingContext { - eventPublisher.beforeRefresh() - refreshOpenFiles() - maybeRefresh(ModalityState.nonModal()) - } - } - } - } - - launch(CoroutineName("save requests flow processing")) { - // not collectLatest - wait for previous execution - saveRequests - .collect { - val forceExecuteImmediately = forceExecuteImmediatelyState.compareAndSet(true, false) - if (!forceExecuteImmediately) { - delay(300.milliseconds) - } - - if (blockSaveOnFrameDeactivationCount.get() != 0) { - return@collect - } - - val job = currentJob.updateAndGet { oldJob -> - oldJob?.cancel() - launch(start = CoroutineStart.LAZY) { processTasks(forceExecuteImmediately = forceExecuteImmediately) } - }!! - try { - if (job.start()) { - job.join() - } - } - catch (_: CancellationException) { } - finally { - currentJob.compareAndSet(job, null) - } - } - } - listenIdleAndActivate() } @@ -351,7 +351,7 @@ internal class SaveAndSyncHandlerImpl(private val coroutineScope: CoroutineScope session.addAllFiles(*ManagingFS.getInstance().localRoots) refreshSession.getAndSet(session)?.cancel() session.launch() - LOG.debug("vfs refreshed") + LOG.debug("VFS refresh started") } override fun refreshOpenFiles() { diff --git a/platform/core-api/src/com/intellij/openapi/vfs/SavingRequestor.java b/platform/core-api/src/com/intellij/openapi/vfs/SavingRequestor.java index ff3e1bb90697..b0fb1949fd85 100644 --- a/platform/core-api/src/com/intellij/openapi/vfs/SavingRequestor.java +++ b/platform/core-api/src/com/intellij/openapi/vfs/SavingRequestor.java @@ -1,8 +1,7 @@ -// Copyright 2000-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// 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.vfs; /** * Marker interface for the requestor to label VFS events as coming from a save operation. */ -public interface SavingRequestor { -} +public interface SavingRequestor { } diff --git a/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileEvent.java b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileEvent.java index 51380ee46d1d..27cb89bfe807 100644 --- a/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileEvent.java +++ b/platform/core-api/src/com/intellij/openapi/vfs/VirtualFileEvent.java @@ -17,7 +17,6 @@ public class VirtualFileEvent extends EventObject { private final Object myRequestor; private final VirtualFile myFile; private final VirtualFile myParent; - private final long myOldModificationStamp; private final long myNewModificationStamp; @@ -49,7 +48,7 @@ public class VirtualFileEvent extends EventObject { } /** - * Returns the parent of the virtual file, or {@code null} if the file is a root directory + * Returns the parent of the virtual file, or {@code null} if the file is a root directory, * or it was not possible to determine the parent (depends on the specific VFS implementation). */ public @Nullable VirtualFile getParent() { diff --git a/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFileCreateEvent.java b/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFileCreateEvent.java index f2d6d2470d70..47ee2800b846 100644 --- a/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFileCreateEvent.java +++ b/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFileCreateEvent.java @@ -11,7 +11,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public final class VFileCreateEvent extends VFileEvent { - private final @NotNull VirtualFile myParent; + private final VirtualFile myParent; private final boolean myDirectory; private final FileAttributes myAttributes; private final String mySymlinkTarget; @@ -72,7 +72,7 @@ public final class VFileCreateEvent extends VFileEvent { return mySymlinkTarget; } - /** @return true if the newly created file is a directory which has no children. */ + /** @return {@code true} if the newly created file is a directory that has no children. */ public boolean isEmptyDirectory() { return isDirectory() && myChildren != null && myChildren.length == 0; } diff --git a/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFileEvent.java b/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFileEvent.java index d1b8655cb2d5..f51bfcfb69fe 100644 --- a/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFileEvent.java +++ b/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFileEvent.java @@ -52,11 +52,11 @@ public abstract class VFileEvent { protected abstract @NotNull String computePath(); /** - * Returns the VirtualFile which this event belongs to. - * In some cases it may be null - it is not guaranteed that there is such file. + * Returns the {@link VirtualFile} which this event belongs to. + * In some cases, it may be {@code null} - it is not guaranteed that the file exists. *
* NB: Use this method with caution, because {@link VFileCreateEvent#getFile()} needs - * {@link VirtualFile#findChild(String)} which may be a performance leak. + * {@link VirtualFile#findChild(String)} which may be a performance hit. */ public abstract @Nullable VirtualFile getFile(); diff --git a/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFilePropertyChangeEvent.java b/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFilePropertyChangeEvent.java index 2f3902810825..2d72179cbf8e 100644 --- a/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFilePropertyChangeEvent.java +++ b/platform/core-api/src/com/intellij/openapi/vfs/newvfs/events/VFilePropertyChangeEvent.java @@ -53,9 +53,9 @@ public final class VFilePropertyChangeEvent extends VFileEvent { switch (propertyName) { case VirtualFile.PROP_NAME: if (oldValue == null) throw new IllegalArgumentException("oldName must not be null"); - if (!(oldValue instanceof String)) throw new IllegalArgumentException("oldName must be String, got "+oldValue); + if (!(oldValue instanceof String)) throw new IllegalArgumentException("oldName must be String, got " + oldValue); if (newValue == null) throw new IllegalArgumentException("newName must not be null"); - if (!(newValue instanceof String)) throw new IllegalArgumentException("newName must be String, got "+newValue); + if (!(newValue instanceof String)) throw new IllegalArgumentException("newName must be String, got " + newValue); break; case VirtualFile.PROP_ENCODING: if (oldValue == null) throw new IllegalArgumentException("oldCharset must not be null"); @@ -175,7 +175,7 @@ public final class VFilePropertyChangeEvent extends VFileEvent { return getPathWithFileName(myNewValue); } - /** Replaces file name in {@code myFile} path with {@code fileName}, if an event is a rename event; leaves path as is otherwise */ + /** Replaces file name in {@code myFile} path with {@code fileName}, if an event is a rename event; leaves the path as is otherwise */ private @NotNull String getPathWithFileName(Object fileName) { if (VirtualFile.PROP_NAME.equals(myPropertyName)) { // fileName must be String, according to `checkPropertyValuesCorrect` implementation diff --git a/platform/core-api/src/com/intellij/util/FileContentUtilCore.java b/platform/core-api/src/com/intellij/util/FileContentUtilCore.java index 2396a22ffcd3..e1ebfae5bfd5 100644 --- a/platform/core-api/src/com/intellij/util/FileContentUtilCore.java +++ b/platform/core-api/src/com/intellij/util/FileContentUtilCore.java @@ -18,7 +18,7 @@ public final class FileContentUtilCore { public static final String FORCE_RELOAD_REQUESTOR = "FileContentUtilCore.saveOrReload"; /** - * Forces a reparse of the specified array of files. + * Forces reparsing the specified files. * * @param files the files to reparse. */ @@ -27,7 +27,7 @@ public final class FileContentUtilCore { } /** - * Forces a reparse of the specified collection of files. + * Forces reparsing the specified files. * * @param files the files to reparse. */ diff --git a/platform/ide-core-impl/src/com/intellij/openapi/vfs/newvfs/VfsImplUtil.java b/platform/ide-core-impl/src/com/intellij/openapi/vfs/newvfs/VfsImplUtil.java index 0284151c2d1b..6d8b615c5240 100644 --- a/platform/ide-core-impl/src/com/intellij/openapi/vfs/newvfs/VfsImplUtil.java +++ b/platform/ide-core-impl/src/com/intellij/openapi/vfs/newvfs/VfsImplUtil.java @@ -184,7 +184,7 @@ public final class VfsImplUtil { public record PathFromRoot(@NotNull NewVirtualFile root, @NotNull String pathFromRoot) {} /** - * @return (file system root, relative path inside that root) or null if the path is invalid or the root is not found + * Returns a (file system root, relative path inside that root) pair, or {@code null} when the path is invalid or the root is not found. * For example, {@code extractRootFromPath(LocalFileSystem.getInstance, "C:/temp")} -> ("C:", "/temp") * {@code extractRootFromPath(JarFileSystem.getInstance, "/temp/temp.jar!/com/foo/bar")} -> ("/temp/temp.jar!/", "/com/foo/bar") */ diff --git a/platform/ide-core/src/com/intellij/ide/GeneralSettings.kt b/platform/ide-core/src/com/intellij/ide/GeneralSettings.kt index 408387c00212..3555ff7868e1 100644 --- a/platform/ide-core/src/com/intellij/ide/GeneralSettings.kt +++ b/platform/ide-core/src/com/intellij/ide/GeneralSettings.kt @@ -19,7 +19,6 @@ import org.jetbrains.annotations.SystemDependent private const val SHOW_TIPS_ON_STARTUP_DEFAULT_VALUE_PROPERTY = "ide.show.tips.on.startup.default.value" private const val CONFIGURED_PROPERTY = "GeneralSettings.initiallyConfigured" -@Suppress("unused", "EnumEntryName") @State(name = "GeneralSettings", storages = [Storage(GeneralSettings.IDE_GENERAL_XML)], category = SettingsCategory.SYSTEM) class GeneralSettings : PersistentStateComponent
- * A new instance of the specified class will be created each time then the Settings dialog is opened
+ * To provide additional options in General section register implementation of [SearchableConfigurable] in the 'plugin.xml':
+ * ```
+ *