spelling: invokeAndWaitIfNeed -> invokeAndWaitIfNeeded

This commit is contained in:
Vladimir Krivosheev
2019-01-17 18:20:52 +01:00
parent ba1b854ce0
commit 0d8f9f308a
10 changed files with 39 additions and 48 deletions
@@ -1,10 +1,10 @@
// 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-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.
package com.intellij.jarRepository
import com.intellij.codeInsight.ExternalAnnotationsArtifactsResolver
import com.intellij.codeInsight.externalAnnotation.location.AnnotationsLocation
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.application.invokeAndWaitIfNeed
import com.intellij.openapi.application.invokeAndWaitIfNeeded
import com.intellij.openapi.application.runWriteAction
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.project.Project
@@ -50,7 +50,7 @@ class ExternalAnnotationsRepositoryResolver : ExternalAnnotationsArtifactsResolv
as MutableList<OrderRoot>?
}
invokeAndWaitIfNeed {
invokeAndWaitIfNeeded {
updateLibrary(roots, mavenLibDescriptor, library)
}
@@ -73,7 +73,7 @@ class ExternalAnnotationsRepositoryResolver : ExternalAnnotationsArtifactsResolv
.loadDependenciesSync(project, descriptor, setOf(ArtifactKind.ANNOTATIONS), repos, null)
?: return library
invokeAndWaitIfNeed { updateLibrary(roots, descriptor, library) }
invokeAndWaitIfNeeded { updateLibrary(roots, descriptor, library) }
return library
}
@@ -1,11 +1,11 @@
// 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-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.
@file:JvmName("CredentialPromptDialog")
package com.intellij.credentialStore
import com.intellij.CommonBundle
import com.intellij.ide.passwordSafe.PasswordSafe
import com.intellij.openapi.application.ModalityState
import com.intellij.openapi.application.invokeAndWaitIfNeed
import com.intellij.openapi.application.invokeAndWaitIfNeeded
import com.intellij.openapi.project.Project
import com.intellij.ui.AppIcon
import com.intellij.ui.components.CheckBox
@@ -57,7 +57,7 @@ fun askCredentials(project: Project?,
}
}
return invokeAndWaitIfNeed(ModalityState.any()) {
return invokeAndWaitIfNeeded(ModalityState.any()) {
val passwordField = JPasswordField()
val rememberCheckBox = RememberCheckBoxState.createCheckBox(toolTip = "The password will be stored between application sessions.")
@@ -69,7 +69,7 @@ fun askCredentials(project: Project?,
AppIcon.getInstance().requestAttention(project, true)
if (!dialog(dialogTitle, project = project, panel = panel, focusedComponent = passwordField, errorText = error).showAndGet()) {
return@invokeAndWaitIfNeed null
return@invokeAndWaitIfNeeded null
}
RememberCheckBoxState.update(rememberCheckBox)
@@ -81,7 +81,7 @@ fun askCredentials(project: Project?,
}
// for memory only store isRemember is true, because false doesn't matter
return@invokeAndWaitIfNeed CredentialRequestResult(credentials, isRemember = rememberCheckBox.isSelected)
return@invokeAndWaitIfNeeded CredentialRequestResult(credentials, isRemember = rememberCheckBox.isSelected)
}
}
@@ -23,9 +23,9 @@ inline fun <T> runReadAction(crossinline runnable: () -> T): T {
}
/**
* @exclude Internal use only
* @suppress Internal use only
*/
fun <T> invokeAndWaitIfNeed(modalityState: ModalityState? = null, runnable: () -> T): T {
fun <T> invokeAndWaitIfNeeded(modalityState: ModalityState? = null, runnable: () -> T): T {
val app = ApplicationManager.getApplication()
if (app == null) {
if (SwingUtilities.isEventDispatchThread()) {
@@ -49,6 +49,11 @@ fun <T> invokeAndWaitIfNeed(modalityState: ModalityState? = null, runnable: () -
}
}
@Deprecated(replaceWith = ReplaceWith("invokeAndWaitIfNeeded()"), message = "Use invokeAndWaitIfNeeded()")
fun <T> invokeAndWaitIfNeed(modalityState: ModalityState? = null, runnable: () -> T): T {
return invokeAndWaitIfNeeded(modalityState, runnable)
}
@PublishedApi
internal inline fun <T> computeDelegated(executor: (setter: (T) -> Unit) -> Unit): T {
var resultRef: T? = null
@@ -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-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.
package git4idea
import com.intellij.openapi.application.invokeAndWaitIfNeed
import com.intellij.openapi.application.invokeAndWaitIfNeeded
import com.intellij.vcs.log.Hash
import com.intellij.vcs.log.impl.VcsProjectLog
import git4idea.branch.GitBranchUtil
@@ -35,7 +35,7 @@ fun findProtectedRemoteBranchContainingCommit(repository: GitRepository, hash: H
val root = repository.root
val branchesGetter = VcsProjectLog.getInstance(repository.project).dataManager?.containingBranchesGetter
val branches = if (branchesGetter != null) {
invokeAndWaitIfNeed { branchesGetter.getContainingBranchesQuickly(root, hash) } ?:
invokeAndWaitIfNeeded { branchesGetter.getContainingBranchesQuickly(root, hash) } ?:
branchesGetter.getContainingBranchesSynchronously(root, hash)
}
else {
@@ -1,7 +1,7 @@
// 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.
package git4idea.tests
import com.intellij.openapi.application.invokeAndWaitIfNeed
import com.intellij.openapi.application.invokeAndWaitIfNeeded
import com.intellij.openapi.application.runReadAction
import com.intellij.openapi.application.runWriteAction
import com.intellij.openapi.editor.Document
@@ -198,7 +198,7 @@ class GitPartialCommitTest : GitSingleRepoTest() {
private fun assertChanges(changes: ChangesBuilder.() -> Unit): List<Change> {
return changeListManager.assertChanges(changes)
}
private fun assertCommittedContent(fileName: String, expectedContent: String, useFilters: Boolean = false) {
val actualContent = repo.gitAsBytes("cat-file" +
(if (useFilters) " --filters" else " -p") +
@@ -207,7 +207,7 @@ class GitPartialCommitTest : GitSingleRepoTest() {
}
private fun withTrackedDocument(fileName: String, newContent: String, task: (Document, PartialLocalLineStatusTracker) -> Unit) {
invokeAndWaitIfNeed {
invokeAndWaitIfNeeded {
val lstm = LineStatusTrackerManager.getInstance(project) as LineStatusTrackerManager
val file = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(child(fileName))!!
@@ -1,19 +1,5 @@
// 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-2012 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-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.
package org.jetbrains.plugins.github
import com.intellij.CommonBundle
@@ -22,7 +8,7 @@ import com.intellij.ide.BrowserUtil
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.CommonDataKeys
import com.intellij.openapi.actionSystem.DataProvider
import com.intellij.openapi.application.invokeAndWaitIfNeed
import com.intellij.openapi.application.invokeAndWaitIfNeeded
import com.intellij.openapi.components.service
import com.intellij.openapi.progress.ProcessCanceledException
import com.intellij.openapi.progress.ProgressIndicator
@@ -265,7 +251,7 @@ class GithubShareAction : DumbAwareAction("Share Project on GitHub", "Easily sha
allFiles.addAll(trackedFiles)
allFiles.addAll(untrackedFiles)
val dialog = invokeAndWaitIfNeed(indicator.modalityState) {
val dialog = invokeAndWaitIfNeeded(indicator.modalityState) {
GithubUntrackedFilesDialog(project, allFiles).apply {
if (!trackedFiles.isEmpty()) {
selectedFiles = trackedFiles
@@ -1,11 +1,11 @@
// 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-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.
package org.jetbrains.plugins.github.authentication.ui
import com.intellij.icons.AllIcons
import com.intellij.ide.BrowserUtil
import com.intellij.openapi.Disposable
import com.intellij.openapi.application.ModalityState
import com.intellij.openapi.application.invokeAndWaitIfNeed
import com.intellij.openapi.application.invokeAndWaitIfNeeded
import com.intellij.openapi.components.service
import com.intellij.openapi.progress.EmptyProgressIndicator
import com.intellij.openapi.progress.ProgressIndicator
@@ -260,7 +260,7 @@ class GithubLoginDialog @JvmOverloads constructor(private val executorFactory: G
override fun createExecutor(): GithubApiRequestExecutor.WithBasicAuth {
val modalityState = ModalityState.stateForComponent(passwordField)
return executorFactory.create(loginTextField.text, passwordField.password, Supplier {
invokeAndWaitIfNeed(modalityState) {
invokeAndWaitIfNeeded(modalityState) {
Messages.showInputDialog(passwordField,
"Authentication Code",
"Github Two-Factor Authentication",
@@ -1,8 +1,8 @@
// 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-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.
package org.jetbrains.plugins.github.extensions
import com.intellij.openapi.application.ModalityState
import com.intellij.openapi.application.invokeAndWaitIfNeed
import com.intellij.openapi.application.invokeAndWaitIfNeeded
import com.intellij.openapi.project.Project
import com.intellij.util.AuthData
import git4idea.DialogManager
@@ -31,7 +31,7 @@ internal class InteractiveGithubHttpAuthDataProvider(private val project: Projec
DialogManager.show(dialog)
if (!dialog.isOK) return null
val account = dialog.account
val token = invokeAndWaitIfNeed(parentComponent?.let(ModalityState::stateForComponent) ?: ModalityState.any()) {
val token = invokeAndWaitIfNeeded(parentComponent?.let(ModalityState::stateForComponent) ?: ModalityState.any()) {
authenticationManager.getTokenForAccount(account) ?: authenticationManager.requestNewToken(account, project, parentComponent)
} ?: return null
if (dialog.setDefault) authenticationManager.setDefaultAccount(project, account)
@@ -1,8 +1,8 @@
// 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-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.
package org.jetbrains.plugins.github.pullrequest.data.service
import com.intellij.openapi.Disposable
import com.intellij.openapi.application.invokeAndWaitIfNeed
import com.intellij.openapi.application.invokeAndWaitIfNeeded
import com.intellij.openapi.progress.ProcessCanceledException
import com.intellij.openapi.progress.ProgressIndicator
import com.intellij.openapi.progress.ProgressManager
@@ -101,7 +101,7 @@ class GithubPullRequestsStateServiceImpl internal constructor(private val projec
indicator.checkCanceled()
indicator.text2 = "Acquiring commit message"
val commitMessage = invokeAndWaitIfNeed {
val commitMessage = invokeAndWaitIfNeeded {
val dialog = GithubMergeCommitMessageDialog(project,
"Merge Pull Request",
"Merge pull request #${pullRequest}",
@@ -182,7 +182,7 @@ class GithubPullRequestsStateServiceImpl internal constructor(private val projec
indicator.text2 = "Acquiring commit message"
val body = "* " + StringUtil.join(commits, { it.subject }, "\n\n* ")
val commitMessage = invokeAndWaitIfNeed {
val commitMessage = invokeAndWaitIfNeeded {
val dialog = GithubMergeCommitMessageDialog(project,
"Merge Pull Request",
"Merge pull request #${pullRequest}",
@@ -1,9 +1,9 @@
// 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-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.
package org.jetbrains.plugins.github.util
import com.intellij.concurrency.JobScheduler
import com.intellij.openapi.application.ModalityState
import com.intellij.openapi.application.invokeAndWaitIfNeed
import com.intellij.openapi.application.invokeAndWaitIfNeeded
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.progress.ProcessCanceledException
import com.intellij.openapi.progress.ProgressIndicator
@@ -120,7 +120,7 @@ object GithubUtil {
val authManager = GithubAuthenticationManager.getInstance()
var account = authManager.getSingleOrDefaultAccount(project)
if (account == null) {
account = invokeAndWaitIfNeed(ModalityState.any()) { authManager.requestNewAccount(project) }
account = invokeAndWaitIfNeeded(ModalityState.any()) { authManager.requestNewAccount(project) }
}
if (account == null) throw ProcessCanceledException()