Skip to content

Commit 68a5dbb

Browse files
Vassiliy-KudryashovVassiliy.Kudryashov
and
Vassiliy.Kudryashov
authored
Update compatibility and dependencies, fix Python plugin integration a bit #2460 (#2471)
Plugin is not compatible with latest IntelliJ IDEA 2023.2 #2460 Co-authored-by: Vassiliy.Kudryashov <Vassiliy.Kudryashov@huawei.com>
1 parent a5eb0a6 commit 68a5dbb

File tree

7 files changed

+45
-39
lines changed

7 files changed

+45
-39
lines changed

gradle.properties

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ ultimateEdition=Ultimate
1515
# IU, IC, PC, PY
1616
# IC for AndroidStudio
1717
ideType=IC
18-
ideVersion=231.8109.175
18+
ideVersion=232.8660.185
1919
# ALL, NOJS
2020
buildType=NOJS
2121

@@ -28,11 +28,11 @@ goIde=IU
2828
#androidStudioPath=your_path_to_android_studio
2929

3030
# Version numbers: https://plugins.jetbrains.com/plugin/7322-python-community-edition/versions
31-
pythonCommunityPluginVersion=231.8109.144
31+
pythonCommunityPluginVersion=232.8660.185
3232
# Version numbers: https://plugins.jetbrains.com/plugin/631-python/versions
33-
pythonUltimatePluginVersion=231.8109.175
33+
pythonUltimatePluginVersion=232.8660.185
3434
# Version numbers: https://plugins.jetbrains.com/plugin/9568-go/versions
35-
goPluginVersion=231.8109.175
35+
goPluginVersion=232.8660.142
3636

3737
junit5Version=5.8.2
3838
junit4Version=4.13.2

utbot-intellij-python/src/main/java/org/utbot/intellij/plugin/language/python/table/UtPyMemberSelectionTable.java

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
package org.utbot.intellij.plugin.language.python.table;
22

3+
import com.intellij.openapi.actionSystem.BackgroundableDataProvider;
34
import com.intellij.openapi.actionSystem.CommonDataKeys;
45
import com.intellij.openapi.actionSystem.DataProvider;
56
import com.intellij.refactoring.ui.EnableDisableAction;
67
import com.intellij.ui.*;
78
import com.intellij.ui.icons.RowIcon;
89
import com.intellij.ui.table.JBTable;
9-
import com.intellij.util.containers.ContainerUtil;
1010
import com.intellij.util.ui.JBUI;
11+
import com.jetbrains.python.psi.PyElement;
1112
import org.jetbrains.annotations.NonNls;
1213
import org.jetbrains.annotations.NotNull;
1314
import org.jetbrains.annotations.Nullable;
@@ -21,13 +22,14 @@
2122
import java.util.Collection;
2223
import java.util.List;
2324

