From 6bf4f1a676ae0227d7cedb3bb7fe3e06e2ed0a5b Mon Sep 17 00:00:00 2001 From: Hanxiao Liu <hanli@microsoft.com> Date: Thu, 27 Dec 2018 16:48:11 +0800 Subject: [PATCH 1/5] Add sync with editor command and use different icons for package representation --- images/dark/icon-link.svg | 25 ++++++++++++++++++++ images/light/icon-link.svg | 25 ++++++++++++++++++++ package.json | 41 ++++++++++++++++++++++++++++++-- package.nls.json | 5 +++- package.nls.zh.json | 5 +++- src/commands.ts | 7 ++++++ src/settings.ts | 42 ++++++++++++++++++++++++++------- src/views/dependencyExplorer.ts | 2 +- 8 files changed, 138 insertions(+), 14 deletions(-) create mode 100644 images/dark/icon-link.svg create mode 100644 images/light/icon-link.svg diff --git a/images/dark/icon-link.svg b/images/dark/icon-link.svg new file mode 100644 index 00000000..94b21ef4 --- /dev/null +++ b/images/dark/icon-link.svg @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve"> +<style type="text/css"> + .st0{fill:#2D2D30;} + .st1{fill:#C5C5C5;} +</style> +<g id="_x7B__PAGE_GRID__x7D_"> +</g> +<g id="outline"> +</g> +<g id="icon_x5F_bg"> + <polygon class="st0" points="10.8,0 6,0 8,2 2.4,2 2.4,6 8,6 6,8 10.8,8 14.8,4 "/> + <path class="st1" d="M10.4,5h-7V3h7l-2-2h2l3,3l-3,3h-2L10.4,5z"/> + <polygon class="st0" points="6,16 10.8,16 8.8,14 14.4,14 14.4,10 8.8,10 10.8,8 6,8 2,12 "/> + <path class="st1" d="M6.4,11h7v2h-7l2,2h-2l-3-3l3-3h2L6.4,11z"/> +</g> +<g id="icon_x5F_fg"> +</g> +<g id="not_x5F_bg"> +</g> +<g id="not_x5F_fg"> +</g> +</svg> diff --git a/images/light/icon-link.svg b/images/light/icon-link.svg new file mode 100644 index 00000000..e4cd992a --- /dev/null +++ b/images/light/icon-link.svg @@ -0,0 +1,25 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve"> +<style type="text/css"> + .st0{fill:#F6F6F6;} + .st1{fill:#424242;} +</style> +<g id="_x7B__PAGE_GRID__x7D_"> +</g> +<g id="outline"> +</g> +<g id="icon_x5F_bg"> + <polygon class="st0" points="10.8,0 6,0 8,2 2.4,2 2.4,6 8,6 6,8 10.8,8 14.8,4 "/> + <path class="st1" d="M10.4,5h-7V3h7l-2-2h2l3,3l-3,3h-2L10.4,5z"/> + <polygon class="st0" points="6,16 10.8,16 8.8,14 14.4,14 14.4,10 8.8,10 10.8,8 6,8 2,12 "/> + <path class="st1" d="M6.4,11h7v2h-7l2,2h-2l-3-3l3-3h2L6.4,11z"/> +</g> +<g id="icon_x5F_fg"> +</g> +<g id="not_x5F_bg"> +</g> +<g id="not_x5F_fg"> +</g> +</svg> diff --git a/package.json b/package.json index 79056161..fdf792e9 100644 --- a/package.json +++ b/package.json @@ -56,6 +56,33 @@ "dark": "images/dark/icon-hierarchical.svg", "light": "images/light/icon-hierarchical.svg" } + }, + { + "command": "java.view.package.changeToHierarchicalPackageView", + "title": "%contributes.commands.java.view.package.changeToHierarchicalPackageView%", + "category": "Java", + "icon": { + "dark": "images/dark/icon-hierarchical.svg", + "light": "images/light/icon-hierarchical.svg" + } + }, + { + "command": "java.view.package.changeToFlatPackageView", + "title": "%contributes.commands.java.view.package.changeToFlatPackageView%", + "category": "Java", + "icon": { + "dark": "images/dark/icon-flat.svg", + "light": "images/light/icon-flat.svg" + } + }, + { + "command": "java.view.package.syncWithFolderExplorer", + "title": "%contributes.commands.java.view.package.syncWithFolderExplorer%", + "category": "Java", + "icon": { + "dark": "images/dark/icon-link.svg", + "light": "images/light/icon-link.svg" + } } ], "configuration": { @@ -88,10 +115,20 @@ { "command": "java.view.package.refresh", "when": "view == javaDependencyExplorer", + "group": "navigation@2" + }, + { + "command": "java.view.package.changeToHierarchicalPackageView", + "when": "view == javaDependencyExplorer && config.java.dependency.packagePresentation == flat", + "group": "navigation@1" + }, + { + "command": "java.view.package.changeToFlatPackageView", + "when": "view == javaDependencyExplorer && config.java.dependency.packagePresentation != flat", "group": "navigation@1" }, { - "command": "java.view.package.changeRepresentation", + "command": "java.view.package.syncWithFolderExplorer", "when": "view == javaDependencyExplorer", "group": "navigation@0" } @@ -143,4 +180,4 @@ "vscode-extension-telemetry-wrapper": "^0.3.8", "xml2js": "^0.4.19" } -} +} \ No newline at end of file diff --git a/package.nls.json b/package.nls.json index e8503883..a15c41b7 100644 --- a/package.nls.json +++ b/package.nls.json @@ -3,8 +3,11 @@ "contributes.commands.java.project.create": "Create Java Project", "contributes.commands.java.view.package.refresh": "Refresh", "contributes.commands.java.view.package.changeRepresentation": "Change package representation", + "contributes.commands.java.view.package.changeToFlatPackageView":"Change to flat package representation", + "contributes.commands.java.view.package.changeToHierarchicalPackageView":"Change to hierarchical package representation", + "contributes.commands.java.view.package.syncWithFolderExplorer":"Synchronize/desynchronize dependency viewer selection with folder explorer", "configuration.java.dependency.title": "Java Dependency Configuration", "configuration.java.dependency.showOutline": "Enable show outline in the Java Dependency explorer", "configuration.java.dependency.syncWithFolderExplorer": "Synchronize dependency viewer selection with folder explorer", "configuration.java.dependency.packagePresentation": "Package presentation mode: flat or hierarchical" -} \ No newline at end of file +} diff --git a/package.nls.zh.json b/package.nls.zh.json index a0955eee..4e7c39c3 100644 --- a/package.nls.zh.json +++ b/package.nls.zh.json @@ -3,8 +3,11 @@ "contributes.commands.java.project.create": "创建 Java 项目", "contributes.commands.java.view.package.refresh": "刷新", "contributes.commands.java.view.package.changeRepresentation": "更改包展示形式", + "contributes.commands.java.view.package.changeToFlatPackageView":"将 Java 包显示方式切换为平行显示", + "contributes.commands.java.view.package.changeToHierarchicalPackageView":"将 Java 包显示方式切换为分层显示", + "contributes.commands.java.view.package.syncWithFolderExplorer":"开启/关闭 Java 依赖项资源管理器与当前浏览文件的关联", "configuration.java.dependency.title": "Java 依赖管理配置", "configuration.java.dependency.showOutline": "在 Java 依赖项资源管理器中显示类成员大纲", "configuration.java.dependency.syncWithFolderExplorer": "在 Java 依赖项资源管理器中同步关联当前打开的文件", "configuration.java.dependency.packagePresentation": "Java 包显示方式: 平行显示或者分层显示" -} \ No newline at end of file +} diff --git a/src/commands.ts b/src/commands.ts index 7f981852..39aee758 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -12,6 +12,12 @@ export namespace Commands { export const VIEW_PACKAGE_CHANGEREPRESENTATION = "java.view.package.changeRepresentation"; + export const VIEW_PACKAGE_CHANGETOFLATPACKAGEVIEW = "java.view.package.changeToFlatPackageView"; + + export const VIEW_PACKAGE_CHANGETOHIERARCHICALPACKAGEVIEW = "java.view.package.changeToHierarchicalPackageView"; + + export const VIEW_PACKAGE_SYNCWITHFOLDER = "java.view.package.syncWithFolderExplorer"; + export const VIEW_PACKAGE_REFRESH = "java.view.package.refresh"; export const VIEW_PACKAGE_OPEN_FILE = "java.view.package.openFile"; @@ -25,4 +31,5 @@ export namespace Commands { export const JAVA_GETPACKAGEDATA = "java.getPackageData"; export const JAVA_RESOLVEPATH = "java.resolvePath"; + } diff --git a/src/settings.ts b/src/settings.ts index 520c0fd0..dce3d7a6 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -13,16 +13,40 @@ export class Settings { return; } const updatedConfig = workspace.getConfiguration("java.dependency"); - if (updatedConfig.showOutline !== this._depdendencyConfig.showOutline - || updatedConfig.packagePresentation !== this._depdendencyConfig.packagePresentation) { + if (updatedConfig.showOutline !== this._dependencyConfig.showOutline + || updatedConfig.packagePresentation !== this._dependencyConfig.packagePresentation + || (updatedConfig.syncWithFolderExplorer !== this._dependencyConfig.syncWithFolderExplorer + && updatedConfig.syncWithFolderExplorer)) { commands.executeCommand(Commands.VIEW_PACKAGE_REFRESH); } - this._depdendencyConfig = updatedConfig; + this._dependencyConfig = updatedConfig; })); - const instrumented = instrumentOperation(Commands.VIEW_PACKAGE_CHANGEREPRESENTATION, Settings.changePackageRepresentation); - context.subscriptions.push(commands.registerCommand(Commands.VIEW_PACKAGE_CHANGEREPRESENTATION, instrumented)); + context.subscriptions.push(commands.registerCommand(Commands.VIEW_PACKAGE_SYNCWITHFOLDER, + instrumentOperation(Commands.VIEW_PACKAGE_SYNCWITHFOLDER, Settings.syncWithFolderCommand))); + + context.subscriptions.push(commands.registerCommand(Commands.VIEW_PACKAGE_CHANGEREPRESENTATION, + instrumentOperation(Commands.VIEW_PACKAGE_CHANGEREPRESENTATION, Settings.changePackageRepresentation))); + + context.subscriptions.push(commands.registerCommand(Commands.VIEW_PACKAGE_CHANGETOFLATPACKAGEVIEW, + instrumentOperation(Commands.VIEW_PACKAGE_CHANGETOFLATPACKAGEVIEW, Settings.changeToFlatPackageView))); + + context.subscriptions.push(commands.registerCommand(Commands.VIEW_PACKAGE_CHANGETOHIERARCHICALPACKAGEVIEW, + instrumentOperation(Commands.VIEW_PACKAGE_CHANGETOHIERARCHICALPACKAGEVIEW, Settings.changeToHierarchicalPackageView))); + } + + public static syncWithFolderCommand(): void { + const syncWithFolder = Settings.syncWithFolderExplorer(); + workspace.getConfiguration().update("java.dependency.syncWithFolderExplorer", !syncWithFolder, false); + } + + public static changeToFlatPackageView(): void { + workspace.getConfiguration().update("java.dependency.packagePresentation", PackagePresentation.Flat, false); + } + + public static changeToHierarchicalPackageView(): void { + workspace.getConfiguration().update("java.dependency.packagePresentation", PackagePresentation.Hierarchical, false); } public static changePackageRepresentation(): void { @@ -31,18 +55,18 @@ export class Settings { } public static showOutline(): boolean { - return this._depdendencyConfig.get("showOutline"); + return this._dependencyConfig.get("showOutline"); } public static syncWithFolderExplorer(): boolean { - return this._depdendencyConfig.get("syncWithFolderExplorer"); + return this._dependencyConfig.get("syncWithFolderExplorer"); } public static isHierarchicalView(): boolean { - return this._depdendencyConfig.get("packagePresentation") === PackagePresentation.Hierarchical; + return this._dependencyConfig.get("packagePresentation") === PackagePresentation.Hierarchical; } - private static _depdendencyConfig: WorkspaceConfiguration = workspace.getConfiguration("java.dependency"); + private static _dependencyConfig: WorkspaceConfiguration = workspace.getConfiguration("java.dependency"); } enum PackagePresentation { diff --git a/src/views/dependencyExplorer.ts b/src/views/dependencyExplorer.ts index 9909c9d0..d40f9ee2 100644 --- a/src/views/dependencyExplorer.ts +++ b/src/views/dependencyExplorer.ts @@ -35,7 +35,7 @@ export class DependencyExplorer { }); this._dataProvider.onDidChangeTreeData(() => { - if (window.activeTextEditor) { + if (window.activeTextEditor && Settings.syncWithFolderExplorer()) { this.reveal(window.activeTextEditor.document.uri); } }); From a2ba85fe777aa51e0b5925778d78bae69d679e70 Mon Sep 17 00:00:00 2001 From: Hanxiao Liu <hanli@microsoft.com> Date: Thu, 27 Dec 2018 17:23:34 +0800 Subject: [PATCH 2/5] Resolve comments --- images/dark/icon-link.svg | 2 +- images/light/icon-link.svg | 2 +- package.json | 2 +- src/views/dependencyExplorer.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/images/dark/icon-link.svg b/images/dark/icon-link.svg index 94b21ef4..83e1692d 100644 --- a/images/dark/icon-link.svg +++ b/images/dark/icon-link.svg @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> -<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve"> <style type="text/css"> .st0{fill:#2D2D30;} diff --git a/images/light/icon-link.svg b/images/light/icon-link.svg index e4cd992a..54960d05 100644 --- a/images/light/icon-link.svg +++ b/images/light/icon-link.svg @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> -<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" +<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve"> <style type="text/css"> .st0{fill:#F6F6F6;} diff --git a/package.json b/package.json index fdf792e9..8d5142cc 100644 --- a/package.json +++ b/package.json @@ -180,4 +180,4 @@ "vscode-extension-telemetry-wrapper": "^0.3.8", "xml2js": "^0.4.19" } -} \ No newline at end of file +} diff --git a/src/views/dependencyExplorer.ts b/src/views/dependencyExplorer.ts index d40f9ee2..9909c9d0 100644 --- a/src/views/dependencyExplorer.ts +++ b/src/views/dependencyExplorer.ts @@ -35,7 +35,7 @@ export class DependencyExplorer { }); this._dataProvider.onDidChangeTreeData(() => { - if (window.activeTextEditor && Settings.syncWithFolderExplorer()) { + if (window.activeTextEditor) { this.reveal(window.activeTextEditor.document.uri); } }); From 0005ac6574feb1a5bc8757b2798b6d06aad48b48 Mon Sep 17 00:00:00 2001 From: Hanxiao Liu <hanli@microsoft.com> Date: Thu, 3 Jan 2019 17:16:38 +0800 Subject: [PATCH 3/5] Add icon for link/unlink, and refresh when configuration are updated --- images/dark/icon-hierarchical.svg | 4 ---- images/dark/icon-link.svg | 21 +++++++-------------- images/dark/icon-unlink.svg | 15 +++++++++++++++ images/light/icon-flat.svg | 4 ++-- images/light/icon-hierarchical.svg | 2 +- images/light/icon-link.svg | 21 +++++++-------------- images/light/icon-unlink.svg | 17 +++++++++++++++++ package.json | 25 +++++++++++++++---------- package.nls.json | 3 ++- package.nls.zh.json | 3 ++- src/commands.ts | 4 ++-- src/settings.ts | 21 ++++++++++----------- src/views/dependencyExplorer.ts | 2 +- 13 files changed, 81 insertions(+), 61 deletions(-) create mode 100644 images/dark/icon-unlink.svg create mode 100644 images/light/icon-unlink.svg diff --git a/images/dark/icon-hierarchical.svg b/images/dark/icon-hierarchical.svg index ea746736..3ce00c96 100644 --- a/images/dark/icon-hierarchical.svg +++ b/images/dark/icon-hierarchical.svg @@ -20,8 +20,4 @@ <g id="icon_x5F_fg"> <path class="st0" d="M7,13v1h1v-1H7z M7,8v1h1V8H7z M3,3v1h1V3H3z"/> </g> -<g id="not_x5F_bg"> -</g> -<g id="not_x5F_fg"> -</g> </svg> diff --git a/images/dark/icon-link.svg b/images/dark/icon-link.svg index 83e1692d..0a153203 100644 --- a/images/dark/icon-link.svg +++ b/images/dark/icon-link.svg @@ -1,25 +1,18 @@ <?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> -<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" +<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve"> <style type="text/css"> - .st0{fill:#2D2D30;} + .st0{fill:#252526;} .st1{fill:#C5C5C5;} </style> -<g id="_x7B__PAGE_GRID__x7D_"> +<g id="canvas"> + <rect class="st0" width="16" height="16"/> </g> <g id="outline"> + <polygon class="st0" points="11.4,7 13,7 13,3 7.4,3 9.4,1 4.6,1 0.6,5 4.6,9 3,9 3,13 8.6,13 6.6,15 11.4,15 15.4,11 "/> </g> -<g id="icon_x5F_bg"> - <polygon class="st0" points="10.8,0 6,0 8,2 2.4,2 2.4,6 8,6 6,8 10.8,8 14.8,4 "/> - <path class="st1" d="M10.4,5h-7V3h7l-2-2h2l3,3l-3,3h-2L10.4,5z"/> - <polygon class="st0" points="6,16 10.8,16 8.8,14 14.4,14 14.4,10 8.8,10 10.8,8 6,8 2,12 "/> - <path class="st1" d="M6.4,11h7v2h-7l2,2h-2l-3-3l3-3h2L6.4,11z"/> -</g> -<g id="icon_x5F_fg"> -</g> -<g id="not_x5F_bg"> -</g> -<g id="not_x5F_fg"> +<g id="iconBg"> + <path class="st1" d="M14,11l-3,3H9l2-2H4v-2h7L9,8h2L14,11z M7,8L5,6h7V4H5l2-2H5L2,5l3,3H7z"/> </g> </svg> diff --git a/images/dark/icon-unlink.svg b/images/dark/icon-unlink.svg new file mode 100644 index 00000000..e3c72530 --- /dev/null +++ b/images/dark/icon-unlink.svg @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve"> +<style type="text/css"> + .st0{fill:#252526;} + .st1{fill:#C5C5C5;} +</style> +<g id="outline"> + <polyline class="st0" points="13,3 7.4,3 9.4,1 4.6,1 0.6,5 4.6,9 3,9 3,13 8.6,13 6.6,15 11.4,15 15.4,11 11.4,7 13,7 "/> +</g> +<g id="iconBg"> + <path class="st1" d="M14,11l-3,3H9l2-2H4v-2h7L9,8h2L14,11z M7,8L5,6h7V4H5l2-2H5L2,5l3,3H7z"/> +</g> +</svg> diff --git a/images/light/icon-flat.svg b/images/light/icon-flat.svg index b58716a9..1146126c 100644 --- a/images/light/icon-flat.svg +++ b/images/light/icon-flat.svg @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> -<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" +<svg version="1.1" id="layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve"> <style type="text/css"> .st0{fill:#F6F6F6;} @@ -10,7 +10,7 @@ <g id="_x7B__PAGE_GRID__x7D_"> </g> <g id="outline"> - <path class="st0" d="M1,1h5v1l10,0v3L6,5v2h10v3H6v2l10,0v3L6,15v1H1V1z"/> + <path class="st0" d="M1,1h5v1h10v3H6v2h10v3H6v2h10v3H6v1H1V1z"/> </g> <g id="icon_x5F_bg"> <g> diff --git a/images/light/icon-hierarchical.svg b/images/light/icon-hierarchical.svg index 4cd7ccc3..81e9fb31 100644 --- a/images/light/icon-hierarchical.svg +++ b/images/light/icon-hierarchical.svg @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> -<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" +<svg version="1.1" id="layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve"> <style type="text/css"> .st0{fill:#F6F6F6;} diff --git a/images/light/icon-link.svg b/images/light/icon-link.svg index 54960d05..f039fcd0 100644 --- a/images/light/icon-link.svg +++ b/images/light/icon-link.svg @@ -1,25 +1,18 @@ <?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> -<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" +<svg version="1.1" id="layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve"> <style type="text/css"> .st0{fill:#F6F6F6;} .st1{fill:#424242;} </style> -<g id="_x7B__PAGE_GRID__x7D_"> -</g> +<rect id="canvas" class="st0" width="16" height="16"/> <g id="outline"> + <polygon class="st0" points="11.4,7 13,7 13,3 7.4,3 9.4,1 4.6,1 0.6,5 4.6,9 3,9 3,13 8.6,13 6.6,15 11.4,15 15.4,11 "/> </g> -<g id="icon_x5F_bg"> - <polygon class="st0" points="10.8,0 6,0 8,2 2.4,2 2.4,6 8,6 6,8 10.8,8 14.8,4 "/> - <path class="st1" d="M10.4,5h-7V3h7l-2-2h2l3,3l-3,3h-2L10.4,5z"/> - <polygon class="st0" points="6,16 10.8,16 8.8,14 14.4,14 14.4,10 8.8,10 10.8,8 6,8 2,12 "/> - <path class="st1" d="M6.4,11h7v2h-7l2,2h-2l-3-3l3-3h2L6.4,11z"/> -</g> -<g id="icon_x5F_fg"> -</g> -<g id="not_x5F_bg"> -</g> -<g id="not_x5F_fg"> +<g id="iconBg"> + <g> + <path class="st1" d="M14,11l-3,3H9l2-2H4v-2h7L9,8h2L14,11z M7,8L5,6h7V4H5l2-2H5L2,5l3,3H7z"/> + </g> </g> </svg> diff --git a/images/light/icon-unlink.svg b/images/light/icon-unlink.svg new file mode 100644 index 00000000..c3f5fe3c --- /dev/null +++ b/images/light/icon-unlink.svg @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> +<svg version="1.1" id="layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" + viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve"> +<style type="text/css"> + .st0{fill:#F6F6F6;} + .st1{fill:#424242;} +</style> +<g id="outline"> + <polygon class="st0" points="11.4,7 13,7 13,3 7.4,3 9.4,1 4.6,1 0.6,5 4.6,9 3,9 3,13 8.6,13 6.6,15 11.4,15 15.4,11 "/> +</g> +<g id="iconBg"> + <g> + <path class="st1" d="M14,11l-3,3H9l2-2H4v-2h7L9,8h2L14,11z M7,8L5,6h7V4H5l2-2H5L2,5l3,3H7z"/> + </g> +</g> +</svg> diff --git a/package.json b/package.json index 8d5142cc..460cc643 100644 --- a/package.json +++ b/package.json @@ -48,15 +48,6 @@ "light": "images/light/icon-refresh.svg" } }, - { - "command": "java.view.package.changeRepresentation", - "title": "%contributes.commands.java.view.package.changeRepresentation%", - "category": "Java", - "icon": { - "dark": "images/dark/icon-hierarchical.svg", - "light": "images/light/icon-hierarchical.svg" - } - }, { "command": "java.view.package.changeToHierarchicalPackageView", "title": "%contributes.commands.java.view.package.changeToHierarchicalPackageView%", @@ -79,6 +70,15 @@ "command": "java.view.package.syncWithFolderExplorer", "title": "%contributes.commands.java.view.package.syncWithFolderExplorer%", "category": "Java", + "icon": { + "dark": "images/dark/icon-unlink.svg", + "light": "images/light/icon-unlink.svg" + } + }, + { + "command": "java.view.package.desyncWithFolderExplorer", + "title": "%contributes.commands.java.view.package.desyncWithFolderExplorer%", + "category": "Java", "icon": { "dark": "images/dark/icon-link.svg", "light": "images/light/icon-link.svg" @@ -129,7 +129,12 @@ }, { "command": "java.view.package.syncWithFolderExplorer", - "when": "view == javaDependencyExplorer", + "when": "view == javaDependencyExplorer && config.java.dependency.syncWithFolderExplorer != true", + "group": "navigation@0" + }, + { + "command": "java.view.package.desyncWithFolderExplorer", + "when": "view == javaDependencyExplorer && config.java.dependency.syncWithFolderExplorer == true", "group": "navigation@0" } ] diff --git a/package.nls.json b/package.nls.json index a15c41b7..da7c9804 100644 --- a/package.nls.json +++ b/package.nls.json @@ -5,7 +5,8 @@ "contributes.commands.java.view.package.changeRepresentation": "Change package representation", "contributes.commands.java.view.package.changeToFlatPackageView":"Change to flat package representation", "contributes.commands.java.view.package.changeToHierarchicalPackageView":"Change to hierarchical package representation", - "contributes.commands.java.view.package.syncWithFolderExplorer":"Synchronize/desynchronize dependency viewer selection with folder explorer", + "contributes.commands.java.view.package.syncWithFolderExplorer":"Synchronize dependency viewer selection with folder explorer", + "contributes.commands.java.view.package.desyncWithFolderExplorer":"Desynchronize dependency viewer selection with folder explorer", "configuration.java.dependency.title": "Java Dependency Configuration", "configuration.java.dependency.showOutline": "Enable show outline in the Java Dependency explorer", "configuration.java.dependency.syncWithFolderExplorer": "Synchronize dependency viewer selection with folder explorer", diff --git a/package.nls.zh.json b/package.nls.zh.json index 4e7c39c3..130c338d 100644 --- a/package.nls.zh.json +++ b/package.nls.zh.json @@ -5,7 +5,8 @@ "contributes.commands.java.view.package.changeRepresentation": "更改包展示形式", "contributes.commands.java.view.package.changeToFlatPackageView":"将 Java 包显示方式切换为平行显示", "contributes.commands.java.view.package.changeToHierarchicalPackageView":"将 Java 包显示方式切换为分层显示", - "contributes.commands.java.view.package.syncWithFolderExplorer":"开启/关闭 Java 依赖项资源管理器与当前浏览文件的关联", + "contributes.commands.java.view.package.syncWithFolderExplorer":"开启 Java 依赖项资源管理器与当前浏览文件的关联", + "contributes.commands.java.view.package.desyncWithFolderExplorer":"关闭 Java 依赖项资源管理器与当前浏览文件的关联", "configuration.java.dependency.title": "Java 依赖管理配置", "configuration.java.dependency.showOutline": "在 Java 依赖项资源管理器中显示类成员大纲", "configuration.java.dependency.syncWithFolderExplorer": "在 Java 依赖项资源管理器中同步关联当前打开的文件", diff --git a/src/commands.ts b/src/commands.ts index 39aee758..84be0879 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -10,14 +10,14 @@ export namespace Commands { */ export const EXECUTE_WORKSPACE_COMMAND = "java.execute.workspaceCommand"; - export const VIEW_PACKAGE_CHANGEREPRESENTATION = "java.view.package.changeRepresentation"; - export const VIEW_PACKAGE_CHANGETOFLATPACKAGEVIEW = "java.view.package.changeToFlatPackageView"; export const VIEW_PACKAGE_CHANGETOHIERARCHICALPACKAGEVIEW = "java.view.package.changeToHierarchicalPackageView"; export const VIEW_PACKAGE_SYNCWITHFOLDER = "java.view.package.syncWithFolderExplorer"; + export const VIEW_PACKAGE_DESYNCWITHFOLDER = "java.view.package.desyncWithFolderExplorer"; + export const VIEW_PACKAGE_REFRESH = "java.view.package.refresh"; export const VIEW_PACKAGE_OPEN_FILE = "java.view.package.openFile"; diff --git a/src/settings.ts b/src/settings.ts index dce3d7a6..06ded5ed 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -17,17 +17,18 @@ export class Settings { || updatedConfig.packagePresentation !== this._dependencyConfig.packagePresentation || (updatedConfig.syncWithFolderExplorer !== this._dependencyConfig.syncWithFolderExplorer && updatedConfig.syncWithFolderExplorer)) { + this._dependencyConfig = updatedConfig; commands.executeCommand(Commands.VIEW_PACKAGE_REFRESH); + } else { + this._dependencyConfig = updatedConfig; } - this._dependencyConfig = updatedConfig; - })); context.subscriptions.push(commands.registerCommand(Commands.VIEW_PACKAGE_SYNCWITHFOLDER, instrumentOperation(Commands.VIEW_PACKAGE_SYNCWITHFOLDER, Settings.syncWithFolderCommand))); - context.subscriptions.push(commands.registerCommand(Commands.VIEW_PACKAGE_CHANGEREPRESENTATION, - instrumentOperation(Commands.VIEW_PACKAGE_CHANGEREPRESENTATION, Settings.changePackageRepresentation))); + context.subscriptions.push(commands.registerCommand(Commands.VIEW_PACKAGE_DESYNCWITHFOLDER, + instrumentOperation(Commands.VIEW_PACKAGE_DESYNCWITHFOLDER, Settings.desyncWithFolderCommand))); context.subscriptions.push(commands.registerCommand(Commands.VIEW_PACKAGE_CHANGETOFLATPACKAGEVIEW, instrumentOperation(Commands.VIEW_PACKAGE_CHANGETOFLATPACKAGEVIEW, Settings.changeToFlatPackageView))); @@ -37,8 +38,11 @@ export class Settings { } public static syncWithFolderCommand(): void { - const syncWithFolder = Settings.syncWithFolderExplorer(); - workspace.getConfiguration().update("java.dependency.syncWithFolderExplorer", !syncWithFolder, false); + workspace.getConfiguration().update("java.dependency.syncWithFolderExplorer", true, false); + } + + public static desyncWithFolderCommand(): void { + workspace.getConfiguration().update("java.dependency.syncWithFolderExplorer", false, false); } public static changeToFlatPackageView(): void { @@ -49,11 +53,6 @@ export class Settings { workspace.getConfiguration().update("java.dependency.packagePresentation", PackagePresentation.Hierarchical, false); } - public static changePackageRepresentation(): void { - const representationSetting = Settings.isHierarchicalView() ? PackagePresentation.Flat : PackagePresentation.Hierarchical; - workspace.getConfiguration().update("java.dependency.packagePresentation", representationSetting, false); - } - public static showOutline(): boolean { return this._dependencyConfig.get("showOutline"); } diff --git a/src/views/dependencyExplorer.ts b/src/views/dependencyExplorer.ts index adbf6a35..6024c4b8 100644 --- a/src/views/dependencyExplorer.ts +++ b/src/views/dependencyExplorer.ts @@ -35,7 +35,7 @@ export class DependencyExplorer { }); this._dataProvider.onDidChangeTreeData(() => { - if (window.activeTextEditor) { + if (window.activeTextEditor && Settings.syncWithFolderExplorer()) { this.reveal(window.activeTextEditor.document.uri); } }); From bd34afc573d2156b17636d5ab09a07180f05d6bb Mon Sep 17 00:00:00 2001 From: Hanxiao Liu <hanli@microsoft.com> Date: Thu, 3 Jan 2019 17:19:16 +0800 Subject: [PATCH 4/5] Rename layer in icons --- images/dark/icon-flat.svg | 2 +- images/dark/icon-hierarchical.svg | 2 +- images/dark/icon-link.svg | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/images/dark/icon-flat.svg b/images/dark/icon-flat.svg index c9f034d3..e0ff9b23 100644 --- a/images/dark/icon-flat.svg +++ b/images/dark/icon-flat.svg @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> -<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" +<svg version="1.1" id="layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve"> <style type="text/css"> .st0{fill:#2D2D30;} diff --git a/images/dark/icon-hierarchical.svg b/images/dark/icon-hierarchical.svg index 3ce00c96..79d4111b 100644 --- a/images/dark/icon-hierarchical.svg +++ b/images/dark/icon-hierarchical.svg @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> -<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" +<svg version="1.1" id="layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve"> <style type="text/css"> .st0{fill:#2D2D30;} diff --git a/images/dark/icon-link.svg b/images/dark/icon-link.svg index 0a153203..02becc2c 100644 --- a/images/dark/icon-link.svg +++ b/images/dark/icon-link.svg @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <!-- Generator: Adobe Illustrator 22.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> -<svg version="1.1" id="图层_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" +<svg version="1.1" id="layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 16 16" style="enable-background:new 0 0 16 16;" xml:space="preserve"> <style type="text/css"> .st0{fill:#252526;} From 7d7b1be6184747da8af2ff09ef28b63cadf44c11 Mon Sep 17 00:00:00 2001 From: Hanxiao Liu <hanli@microsoft.com> Date: Fri, 4 Jan 2019 10:35:53 +0800 Subject: [PATCH 5/5] Rename commands --- package.json | 12 ++++++------ package.nls.json | 4 ++-- package.nls.zh.json | 4 ++-- src/commands.ts | 4 ++-- src/settings.ts | 12 ++++++------ 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 460cc643..86aa2acc 100644 --- a/package.json +++ b/package.json @@ -67,8 +67,8 @@ } }, { - "command": "java.view.package.syncWithFolderExplorer", - "title": "%contributes.commands.java.view.package.syncWithFolderExplorer%", + "command": "java.view.package.linkWithFolderExplorer", + "title": "%contributes.commands.java.view.package.linkWithFolderExplorer%", "category": "Java", "icon": { "dark": "images/dark/icon-unlink.svg", @@ -76,8 +76,8 @@ } }, { - "command": "java.view.package.desyncWithFolderExplorer", - "title": "%contributes.commands.java.view.package.desyncWithFolderExplorer%", + "command": "java.view.package.unlinkWithFolderExplorer", + "title": "%contributes.commands.java.view.package.unlinkWithFolderExplorer%", "category": "Java", "icon": { "dark": "images/dark/icon-link.svg", @@ -128,12 +128,12 @@ "group": "navigation@1" }, { - "command": "java.view.package.syncWithFolderExplorer", + "command": "java.view.package.linkWithFolderExplorer", "when": "view == javaDependencyExplorer && config.java.dependency.syncWithFolderExplorer != true", "group": "navigation@0" }, { - "command": "java.view.package.desyncWithFolderExplorer", + "command": "java.view.package.unlinkWithFolderExplorer", "when": "view == javaDependencyExplorer && config.java.dependency.syncWithFolderExplorer == true", "group": "navigation@0" } diff --git a/package.nls.json b/package.nls.json index da7c9804..1c1d81b1 100644 --- a/package.nls.json +++ b/package.nls.json @@ -5,8 +5,8 @@ "contributes.commands.java.view.package.changeRepresentation": "Change package representation", "contributes.commands.java.view.package.changeToFlatPackageView":"Change to flat package representation", "contributes.commands.java.view.package.changeToHierarchicalPackageView":"Change to hierarchical package representation", - "contributes.commands.java.view.package.syncWithFolderExplorer":"Synchronize dependency viewer selection with folder explorer", - "contributes.commands.java.view.package.desyncWithFolderExplorer":"Desynchronize dependency viewer selection with folder explorer", + "contributes.commands.java.view.package.linkWithFolderExplorer":"Synchronize dependency viewer selection with folder explorer", + "contributes.commands.java.view.package.unlinkWithFolderExplorer":"Desynchronize dependency viewer selection with folder explorer", "configuration.java.dependency.title": "Java Dependency Configuration", "configuration.java.dependency.showOutline": "Enable show outline in the Java Dependency explorer", "configuration.java.dependency.syncWithFolderExplorer": "Synchronize dependency viewer selection with folder explorer", diff --git a/package.nls.zh.json b/package.nls.zh.json index 130c338d..59dfcef1 100644 --- a/package.nls.zh.json +++ b/package.nls.zh.json @@ -5,8 +5,8 @@ "contributes.commands.java.view.package.changeRepresentation": "更改包展示形式", "contributes.commands.java.view.package.changeToFlatPackageView":"将 Java 包显示方式切换为平行显示", "contributes.commands.java.view.package.changeToHierarchicalPackageView":"将 Java 包显示方式切换为分层显示", - "contributes.commands.java.view.package.syncWithFolderExplorer":"开启 Java 依赖项资源管理器与当前浏览文件的关联", - "contributes.commands.java.view.package.desyncWithFolderExplorer":"关闭 Java 依赖项资源管理器与当前浏览文件的关联", + "contributes.commands.java.view.package.linkWithFolderExplorer":"开启 Java 依赖项资源管理器与当前浏览文件的关联", + "contributes.commands.java.view.package.unlinkWithFolderExplorer":"关闭 Java 依赖项资源管理器与当前浏览文件的关联", "configuration.java.dependency.title": "Java 依赖管理配置", "configuration.java.dependency.showOutline": "在 Java 依赖项资源管理器中显示类成员大纲", "configuration.java.dependency.syncWithFolderExplorer": "在 Java 依赖项资源管理器中同步关联当前打开的文件", diff --git a/src/commands.ts b/src/commands.ts index 84be0879..430fd354 100644 --- a/src/commands.ts +++ b/src/commands.ts @@ -14,9 +14,9 @@ export namespace Commands { export const VIEW_PACKAGE_CHANGETOHIERARCHICALPACKAGEVIEW = "java.view.package.changeToHierarchicalPackageView"; - export const VIEW_PACKAGE_SYNCWITHFOLDER = "java.view.package.syncWithFolderExplorer"; + export const VIEW_PACKAGE_LINKWITHFOLDER = "java.view.package.linkWithFolderExplorer"; - export const VIEW_PACKAGE_DESYNCWITHFOLDER = "java.view.package.desyncWithFolderExplorer"; + export const VIEW_PACKAGE_UNLINKWITHFOLDER = "java.view.package.unlinkWithFolderExplorer"; export const VIEW_PACKAGE_REFRESH = "java.view.package.refresh"; diff --git a/src/settings.ts b/src/settings.ts index 06ded5ed..cd5e4e2f 100644 --- a/src/settings.ts +++ b/src/settings.ts @@ -24,11 +24,11 @@ export class Settings { } })); - context.subscriptions.push(commands.registerCommand(Commands.VIEW_PACKAGE_SYNCWITHFOLDER, - instrumentOperation(Commands.VIEW_PACKAGE_SYNCWITHFOLDER, Settings.syncWithFolderCommand))); + context.subscriptions.push(commands.registerCommand(Commands.VIEW_PACKAGE_LINKWITHFOLDER, + instrumentOperation(Commands.VIEW_PACKAGE_LINKWITHFOLDER, Settings.linkWithFolderCommand))); - context.subscriptions.push(commands.registerCommand(Commands.VIEW_PACKAGE_DESYNCWITHFOLDER, - instrumentOperation(Commands.VIEW_PACKAGE_DESYNCWITHFOLDER, Settings.desyncWithFolderCommand))); + context.subscriptions.push(commands.registerCommand(Commands.VIEW_PACKAGE_UNLINKWITHFOLDER, + instrumentOperation(Commands.VIEW_PACKAGE_UNLINKWITHFOLDER, Settings.unlinkWithFolderCommand))); context.subscriptions.push(commands.registerCommand(Commands.VIEW_PACKAGE_CHANGETOFLATPACKAGEVIEW, instrumentOperation(Commands.VIEW_PACKAGE_CHANGETOFLATPACKAGEVIEW, Settings.changeToFlatPackageView))); @@ -37,11 +37,11 @@ export class Settings { instrumentOperation(Commands.VIEW_PACKAGE_CHANGETOHIERARCHICALPACKAGEVIEW, Settings.changeToHierarchicalPackageView))); } - public static syncWithFolderCommand(): void { + public static linkWithFolderCommand(): void { workspace.getConfiguration().update("java.dependency.syncWithFolderExplorer", true, false); } - public static desyncWithFolderCommand(): void { + public static unlinkWithFolderCommand(): void { workspace.getConfiguration().update("java.dependency.syncWithFolderExplorer", false, false); }