IEP-922 Original Launch Configuration disappears after creating the new one.#851
IEP-922 Original Launch Configuration disappears after creating the new one.#851kolipakakondal merged 1 commit intomasterfrom
Conversation
WalkthroughThe Changes
Poem
TipsChat with CodeRabbit Bot (
|
| IProject project = descriptor.getAdapter(IProject.class); | ||
| if (project != null) | ||
| { | ||
| Map<String, ILaunchConfiguration> projectConfigs = configs.get(project); | ||
| if (projectConfigs == null) | ||
| { | ||
| projectConfigs = new HashMap<>(); | ||
| configs.put(project, projectConfigs); | ||
| } | ||
|
|
||
| String targetConfig = descriptor.getName(); | ||
| configuration = projectConfigs.get(targetConfig); | ||
| configuration = configs.computeIfAbsent(project, key -> new HashMap<>()).get(targetConfig); | ||
| if (configuration == null) | ||
| { | ||
| // do we already have one with the descriptor? |
There was a problem hiding this comment.
Note: This review was outside of the patch, so it was mapped to the patch with the greatest overlap. Original lines [27-42]
The computeIfAbsent method is used to simplify the initialization and retrieval of launch configurations. This is a good use of Java 8's Map API and improves the readability of the code.
| } | ||
| if (configuration.exists()) | ||
| { | ||
| Map<String, ILaunchConfiguration> projectConfigs = configs.get(project); | ||
| if (projectConfigs == null) | ||
| { | ||
| projectConfigs = new HashMap<>(); | ||
| configs.put(project, projectConfigs); | ||
| } | ||
|
|
||
| projectConfigs.put(configuration.getName(), configuration); | ||
| configs.computeIfAbsent(project, key -> new HashMap<>()).put(configuration.getName(), configuration); | ||
| } |
There was a problem hiding this comment.
The computeIfAbsent method is used to simplify the initialization and storage of launch configurations. This is a good use of Java 8's Map API and improves the readability of the code.
|
@sigmaaa hi! Tested under: LGTM 👍 |
Description
Looks like
launchBarManager.launchObjectRemoved(projectEntry.getKey());is not necessary to call fromlaunchConfigurationRemovedmethod. It was added in IEP-442 PR. I've tested the mentioned test cases there and looks fine without these changes, so I removed this override method.Also, I've made small refactoring by using computeIfAbsence to make other methods more clear
Fixes # (IEP-922)
Type of change
Please delete options that are not relevant.
How has this been tested?
Test 1:
Test 2:
Test Configuration:
Dependent components impacted by this PR:
Checklist
Summary by CodeRabbit