Skip to content

Commit dcab722

Browse files
committed
Fix after rebase
1 parent 4fad780 commit dcab722

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/UTBotStartupActivity.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
package org.utbot.cpp.clion.plugin
22

33
import com.intellij.ide.util.RunOnceUtil
4+
import com.intellij.openapi.components.service
45
import com.intellij.openapi.project.Project
56
import com.intellij.openapi.startup.StartupActivity
67
import org.utbot.cpp.clion.plugin.client.Client
78
import org.utbot.cpp.clion.plugin.client.ClientManager
89
import org.utbot.cpp.clion.plugin.settings.pluginSettings
910
import org.utbot.cpp.clion.plugin.settings.settings
1011
import org.utbot.cpp.clion.plugin.ui.wizard.UTBotWizard
11-
import org.utbot.cpp.clion.plugin.utils.getCurrentClient
1212
import org.utbot.cpp.clion.plugin.utils.invokeOnEdt
1313

1414
class UTBotStartupActivity : StartupActivity {
1515
override fun runActivity(project: Project) {
16-
// we initialize Client here, so that initialization will not happen when user issues first
17-
// generation request which would cause a UI freeze
16+
// We initialize Client here, so that initialization will not happen
17+
// when user issues first generation request which would cause a UI freeze.
1818
initializeClient(project)
1919
guessPathsOnFirstOpen(project)
2020
showWizardOnFirstOpen(project)
2121
}
2222

2323
// Here we address the service ClientManager for the first time so that it
2424
// will be initialized by the ide and Client will be created.
25-
// Client in turn will create a grpc channel and start heartbeating the server
25+
// Client in turn will create a grpc channel and start heart-beating the server.
2626
private fun initializeClient(project: Project) = project.service<ClientManager>()
2727

2828

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/utils/ClientUtils.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,15 @@ import org.utbot.cpp.clion.plugin.client.logger.ClientLogger
1111
//TODO: remove logger from this file
1212
val Project.logger: ClientLogger get() = this.service()
1313

14-
fun AnActionEvent.getClient(): Client = this.getRequiredData(CommonDataKeys.PROJECT).getClient()
14+
val AnActionEvent.currentClient: Client
15+
get() = this.getRequiredData(CommonDataKeys.PROJECT).getCurrentClient()
1516

16-
fun Project.getClient(): Client = this.service<ClientManager>().client
17+
/**
18+
* NB: [Client] can be changed when user changes connection settings.
19+
* Use this function to obtain a reference to a Client and execute request
20+
* using Client#executeRequestIfNotDisposed.
21+
*/
22+
fun Project.getCurrentClient(): Client = this.service<ClientManager>().client
1723

1824
fun AnActionEvent.activeProject() = this.project
1925
?: error("A project related to action event $this not found")

clion-plugin/src/main/kotlin/org/utbot/cpp/clion/plugin/utils/shortcuts.kt

Whitespace-only changes.

0 commit comments

Comments
 (0)