类com.intellij.psi.impl.PsiFileFactoryImpl源码实例Demo

下面列出了怎么用com.intellij.psi.impl.PsiFileFactoryImpl的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: antlr4-intellij-adaptor   文件: Trees.java
public static PsiElement createLeafFromText(Project project, Language language, PsiElement context,
											String text, IElementType type)
{
	PsiFileFactoryImpl factory = (PsiFileFactoryImpl) PsiFileFactory.getInstance(project);
	PsiElement el = factory.createElementFromText(text, language, type, context);
	if ( el==null ) return null;
	return PsiTreeUtil.getDeepestFirst(el); // forces parsing of file!!
	// start rule depends on root passed in
}
 
源代码2 项目: antlr4-intellij-adaptor   文件: Trees.java
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 项目: intellij-plugin-v4   文件: MyPsiUtils.java
public static PsiElement createLeafFromText(Project project, PsiElement context,
											String text, IElementType type)
{
	PsiFileFactoryImpl factory = (PsiFileFactoryImpl)PsiFileFactory.getInstance(project);
	PsiElement el = factory.createElementFromText(text,
												  ANTLRv4Language.INSTANCE,
												  type,
												  context);
	return PsiTreeUtil.getDeepestFirst(el); // forces parsing of file!!
	// start rule depends on root passed in
}
 
源代码4 项目: consulo   文件: LightProjectBuilder.java
@Override
public void registerServices(@Nonnull InjectingContainerBuilder builder) {
  builder.bind(PsiFileFactory.class).to(PsiFileFactoryImpl.class);
  builder.bind(PsiManager.class).to(PsiManagerImpl.class);
  builder.bind(FileIndexFacade.class).to(LightFileIndexFacade.class);
  builder.bind(PsiModificationTracker.class).to(PsiModificationTrackerImpl.class);
}
 
源代码5 项目: intellij-plugin-v4   文件: MyPsiUtils.java
public static PsiFile createFile(Project project, String text) {
	String fileName = "a.g4"; // random name but must be .g4
	PsiFileFactoryImpl factory = (PsiFileFactoryImpl)PsiFileFactory.getInstance(project);
	return factory.createFileFromText(fileName, ANTLRv4Language.INSTANCE,
									  text, false, false);
}
 
 类所在包
 类方法
 同包方法