本文整理匯總了Java中com.intellij.openapi.fileTypes.LanguageFileType.getDefaultExtension方法的典型用法代碼示例。如果您正苦於以下問題:Java LanguageFileType.getDefaultExtension方法的具體用法?Java LanguageFileType.getDefaultExtension怎麽用?Java LanguageFileType.getDefaultExtension使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.openapi.fileTypes.LanguageFileType
的用法示例。
在下文中一共展示了LanguageFileType.getDefaultExtension方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getTaskFileName
import com.intellij.openapi.fileTypes.LanguageFileType; //導入方法依賴的package包/類
@Nullable
private static String getTaskFileName(@NotNull Language language) {
// This is a hacky way to how we should name task file.
// It's assumed that if test's name is capitalized we need to capitalize task file name too.
String testFileName = EduPluginConfigurator.INSTANCE.forLanguage(language).getTestFileName();
boolean capitalize = !testFileName.isEmpty() && Character.isUpperCase(testFileName.charAt(0));
LanguageFileType type = language.getAssociatedFileType();
if (type == null) {
LOG.warn("Failed to create task file name: associated file type for " + language + " is null");
return null;
}
return (capitalize ? StringUtil.capitalize(TASK_NAME) : TASK_NAME) + "." + type.getDefaultExtension();
}
示例2: createFile
import com.intellij.openapi.fileTypes.LanguageFileType; //導入方法依賴的package包/類
public static PsiFile createFile(Project project, Language language, String text) {
LanguageFileType ftype = language.getAssociatedFileType();
if ( ftype==null ) return null;
String ext = ftype.getDefaultExtension();
String fileName = "___fubar___."+ext; // random name but must have correct extension
PsiFileFactoryImpl factory = (PsiFileFactoryImpl)PsiFileFactory.getInstance(project);
return factory.createFileFromText(fileName, language, text, false, false);
}
示例3: createDummyFile
import com.intellij.openapi.fileTypes.LanguageFileType; //導入方法依賴的package包/類
protected PsiFile createDummyFile(String text, final LanguageFileType fileType) {
String ext = fileType.getDefaultExtension();
@NonNls String fileName = "_Dummy_." + ext;
return PsiFileFactory.getInstance(myManager.getProject()).createFileFromText(fileType, fileName, text, 0, text.length());
}