Skip to content

Commit

Permalink
Add LibertyModules.rescan... to scan without clearing the list
Browse files Browse the repository at this point in the history
Signed-off-by: Paul Gooderham <[email protected]>
  • Loading branch information
turkeylurkey committed Jan 15, 2025
1 parent 35c3458 commit f54d739
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions src/main/java/io/openliberty/tools/intellij/LibertyModules.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,22 @@ public synchronized static LibertyModules getInstance() {
}

/**
* Scan the project for the modules that are Liberty apps.
* @return null if there are no Liberty modules
* Remove existing data and scan the project for the modules that are Liberty apps.
* @return this singleton, the list will be empty if there are no Liberty modules
*/
public LibertyModules scanLibertyModules(Project project) {
synchronized (libertyModules) {
removeForProject(project); // remove previous data, if any
return rescanLibertyModules(project);
}
}

/**
* Scan the project for the modules that are Liberty apps and update any existing entries.
* @return this singleton, the list will be empty if there are no Liberty modules
*/
public LibertyModules rescanLibertyModules(Project project) {
synchronized (libertyModules) {
ArrayList<BuildFile> buildFiles = new ArrayList<>();
try {
buildFiles.addAll(LibertyProjectUtil.getMavenBuildFiles(project));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class LibertyRunConfiguration extends ModuleBasedConfiguration<RunConfigu
public LibertyRunConfiguration(Project project, ConfigurationFactory factory, String name) {
super(name, getRunConfigurationModule(project), factory);
// Find Liberty modules here to populate config field called "build file" and avoid NPE
this.libertyModules = LibertyModules.getInstance().scanLibertyModules(project);
this.libertyModules = LibertyModules.getInstance().rescanLibertyModules(project);
}

@NotNull
Expand Down

0 comments on commit f54d739

Please sign in to comment.