當前位置: 首頁>>代碼示例>>Java>>正文


Java BracePair.getLeftBraceType方法代碼示例

本文整理匯總了Java中com.intellij.lang.BracePair.getLeftBraceType方法的典型用法代碼示例。如果您正苦於以下問題:Java BracePair.getLeftBraceType方法的具體用法?Java BracePair.getLeftBraceType怎麽用?Java BracePair.getLeftBraceType使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.lang.BracePair的用法示例。


在下文中一共展示了BracePair.getLeftBraceType方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getOppositeBraceTokenTypes

import com.intellij.lang.BracePair; //導入方法依賴的package包/類
@Override
@NotNull
public List<IElementType> getOppositeBraceTokenTypes(@NotNull IElementType type) {
  List<IElementType> result = null;

  for (BracePair pair : myMatcher.getPairs()) {
    IElementType match = null;

    if (type == pair.getRightBraceType()) match = pair.getLeftBraceType();
    if (type == pair.getLeftBraceType()) match = pair.getRightBraceType();

    if (match != null) {
      if (result == null) result = new ArrayList<IElementType>(2);
      result.add(match);
    }
  }

  return result != null ? result : Collections.<IElementType>emptyList();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:20,代碼來源:PairedBraceMatcherAdapter.java

示例2: getBraceTokenGroupId

import com.intellij.lang.BracePair; //導入方法依賴的package包/類
@Override
public int getBraceTokenGroupId(IElementType tokenType) {
  final Language l = tokenType.getLanguage();
  PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(l);
  
  if (matcher != null) {
    BracePair[] pairs = matcher.getPairs();
    for (BracePair pair : pairs) {
      if (pair.getLeftBraceType() == tokenType || pair.getRightBraceType() == tokenType ) {
        return l.hashCode();
      }
    }
  }
  if (tokenType instanceof IXmlLeafElementType) {
    return tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER || tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_END_DELIMITER
           ? XML_VALUE_DELIMITER_GROUP
           : XML_TAG_TOKEN_GROUP;
  }
  else{
    return BraceMatchingUtil.UNDEFINED_TOKEN_GROUP;
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:XmlBraceMatcher.java

示例3: isStructuralBrace

import com.intellij.lang.BracePair; //導入方法依賴的package包/類
@Override
public boolean isStructuralBrace(HighlighterIterator iterator,CharSequence text, FileType fileType) {
  IElementType tokenType = iterator.getTokenType();

  PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(tokenType.getLanguage());
  if (matcher != null) {
    BracePair[] pairs = matcher.getPairs();
    for (BracePair pair : pairs) {
      if ((pair.getLeftBraceType() == tokenType || pair.getRightBraceType() == tokenType) &&
          pair.isStructural()) return true;
    }
  }
  if (fileType instanceof XmlLikeFileType) {
    return isXmlStructuralBrace(iterator, text, fileType, tokenType);
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:18,代碼來源:XmlBraceMatcher.java

示例4: getBraceTokenGroupId

import com.intellij.lang.BracePair; //導入方法依賴的package包/類
public int getBraceTokenGroupId(IElementType tokenType) {
  final Language l = tokenType.getLanguage();
  PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(l);
  
  if (matcher != null) {
    BracePair[] pairs = matcher.getPairs();
    for (BracePair pair : pairs) {
      if (pair.getLeftBraceType() == tokenType || pair.getRightBraceType() == tokenType ) {
        return l.hashCode();
      }
    }
  }
  if (tokenType instanceof IXmlLeafElementType) {
    return tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER || tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_END_DELIMITER
           ? XML_VALUE_DELIMITER_GROUP
           : XML_TAG_TOKEN_GROUP;
  }
  else{
    return BraceMatchingUtil.UNDEFINED_TOKEN_GROUP;
  }
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:22,代碼來源:XmlBraceMatcher.java

示例5: isStructuralBrace

import com.intellij.lang.BracePair; //導入方法依賴的package包/類
public boolean isStructuralBrace(HighlighterIterator iterator,CharSequence text, FileType fileType) {
  IElementType tokenType = iterator.getTokenType();

  PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(tokenType.getLanguage());
  if (matcher != null) {
    BracePair[] pairs = matcher.getPairs();
    for (BracePair pair : pairs) {
      if ((pair.getLeftBraceType() == tokenType || pair.getRightBraceType() == tokenType) &&
          pair.isStructural()) return true;
    }
  }
  if (fileType instanceof XmlLikeFileType) {
    return isXmlStructuralBrace(iterator, text, fileType, tokenType);
  }
  return false;
}
 
開發者ID:lshain-android-source,項目名稱:tools-idea,代碼行數:17,代碼來源:XmlBraceMatcher.java

示例6: getOppositeBraceTokenType

import com.intellij.lang.BracePair; //導入方法依賴的package包/類
@Override
public IElementType getOppositeBraceTokenType(@NotNull final IElementType type)
{
	PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(type.getLanguage());
	if(matcher != null)
	{
		BracePair[] pairs = matcher.getPairs();
		for(BracePair pair : pairs)
		{
			if(pair.getLeftBraceType() == type)
			{
				return pair.getRightBraceType();
			}
			if(pair.getRightBraceType() == type)
			{
				return pair.getLeftBraceType();
			}
		}
	}
	return null;
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:22,代碼來源:CSharpDocBraceMatcher.java

示例7: getOppositeBraceTokenTypes

import com.intellij.lang.BracePair; //導入方法依賴的package包/類
@Override
@Nonnull
public List<IElementType> getOppositeBraceTokenTypes(@Nonnull IElementType type) {
  List<IElementType> result = null;

  for (BracePair pair : myMatcher.getPairs()) {
    IElementType match = null;

    if (type == pair.getRightBraceType()) match = pair.getLeftBraceType();
    if (type == pair.getLeftBraceType()) match = pair.getRightBraceType();

    if (match != null) {
      if (result == null) result = new ArrayList<IElementType>(2);
      result.add(match);
    }
  }

  return result != null ? result : Collections.<IElementType>emptyList();
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:20,代碼來源:PairedBraceMatcherAdapter.java

示例8: getBraceTokenGroupId

import com.intellij.lang.BracePair; //導入方法依賴的package包/類
@Override
public int getBraceTokenGroupId(IElementType tokenType) {
  final BracePair[] pairs = myMatcher.getPairs();
  for (BracePair pair : pairs) {
    if (tokenType == pair.getLeftBraceType() || tokenType == pair.getRightBraceType()) return myLanguage.hashCode();
  }
  return -1;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:9,代碼來源:PairedBraceMatcherAdapter.java

示例9: findPair

import com.intellij.lang.BracePair; //導入方法依賴的package包/類
@Nullable
public BracePair findPair(boolean left, HighlighterIterator iterator, CharSequence fileText, FileType fileType) {
  final IElementType tokenType = iterator.getTokenType();
  final BracePair[] pairs = myMatcher.getPairs();
  for (BracePair pair : pairs) {
    if (tokenType == (left ? pair.getLeftBraceType() : pair.getRightBraceType())) return pair;
  }
  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:PairedBraceMatcherAdapter.java

示例10: getOppositeBraceTokenType

import com.intellij.lang.BracePair; //導入方法依賴的package包/類
@Override
public IElementType getOppositeBraceTokenType(@NotNull final IElementType type) {
  final BracePair[] pairs = myMatcher.getPairs();
  for (BracePair pair : pairs) {
    if (type == pair.getRightBraceType()) return pair.getLeftBraceType();
    if (type == pair.getLeftBraceType()) return pair.getRightBraceType();
  }

  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:11,代碼來源:PairedBraceMatcherAdapter.java

示例11: isPairBraces

import com.intellij.lang.BracePair; //導入方法依賴的package包/類
@Override
public boolean isPairBraces(IElementType tokenType, IElementType tokenType2) {
  final BracePair[] pairs = myMatcher.getPairs();
  for (BracePair pair : pairs) {
    if (tokenType == pair.getLeftBraceType() && tokenType2 == pair.getRightBraceType() ||
        tokenType == pair.getRightBraceType() && tokenType2 == pair.getLeftBraceType()) {
      return true;
    }
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:12,代碼來源:PairedBraceMatcherAdapter.java

示例12: isStructuralBrace

import com.intellij.lang.BracePair; //導入方法依賴的package包/類
@Override
public boolean isStructuralBrace(HighlighterIterator iterator, CharSequence text, FileType fileType) {
  final IElementType tokenType = iterator.getTokenType();
  final BracePair[] pairs = myMatcher.getPairs();
  for (BracePair pair : pairs) {
    if (tokenType == pair.getRightBraceType() || tokenType == pair.getLeftBraceType()) return pair.isStructural();
  }
  return false;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:10,代碼來源:PairedBraceMatcherAdapter.java

示例13: isLBraceToken

import com.intellij.lang.BracePair; //導入方法依賴的package包/類
@Override
public boolean isLBraceToken(HighlighterIterator iterator, CharSequence fileText, FileType fileType) {
  final IElementType tokenType = iterator.getTokenType();
  PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(tokenType.getLanguage());
  if (matcher != null) {
    BracePair[] pairs = matcher.getPairs();
    for (BracePair pair : pairs) {
      if (pair.getLeftBraceType() == tokenType) return true;
    }
  }
  return tokenType == XmlTokenType.XML_START_TAG_START ||
         tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER ||
         tokenType == XmlTokenType.XML_CDATA_START;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:XmlBraceMatcher.java

示例14: isPairBraces

import com.intellij.lang.BracePair; //導入方法依賴的package包/類
@Override
public boolean isPairBraces(IElementType tokenType1, IElementType tokenType2) {
  PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(tokenType1.getLanguage());
  if (matcher != null) {
    BracePair[] pairs = matcher.getPairs();
    for (BracePair pair : pairs) {
      if (pair.getLeftBraceType() == tokenType1 ) return pair.getRightBraceType() == tokenType2;
      if (pair.getRightBraceType() == tokenType1 ) return pair.getLeftBraceType() == tokenType2;
    }
  }
  if (tokenType2.equals(PAIRING_TOKENS.get(tokenType1))) return true;
  List<IElementType> keys = PAIRING_TOKENS.getKeysByValue(tokenType1);
  return keys != null && keys.contains(tokenType2);
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:15,代碼來源:XmlBraceMatcher.java

示例15: getOppositeBraceTokenType

import com.intellij.lang.BracePair; //導入方法依賴的package包/類
@Override
public IElementType getOppositeBraceTokenType(@NotNull final IElementType type) {
  PairedBraceMatcher matcher = LanguageBraceMatching.INSTANCE.forLanguage(type.getLanguage());
  if (matcher != null) {
    BracePair[] pairs = matcher.getPairs();
    for (BracePair pair : pairs) {
      if (pair.getLeftBraceType() == type ) return pair.getRightBraceType();
      if (pair.getRightBraceType() == type ) return pair.getLeftBraceType();
    }
  }
  return null;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:13,代碼來源:XmlBraceMatcher.java


注:本文中的com.intellij.lang.BracePair.getLeftBraceType方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。