当前位置: 首页>>代码示例>>Java>>正文


Java IFileElementType类代码示例

本文整理汇总了Java中com.intellij.psi.tree.IFileElementType的典型用法代码示例。如果您正苦于以下问题:Java IFileElementType类的具体用法?Java IFileElementType怎么用?Java IFileElementType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IFileElementType类属于com.intellij.psi.tree包,在下文中一共展示了IFileElementType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: canHaveStub

import com.intellij.psi.tree.IFileElementType; //导入依赖的package包/类
@Override
public boolean canHaveStub(VirtualFile file) {
  final FileType fileType = file.getFileType();
  if (fileType instanceof LanguageFileType) {
    Language l = ((LanguageFileType)fileType).getLanguage();
    ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(l);
    if (parserDefinition == null) return false;
    final IFileElementType elementType = parserDefinition.getFileNodeType();
    return elementType instanceof IStubFileElementType && ((IStubFileElementType)elementType).shouldBuildStubFor(file);
  }
  else if (fileType.isBinary()) {
    final BinaryFileStubBuilder builder = BinaryFileStubBuilders.INSTANCE.forFileType(fileType);
    return builder != null && builder.acceptsFile(file);
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CoreStubTreeLoader.java

示例2: getCumulativeVersion

import com.intellij.psi.tree.IFileElementType; //导入依赖的package包/类
public static int getCumulativeVersion() {
  int version = VERSION;
  for (final FileType fileType : FileTypeRegistry.getInstance().getRegisteredFileTypes()) {
    if (fileType instanceof LanguageFileType) {
      Language l = ((LanguageFileType)fileType).getLanguage();
      ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(l);
      if (parserDefinition != null) {
        final IFileElementType type = parserDefinition.getFileNodeType();
        if (type instanceof IStubFileElementType) {
          version += ((IStubFileElementType)type).getStubVersion();
        }
      }
    }

    BinaryFileStubBuilder builder = BinaryFileStubBuilders.INSTANCE.forFileType(fileType);
    if (builder != null) {
      version += builder.getStubVersion();
    }
  }
  return version;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:CumulativeStubVersion.java

示例3: canHaveStub

import com.intellij.psi.tree.IFileElementType; //导入依赖的package包/类
public static boolean canHaveStub(@NotNull VirtualFile file) {
  final FileType fileType = file.getFileType();
  if (fileType instanceof LanguageFileType) {
    final Language l = ((LanguageFileType)fileType).getLanguage();
    final ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(l);
    if (parserDefinition == null) {
      return false;
    }

    final IFileElementType elementType = parserDefinition.getFileNodeType();
    if (elementType instanceof IStubFileElementType) {
      if (((IStubFileElementType)elementType).shouldBuildStubFor(file)) {
        return true;
      }
      if (IndexingStamp.isFileIndexedStateCurrent(file, INDEX_ID)) {
        return true;
      }
    }
  }
  final BinaryFileStubBuilder builder = BinaryFileStubBuilders.INSTANCE.forFileType(fileType);
  return builder != null && builder.acceptsFile(file);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:StubUpdatingIndex.java

示例4: createLanguageBindings

import com.intellij.psi.tree.IFileElementType; //导入依赖的package包/类
/**
 * Creates the IDEA language object associated with the specified language.
 *
 * @param language
 *            The language.
 * @return The created IDEA language.
 */
private LanguageBindings createLanguageBindings(final ILanguage language) {
    final MetaborgIdeaLanguage ideaLanguage = createIdeaLanguage(language);
    final MetaborgLanguageFileType fileType = createFileType(ideaLanguage);
    final SpoofaxTokenTypeManager tokenTypeManager = createTokenTypeManager(ideaLanguage);
    final IFileElementType fileElementType = createFileElementType(ideaLanguage, tokenTypeManager);
    final ParserDefinition parserDefinition = createParserDefinition(fileType, fileElementType);
    final SpoofaxSyntaxHighlighterFactory syntaxHighlighterFactory = createSyntaxHighlighterFactory();

    final InstanceLanguageExtensionPoint<?> parserDefinitionExtension =
        new InstanceLanguageExtensionPoint<>(ExtensionIds.ParserDefinition, ideaLanguage, parserDefinition);
    final InstanceSyntaxHighlighterFactoryExtensionPoint syntaxHighlighterFactoryExtension =
        new InstanceSyntaxHighlighterFactoryExtensionPoint(ideaLanguage, syntaxHighlighterFactory);
    final InstanceLanguageExtensionPoint<?> externalAnnotatorExtension = new InstanceLanguageExtensionPoint<>(
        ExtensionIds.ExternalAnnotator, ideaLanguage, this.metaborgSourceAnnotator);

    return new LanguageBindings(tokenTypeManager, fileType, parserDefinitionExtension,
        syntaxHighlighterFactoryExtension, externalAnnotatorExtension);
}
 
开发者ID:metaborg,项目名称:spoofax-intellij,代码行数:26,代码来源:DefaultIdeaLanguageManager.java

示例5: canHaveStub

import com.intellij.psi.tree.IFileElementType; //导入依赖的package包/类
public static boolean canHaveStub(@NotNull VirtualFile file) {
  final FileType fileType = file.getFileType();
  if (fileType instanceof LanguageFileType) {
    final Language l = ((LanguageFileType)fileType).getLanguage();
    final ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(l);
    if (parserDefinition == null) {
      return false;
    }

    final IFileElementType elementType = parserDefinition.getFileNodeType();
    if (elementType instanceof IStubFileElementType) {
      if (((IStubFileElementType)elementType).shouldBuildStubFor(file)) {
        return true;
      }
      final ID indexId = IndexInfrastructure.getStubId(INDEX_ID, file.getFileType());
      if (IndexingStamp.isFileIndexed(file, indexId, IndexInfrastructure.getIndexCreationStamp(indexId))) {
        return true;
      }
    }
  }
  final BinaryFileStubBuilder builder = BinaryFileStubBuilders.INSTANCE.forFileType(fileType);
  return builder != null && builder.acceptsFile(file);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:StubUpdatingIndex.java

示例6: computeVersionMap

import com.intellij.psi.tree.IFileElementType; //导入依赖的package包/类
private static Map<FileType, Integer> computeVersionMap() {
  Map<FileType, Integer> map = new HashMap<FileType, Integer>();
  for (final FileType fileType : FileTypeManager.getInstance().getRegisteredFileTypes()) {
    if (fileType instanceof LanguageFileType) {
      Language l = ((LanguageFileType)fileType).getLanguage();
      ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(l);
      if (parserDefinition != null) {
        final IFileElementType type = parserDefinition.getFileNodeType();
        if (type instanceof IStubFileElementType) {
          map.put(fileType, ((IStubFileElementType)type).getStubVersion());
        }
      }
    }
    final BinaryFileStubBuilder builder = BinaryFileStubBuilders.INSTANCE.forFileType(fileType);
    if (builder != null) {
      map.put(fileType, builder.getStubVersion());
    }
  }
  return map;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:StubUpdatingIndex.java

示例7: IgnoreFile

import com.intellij.psi.tree.IFileElementType; //导入依赖的package包/类
/** Builds a new instance of {@link IgnoreFile}. */
public IgnoreFile(@NotNull FileViewProvider viewProvider, @NotNull IgnoreFileType fileType) {
    super(viewProvider);

    this.fileType = fileType;
    this.language = findLanguage(fileType.getLanguage(), viewProvider);

    final ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(this.language);
    if (parserDefinition == null) {
        throw new RuntimeException(
                "PsiFileBase: language.getParserDefinition() returned null for: " + this.language
        );
    }
    this.parserDefinition = parserDefinition;

    final IFileElementType nodeType = parserDefinition.getFileNodeType();
    init(nodeType, nodeType);
}
 
开发者ID:hsz,项目名称:idea-gitignore,代码行数:19,代码来源:IgnoreFile.java

示例8: createElementType

import com.intellij.psi.tree.IFileElementType; //导入依赖的package包/类
@NotNull
private static IElementType createElementType(String id, BiConsumer<PsiBuilder, LanguageVersion> consumer)
{
	return new IFileElementType(id, CSharpLanguage.INSTANCE)
	{
		@Override
		protected ASTNode doParseContents(@NotNull ASTNode chameleon, @NotNull PsiElement psi)
		{
			final Project project = psi.getProject();
			final Language languageForParser = getLanguageForParser(psi);
			final LanguageVersion tempLanguageVersion = chameleon.getUserData(LanguageVersion.KEY);
			final LanguageVersion languageVersion = tempLanguageVersion == null ? psi.getLanguageVersion() : tempLanguageVersion;
			final PsiBuilder builder = PsiBuilderFactory.getInstance().createBuilder(project, chameleon, null, languageForParser, languageVersion, chameleon.getChars());
			consumer.accept(builder, languageVersion);
			while(!builder.eof())
			{
				builder.advanceLexer();
			}
			return builder.getTreeBuilt();
		}
	};
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:23,代码来源:CSharpFileFactory.java

示例9: parseImpl

import com.intellij.psi.tree.IFileElementType; //导入依赖的package包/类
@Override
protected ParseTree parseImpl(ANTLRv4Parser parser, IElementType root, PsiBuilder builder) {
	int startRule;
	if (root instanceof IFileElementType) {
		startRule = ANTLRv4Parser.RULE_grammarSpec;
	}
	else if (root == ANTLRv4TokenTypes.TOKEN_ELEMENT_TYPES.get(ANTLRv4Lexer.TOKEN_REF)
		|| root == ANTLRv4TokenTypes.TOKEN_ELEMENT_TYPES.get(ANTLRv4Lexer.RULE_REF)) {
		startRule = ANTLRv4Parser.RULE_atom;
	}
	else {
		startRule = Token.INVALID_TYPE;
	}

	switch (startRule) {
	case ANTLRv4Parser.RULE_grammarSpec:
		return parser.grammarSpec();

	case ANTLRv4Parser.RULE_atom:
		return parser.atom();

	default:
		String ruleName = ANTLRv4Parser.ruleNames[startRule];
		throw new UnsupportedOperationException(String.format("cannot start parsing using root element %s", root));
	}
}
 
开发者ID:antlr,项目名称:intellij-plugin-v4,代码行数:27,代码来源:ANTLRv4GrammarParser.java

示例10: canHaveStub

import com.intellij.psi.tree.IFileElementType; //导入依赖的package包/类
public static boolean canHaveStub(@Nonnull VirtualFile file) {
  final FileType fileType = file.getFileType();
  if (fileType instanceof LanguageFileType) {
    final Language l = ((LanguageFileType)fileType).getLanguage();
    final ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(l);
    if (parserDefinition == null) {
      return false;
    }

    final IFileElementType elementType = parserDefinition.getFileNodeType();
    if (elementType instanceof IStubFileElementType) {
      if (((IStubFileElementType)elementType).shouldBuildStubFor(file)) {
        return true;
      }
      FileBasedIndex fileBasedIndex = FileBasedIndex.getInstance();
      if (file instanceof NewVirtualFile &&
          fileBasedIndex instanceof FileBasedIndexImpl &&
          ((FileBasedIndexImpl)fileBasedIndex).getIndex(INDEX_ID).isIndexedStateForFile(((NewVirtualFile)file).getId(), file)) {
        return true;
      }
    }
  }
  final BinaryFileStubBuilder builder = BinaryFileStubBuilders.INSTANCE.forFileType(fileType);
  return builder != null && builder.acceptsFile(file);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:26,代码来源:StubUpdatingIndex.java

示例11: getVersionOwner

import com.intellij.psi.tree.IFileElementType; //导入依赖的package包/类
private static Object getVersionOwner(FileType fileType) {
  Object owner = null;
  if (fileType instanceof LanguageFileType) {
    Language l = ((LanguageFileType)fileType).getLanguage();
    ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(l);
    if (parserDefinition != null) {
      final IFileElementType type = parserDefinition.getFileNodeType();
      if (type instanceof IStubFileElementType) {
        owner = type;
      }
    }
  }

  BinaryFileStubBuilder builder = BinaryFileStubBuilders.INSTANCE.forFileType(fileType);
  if (builder != null) {
    owner = builder;
  }
  return owner;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:StubVersionMap.java

示例12: buildStubTree

import com.intellij.psi.tree.IFileElementType; //导入依赖的package包/类
@Override
public StubElement buildStubTree(@NotNull PsiFile file) {
  LighterAST tree = FORCED_AST.get();
  if (tree == null) {
    FileType fileType = file.getFileType();
    if (!(fileType instanceof LanguageFileType)) {
      LOG.error("File is not of LanguageFileType: " + fileType + ", " + file);
      return null;
    }
    Language language = ((LanguageFileType)fileType).getLanguage();
    final IFileElementType contentType = LanguageParserDefinitions.INSTANCE.forLanguage(language).getFileNodeType();
    if (!(contentType instanceof IStubFileElementType)) {
      LOG.error("File is not of IStubFileElementType: " + contentType + ", " + file);
      return null;
    }

    final FileASTNode node = file.getNode();
    if (contentType instanceof ILightStubFileElementType) {
      tree = node.getLighterAST();
    }
    else {
      tree = new TreeBackedLighterAST(node);
    }
  } else {
    FORCED_AST.set(null);
  }
  if (tree == null) return null;

  final StubElement rootStub = createStubForFile(file, tree);
  buildStubTree(tree, tree.getRoot(), rootStub);
  return rootStub;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:LightStubBuilder.java

示例13: createLazy

import com.intellij.psi.tree.IFileElementType; //导入依赖的package包/类
@Override
@NotNull
public LazyParseableElement createLazy(final ILazyParseableElementType type, final CharSequence text) {
  if (type instanceof IFileElementType) {
    return new FileElement(type, text);
  }

  return new LazyParseableElement(type, text);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:CoreASTFactory.java

示例14: createComposite

import com.intellij.psi.tree.IFileElementType; //导入依赖的package包/类
@Override
@NotNull
public CompositeElement createComposite(final IElementType type) {
  if (type instanceof IFileElementType) {
    return new FileElement(type, null);
  }

  return new CompositeElement(type);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:CoreASTFactory.java

示例15: createComposite

import com.intellij.psi.tree.IFileElementType; //导入依赖的package包/类
@Override
@Nullable
public CompositeElement createComposite(final IElementType type) {
  if (type instanceof IFileElementType) {
    return new FileElement(type, null);
  }
  return new CompositeElement(type);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:PropertiesASTFactory.java


注:本文中的com.intellij.psi.tree.IFileElementType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。