Skip to content

Commit

Permalink
ui: Add submenu for Maven and Gradle
Browse files Browse the repository at this point in the history
Signed-off-by: sheche <[email protected]>
  • Loading branch information
jdneo committed Jul 13, 2022
1 parent 8f59095 commit 92bd034
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 5 deletions.
31 changes: 29 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -550,12 +550,39 @@
"group": "inline"
},
{
"command": "java.project.update",
"when": "view == javaProjectExplorer && viewItem =~ /java:project(?=.*?\\b\\+uri\\b)(?=.*?\\b\\+(maven|gradle)\\b)/",
"submenu": "javaProject.maven",
"when": "view == javaProjectExplorer && viewItem =~ /java:project(?=.*?\\b\\+uri\\b)(?=.*?\\b\\+(maven)\\b)/",
"group": "9_configuration@10"
},
{
"submenu": "javaProject.gradle",
"when": "view == javaProjectExplorer && viewItem =~ /java:project(?=.*?\\b\\+uri\\b)(?=.*?\\b\\+(gradle)\\b)/",
"group": "9_configuration@10"
}
],
"javaProject.maven": [
{
"command": "java.project.update",
"group": "maven@10"
}
],
"javaProject.gradle": [
{
"command": "java.project.update",
"group": "gradle@10"
}
]
},
"submenus": [
{
"id": "javaProject.maven",
"label": "Maven"
},
{
"id": "javaProject.gradle",
"label": "Gradle"
}
],
"views": {
"explorer": [
{
Expand Down
2 changes: 1 addition & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"contributes.commands.java.view.package.refresh": "Refresh",
"contributes.commands.java.project.build.workspace": "Rebuild All",
"contributes.commands.java.project.clean.workspace": "Clean Workspace",
"contributes.commands.java.project.update": "Update Project",
"contributes.commands.java.project.rebuild": "Rebuild Project",
"contributes.commands.java.project.update": "Reload Project",
"contributes.commands.java.view.package.revealInProjectExplorer": "Reveal in Java Project Explorer",
"contributes.commands.java.view.package.changeToFlatPackageView":"Flat View",
"contributes.commands.java.view.package.changeToHierarchicalPackageView":"Hierarchical View",
Expand Down
2 changes: 1 addition & 1 deletion package.nls.zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"contributes.commands.java.view.package.refresh": "刷新",
"contributes.commands.java.project.build.workspace": "重新构建所有项目",
"contributes.commands.java.project.clean.workspace": "清理工作空间",
"contributes.commands.java.project.update": "更新项目",
"contributes.commands.java.project.rebuild": "重新构建项目",
"contributes.commands.java.project.update": "重新加载项目",
"contributes.commands.java.view.package.revealInProjectExplorer": "在 Java 项目视图中显示",
"contributes.commands.java.view.package.changeToFlatPackageView":"平行显示",
"contributes.commands.java.view.package.changeToHierarchicalPackageView":"层级显示",
Expand Down
3 changes: 2 additions & 1 deletion src/views/dependencyDataProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ export class DependencyDataProvider implements TreeDataProvider<ExplorerNode> {
commands.executeCommand(Commands.JAVA_CLEAN_WORKSPACE)));
context.subscriptions.push(instrumentOperationAsVsCodeCommand(Commands.JAVA_PROJECT_UPDATE, async (node: INodeData) => {
if (!node.uri) {
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.");
sendError(new Error("Uri not available when reloading project"));
window.showErrorMessage("The URI of the project is not available, you can try to trigger the command 'Java: Reload Project' from Command Palette.");
return;
}
const pattern: RelativePattern = new RelativePattern(Uri.parse(node.uri).fsPath, "{pom.xml,*.gradle}");
Expand Down

0 comments on commit 92bd034

Please sign in to comment.