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


Java TailType.HUMBLE_SPACE_BEFORE_WORD属性代码示例

本文整理汇总了Java中com.intellij.codeInsight.TailType.HUMBLE_SPACE_BEFORE_WORD属性的典型用法代码示例。如果您正苦于以下问题:Java TailType.HUMBLE_SPACE_BEFORE_WORD属性的具体用法?Java TailType.HUMBLE_SPACE_BEFORE_WORD怎么用?Java TailType.HUMBLE_SPACE_BEFORE_WORD使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.intellij.codeInsight.TailType的用法示例。


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

示例1: getReturnTail

private static TailType getReturnTail(PsiElement position) {
  PsiElement scope = position;
  while(true){
    if (scope instanceof PsiFile || scope instanceof PsiClassInitializer){
      return TailType.NONE;
    }

    if (scope instanceof PsiMethod){
      final PsiMethod method = (PsiMethod)scope;
      if(method.isConstructor() || PsiType.VOID.equals(method.getReturnType())) {
        return TailType.SEMICOLON;
      }

      return TailType.HUMBLE_SPACE_BEFORE_WORD;
    }
    if (scope instanceof PsiLambdaExpression) {
      final PsiType returnType = LambdaUtil.getFunctionalInterfaceReturnType(((PsiLambdaExpression)scope));
      if (PsiType.VOID.equals(returnType)) {
        return TailType.SEMICOLON;
      }
      return TailType.HUMBLE_SPACE_BEFORE_WORD;
    }
    scope = scope.getParent();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:JavaKeywordCompletion.java

示例2: addBreakContinue

private static void addBreakContinue(Consumer<LookupElement> result, PsiElement position) {
  PsiLoopStatement loop = PsiTreeUtil.getParentOfType(position, PsiLoopStatement.class);

  LookupElement br = createKeyword(position, PsiKeyword.BREAK);
  LookupElement cont = createKeyword(position, PsiKeyword.CONTINUE);
  TailType tailType;
  if (psiElement().insideSequence(true, psiElement(PsiLabeledStatement.class),
                                  or(psiElement(PsiFile.class), psiElement(PsiMethod.class),
                                     psiElement(PsiClassInitializer.class))).accepts(position)) {
    tailType = TailType.HUMBLE_SPACE_BEFORE_WORD;
  }
  else {
    tailType = TailType.SEMICOLON;
  }
  br = TailTypeDecorator.withTail(br, tailType);
  cont = TailTypeDecorator.withTail(cont, tailType);

  if (loop != null && PsiTreeUtil.isAncestor(loop.getBody(), position, false)) {
    result.consume(br);
    result.consume(cont);
  }
  if (psiElement().inside(PsiSwitchStatement.class).accepts(position)) {
    result.consume(br);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:JavaKeywordCompletion.java

示例3: addBreakContinue

private static void addBreakContinue(CompletionResultSet result, PsiElement position) {
  PsiLoopStatement loop = PsiTreeUtil.getParentOfType(position, PsiLoopStatement.class);

  LookupElement br = createKeyword(position, PsiKeyword.BREAK);
  LookupElement cont = createKeyword(position, PsiKeyword.CONTINUE);
  TailType tailType;
  if (psiElement().insideSequence(true, psiElement(PsiLabeledStatement.class),
                                  or(psiElement(PsiFile.class), psiElement(PsiMethod.class),
                                     psiElement(PsiClassInitializer.class))).accepts(position)) {
    tailType = TailType.HUMBLE_SPACE_BEFORE_WORD;
  }
  else {
    tailType = TailType.SEMICOLON;
  }
  br = TailTypeDecorator.withTail(br, tailType);
  cont = TailTypeDecorator.withTail(cont, tailType);

  if (loop != null && new InsideElementFilter(new ClassFilter(PsiStatement.class)).isAcceptable(position, loop)) {
    result.addElement(br);
    result.addElement(cont);
  }
  if (psiElement().inside(PsiSwitchStatement.class).accepts(position)) {
    result.addElement(br);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:JavaCompletionData.java

示例4: getReturnTail

private static TailType getReturnTail(PsiElement position)
{
	PsiElement scope = position;
	while(true)
	{
		if(scope instanceof PsiFile || scope instanceof PsiClassInitializer)
		{
			return TailType.NONE;
		}

		if(scope instanceof PsiMethod)
		{
			final PsiMethod method = (PsiMethod) scope;
			if(method.isConstructor() || PsiType.VOID.equals(method.getReturnType()))
			{
				return TailType.SEMICOLON;
			}

			return TailType.HUMBLE_SPACE_BEFORE_WORD;
		}
		if(scope instanceof PsiLambdaExpression)
		{
			final PsiType returnType = LambdaUtil.getFunctionalInterfaceReturnType(((PsiLambdaExpression) scope));
			if(PsiType.VOID.equals(returnType))
			{
				return TailType.SEMICOLON;
			}
			return TailType.HUMBLE_SPACE_BEFORE_WORD;
		}
		scope = scope.getParent();
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:32,代码来源:JavaKeywordCompletion.java

示例5: addBreakContinue

private void addBreakContinue()
{
	PsiLoopStatement loop = PsiTreeUtil.getParentOfType(myPosition, PsiLoopStatement.class, true, PsiLambdaExpression.class, PsiMember.class);

	LookupElement br = createKeyword(PsiKeyword.BREAK);
	LookupElement cont = createKeyword(PsiKeyword.CONTINUE);
	TailType tailType;
	if(psiElement().insideSequence(true, psiElement(PsiLabeledStatement.class), or(psiElement(PsiFile.class), psiElement(PsiMethod.class), psiElement(PsiClassInitializer.class))).accepts
			(myPosition))
	{
		tailType = TailType.HUMBLE_SPACE_BEFORE_WORD;
	}
	else
	{
		tailType = TailType.SEMICOLON;
	}
	br = TailTypeDecorator.withTail(br, tailType);
	cont = TailTypeDecorator.withTail(cont, tailType);

	if(loop != null && PsiTreeUtil.isAncestor(loop.getBody(), myPosition, false))
	{
		addKeyword(br);
		addKeyword(cont);
	}
	if(psiElement().inside(PsiSwitchStatement.class).accepts(myPosition))
	{
		addKeyword(br);
	}

	for(PsiLabeledStatement labeled : psiApi().parents(myPosition).takeWhile(notInstanceOf(PsiMember.class)).filter(PsiLabeledStatement.class))
	{
		addKeyword(TailTypeDecorator.withTail(LookupElementBuilder.create("break " + labeled.getName()).bold(), TailType.SEMICOLON));
	}
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:34,代码来源:JavaKeywordCompletion.java


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