Java Code Examples for com.intellij.psi.tree.IElementType#getIndex()

The following examples show how to use com.intellij.psi.tree.IElementType#getIndex() . 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: IntBasedStorage.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public int packData(IElementType tokenType, int state, boolean isRestartableState) {
  return ((state & 0xFFFF) << 16) | (tokenType.getIndex() & 0xffff);
}
 
Example 2
Source File: ShortBasedStorage.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public int packData(IElementType tokenType, int state, boolean isRestartableState) {
  final short idx = tokenType.getIndex();
  return isRestartableState ? idx : -idx;
}
 
Example 3
Source File: Identikit.java    From consulo with Apache License 2.0 4 votes vote down vote up
private ByType(@Nonnull Class<? extends PsiElement> elementClass, @Nullable IElementType elementType, @Nonnull Language fileLanguage) {
  myElementClassName = elementClass.getName();
  myElementTypeId = elementType != null ? elementType.getIndex() : -1;
  myFileLanguageId = fileLanguage.getID();
}
 
Example 4
Source File: Identikit.java    From consulo with Apache License 2.0 4 votes vote down vote up
private boolean isAcceptable(@Nonnull PsiElement element) {
  IElementType type = PsiUtilCore.getElementType(element);
  return myElementClassName.equals(element.getClass().getName()) && type != null && myElementTypeId == type.getIndex();
}