Skip to content

Commit

Permalink
Display project name when adding extensions
Browse files Browse the repository at this point in the history
When picking which project to add more extensions to when
you have multiple projects in the same workspace,
the name of the project is now displayed,
instead of just the name of the folder that the project is in.

Fixes redhat-developer#215

Signed-off-by: David Thompson <davthomp@redhat.com>
  • Loading branch information
datho7561 committed Jun 26, 2020
1 parent f423ce9 commit 1e12f62
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
8 changes: 5 additions & 3 deletions src/definitions/ProjectLabelInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ import { WORKSPACE_LABELS_COMMAND_ID } from "./constants";

export class ProjectLabelInfo {
uri: string;
name: string;
labels: ProjectLabel[];
constructor(uri: string, labels: ProjectLabel[]) {
constructor(uri: string, name: string, labels: ProjectLabel[]) {
this.uri = uri;
this.labels = labels;
this.name = name;
}

public getBuildSupport(): BuildSupport|undefined {
Expand Down Expand Up @@ -54,9 +56,9 @@ export class ProjectLabelInfo {
}

public static async getWorkspaceProjectLabelInfo(): Promise<ProjectLabelInfo[]> {
const projectLabels: {uri: string, labels: ProjectLabel[]}[] = await commands.executeCommand("java.execute.workspaceCommand", WORKSPACE_LABELS_COMMAND_ID);
const projectLabels: {uri: string, name: string, labels: ProjectLabel[]}[] = await commands.executeCommand("java.execute.workspaceCommand", WORKSPACE_LABELS_COMMAND_ID);
return projectLabels.map((p) => {
return new ProjectLabelInfo(p.uri, p.labels);
return new ProjectLabelInfo(p.uri, p.name, p.labels);
});
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/utils/workspaceUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ export async function getFilePathsFromFolder(folderPath: string, glob: string):
* Returns an array of `ProjectTypeInfo` containing information for each project
* in the current workspace
*
* @param projectLabel optioanlly specify what project label to retrieve
* @param projectLabel optionally specify what project label to retrieve
*/
export async function getWorkspaceProjectLabels(projectLabel?: ProjectLabel): Promise<ProjectLabelInfo[]> {
const result: ProjectLabelInfo[] = await ProjectLabelInfo.getWorkspaceProjectLabelInfo();
if (!projectLabel) return result;
return result.filter((projectLabelInfo: ProjectLabelInfo) => {
return projectLabelInfo.labels.includes(projectLabel);
});
}
}
4 changes: 2 additions & 2 deletions src/wizards/getQuarkusProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ async function getProjectQuickPickItems(quarkusProjectFolders: ProjectLabelInfo[
return quarkusProjectFolders.map((projectInfo) => {
return {
detail: projectInfo.uri,
label: path.basename(projectInfo.uri),
label: projectInfo.name,
projectLabelInfo: projectInfo
};
});
}
}

0 comments on commit 1e12f62

Please sign in to comment.