Skip to content

Commit 755f1c1

Browse files
authored
ui: Add submenu for Maven and Gradle (#664)
Signed-off-by: sheche <[email protected]>
1 parent 8f59095 commit 755f1c1

File tree

4 files changed

+33
-5
lines changed

4 files changed

+33
-5
lines changed

package.json

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -550,12 +550,39 @@
550550
"group": "inline"
551551
},
552552
{
553-
"command": "java.project.update",
554-
"when": "view == javaProjectExplorer && viewItem =~ /java:project(?=.*?\\b\\+uri\\b)(?=.*?\\b\\+(maven|gradle)\\b)/",
553+
"submenu": "javaProject.maven",
554+
"when": "view == javaProjectExplorer && viewItem =~ /java:project(?=.*?\\b\\+uri\\b)(?=.*?\\b\\+(maven)\\b)/",
555+
"group": "9_configuration@10"
556+
},
557+
{
558+
"submenu": "javaProject.gradle",
559+
"when": "view == javaProjectExplorer && viewItem =~ /java:project(?=.*?\\b\\+uri\\b)(?=.*?\\b\\+(gradle)\\b)/",
555560
"group": "9_configuration@10"
556561
}
562+
],
563+
"javaProject.maven": [
564+
{
565+
"command": "java.project.update",
566+
"group": "maven@10"
567+
}
568+
],
569+
"javaProject.gradle": [
570+
{
571+
"command": "java.project.update",
572+
"group": "gradle@10"
573+
}
557574
]
558575
},
576+
"submenus": [
577+
{
578+
"id": "javaProject.maven",
579+
"label": "Maven"
580+
},
581+
{
582+
"id": "javaProject.gradle",
583+
"label": "Gradle"
584+
}
585+
],
559586
"views": {
560587
"explorer": [
561588
{

package.nls.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"contributes.commands.java.view.package.refresh": "Refresh",
88
"contributes.commands.java.project.build.workspace": "Rebuild All",
99
"contributes.commands.java.project.clean.workspace": "Clean Workspace",
10-
"contributes.commands.java.project.update": "Update Project",
1110
"contributes.commands.java.project.rebuild": "Rebuild Project",
11+
"contributes.commands.java.project.update": "Reload Project",
1212
"contributes.commands.java.view.package.revealInProjectExplorer": "Reveal in Java Project Explorer",
1313
"contributes.commands.java.view.package.changeToFlatPackageView":"Flat View",
1414
"contributes.commands.java.view.package.changeToHierarchicalPackageView":"Hierarchical View",

package.nls.zh.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"contributes.commands.java.view.package.refresh": "刷新",
88
"contributes.commands.java.project.build.workspace": "重新构建所有项目",
99
"contributes.commands.java.project.clean.workspace": "清理工作空间",
10-
"contributes.commands.java.project.update": "更新项目",
1110
"contributes.commands.java.project.rebuild": "重新构建项目",
11+
"contributes.commands.java.project.update": "重新加载项目",
1212
"contributes.commands.java.view.package.revealInProjectExplorer": "在 Java 项目视图中显示",
1313
"contributes.commands.java.view.package.changeToFlatPackageView":"平行显示",
1414
"contributes.commands.java.view.package.changeToHierarchicalPackageView":"层级显示",

src/views/dependencyDataProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ export class DependencyDataProvider implements TreeDataProvider<ExplorerNode> {
6060
commands.executeCommand(Commands.JAVA_CLEAN_WORKSPACE)));
6161
context.subscriptions.push(instrumentOperationAsVsCodeCommand(Commands.JAVA_PROJECT_UPDATE, async (node: INodeData) => {
6262
if (!node.uri) {
63-
window.showErrorMessage("The URI of the project is not available, you can try to update the project by right clicking the project configuration file (pom.xml or *.gradle) from the File Explorer.");
63+
sendError(new Error("Uri not available when reloading project"));
64+
window.showErrorMessage("The URI of the project is not available, you can try to trigger the command 'Java: Reload Project' from Command Palette.");
6465
return;
6566
}
6667
const pattern: RelativePattern = new RelativePattern(Uri.parse(node.uri).fsPath, "{pom.xml,*.gradle}");

0 commit comments

Comments
 (0)