use of com.intellij.psi.PsiImportStaticStatement in project intellij-community by JetBrains.
the class InlineStaticImportHandler method inlineElement.
@Override
public void inlineElement(Project project, Editor editor, PsiElement element) {
final PsiImportStaticStatement staticStatement = PsiTreeUtil.getParentOfType(element, PsiImportStaticStatement.class);
final List<PsiJavaCodeReferenceElement> referenceElements = collectReferencesThrough(element.getContainingFile(), null, staticStatement);
RefactoringEventData data = new RefactoringEventData();
data.addElement(element);
project.getMessageBus().syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC).refactoringStarted(REFACTORING_ID, data);
new WriteCommandAction(project, REFACTORING_NAME) {
@Override
protected void run(@NotNull Result result) throws Throwable {
replaceAllAndDeleteImport(referenceElements, null, staticStatement);
}
}.execute();
project.getMessageBus().syncPublisher(RefactoringEventListener.REFACTORING_EVENT_TOPIC).refactoringDone(REFACTORING_ID, null);
}
Aggregations