Search in sources :

Example 11 with AbstractInplaceIntroducer

use of com.intellij.refactoring.introduce.inplace.AbstractInplaceIntroducer in project intellij-community by JetBrains.

the class InplaceIntroduceVariableTest method testConflictingInnerClassName.

public void testConflictingInnerClassName() throws Exception {
    final CodeStyleSettings settings = CodeStyleSettingsManager.getSettings(getProject());
    final boolean oldOption = settings.INSERT_INNER_CLASS_IMPORTS;
    try {
        settings.INSERT_INNER_CLASS_IMPORTS = true;
        doTest(new Pass<AbstractInplaceIntroducer>() {

            @Override
            public void pass(AbstractInplaceIntroducer inplaceIntroduceFieldPopup) {
                type("constants");
            }
        });
    } finally {
        settings.INSERT_INNER_CLASS_IMPORTS = oldOption;
    }
}
Also used : CodeStyleSettings(com.intellij.psi.codeStyle.CodeStyleSettings) AbstractInplaceIntroducer(com.intellij.refactoring.introduce.inplace.AbstractInplaceIntroducer)

Example 12 with AbstractInplaceIntroducer

use of com.intellij.refactoring.introduce.inplace.AbstractInplaceIntroducer in project intellij-community by JetBrains.

the class InplaceIntroduceVariableTest method doTestStopEditing.

private void doTestStopEditing(Pass<AbstractInplaceIntroducer> pass) {
    String name = getTestName(true);
    configureByFile(getBasePath() + name + getExtension());
    final boolean enabled = getEditor().getSettings().isVariableInplaceRenameEnabled();
    try {
        TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
        getEditor().getSettings().setVariableInplaceRenameEnabled(true);
        final AbstractInplaceIntroducer introducer = invokeRefactoring();
        pass.pass(introducer);
        checkResultByFile(getBasePath() + name + "_after" + getExtension());
    } finally {
        TemplateState state = TemplateManagerImpl.getTemplateState(getEditor());
        if (state != null) {
            state.gotoEnd(true);
        }
        getEditor().getSettings().setVariableInplaceRenameEnabled(enabled);
    }
}
Also used : AbstractInplaceIntroducer(com.intellij.refactoring.introduce.inplace.AbstractInplaceIntroducer) TemplateState(com.intellij.codeInsight.template.impl.TemplateState)

Example 13 with AbstractInplaceIntroducer

use of com.intellij.refactoring.introduce.inplace.AbstractInplaceIntroducer in project intellij-community by JetBrains.

the class AbstractInplaceIntroduceTest method doTestEscape.

protected void doTestEscape(Pass<AbstractInplaceIntroducer> pass) {
    String name = getTestName(true);
    configureByFile(getBasePath() + name + getExtension());
    final boolean enabled = getEditor().getSettings().isVariableInplaceRenameEnabled();
    try {
        TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
        getEditor().getSettings().setVariableInplaceRenameEnabled(true);
        final AbstractInplaceIntroducer introducer = invokeRefactoring();
        if (pass != null) {
            pass.pass(introducer);
        }
        TemplateState state = TemplateManagerImpl.getTemplateState(getEditor());
        assert state != null;
        state.gotoEnd(true);
        checkResultByFile(getBasePath() + name + "_after" + getExtension());
    } finally {
        getEditor().getSettings().setVariableInplaceRenameEnabled(enabled);
    }
}
Also used : AbstractInplaceIntroducer(com.intellij.refactoring.introduce.inplace.AbstractInplaceIntroducer) TemplateState(com.intellij.codeInsight.template.impl.TemplateState)

Aggregations

AbstractInplaceIntroducer (com.intellij.refactoring.introduce.inplace.AbstractInplaceIntroducer)13 TemplateState (com.intellij.codeInsight.template.impl.TemplateState)6 PsiClassListCellRenderer (com.intellij.ide.util.PsiClassListCellRenderer)3 Pass (com.intellij.openapi.util.Pass)2 PsiElementProcessor (com.intellij.psi.search.PsiElementProcessor)2 TypeSelectorManagerImpl (com.intellij.refactoring.ui.TypeSelectorManagerImpl)2 ArrayList (java.util.ArrayList)2 NotNull (org.jetbrains.annotations.NotNull)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 TextRange (com.intellij.openapi.util.TextRange)1 CodeStyleSettings (com.intellij.psi.codeStyle.CodeStyleSettings)1 PrepareFailedException (com.intellij.refactoring.extractMethod.PrepareFailedException)1 IncorrectOperationException (com.intellij.util.IncorrectOperationException)1