本文整理汇总了Java中com.intellij.ide.fileTemplates.FileTemplate.setText方法的典型用法代码示例。如果您正苦于以下问题:Java FileTemplate.setText方法的具体用法?Java FileTemplate.setText怎么用?Java FileTemplate.setText使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ide.fileTemplates.FileTemplate
的用法示例。
在下文中一共展示了FileTemplate.setText方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: restoreTemplate
import com.intellij.ide.fileTemplates.FileTemplate; //导入方法依赖的package包/类
private void restoreTemplate(FileTemplate newTemplate, FileTemplateManager ftm) {
// Restore Old
if (backupTemplate != null) {
newTemplate.setText(backupTemplate.getText());
newTemplate.setExtension(backupTemplate.getExtension());
newTemplate.setLiveTemplateEnabled(backupTemplate.isLiveTemplateEnabled());
newTemplate.setReformatCode(backupTemplate.isReformatCode());
} else {
ftm.removeTemplate(newTemplate);
}
}
示例2: testSurroundWithTryCatchProperties
import com.intellij.ide.fileTemplates.FileTemplate; //导入方法依赖的package包/类
public void testSurroundWithTryCatchProperties() {
FileTemplate template = FileTemplateManager.getInstance(getProject()).getCodeTemplate(JavaTemplateUtil.TEMPLATE_CATCH_BODY);
String old = template.getText();
template.setText("// ${DS} \n" +
"${EXCEPTION}.printStackTrace();");
try {
doTest(new JavaWithTryCatchSurrounder());
}
finally {
template.setText(old);
}
}
示例3: testSchemas
import com.intellij.ide.fileTemplates.FileTemplate; //导入方法依赖的package包/类
public void testSchemas() throws Exception {
assertEquals(FileTemplatesScheme.DEFAULT, myTemplateManager.getCurrentScheme());
FileTemplate template = myTemplateManager.getTemplate(TEST_TEMPLATE_TXT);
assertEquals(HI_THERE, template.getText());
String newText = "good bye";
template.setText(newText);
assertEquals(newText, myTemplateManager.getTemplate(TEST_TEMPLATE_TXT).getText());
myTemplateManager.setCurrentScheme(myTemplateManager.getProjectScheme());
assertEquals(HI_THERE, myTemplateManager.getTemplate(TEST_TEMPLATE_TXT).getText());
myTemplateManager.setCurrentScheme(FileTemplatesScheme.DEFAULT);
assertEquals(newText, myTemplateManager.getTemplate(TEST_TEMPLATE_TXT).getText());
}
示例4: testSurviveOnProjectReopen
import com.intellij.ide.fileTemplates.FileTemplate; //导入方法依赖的package包/类
public void testSurviveOnProjectReopen() throws Exception {
File foo = PlatformTestCase.createTempDir("foo");
Project reloaded = null;
final Project project = ProjectManager.getInstance().createProject("foo", foo.getPath());;
try {
assertNotNull(project);
FileTemplateManager manager = FileTemplateManager.getInstance(project);
manager.setCurrentScheme(manager.getProjectScheme());
FileTemplate template = manager.getTemplate(TEST_TEMPLATE_TXT);
assertEquals(HI_THERE, template.getText());
String newText = "good bye";
template.setText(newText);
assertEquals(newText, manager.getTemplate(TEST_TEMPLATE_TXT).getText());
PlatformTestUtil.saveProject(project);
closeProject(project);
reloaded = ProjectManager.getInstance().loadAndOpenProject(foo.getPath());
assertNotNull(reloaded);
manager = FileTemplateManager.getInstance(reloaded);
assertEquals(manager.getProjectScheme(), manager.getCurrentScheme());
//manager.setCurrentScheme(FileTemplatesScheme.DEFAULT);
//manager.setCurrentScheme(manager.getProjectScheme()); // enforce reloading
assertEquals(newText, manager.getTemplate(TEST_TEMPLATE_TXT).getText());
}
finally {
closeProject(project);
closeProject(reloaded);
}
}
示例5: testTemplateAttributesExpansionInCreatedDestinationModule
import com.intellij.ide.fileTemplates.FileTemplate; //导入方法依赖的package包/类
public void testTemplateAttributesExpansionInCreatedDestinationModule() {
final FileTemplateManager instance = FileTemplateManager.getInstance(myFixture.getProject());
final FileTemplate template = instance.getInternalTemplate("Python Script");
assertNotNull(template);
final String oldTemplateContent = template.getText();
try {
template.setText("NAME = '${NAME}'");
doMoveSymbolTest("C", "b.py");
}
finally {
template.setText(oldTemplateContent);
}
}
示例6: createFileFromTemplate
import com.intellij.ide.fileTemplates.FileTemplate; //导入方法依赖的package包/类
@Override
protected PsiFile createFileFromTemplate(String s, FileTemplate template, PsiDirectory directory) {
template.setExtension("php");
template.setText(BxCore.loadTemplate(template.getName()));
return super.createFileFromTemplate(s, template, directory);
}