This commit is contained in:
Yan Zhang 2017-12-05 16:31:37 +08:00
Родитель bef633f5dc
Коммит a89cc86a50
6 изменённых файлов: 18 добавлений и 12 удалений

Просмотреть файл

@ -18,6 +18,7 @@ All notable changes to the "vscode-maven" extension will be documented in this f
- [0.0.1](#001)
## Unreleased
- Support to import all projects under specified folder.
## Released
### 0.2.1

Просмотреть файл

@ -23,15 +23,20 @@ Maven installed and PATH added, i.e., `mvn` command can be executed directly in
![Screenshot](images/view_context.png)
* If you want to add project whose `pom.xml` is elsewhere not in the workspace, you can `right-click` on the `pom.xml`, select `Pin to Maven Project Explorer`. The extension will force to show the corresponding project in sidebar.
* If you want to add a project whose `pom.xml` is elsewhere not in the workspace, you have multiple ways to import it.
* `right-click` on the `pom.xml`, select `Import Maven Project`. The extension will force to show the corresponding project in sidebar.
* Or simply click the `+` button, and select a `pom.xml` in a system dialog.
* Or you just want to search `pom.xml` files recursively and import all of them. Then click the folder-shaped button beside.
![Screenshot](images/explorer_context.png)
In fact, the extension simply adds the pom.xml absolute path in your `Workspace Settings`, and then refreshes the whole view.
In fact, the extension imports a Maven project by adding its absolute path in your `Workspace Settings`, and then refreshes the whole view.
```
{
"maven.projects.pinnedPomPaths": [
"c:\\path-to-project\\a\\generated.from.archetype\\pom.xml"
"c:\\path-to-project\\pom.xml"
]
}
```

Двоичные данные
images/explorer_context.png

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 25 KiB

После

Ширина:  |  Высота:  |  Размер: 21 KiB

Просмотреть файл

@ -35,7 +35,7 @@
"onCommand:maven.goal.deploy",
"onCommand:maven.goal.custom",
"onCommand:maven.project.effectivePom",
"onCommand:maven.project.pinProject",
"onCommand:maven.project.import",
"onCommand:maven.project.openPom",
"onCommand:maven.archetype.generate",
"onView:mavenProjects"
@ -108,7 +108,7 @@
"category": "Maven"
},
{
"command": "maven.project.pinProject",
"command": "maven.project.import",
"title": "Import Maven Project",
"category": "Maven",
"icon": {
@ -156,7 +156,7 @@
"group": "maven@1"
},
{
"command": "maven.project.pinProject",
"command": "maven.project.import",
"when": "resourceFilename == pom.xml",
"group": "maven@0"
}
@ -173,7 +173,7 @@
"group": "navigation@1"
},
{
"command": "maven.project.pinProject",
"command": "maven.project.import",
"when": "view == mavenProjects",
"group": "navigation@0"
}

Просмотреть файл

@ -188,7 +188,7 @@ export class ProjectDataProvider implements TreeDataProvider<TreeItem> {
}
}
public async pinProject(entry: Uri | undefined): Promise<void> {
public async importProject(entry: Uri | undefined): Promise<void> {
let currentPomXml: string = null;
if (!entry) {
entry = await VSCodeUI.openDialogForFile({ filters: { "POM File": ["xml"] }, openLabel: "Import" });
@ -209,7 +209,7 @@ export class ProjectDataProvider implements TreeDataProvider<TreeItem> {
}
}
public async searchAndPinProjects(): Promise<void> {
public async searchAndImportProjects(): Promise<void> {
const res: Uri = await VSCodeUI.openDialogForFolder({openLabel: "Import All"});
if (res && res.fsPath) {
const foundPomXmls: string[] = await Utils.findAllInDir(res.fsPath, "pom.xml", 99);

Просмотреть файл

@ -30,8 +30,8 @@ export function activate(context: vscode.ExtensionContext): void {
mavenProjectsTreeDataProvider.customGoal(item);
}));
context.subscriptions.push(vscode.commands.registerCommand("maven.project.pinProject", (entry: Uri | undefined) => {
mavenProjectsTreeDataProvider.pinProject(entry);
context.subscriptions.push(vscode.commands.registerCommand("maven.project.import", (entry: Uri | undefined) => {
mavenProjectsTreeDataProvider.importProject(entry);
}));
context.subscriptions.push(vscode.commands.registerCommand("maven.project.openPom", (item: ProjectItem | undefined) => {
@ -45,7 +45,7 @@ export function activate(context: vscode.ExtensionContext): void {
}));
context.subscriptions.push(vscode.commands.registerCommand("maven.project.importAll", () => {
mavenProjectsTreeDataProvider.searchAndPinProjects();
mavenProjectsTreeDataProvider.searchAndImportProjects();
}));
context.subscriptions.push(vscode.window.onDidCloseTerminal((closedTerminal: vscode.Terminal) => {