24-
public class UtPyMemberSelectionTable<T extends UtPyTableItem> extends JBTable implements DataProvider {
25+
public class UtPyMemberSelectionTable<T extends UtPyTableItem> extends JBTable implements BackgroundableDataProvider {
2526
protected static final int CHECKED_COLUMN = 0;
2627
protected static final int DISPLAY_NAME_COLUMN = 1;
2728
protected static final int ICON_POSITION = 0;
2829

2930
protected List<T> myItems;
3031
protected MyTableModel<T> myTableModel;
32+
private DataProvider dataProvider;
3133

3234
public UtPyMemberSelectionTable(Collection<T> items) {
3335
myItems = new ArrayList<>(items);
@@ -52,11 +54,22 @@ public void setItems(Collection<T> items) {
5254
}
5355

5456
@Override
55-
public @Nullable Object getData(@NotNull @NonNls String dataId) {
56-
if (CommonDataKeys.PSI_ELEMENT.is(dataId)) {
57-
return ContainerUtil.getFirstItem(getSelectedMemberInfos());
57+
public @Nullable DataProvider createBackgroundDataProvider() {
58+
if (dataProvider == null) {
59+
dataProvider = new DataProvider() {
60+
@Override
61+
public @Nullable Object getData(@NotNull @NonNls String dataId) {
62+
if (CommonDataKeys.PSI_ELEMENT.is(dataId)) {
63+
for (UtPyTableItem item : getSelectedMemberInfos()) {
64+
PyElement pyElement = item.getContent();
65+
if (pyElement != null) return pyElement;
66+
}
67+
}
68+
return null;
69+
}
70+
};
5871
}
59-
return null;
72+
return dataProvider;
6073
}
6174

6275
public Collection<T> getSelectedMemberInfos() {

utbot-intellij-python/src/main/kotlin/org/utbot/intellij/plugin/language/python/IntellijRequirementsInstaller.kt

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import org.utbot.intellij.plugin.ui.utils.showErrorDialogLater
1212
import org.utbot.python.utils.RequirementsInstaller
1313
import org.utbot.python.utils.RequirementsUtils
1414
import javax.swing.JComponent
15+
import org.jetbrains.concurrency.runAsync
1516

1617

1718
class IntellijRequirementsInstaller(
@@ -24,20 +25,24 @@ class IntellijRequirementsInstaller(
2425
override fun installRequirements(pythonPath: String, requirements: List<String>) {
2526
invokeLater {
2627
if (InstallRequirementsDialog(requirements).showAndGet()) {
27-
val installResult = RequirementsUtils.installRequirements(pythonPath, requirements)
28-
if (installResult.exitValue != 0) {
29-
showErrorDialogLater(
30-
project,
31-
"Requirements installing failed.<br>" +
32-
"${installResult.stderr}<br><br>" +
33-
"Try to install with pip:<br>" +
34-
" ${requirements.joinToString("<br>")}",
35-
"Requirements error"
36-
)
37-
} else {
28+
runAsync {
29+
val installResult = RequirementsUtils.installRequirements(pythonPath, requirements)
3830
invokeLater {
39-
runReadAction {
40-
PythonNotifier.notify("Requirements installation is complete")
31+
if (installResult.exitValue != 0) {
32+
showErrorDialogLater(
33+
project,
34+
"Requirements installing failed.<br>" +
35+
"${installResult.stderr}<br><br>" +
36+
"Try to install with pip:<br>" +
37+
" ${requirements.joinToString("<br>")}",
38+
"Requirements error"
39+
)
40+
} else {
41+
invokeLater {
42+
runReadAction {
43+
PythonNotifier.notify("Requirements installation is complete")
44+
}
45+
}
4146
}
4247
}
4348
}

utbot-intellij-python/src/main/kotlin/org/utbot/intellij/plugin/language/python/PythonDialogWindow.kt

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class PythonDialogWindow(val model: PythonTestsModel) : DialogWrapper(model.proj
6363
}
6464

6565
init()
66+
setOKButtonText(ACTION_GENERATE)
6667
}
6768

6869
override fun createCenterPanel(): JComponent {
@@ -140,19 +141,6 @@ class PythonDialogWindow(val model: PythonTestsModel) : DialogWrapper(model.proj
140141

141142
private fun checkMembers(members: Collection<UtPyTableItem>) = members.forEach { it.isChecked = true }
142143

143-
class OKOptionAction(private val okAction: Action) : AbstractAction(ACTION_GENERATE) {
144-
init {
145-
putValue(DEFAULT_ACTION, java.lang.Boolean.TRUE)
146-
putValue(FOCUSED_ACTION, java.lang.Boolean.TRUE)
147-
}
148-
override fun actionPerformed(e: ActionEvent?) {
149-
okAction.actionPerformed(e)
150-
}
151-
}
152-
153-
private val okOptionAction: OKOptionAction get() = OKOptionAction(super.getOKAction())
154-
override fun getOKAction() = okOptionAction
155-
156144
override fun doOKAction() {
157145
val selectedMembers = pyElementsTable.selectedMemberInfos
158146
model.selectedElements = selectedMembers.mapNotNull { it.content }.toSet()

utbot-intellij/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ tasks {
114114

115115
patchPluginXml {
116116
sinceBuild.set("223")
117-
untilBuild.set("231.*")
117+
untilBuild.set("232.*")
118118
version.set(semVer)
119119
}
120120

utbot-intellij/src/main/kotlin/org/utbot/intellij/plugin/process/EngineProcess.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class EngineProcess private constructor(val project: Project, private val classN
172172
}
173173
}
174174

175-
private fun computeSourceFileByClass(params: ComputeSourceFileByClassArguments): String =
175+
private fun computeSourceFileByClass(params: ComputeSourceFileByClassArguments): String? =
176176
DumbService.getInstance(project).runReadActionInSmartMode<String?> {
177177
val scope = GlobalSearchScope.allScope(project)
178178
// JavaFileManager requires canonical name as it is said in import

utbot-ui-commons/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ tasks {
4242

4343
patchPluginXml {
4444
sinceBuild.set("223")
45-
untilBuild.set("223.*")
45+
untilBuild.set("232.*")
4646
version.set(semVer)
4747
}
4848
}

0 commit comments

Comments
 (0)