@@ -11,7 +11,7 @@ import { localize } from "../util/i18nUtil";
1111import { QuickPickItem } from "vscode" ;
1212import { LibertyProject , ProjectProvider } from "./libertyProject" ;
1313import { getReport , filterProjects } from "../util/helperUtil" ;
14- import { COMMAND_TITLES , LIBERTY_MAVEN_PROJECT , LIBERTY_GRADLE_PROJECT , LIBERTY_MAVEN_PROJECT_CONTAINER , LIBERTY_GRADLE_PROJECT_CONTAINER , LIBERTY_SERVER_ENV_PORT_REGEX } from "../definitions/constants" ;
14+ import { COMMAND_TITLES , LIBERTY_SERVER_ENV_PORT_REGEX , isMaven , isGradle , isContainer } from "../definitions/constants" ;
1515import { getGradleTestReport } from "../util/gradleUtil" ;
1616import { DashboardData } from "./dashboard" ;
1717import { ProjectStartCmdParam } from "./projectStartCmdParam" ;
@@ -116,7 +116,7 @@ export async function startDevMode(libProject?: LibertyProject | undefined): Pro
116116 if ( terminal !== undefined ) {
117117 terminal . show ( ) ;
118118 targetProject . setTerminal ( terminal ) ;
119- if ( targetProject . getContextValue ( ) === LIBERTY_MAVEN_PROJECT || targetProject . getContextValue ( ) === LIBERTY_MAVEN_PROJECT_CONTAINER ) {
119+ if ( isMaven ( targetProject . getContextValue ( ) ) ) {
120120 // For multi-module projects, use parent aggregator path
121121 const pomPath = targetProject . parent ? targetProject . parent . getPath ( ) : targetProject . getPath ( ) ;
122122 // Use module selector (-pl) if:
@@ -127,7 +127,7 @@ export async function startDevMode(libProject?: LibertyProject | undefined): Pro
127127 : undefined ;
128128 const cmd = await getCommandForMaven ( pomPath , "io.openliberty.tools:liberty-maven-plugin:dev" , targetProject . getTerminalType ( ) , undefined , artifactId ) ;
129129 terminal . sendText ( cmd ) ; // start dev mode on current project
130- } else if ( targetProject . getContextValue ( ) === LIBERTY_GRADLE_PROJECT || targetProject . getContextValue ( ) === LIBERTY_GRADLE_PROJECT_CONTAINER ) {
130+ } else if ( isGradle ( targetProject . getContextValue ( ) ) ) {
131131 const cmd = await getCommandForGradle ( targetProject . getPath ( ) , "libertyDev" , targetProject . getTerminalType ( ) ) ;
132132 terminal . sendText ( cmd ) ; // start dev mode on current project
133133 }
@@ -290,10 +290,10 @@ export async function attachDebugger(libProject?: LibertyProject | undefined): P
290290
291291 const EXCLUDED_DIR_PATTERN = "**/{bin,classes}/**" ;
292292 let pathPrefix = "" ;
293- if ( targetProject . getContextValue ( ) === LIBERTY_MAVEN_PROJECT || targetProject . getContextValue ( ) === LIBERTY_MAVEN_PROJECT_CONTAINER ) {
293+ if ( isMaven ( targetProject . getContextValue ( ) ) ) {
294294 pathPrefix = "target" ;
295295
296- } else if ( targetProject . getContextValue ( ) === LIBERTY_GRADLE_PROJECT || targetProject . getContextValue ( ) === LIBERTY_GRADLE_PROJECT_CONTAINER ) {
296+ } else if ( isGradle ( targetProject . getContextValue ( ) ) ) {
297297 pathPrefix = "build" ;
298298 }
299299 let paths : string [ ] = [ ] ;
@@ -424,9 +424,9 @@ export async function customDevMode(libProject?: LibertyProject | undefined, par
424424
425425 let placeHolderStr = "" ;
426426 let promptString = localize ( "specify.custom.parms.maven" ) ;
427- if ( targetProject . getContextValue ( ) === LIBERTY_MAVEN_PROJECT || targetProject . getContextValue ( ) === LIBERTY_MAVEN_PROJECT_CONTAINER ) {
427+ if ( isMaven ( targetProject . getContextValue ( ) ) ) {
428428 placeHolderStr = "e.g. -DhotTests=true" ;
429- } else if ( targetProject . getContextValue ( ) === LIBERTY_GRADLE_PROJECT || targetProject . getContextValue ( ) === LIBERTY_GRADLE_PROJECT_CONTAINER ) {
429+ } else if ( isGradle ( targetProject . getContextValue ( ) ) ) {
430430 placeHolderStr = "e.g. --hotTests" ;
431431 promptString = localize ( "specify.custom.parms.gradle" ) ;
432432 }
@@ -460,7 +460,7 @@ export async function customDevMode(libProject?: LibertyProject | undefined, par
460460 await helperUtil . saveStorageData ( projectProvider . getContext ( ) , dashboardData ) ;
461461 }
462462
463- if ( targetProject . getContextValue ( ) === LIBERTY_MAVEN_PROJECT || targetProject . getContextValue ( ) === LIBERTY_MAVEN_PROJECT_CONTAINER ) {
463+ if ( isMaven ( targetProject . getContextValue ( ) ) ) {
464464 // For multi-module projects, use parent aggregator path
465465 const pomPath = targetProject . parent ? targetProject . parent . getPath ( ) : targetProject . getPath ( ) ;
466466 // Use module selector (-pl) if:
@@ -471,7 +471,7 @@ export async function customDevMode(libProject?: LibertyProject | undefined, par
471471 : undefined ;
472472 const cmd = await getCommandForMaven ( pomPath , "io.openliberty.tools:liberty-maven-plugin:dev" , targetProject . getTerminalType ( ) , customCommand , artifactId ) ;
473473 terminal . sendText ( cmd ) ;
474- } else if ( targetProject . getContextValue ( ) === LIBERTY_GRADLE_PROJECT || targetProject . getContextValue ( ) === LIBERTY_GRADLE_PROJECT_CONTAINER ) {
474+ } else if ( isGradle ( targetProject . getContextValue ( ) ) ) {
475475 const cmd = await getCommandForGradle ( targetProject . getPath ( ) , "libertyDev" , targetProject . getTerminalType ( ) , customCommand ) ;
476476 terminal . sendText ( cmd ) ;
477477 }
@@ -514,7 +514,7 @@ export async function startContainerDevMode(libProject?: LibertyProject | undefi
514514 if ( terminal !== undefined ) {
515515 terminal . show ( ) ;
516516 targetProject . setTerminal ( terminal ) ;
517- if ( targetProject . getContextValue ( ) === LIBERTY_MAVEN_PROJECT_CONTAINER ) {
517+ if ( isContainer ( targetProject . getContextValue ( ) ) && isMaven ( targetProject . getContextValue ( ) ) ) {
518518 // For multi-module projects, use parent aggregator path
519519 const pomPath = targetProject . parent ? targetProject . parent . getPath ( ) : targetProject . getPath ( ) ;
520520 // Use module selector (-pl) if:
@@ -525,7 +525,7 @@ export async function startContainerDevMode(libProject?: LibertyProject | undefi
525525 : undefined ;
526526 const cmd = await getCommandForMaven ( pomPath , "io.openliberty.tools:liberty-maven-plugin:devc" , targetProject . getTerminalType ( ) , undefined , artifactId ) ;
527527 terminal . sendText ( cmd ) ;
528- } else if ( targetProject . getContextValue ( ) === LIBERTY_GRADLE_PROJECT_CONTAINER ) {
528+ } else if ( isContainer ( targetProject . getContextValue ( ) ) && isGradle ( targetProject . getContextValue ( ) ) ) {
529529 const cmd = await getCommandForGradle ( targetProject . getPath ( ) , "libertyDevc" , targetProject . getTerminalType ( ) ) ;
530530 terminal . sendText ( cmd ) ;
531531 }
@@ -590,7 +590,7 @@ export async function openReport(reportType: string, libProject?: LibertyProject
590590 reportTypeLabel = "test" ;
591591 }
592592 let showErrorMessage : boolean = true ;
593- if ( targetProject . getContextValue ( ) === LIBERTY_MAVEN_PROJECT || targetProject . getContextValue ( ) === LIBERTY_MAVEN_PROJECT_CONTAINER ) {
593+ if ( isMaven ( targetProject . getContextValue ( ) ) ) {
594594 report = getReportFile ( path , "reports" , reportType + ".html" ) ;
595595 // show the error message only if both "reports" and "site" dirs do not contain the test reports
596596 // set to false since this will be the first location checked
@@ -602,7 +602,7 @@ export async function openReport(reportType: string, libProject?: LibertyProject
602602 showErrorMessage = true ;
603603 await checkReportAndDisplay ( report , reportType , reportTypeLabel , targetProject , showErrorMessage ) ;
604604 }
605- } else if ( targetProject . getContextValue ( ) === LIBERTY_GRADLE_PROJECT || targetProject . getContextValue ( ) === LIBERTY_GRADLE_PROJECT_CONTAINER ) {
605+ } else if ( isGradle ( targetProject . getContextValue ( ) ) ) {
606606 report = await getGradleTestReport ( targetProject . path , path ) ;
607607 await checkReportAndDisplay ( report , reportType , reportTypeLabel , targetProject , showErrorMessage ) ;
608608 }
@@ -687,7 +687,9 @@ Method adds a project which is selected by the user from the list to the liberty
687687export async function addProjectsToTheDashBoard ( projectProvider : ProjectProvider , selection : string ) : Promise < void > {
688688 const result = await projectProvider . addUserSelectedPath ( selection , projectProvider . getProjects ( ) ) ;
689689 const message = localize ( `add.project.manually.message.${ result } ` , selection ) ;
690- ( result !== 0 ) ? console . error ( message ) : console . info ( message ) ; projectProvider . fireChangeEvent ( ) ;
690+ ( result !== 0 ) ? console . error ( message ) : console . info ( message ) ;
691691 vscode . window . showInformationMessage ( message ) ;
692+ // refresh() re-runs full discovery (including hierarchy) and shows the status bar indicator
693+ await projectProvider . refresh ( ) ;
692694 return Promise . resolve ( ) ;
693695}
0 commit comments