void (@NotNull AnActionEvent e) { MavenProjectsManager manager = MavenActionUtil.getProjectsManager(e.getDataContext()); if(manager == null) return; Map<String, MavenProfileKind> selectedProfiles = e.getData(MavenDataKeys.MAVEN_PROFILES); if(selectedProfiles == null) return; Set<String> selectedProfileIds = selectedProfiles.keySet(); MavenProfileKind targetState = getTargetState(manager, selectedProfiles); if(targetState == null) return; MavenExplicitProfiles newExplicitProfiles = manager.getExplicitProfiles().clone(); switch (targetState) { case NONE -> { // disable explicitly newExplicitProfiles.getEnabledProfiles().removeAll(selectedProfileIds); newExplicitProfiles.getDisabledProfiles().addAll(selectedProfileIds); } case EXPLICIT -> { // enable explicitly newExplicitProfiles.getDisabledProfiles().removeAll(selectedProfileIds); newExplicitProfiles.getEnabledProfiles().addAll(selectedProfileIds); } case IMPLICIT -> { // reset to default state newExplicitProfiles.getEnabledProfiles().removeAll(selectedProfileIds); newExplicitProfiles.getDisabledProfiles().removeAll(selectedProfileIds); } } manager.setExplicitProfiles(newExplicitProfiles); }