void (BaseInjection other) { final String displayName = myNameTextField.getText(); if (StringUtil.isEmpty(displayName)) { throw new IllegalArgumentException("Display name should not be empty"); } other.setDisplayName(displayName); boolean enabled = true; final StringBuilder sb = new StringBuilder(); final ArrayList<InjectionPlace> places = new ArrayList<>(); for (String s : myTextArea.getText().split("\\s*\n\\s*")) { final boolean nextEnabled; if (s.startsWith("+")) { nextEnabled = true; s = s.substring(1).trim(); } else if (s.startsWith("-")) { nextEnabled = false; s = s.substring(1).trim(); } else { sb.append(s.trim()); continue; } if (sb.length() > 0) { final String text = sb.toString(); places.add(new InjectionPlace(myHelper.compileElementPattern(text), enabled)); sb.setLength(0); } sb.append(s); enabled = nextEnabled; } if (sb.length() > 0) { final String text = sb.toString(); places.add(new InjectionPlace(myHelper.compileElementPattern(text), enabled)); } for (InjectionPlace place : places) { ElementPattern<? extends PsiElement> pattern = place.getElementPattern(); if (pattern instanceof PatternCompilerImpl.LazyPresentablePattern) { try { ((PatternCompilerImpl.LazyPresentablePattern<?>)pattern).compile(); } catch (Throwable ex) { throw new IllegalArgumentException("Pattern failed to compile:", ex); } } } other.setInjectionPlaces(places.toArray(InjectionPlace.EMPTY_ARRAY)); }