use of com.intellij.codeInsight.template.impl.TemplateState in project intellij-community by JetBrains.
the class JavaSurroundWithTest method doTestWithTemplateFinish.
private void doTestWithTemplateFinish(@NotNull String fileName, Surrounder surrounder, @Nullable String textToType) {
TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
configureByFile(BASE_PATH + fileName + ".java");
SurroundWithHandler.invoke(getProject(), getEditor(), getFile(), surrounder);
if (textToType != null) {
type(textToType);
}
TemplateState templateState = TemplateManagerImpl.getTemplateState(getEditor());
assertNotNull(templateState);
templateState.nextTab();
checkResultByFile(BASE_PATH + fileName + "_after.java");
}
use of com.intellij.codeInsight.template.impl.TemplateState in project intellij-community by JetBrains.
the class DelegateWithDefaultParamValueTest method doAction.
@Override
protected void doAction(@NotNull ActionHint actionHint, String testFullPath, String testName) throws Exception {
TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
super.doAction(actionHint, testFullPath, testName);
if (actionHint.shouldPresent()) {
TemplateState state = TemplateManagerImpl.getTemplateState(getEditor());
if (state != null) {
state.gotoEnd(false);
}
}
}
use of com.intellij.codeInsight.template.impl.TemplateState in project intellij-community by JetBrains.
the class AddMissingRequiredAnnotationParametersTest method testValueTyping.
public void testValueTyping() {
configureByFile(getBasePath() + "/beforeValueTyping.java");
TemplateManagerImpl.setTemplateTesting(getProject(), getTestRootDisposable());
doAction("Add missing annotation parameters - value3, value2, value1");
final TemplateState state = TemplateManagerImpl.getTemplateState(getEditor());
assertNotNull(state);
type("\"value33\"");
state.nextTab();
type("\"value22\"");
state.nextTab();
type("\"value11\"");
state.nextTab();
assertTrue(state.isFinished());
checkResultByFile(getBasePath() + "/afterValueTyping.java");
}
use of com.intellij.codeInsight.template.impl.TemplateState in project intellij-community by JetBrains.
the class InstanceofPostfixTemplateTest method testSingleExpressionTemplate.
public void testSingleExpressionTemplate() {
TemplateManagerImpl.setTemplateTesting(getProject(), myFixture.getTestRootDisposable());
myFixture.configureByFile(getTestName(true) + ".java");
myFixture.type('\t');
TemplateState templateState = TemplateManagerImpl.getTemplateState(myFixture.getEditor());
assertNotNull(templateState);
assertFalse(templateState.isFinished());
myFixture.type("Integer");
templateState.nextTab();
assertTrue(templateState.isFinished());
myFixture.checkResultByFile(getTestName(true) + "_after.java", true);
}
use of com.intellij.codeInsight.template.impl.TemplateState in project intellij-plugins by JetBrains.
the class DartIntroduceTestBase method doTestInplace.
protected void doTestInplace(@Nullable Consumer<DartIntroduceOperation> customization) {
String name = getTestName(false);
myFixture.configureByFile(name + getFileExtension());
final boolean enabled = myFixture.getEditor().getSettings().isVariableInplaceRenameEnabled();
try {
TemplateManagerImpl.setTemplateTesting(getProject(), myFixture.getTestRootDisposable());
myFixture.getEditor().getSettings().setVariableInplaceRenameEnabled(true);
DartIntroduceHandler handler = createHandler();
final DartIntroduceOperation introduceOperation = new DartIntroduceOperation(myFixture.getProject(), myFixture.getEditor(), myFixture.getFile(), "a");
introduceOperation.setReplaceAll(true);
if (customization != null) {
customization.consume(introduceOperation);
}
handler.performAction(introduceOperation);
TemplateState state = TemplateManagerImpl.getTemplateState(myFixture.getEditor());
assert state != null;
state.gotoEnd(false);
myFixture.checkResultByFile(name + ".after" + getFileExtension(), true);
} finally {
myFixture.getEditor().getSettings().setVariableInplaceRenameEnabled(enabled);
}
}
Aggregations