boolean (final PsiLanguageInjectionHost host, final Collection<String> languages, final boolean enabled) { List<BaseInjection> originalInjections = new ArrayList<>(); List<BaseInjection> newInjections = new ArrayList<>(); for (LanguageInjectionSupport support : InjectorUtils.getActiveInjectionSupports()) { for (BaseInjection injection : getInjections(support.getId())) { if (!languages.contains(injection.getInjectedLanguageId())) continue; boolean replace = false; final ArrayList<InjectionPlace> newPlaces = new ArrayList<>(); for (InjectionPlace place : injection.getInjectionPlaces()) { if (place.isEnabled() != enabled && place.getElementPattern() != null && (place.getElementPattern().accepts(host) || place.getElementPattern().accepts(host.getParent()))) { newPlaces.add(place.enabled(enabled)); replace = true; } else newPlaces.add(place); } if (replace) { originalInjections.add(injection); final BaseInjection newInjection = injection.copy(); newInjection.setInjectionPlaces(newPlaces.toArray(InjectionPlace.EMPTY_ARRAY)); newInjections.add(newInjection); } } } if (!originalInjections.isEmpty()) { replaceInjectionsWithUndo(host.getProject(), host.getContainingFile(), newInjections, originalInjections, Collections.emptyList()); return true; } return false; }