Java Code Examples for com.intellij.ide.fileTemplates.FileTemplate#getExtension()

The following examples show how to use com.intellij.ide.fileTemplates.FileTemplate#getExtension() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: XQueryCreateFromTemplateHandler.java    From intellij-xquery with Apache License 2.0 5 votes vote down vote up
private String getExtension(FileTemplate template, XQuerySettings settings) {
    String extension = template.getExtension();
    if (MAIN_MODULE.equals(template.getName()) && settings.getDefaultMainModuleExtension() != null) {
        extension = settings.getDefaultMainModuleExtension();
    } else if (LIBRARY_MODULE.equals(template.getName()) && settings.getDefaultLibraryModuleExtension() != null) {
        extension = settings.getDefaultLibraryModuleExtension();
    }
    return extension;
}
 
Example 2
Source File: FileReferenceQuickFixProvider.java    From consulo with Apache License 2.0 5 votes vote down vote up
private FileTemplate findTemplate(FileTemplateManager fileTemplateManager) {
  FileTemplate template = fileTemplateManager.getTemplate(myNewFileTemplateName);
  if (template == null) template = fileTemplateManager.findInternalTemplate(myNewFileTemplateName);
  if (template == null) {
    for (FileTemplate fileTemplate : fileTemplateManager.getAllJ2eeTemplates()) {
      final String fileTemplateWithExtension = fileTemplate.getName() + '.' + fileTemplate.getExtension();
      if (fileTemplateWithExtension.equals(myNewFileTemplateName)) {
        return fileTemplate;
      }
    }
  }
  return template;
}
 
Example 3
Source File: FileTemplateTabAsTree.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void selectTemplate(FileTemplate template) {
  String name = template.getName();
  if (template.getExtension().length() > 0) {
    name += "." + template.getExtension();
  }

  final FileTemplateNode node = (FileTemplateNode)TreeUtil.findNodeWithObject(myRoot, name);
  if (node != null) {
    TreeUtil.selectNode(myTree, node);
    onTemplateSelected(); // this is important because we select different Template for the same node
  }
}