@Nullable
 private static InjectionPlace[] dropKnownInvalidPlaces(InjectionPlace[] places) {
   InjectionPlace[] result = places;
   for (InjectionPlace place : places) {
     if (place.getText().contains("matches(\"[^${}/\\\\]+\")")) {
       result = ArrayUtil.remove(result, place);
     }
   }
   return places.length != 0 && result.length == 0 ? null : result;
 }
 private static MultiValuesMap<String, BaseInjection> createInjectionMap(
     final Collection<BaseInjection> injections) {
   final MultiValuesMap<String, BaseInjection> existingMap =
       new MultiValuesMap<String, BaseInjection>();
   for (BaseInjection injection : injections) {
     for (InjectionPlace place : injection.getInjectionPlaces()) {
       existingMap.put(place.getText(), injection);
     }
   }
   return existingMap;
 }
 public boolean setHostInjectionEnabled(
     final PsiLanguageInjectionHost host,
     final Collection<String> languages,
     final boolean enabled) {
   final ArrayList<BaseInjection> originalInjections = new ArrayList<BaseInjection>();
   final ArrayList<BaseInjection> newInjections = new ArrayList<BaseInjection>();
   for (String supportId : getAllInjectorIds()) {
     for (BaseInjection injection : getInjections(supportId)) {
       if (!languages.contains(injection.getInjectedLanguageId())) continue;
       boolean replace = false;
       final ArrayList<InjectionPlace> newPlaces = new ArrayList<InjectionPlace>();
       for (InjectionPlace place : injection.getInjectionPlaces()) {
         if (place.isEnabled() != enabled
             && place.getElementPattern() != null
             && (place.getElementPattern().accepts(host)
                 || place.getElementPattern().accepts(host.getParent()))) {
           newPlaces.add(new InjectionPlace(place.getText(), place.getElementPattern(), enabled));
           replace = true;
         } else newPlaces.add(place);
       }
       if (replace) {
         originalInjections.add(injection);
         final BaseInjection newInjection = injection.copy();
         newInjection.getInjectionPlaces().clear();
         newInjection.getInjectionPlaces().addAll(newPlaces);
         newInjections.add(newInjection);
       }
     }
   }
   if (!originalInjections.isEmpty()) {
     replaceInjectionsWithUndo(
         host.getProject(),
         newInjections,
         originalInjections,
         Collections.<PsiElement>emptyList());
     return true;
   }
   return false;
 }