mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
crash proof
This commit is contained in:
+11
-1
@@ -18,6 +18,7 @@ package com.intellij.execution.impl;
|
||||
import com.intellij.execution.RunManager;
|
||||
import com.intellij.execution.configurations.RefactoringListenerProvider;
|
||||
import com.intellij.execution.configurations.RunConfiguration;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.refactoring.listeners.RefactoringElementListener;
|
||||
import com.intellij.refactoring.listeners.RefactoringElementListenerComposite;
|
||||
@@ -27,13 +28,22 @@ import com.intellij.refactoring.listeners.RefactoringElementListenerProvider;
|
||||
* @author spleaner
|
||||
*/
|
||||
public class RunConfigurationRefactoringElementListenerProvider implements RefactoringElementListenerProvider {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.execution.impl.RunConfigurationRefactoringElementListenerProvider");
|
||||
|
||||
public RefactoringElementListener getListener(final PsiElement element) {
|
||||
RefactoringElementListenerComposite composite = null;
|
||||
final RunConfiguration[] configurations = RunManager.getInstance(element.getProject()).getAllConfigurations();
|
||||
|
||||
for (RunConfiguration configuration : configurations) {
|
||||
if (configuration instanceof RefactoringListenerProvider) { // todo: perhaps better way to handle listeners?
|
||||
final RefactoringElementListener listener = ((RefactoringListenerProvider)configuration).getRefactoringElementListener(element);
|
||||
final RefactoringElementListener listener;
|
||||
try {
|
||||
listener = ((RefactoringListenerProvider)configuration).getRefactoringElementListener(element);
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error(e);
|
||||
continue;
|
||||
}
|
||||
if (listener != null) {
|
||||
if (composite == null) {
|
||||
composite = new RefactoringElementListenerComposite();
|
||||
|
||||
Reference in New Issue
Block a user