use of com.intellij.execution.configurations.RefactoringListenerProvider in project intellij-community by JetBrains.
the class RunConfigurationRefactoringElementListenerProvider method getListener.
@Override
public RefactoringElementListener getListener(final PsiElement element) {
RefactoringElementListenerComposite composite = null;
final List<RunConfiguration> configurations = RunManager.getInstance(element.getProject()).getAllConfigurationsList();
for (RunConfiguration configuration : configurations) {
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;
}
Aggregations