RefactoringElementListener (final PsiElement element) { RefactoringElementListenerComposite composite = null; for (RunConfiguration configuration : RunManager.getInstance(element.getProject()).getAllConfigurationsList()) { if (configuration instanceof RefactoringListenerProvider) { // todo: perhaps better way to handle listeners? RefactoringElementListener listener; try { listener = ((RefactoringListenerProvider)configuration).getRefactoringElementListener(element); } catch (Exception e) { LOG.error(e); continue; } if (listener != null) { if (configuration instanceof LocatableConfiguration) { listener = new NameGeneratingListenerDecorator((LocatableConfiguration)configuration, listener); } if (composite == null) { composite = new RefactoringElementListenerComposite(); } composite.addListener(listener); } } } return composite; }