--- /dev/null
+<root>
+ <item
+ name='java.util.concurrent.CompletableFuture java.util.concurrent.CompletableFuture<java.lang.Void> runAsync(java.lang.Runnable, java.util.concurrent.Executor)'>
+ <annotation name='org.jetbrains.annotations.NotNull'/>
+ </item>
+</root>
\ No newline at end of file
import com.intellij.lang.Language;
import com.intellij.lang.injection.InjectedLanguageManager;
import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.extensions.Extensions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.InvalidDataException;
import com.intellij.openapi.util.WriteExternalException;
}
return elementLanguageSuppressor != null
? Collections.singleton(elementLanguageSuppressor)
- : Collections.<InspectionSuppressor>emptySet();
+ : Collections.emptySet();
}
public void cleanup(@NotNull Project project) {
return;
}
- for (final ToolsImpl toolList : myTools.values()) {
+ for (ToolsImpl toolList : myTools.values()) {
if (toolList.isEnabled()) {
- for (InspectionToolWrapper toolWrapper : toolList.getAllTools()) {
- toolWrapper.cleanup(project);
- }
+ toolList.cleanupTools(project);
}
}
}
return myShortName;
}
- @NotNull
- public List<InspectionToolWrapper> getAllTools() {
- List<InspectionToolWrapper> result = new ArrayList<>();
+ public void cleanupTools(@NotNull Project project) {
for (ScopeToolState state : getTools()) {
- result.add(state.getTool());
+ state.getTool().cleanup(project);
}
- return result;
}
public void writeExternal(@NotNull Element inspectionElement) throws WriteExternalException {
internal fun cleanupSchemes(project: Project) {
for (profile in schemeManager.allSchemes) {
- if ((profile as InspectionProfileImpl).wasInitialized()) {
- profile.cleanup(project)
- }
+ profile.cleanup(project)
}
}
import com.intellij.codeInspection.InspectionProfile
import com.intellij.codeInspection.ex.InspectionProfileImpl
import com.intellij.codeInspection.ex.InspectionToolRegistrar
+import com.intellij.concurrency.runAsync
import com.intellij.configurationStore.SchemeDataHolder
import com.intellij.openapi.Disposable
import com.intellij.openapi.application.ApplicationManager
initialLoadSchemesFuture = CompletableFuture.completedFuture(null)
}
else {
- initialLoadSchemesFuture = CompletableFuture.runAsync({ schemeManager.loadSchemes() }, { app.executeOnPooledThread(it) })
+ initialLoadSchemesFuture = runAsync { schemeManager.loadSchemes() }
}
project.messageBus.connect().subscribe(ProjectManager.TOPIC, object: ProjectManagerListener {
--- /dev/null
+/*
+ * 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.
+ */
+package com.intellij.concurrency
+
+import com.intellij.util.concurrency.AppExecutorUtil
+import java.util.concurrent.CompletableFuture
+
+inline fun runAsync(crossinline runnable: () -> Unit): CompletableFuture<Void> = CompletableFuture.runAsync(Runnable { runnable() }, AppExecutorUtil.getAppExecutorService())
\ No newline at end of file
else {
app.invokeAndWait(runnable, ModalityState.defaultModalityState())
}
-}
+}
\ No newline at end of file