Search in sources :

Example 1 with InlineRefactoringActionHandler

use of com.intellij.refactoring.inline.InlineRefactoringActionHandler in project intellij-community by JetBrains.

the class DaemonRespondToChangesTest method testRehighlightInnerBlockAfterInline.

public void testRehighlightInnerBlockAfterInline() throws Exception {
    configureByFile(BASE_PATH + getTestName(false) + ".java");
    Collection<HighlightInfo> errors = highlightErrors();
    HighlightInfo error = assertOneElement(errors);
    assertEquals("Variable 'e' is already defined in the scope", error.getDescription());
    PsiElement element = getFile().findElementAt(getEditor().getCaretModel().getOffset()).getParent();
    DataContext dataContext = SimpleDataContext.getSimpleContext(CommonDataKeys.PSI_ELEMENT.getName(), element, ((EditorEx) getEditor()).getDataContext());
    new InlineRefactoringActionHandler().invoke(getProject(), getEditor(), getFile(), dataContext);
    Collection<HighlightInfo> afterTyping = highlightErrors();
    assertEmpty(afterTyping);
}
Also used : SimpleDataContext(com.intellij.openapi.actionSystem.impl.SimpleDataContext) DataContext(com.intellij.openapi.actionSystem.DataContext) InlineRefactoringActionHandler(com.intellij.refactoring.inline.InlineRefactoringActionHandler)

Example 2 with InlineRefactoringActionHandler

use of com.intellij.refactoring.inline.InlineRefactoringActionHandler in project intellij-community by JetBrains.

the class InlineAction method getHandler.

@Override
protected RefactoringActionHandler getHandler(@NotNull Language language, PsiElement element) {
    RefactoringActionHandler handler = super.getHandler(language, element);
    if (handler != null)
        return handler;
    List<InlineHandler> handlers = InlineHandlers.getInlineHandlers(language);
    return handlers.isEmpty() ? null : new InlineRefactoringActionHandler();
}
Also used : InlineRefactoringActionHandler(com.intellij.refactoring.inline.InlineRefactoringActionHandler) RefactoringActionHandler(com.intellij.refactoring.RefactoringActionHandler) InlineRefactoringActionHandler(com.intellij.refactoring.inline.InlineRefactoringActionHandler) InlineHandler(com.intellij.lang.refactoring.InlineHandler)

Aggregations

InlineRefactoringActionHandler (com.intellij.refactoring.inline.InlineRefactoringActionHandler)2 InlineHandler (com.intellij.lang.refactoring.InlineHandler)1 DataContext (com.intellij.openapi.actionSystem.DataContext)1 SimpleDataContext (com.intellij.openapi.actionSystem.impl.SimpleDataContext)1 RefactoringActionHandler (com.intellij.refactoring.RefactoringActionHandler)1