From dcab9e0d8b1f4ca3725d1519b3240b41b6a2e6ca Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Sat, 22 Feb 2020 17:16:19 +0100 Subject: [PATCH] cleanup GitOrigin-RevId: ccf49e7210f6b786763117a6f5a22a643bd38ca5 --- .../compiler/server/BuildManager.java | 11 ++++--- .../impl/DefaultJavaProgramRunner.java | 4 +-- .../FeatureUsageSettingsEventScheduler.kt | 4 +-- .../progress/impl/CoreProgressManager.java | 3 +- .../CompletionProgressIndicator.java | 4 +-- .../src/com/intellij/util/ui/Timer.java | 22 +++---------- .../com/intellij/ide/SystemHealthMonitor.java | 6 ++-- .../internal/DebugAttachDetector.java | 4 +-- .../application/impl/ApplicationImpl.java | 7 ++--- .../vfs/impl/local/LocalFileSystemImpl.java | 6 ++-- .../vfs/newvfs/persistent/FlushingDaemon.java | 24 +++----------- .../intellij/diagnostic/StartUpMeasurer.java | 4 +-- .../ui/ChangesViewToolWindowFactory.kt | 24 ++++++++------ .../vcs/changes/ui/VcsToolWindowFactory.kt | 31 ++++++++++--------- .../config/execution/ExecutionHandler.java | 20 ++---------- 15 files changed, 68 insertions(+), 106 deletions(-) diff --git a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java index 5ceae06b5333..dd483a2fbfe5 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java +++ b/java/compiler/impl/src/com/intellij/compiler/server/BuildManager.java @@ -1,4 +1,4 @@ -// 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. +// 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. package com.intellij.compiler.server; import com.intellij.ProjectTopics; @@ -10,7 +10,6 @@ import com.intellij.compiler.impl.javaCompiler.BackendCompiler; import com.intellij.compiler.impl.javaCompiler.eclipse.EclipseCompilerConfiguration; import com.intellij.compiler.impl.javaCompiler.javac.JavacConfiguration; import com.intellij.compiler.server.impl.BuildProcessClasspathManager; -import com.intellij.concurrency.JobScheduler; import com.intellij.execution.ExecutionException; import com.intellij.execution.ExecutionListener; import com.intellij.execution.ExecutionManager; @@ -23,7 +22,10 @@ import com.intellij.ide.file.BatchFileChangeListener; import com.intellij.openapi.Disposable; import com.intellij.openapi.actionSystem.CommonDataKeys; import com.intellij.openapi.application.*; -import com.intellij.openapi.compiler.*; +import com.intellij.openapi.compiler.CompilationStatusListener; +import com.intellij.openapi.compiler.CompileContext; +import com.intellij.openapi.compiler.CompilerPaths; +import com.intellij.openapi.compiler.CompilerTopics; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; @@ -52,6 +54,7 @@ import com.intellij.openapi.vfs.newvfs.events.VFileEvent; import com.intellij.openapi.vfs.newvfs.impl.FileNameCache; import com.intellij.openapi.wm.IdeFrame; import com.intellij.util.*; +import com.intellij.util.concurrency.AppExecutorUtil; import com.intellij.util.concurrency.SequentialTaskExecutor; import com.intellij.util.containers.IntArrayList; import com.intellij.util.io.BaseOutputReader; @@ -315,7 +318,7 @@ public final class BuildManager implements Disposable { ShutDownTracker.getInstance().registerShutdownTask(this::stopListening); if (!IS_UNIT_TEST_MODE) { - ScheduledFuture future = JobScheduler.getScheduler().scheduleWithFixedDelay(() -> runCommand(myGCTask), 3, 180, TimeUnit.MINUTES); + ScheduledFuture future = AppExecutorUtil.getAppScheduledExecutorService().scheduleWithFixedDelay(() -> runCommand(myGCTask), 3, 180, TimeUnit.MINUTES); Disposer.register(this, () -> future.cancel(false)); } } diff --git a/java/execution/impl/src/com/intellij/execution/impl/DefaultJavaProgramRunner.java b/java/execution/impl/src/com/intellij/execution/impl/DefaultJavaProgramRunner.java index 85ee1917a693..899ddf7667b2 100644 --- a/java/execution/impl/src/com/intellij/execution/impl/DefaultJavaProgramRunner.java +++ b/java/execution/impl/src/com/intellij/execution/impl/DefaultJavaProgramRunner.java @@ -1,7 +1,6 @@ // 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. package com.intellij.execution.impl; -import com.intellij.concurrency.JobScheduler; import com.intellij.debugger.engine.JavaDebugProcess; import com.intellij.debugger.impl.DebuggerUtilsEx; import com.intellij.debugger.impl.attach.JavaDebuggerAttachUtil; @@ -38,6 +37,7 @@ import com.intellij.unscramble.ThreadDumpParser; import com.intellij.unscramble.ThreadState; import com.intellij.util.ArrayUtilRt; import com.intellij.util.TimeoutUtil; +import com.intellij.util.concurrency.AppExecutorUtil; import com.intellij.util.messages.MessageBusConnection; import com.intellij.util.text.DateFormatUtil; import com.intellij.xdebugger.XDebugProcess; @@ -298,7 +298,7 @@ public class DefaultJavaProgramRunner implements JvmPatchableProgramRunner myEnabled.set(!myProcessHandler.isProcessTerminating() && !myProcessHandler.isProcessTerminated() && JavaDebuggerAttachUtil.canAttach(myProcessHandler)), 1, TimeUnit.SECONDS); diff --git a/platform/configuration-store-impl/src/statistic/eventLog/FeatureUsageSettingsEventScheduler.kt b/platform/configuration-store-impl/src/statistic/eventLog/FeatureUsageSettingsEventScheduler.kt index d3a0ad693660..59dafc655e15 100644 --- a/platform/configuration-store-impl/src/statistic/eventLog/FeatureUsageSettingsEventScheduler.kt +++ b/platform/configuration-store-impl/src/statistic/eventLog/FeatureUsageSettingsEventScheduler.kt @@ -1,7 +1,6 @@ // 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. package com.intellij.configurationStore.statistic.eventLog -import com.intellij.concurrency.JobScheduler import com.intellij.configurationStore.ComponentInfo import com.intellij.configurationStore.ComponentStoreImpl import com.intellij.internal.statistic.eventLog.fus.FeatureUsageLogger @@ -13,6 +12,7 @@ import com.intellij.openapi.components.stateStore import com.intellij.openapi.diagnostic.logger import com.intellij.openapi.project.Project import com.intellij.openapi.project.ex.ProjectManagerEx +import com.intellij.util.concurrency.AppExecutorUtil import java.util.* import java.util.concurrent.CompletableFuture import java.util.concurrent.Executor @@ -31,7 +31,7 @@ internal class FeatureUsageSettingsEventScheduler : FeatureUsageStateEventTracke return } - JobScheduler.getScheduler().scheduleWithFixedDelay({ logConfigStateEvents() }, INITIAL_DELAY.toLong(), PERIOD_DELAY.toLong(), TimeUnit.MINUTES) + AppExecutorUtil.getAppScheduledExecutorService().scheduleWithFixedDelay({ logConfigStateEvents() }, INITIAL_DELAY.toLong(), PERIOD_DELAY.toLong(), TimeUnit.MINUTES) } } diff --git a/platform/core-impl/src/com/intellij/openapi/progress/impl/CoreProgressManager.java b/platform/core-impl/src/com/intellij/openapi/progress/impl/CoreProgressManager.java index c0567cff6e76..33351fdb6637 100644 --- a/platform/core-impl/src/com/intellij/openapi/progress/impl/CoreProgressManager.java +++ b/platform/core-impl/src/com/intellij/openapi/progress/impl/CoreProgressManager.java @@ -2,7 +2,6 @@ package com.intellij.openapi.progress.impl; import com.google.common.collect.ConcurrentHashMultiset; -import com.intellij.concurrency.JobScheduler; import com.intellij.diagnostic.ThreadDumper; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationManager; @@ -74,7 +73,7 @@ public class CoreProgressManager extends ProgressManager implements Disposable { // must be under threadsUnderIndicator lock private void startBackgroundNonStandardIndicatorsPing() { if (myCheckCancelledFuture == null) { - myCheckCancelledFuture = JobScheduler.getScheduler().scheduleWithFixedDelay(() -> { + myCheckCancelledFuture = AppExecutorUtil.getAppScheduledExecutorService().scheduleWithFixedDelay(() -> { for (ProgressIndicator indicator : nonStandardIndicators) { try { indicator.checkCanceled(); diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java index 8a4f89e66956..e00768fc45f3 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java @@ -12,7 +12,6 @@ import com.intellij.codeInsight.hint.EditorHintListener; import com.intellij.codeInsight.hint.HintManager; import com.intellij.codeInsight.lookup.*; import com.intellij.codeInsight.lookup.impl.LookupImpl; -import com.intellij.concurrency.JobScheduler; import com.intellij.featureStatistics.FeatureUsageTracker; import com.intellij.icons.AllIcons; import com.intellij.injected.editor.DocumentWindow; @@ -52,6 +51,7 @@ import com.intellij.ui.GuiUtils; import com.intellij.ui.LightweightHint; import com.intellij.util.Alarm; import com.intellij.util.ObjectUtils; +import com.intellij.util.concurrency.AppExecutorUtil; import com.intellij.util.concurrency.Semaphore; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.messages.MessageBusConnection; @@ -452,7 +452,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement myCount++; // invoked from a single thread if (myCount == 1) { - JobScheduler.getScheduler().schedule(myFreezeSemaphore::up, ourInsertSingleItemTimeSpan, TimeUnit.MILLISECONDS); + AppExecutorUtil.getAppScheduledExecutorService().schedule(myFreezeSemaphore::up, ourInsertSingleItemTimeSpan, TimeUnit.MILLISECONDS); } myQueue.queue(myUpdate); } diff --git a/platform/platform-api/src/com/intellij/util/ui/Timer.java b/platform/platform-api/src/com/intellij/util/ui/Timer.java index c5115f3a6083..3f98c89fefcd 100644 --- a/platform/platform-api/src/com/intellij/util/ui/Timer.java +++ b/platform/platform-api/src/com/intellij/util/ui/Timer.java @@ -1,30 +1,16 @@ -/* - * 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-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. package com.intellij.util.ui; -import com.intellij.concurrency.JobScheduler; import com.intellij.openapi.Disposable; +import com.intellij.util.concurrency.AppExecutorUtil; import org.jetbrains.annotations.NonNls; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; /** - * @deprecated use {@link JobScheduler#getScheduler()} instead + * @deprecated use {@link AppExecutorUtil#getAppScheduledExecutorService()} instead */ @Deprecated public abstract class Timer implements Disposable, Runnable { @@ -176,6 +162,6 @@ public abstract class Timer implements Disposable, Runnable { future.cancel(true); } - timer.setFuture(JobScheduler.getScheduler().schedule(timer, span, TimeUnit.MILLISECONDS)); + timer.setFuture(AppExecutorUtil.getAppScheduledExecutorService().schedule(timer, span, TimeUnit.MILLISECONDS)); } } diff --git a/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java b/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java index 3d3b6f90f2e8..61ade5ffa449 100644 --- a/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java +++ b/platform/platform-impl/src/com/intellij/ide/SystemHealthMonitor.java @@ -1,7 +1,6 @@ // 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. package com.intellij.ide; -import com.intellij.concurrency.JobScheduler; import com.intellij.diagnostic.VMOptions; import com.intellij.execution.process.UnixProcessManager; import com.intellij.ide.actions.EditCustomVmOptionsAction; @@ -20,6 +19,7 @@ import com.intellij.openapi.util.SystemInfo; import com.intellij.util.JdkBundle; import com.intellij.util.SystemProperties; import com.intellij.util.TimeoutUtil; +import com.intellij.util.concurrency.AppExecutorUtil; import com.intellij.util.lang.JavaVersion; import com.sun.jna.*; import org.jetbrains.annotations.NotNull; @@ -170,7 +170,7 @@ final class SystemHealthMonitor extends PreloadingActivity { final AtomicBoolean reported = new AtomicBoolean(); final ThreadLocal> ourFreeSpaceCalculation = new ThreadLocal<>(); - JobScheduler.getScheduler().schedule(new Runnable() { + AppExecutorUtil.getAppScheduledExecutorService().schedule(new Runnable() { private static final long LOW_DISK_SPACE_THRESHOLD = 50 * 1024 * 1024; private static final long MAX_WRITE_SPEED_IN_BPS = 500 * 1024 * 1024; // 500 MB/sec is near max SSD sequential write speed @@ -239,7 +239,7 @@ final class SystemHealthMonitor extends PreloadingActivity { } private void restart(long timeout) { - JobScheduler.getScheduler().schedule(this, timeout, TimeUnit.SECONDS); + AppExecutorUtil.getAppScheduledExecutorService().schedule(this, timeout, TimeUnit.SECONDS); } }, 1, TimeUnit.SECONDS); } diff --git a/platform/platform-impl/src/com/intellij/internal/DebugAttachDetector.java b/platform/platform-impl/src/com/intellij/internal/DebugAttachDetector.java index c3ef6a0c7cb6..284b1b5dd109 100644 --- a/platform/platform-impl/src/com/intellij/internal/DebugAttachDetector.java +++ b/platform/platform-impl/src/com/intellij/internal/DebugAttachDetector.java @@ -1,7 +1,6 @@ // 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. package com.intellij.internal; -import com.intellij.concurrency.JobScheduler; import com.intellij.ide.ApplicationInitializedListener; import com.intellij.ide.plugins.PluginManagerCore; import com.intellij.notification.Notification; @@ -11,6 +10,7 @@ import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.extensions.ExtensionNotApplicableException; +import com.intellij.util.concurrency.AppExecutorUtil; import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -73,7 +73,7 @@ public final class DebugAttachDetector implements ApplicationInitializedListener return; } - myTask = JobScheduler.getScheduler().scheduleWithFixedDelay(() -> { + myTask = AppExecutorUtil.getAppScheduledExecutorService().scheduleWithFixedDelay(() -> { boolean attached = isAttached(myAgentProperties); if (!myReady) { myAttached = attached; diff --git a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java index 720ca762361f..954589ae7d76 100644 --- a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java @@ -3,7 +3,6 @@ package com.intellij.openapi.application.impl; import com.intellij.BundleBase; import com.intellij.CommonBundle; -import com.intellij.concurrency.JobScheduler; import com.intellij.configurationStore.StoreUtil; import com.intellij.diagnostic.*; import com.intellij.execution.process.ProcessIOExecutorService; @@ -730,11 +729,11 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App dialogRemover.run(); } else { - JobScheduler.getScheduler().schedule(this, 1, TimeUnit.SECONDS); + AppExecutorUtil.getAppScheduledExecutorService().schedule(this, 1, TimeUnit.SECONDS); } } }; - JobScheduler.getScheduler().schedule(task, 1, TimeUnit.SECONDS); + AppExecutorUtil.getAppScheduledExecutorService().schedule(task, 1, TimeUnit.SECONDS); } String name = ApplicationNamesInfo.getInstance().getFullProductName(); String message = ApplicationBundle.message(hasUnsafeBgTasks ? "exit.confirm.prompt.tasks" : "exit.confirm.prompt", name); @@ -1165,7 +1164,7 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App if (!myLock.isWriteLocked()) { Future reportSlowWrite = ourDumpThreadsOnLongWriteActionWaiting <= 0 ? null : - JobScheduler.getScheduler() + AppExecutorUtil.getAppScheduledExecutorService() .scheduleWithFixedDelay(() -> PerformanceWatcher.getInstance().dumpThreads("waiting", true), ourDumpThreadsOnLongWriteActionWaiting, ourDumpThreadsOnLongWriteActionWaiting, TimeUnit.MILLISECONDS); diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java index 9df3d5524e94..ec3209937f82 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/impl/local/LocalFileSystemImpl.java @@ -1,7 +1,6 @@ -// 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. +// 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. package com.intellij.openapi.vfs.impl.local; -import com.intellij.concurrency.JobScheduler; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.fileEditor.FileDocumentManager; @@ -20,6 +19,7 @@ import com.intellij.openapi.vfs.newvfs.VfsImplUtil; import com.intellij.openapi.vfs.newvfs.persistent.PersistentFS; import com.intellij.util.Consumer; import com.intellij.util.ObjectUtils; +import com.intellij.util.concurrency.AppExecutorUtil; import com.intellij.util.containers.ContainerUtil; import gnu.trove.THashMap; import gnu.trove.THashSet; @@ -75,7 +75,7 @@ public final class LocalFileSystemImpl extends LocalFileSystemBase implements Di myManagingFS = ManagingFS.getInstance(); myWatcher = new FileWatcher(myManagingFS); if (myWatcher.isOperational()) { - JobScheduler.getScheduler().scheduleWithFixedDelay( + AppExecutorUtil.getAppScheduledExecutorService().scheduleWithFixedDelay( () -> { if (!ApplicationManager.getApplication().isDisposed()) storeRefreshStatusToFiles(); }, STATUS_UPDATE_PERIOD, STATUS_UPDATE_PERIOD, TimeUnit.MILLISECONDS); } diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FlushingDaemon.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FlushingDaemon.java index 6ed83450fb43..9773861d8b64 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FlushingDaemon.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/persistent/FlushingDaemon.java @@ -1,39 +1,25 @@ -/* - * 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-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. /* * @author max */ package com.intellij.openapi.vfs.newvfs.persistent; -import com.intellij.concurrency.JobScheduler; import com.intellij.util.ConcurrencyUtil; +import com.intellij.util.concurrency.AppExecutorUtil; import org.jetbrains.annotations.NotNull; import java.util.concurrent.ScheduledFuture; import java.util.concurrent.TimeUnit; -public class FlushingDaemon { +public final class FlushingDaemon { public static final String NAME = "Flushing Daemon"; private FlushingDaemon() {} - @NotNull public static ScheduledFuture everyFiveSeconds(@NotNull Runnable r) { - return JobScheduler.getScheduler().scheduleWithFixedDelay(ConcurrencyUtil.underThreadNameRunnable(NAME, r), 5, 5, TimeUnit.SECONDS); + return AppExecutorUtil + .getAppScheduledExecutorService().scheduleWithFixedDelay(ConcurrencyUtil.underThreadNameRunnable(NAME, r), 5, 5, TimeUnit.SECONDS); } } diff --git a/platform/util/src/com/intellij/diagnostic/StartUpMeasurer.java b/platform/util/src/com/intellij/diagnostic/StartUpMeasurer.java index 4bf68161a1e1..47af590a09b8 100644 --- a/platform/util/src/com/intellij/diagnostic/StartUpMeasurer.java +++ b/platform/util/src/com/intellij/diagnostic/StartUpMeasurer.java @@ -1,4 +1,4 @@ -// 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. +// 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. package com.intellij.diagnostic; import com.intellij.util.containers.ObjectLongHashMap; @@ -23,8 +23,6 @@ public final class StartUpMeasurer { // It is not serves only display purposes - it is IDs. Visualizer and another tools to analyze data uses phase IDs, // so, any changes must be discussed across all involved and reflected in changelog (see `format-changelog.md`). public static final class Activities { - public static final String APP_STARTER = "appStarter"; - // this phase name is not fully clear - it is time from `ApplicationLoader.initApplication` to `ApplicationLoader.run` public static final String INIT_APP = "app initialization"; diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesViewToolWindowFactory.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesViewToolWindowFactory.kt index 86d9a2baeaca..5b0f6b22cbb2 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesViewToolWindowFactory.kt +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/ChangesViewToolWindowFactory.kt @@ -12,15 +12,17 @@ import com.intellij.openapi.wm.ToolWindowId import com.intellij.openapi.wm.ToolWindowManager import com.intellij.openapi.wm.impl.content.ToolWindowContentUi.HIDE_ID_LABEL -class ChangesViewToolWindowFactory : VcsToolWindowFactory() { +private class ChangesViewToolWindowFactory : VcsToolWindowFactory() { override fun updateState(project: Project, toolWindow: ToolWindow) { super.updateState(project, toolWindow) toolWindow.stripeTitle = project.vcsManager.allActiveVcss.singleOrNull()?.displayName ?: ToolWindowId.VCS } } -class CommitToolWindowFactory : VcsToolWindowFactory() { - override fun shouldBeAvailable(project: Project): Boolean = super.shouldBeAvailable(project) && project.isCommitToolWindow +private class CommitToolWindowFactory : VcsToolWindowFactory() { + override fun shouldBeAvailable(project: Project): Boolean { + return super.shouldBeAvailable(project) && project.isCommitToolWindow + } override fun createToolWindowContent(project: Project, toolWindow: ToolWindow) { toolWindow.component.putClientProperty(HIDE_ID_LABEL, "true") @@ -28,16 +30,18 @@ class CommitToolWindowFactory : VcsToolWindowFactory() { } } -internal class ActivateVersionControlToolWindowAction : ActivateToolWindowAction(ToolWindowId.VCS) { +private class ActivateVersionControlToolWindowAction : ActivateToolWindowAction(ToolWindowId.VCS) { init { templatePresentation.text = toolWindowId } - override fun useMnemonicFromShortcuts(project: Project): Boolean = - ToolWindowManager.getInstance(project).getToolWindow(COMMIT_TOOLWINDOW_ID)?.isAvailable != true || - isShortcutCustomized(toolWindowId) || - isShortcutCustomized(COMMIT_TOOLWINDOW_ID) + override fun useMnemonicFromShortcuts(project: Project): Boolean { + return ToolWindowManager.getInstance(project).getToolWindow(COMMIT_TOOLWINDOW_ID)?.isAvailable != true || + isShortcutCustomized(toolWindowId) || + isShortcutCustomized(COMMIT_TOOLWINDOW_ID) + } } -private fun isShortcutCustomized(toolWindowId: String): Boolean = - isShortcutCustomized(getActionIdForToolWindow(toolWindowId), KeymapManager.getInstance().activeKeymap) \ No newline at end of file +private fun isShortcutCustomized(toolWindowId: String): Boolean { + return isShortcutCustomized(getActionIdForToolWindow(toolWindowId), KeymapManager.getInstance().activeKeymap) +} \ No newline at end of file diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/VcsToolWindowFactory.kt b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/VcsToolWindowFactory.kt index 67af53f96bc3..708bd9afa2f1 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/VcsToolWindowFactory.kt +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ui/VcsToolWindowFactory.kt @@ -30,17 +30,16 @@ abstract class VcsToolWindowFactory : ToolWindowFactory, DumbAware { val project = (window as ToolWindowEx).project updateState(project, window) - with(project.messageBus.connect()) { - subscribe(VCS_CONFIGURATION_CHANGED, VcsListener { - runInEdt { - if (project.isDisposed) return@runInEdt - updateState(project, window) - } - }) - subscribe(ChangesViewContentManagerListener.TOPIC, object : ChangesViewContentManagerListener { - override fun toolWindowMappingChanged() = updateState(project, window) - }) - } + val connection = project.messageBus.connect() + connection.subscribe(VCS_CONFIGURATION_CHANGED, VcsListener { + runInEdt { + if (project.isDisposed) return@runInEdt + updateState(project, window) + } + }) + connection.subscribe(ChangesViewContentManagerListener.TOPIC, object : ChangesViewContentManagerListener { + override fun toolWindowMappingChanged() = updateState(project, window) + }) } override fun shouldBeAvailable(project: Project): Boolean = project.vcsManager.hasAnyMappings() @@ -67,7 +66,7 @@ abstract class VcsToolWindowFactory : ToolWindowFactory, DumbAware { toolWindow.isShowStripeButton = true } - toolWindow.setAvailable(available) + toolWindow.isAvailable = available } private fun updateContent(project: Project, toolWindow: ToolWindow) { @@ -86,8 +85,9 @@ abstract class VcsToolWindowFactory : ToolWindowFactory, DumbAware { } } - private fun getExtensions(project: Project, toolWindow: ToolWindow): Collection = - ChangesViewContentEP.EP_NAME.getExtensions(project).filter { getToolWindowIdFor(project, it.tabName) == toolWindow.id } + private fun getExtensions(project: Project, toolWindow: ToolWindow): Collection { + return ChangesViewContentEP.EP_NAME.getExtensions(project).filter { getToolWindowIdFor(project, it.tabName) == toolWindow.id } + } private fun createExtensionContent(project: Project, extension: ChangesViewContentEP): Content { val displayName: String = extension.newDisplayNameSupplierInstance(project)?.get() ?: extension.tabName @@ -103,6 +103,7 @@ abstract class VcsToolWindowFactory : ToolWindowFactory, DumbAware { } companion object { - internal val Project.vcsManager: ProjectLevelVcsManager get() = ProjectLevelVcsManager.getInstance(this) + internal val Project.vcsManager: ProjectLevelVcsManager + get() = ProjectLevelVcsManager.getInstance(this) } } \ No newline at end of file diff --git a/plugins/ant/src/com/intellij/lang/ant/config/execution/ExecutionHandler.java b/plugins/ant/src/com/intellij/lang/ant/config/execution/ExecutionHandler.java index ad53b7469a81..25998e302274 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/execution/ExecutionHandler.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/execution/ExecutionHandler.java @@ -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-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. package com.intellij.lang.ant.config.execution; -import com.intellij.concurrency.JobScheduler; import com.intellij.execution.CantRunException; import com.intellij.execution.ExecutionException; import com.intellij.execution.configurations.GeneralCommandLine; @@ -45,6 +30,7 @@ import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.vfs.encoding.EncodingProjectManager; import com.intellij.openapi.wm.StatusBar; import com.intellij.openapi.wm.WindowManager; +import com.intellij.util.concurrency.AppExecutorUtil; import com.intellij.util.concurrency.FutureResult; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -309,7 +295,7 @@ public final class ExecutionHandler { } public void start(final long delay) { - JobScheduler.getScheduler().schedule(this, delay, TimeUnit.MILLISECONDS); + AppExecutorUtil.getAppScheduledExecutorService().schedule(this, delay, TimeUnit.MILLISECONDS); } }