• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java UsageType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getUsageType

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
@Nullable
@Override
public UsageType getUsageType(@NotNull PsiElement element) {
	if (element instanceof SQFCommand) {
		return TYPE_COMMAND_GENERAL;
	}
	if (element instanceof SQFVariable) {
		UsageType x = getUsageTypeForVariable((SQFVariable) element);
		if (x != null) {
			return x;
		}
	}
	if (PsiUtil.isOfElementType(element.getNode(), SQFTypes.STRING)) {
		return TYPE_VAR_IN_STRING;
	}

	if (element.getContainingFile() instanceof SQFFile) {
		return TYPE_UNKNOWN_SQF_USAGE;
	} else if (element.getContainingFile() instanceof HeaderFile) {
		return TYPE_UNKNOWN_HEADER_USAGE;
	}
	return null;
}
 
开发者ID:kayler-renslow,项目名称:arma-intellij-plugin,代码行数:24,代码来源:ArmaUsageTypeProvider.java


示例2: getUsageType

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
@Nullable
@Override
public UsageType getUsageType(PsiElement element) {
  final PsiFile psiFile = element.getContainingFile();

  if (!(psiFile instanceof SchemaFile)) return null;

  if (element instanceof SchemaQnSegment) {
    if (PsiTreeUtil.getParentOfType(element, SchemaImportStatement.class) != null) {
      return IMPORT_USAGE_TYPE;
    }
    return TYPE_REF_USAGE_TYPE; // be more precise: extends, list getElement type etc ?
  }

  if (PsiTreeUtil.getParentOfType(element, SchemaEntityTagRef.class) != null)
    return VAR_TAG_USAGE_TYPE;

  return null;
}
 
开发者ID:SumoLogic,项目名称:epigraph,代码行数:20,代码来源:SchemaUsageTypeProvider.java


示例3: getUsageType

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
@Nullable
@Override
public UsageType getUsageType(PsiElement element) {
  if (!(element instanceof AppleScriptPsiElement)) return null;

  //todo make better psi
  if (element instanceof AppleScriptLabeledParameterDeclarationPart
          || element.getContext() instanceof AppleScriptFormalParameterList
          || element.getContext() instanceof AppleScriptHandlerInterleavedParametersSelectorPart) {
    return UsageType.CLASS_METHOD_PARAMETER_DECLARATION;
  }

  return null;
}
 
开发者ID:ant-druha,项目名称:AppleScript-IDEA,代码行数:15,代码来源:AppleScriptUsageTypeProvider.java


示例4: getUsageType

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
@Nullable
@Override
public UsageType getUsageType(PsiElement element) {
    if (scenarioStateAnnotationProvider.isJGivenScenarioState(element)) {
        return new UsageType(USAGE_TYPE);
    }
    return null;
}
 
开发者ID:TNG,项目名称:jgiven-intellij-plugin,代码行数:9,代码来源:JGivenUsageTypeProvider.java


示例5: provides_JGiven_Usage_type_if_field_is_scenario_state

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
@Test
public void provides_JGiven_Usage_type_if_field_is_scenario_state() throws Exception {
    PsiField field = mock(PsiField.class);
    when(scenarioStateAnnotationProvider.isJGivenScenarioState(field)).thenReturn(true);

    UsageType type = usageTypeProvider.getUsageType(field);

    assertThat(type).isNotNull();
    assertThat(type.toString()).isEqualTo(JGivenUsageTypeProvider.USAGE_TYPE);
}
 
开发者ID:TNG,项目名称:jgiven-intellij-plugin,代码行数:11,代码来源:JGivenUsageTypeProviderTest.java


示例6: provides_no_Usage_type_if_field_is_not_scenario_state

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
@Test
public void provides_no_Usage_type_if_field_is_not_scenario_state() throws Exception {
    PsiField field = mock(PsiField.class);
    when(scenarioStateAnnotationProvider.isJGivenScenarioState(field)).thenReturn(false);

    UsageType type = usageTypeProvider.getUsageType(field);

    assertThat(type).isNull();
}
 
开发者ID:TNG,项目名称:jgiven-intellij-plugin,代码行数:10,代码来源:JGivenUsageTypeProviderTest.java


示例7: getUsageType

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
@Override
public UsageType getUsageType(PsiElement element) {
    if (element instanceof LuaDocPsiElement)
        return LUADOC_USAGE_TYPE;

    if (element instanceof LuaPsiElement)
        return LUA_USAGE_TYPE;

    return null;
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:11,代码来源:LuaUsageTypeProvider.java


示例8: ArmaUsageTypeProvider

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
public ArmaUsageTypeProvider() {
	ResourceBundle bundle = ArmaPlugin.getPluginBundle();
	TYPE_VAR_IN_STRING = new UsageType(bundle.getString("UsageTypeProvider.UsageType.var_in_string"));
	TYPE_UNKNOWN_HEADER_USAGE = new UsageType(bundle.getString("UsageTypeProvider.UsageType.unknown_header"));
	TYPE_UNKNOWN_SQF_USAGE = new UsageType(bundle.getString("UsageTypeProvider.UsageType.unknown_sqf"));
	TYPE_ASSIGNMENT = new UsageType(bundle.getString("UsageTypeProvider.UsageType.assignment"));
	TYPE_FUNCTION_CALL = new UsageType(bundle.getString("UsageTypeProvider.UsageType.function_call"));
	TYPE_FUNCTION_SPAWN = new UsageType(bundle.getString("UsageTypeProvider.UsageType.function_spawn"));
	TYPE_FUNCTION_PARAMETER = new UsageType(bundle.getString("UsageTypeProvider.UsageType.function_param"));
	TYPE_RETURN_STATEMENT = new UsageType(bundle.getString("UsageTypeProvider.UsageType.return_statement"));
	TYPE_COMMAND_ARGUMENT = new UsageType(bundle.getString("UsageTypeProvider.UsageType.command_argument"));
	TYPE_COMMAND_GENERAL = new UsageType(bundle.getString("UsageTypeProvider.UsageType.command_general"));
}
 
开发者ID:kayler-renslow,项目名称:arma-intellij-plugin,代码行数:14,代码来源:ArmaUsageTypeProvider.java


示例9: processIntersectingRange

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
private void processIntersectingRange(@NotNull UsageInfo2UsageAdapter usageInfo2UsageAdapter,
                                      @NotNull final CharSequence chars,
                                      int hiStart,
                                      final int hiEnd,
                                      @NotNull final TextAttributesKey[] tokenHighlights,
                                      final boolean selectUsageWithBold,
                                      @NotNull final List<TextChunk> result) {
  final TextAttributes originalAttrs = convertAttributes(tokenHighlights);
  if (selectUsageWithBold) {
    originalAttrs.setFontType(Font.PLAIN);
  }

  final int[] lastOffset = {hiStart};
  usageInfo2UsageAdapter.processRangeMarkers(new Processor<Segment>() {
    @Override
    public boolean process(Segment segment) {
      int usageStart = segment.getStartOffset();
      int usageEnd = segment.getEndOffset();
      if (rangeIntersect(lastOffset[0], hiEnd, usageStart, usageEnd)) {
        addChunk(chars, lastOffset[0], Math.max(lastOffset[0], usageStart), originalAttrs, false, null, result);

        UsageType usageType = isHighlightedAsString(tokenHighlights)
                         ? UsageType.LITERAL_USAGE
                         : isHighlightedAsComment(tokenHighlights) ? UsageType.COMMENT_USAGE : null;
        addChunk(chars, Math.max(lastOffset[0], usageStart), Math.min(hiEnd, usageEnd), originalAttrs, selectUsageWithBold, usageType, result);
        lastOffset[0] = usageEnd;
        if (usageEnd > hiEnd) {
          return false;
        }
      }
      return true;
    }
  });
  if (lastOffset[0] < hiEnd) {
    addChunk(chars, lastOffset[0], hiEnd, originalAttrs, false, null, result);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:ChunkExtractor.java


示例10: addChunk

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
private static void addChunk(@NotNull CharSequence chars,
                             int start,
                             int end,
                             @NotNull TextAttributes originalAttrs,
                             boolean bold,
                             @Nullable UsageType usageType,
                             @NotNull List<TextChunk> result) {
  if (start >= end) return;

  TextAttributes attrs = bold
                         ? TextAttributes.merge(originalAttrs, new TextAttributes(null, null, null, null, Font.BOLD))
                         : originalAttrs;
  result.add(new TextChunk(attrs, StringFactory.createShared(CharArrayUtil.fromSequence(chars, start, end)), usageType));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ChunkExtractor.java


示例11: getUsageType

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
@Nullable
public UsageType getUsageType() {
  UsageType usageType = myUsageType;

  if (usageType == null) {
    usageType = UsageType.UNCLASSIFIED;
    PsiFile file = getPsiFile();

    if (file != null) {
      ChunkExtractor extractor = ChunkExtractor.getExtractor(file);
      Segment segment = getFirstSegment();

      if (segment != null) {
        Document document = PsiDocumentManager.getInstance(getProject()).getDocument(file);

        if (document != null) {
          SmartList<TextChunk> chunks = new SmartList<TextChunk>();
          extractor.createTextChunks(
            this,
            document.getCharsSequence(),
            segment.getStartOffset(),
            segment.getEndOffset(),
            false,
            chunks
          );

          for(TextChunk chunk:chunks) {
            UsageType chunkUsageType = chunk.getType();
            if (chunkUsageType != null) {
              usageType = chunkUsageType;
              break;
            }
          }
        }
      }
    }
    myUsageType = usageType;
  }
  return usageType;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:UsageInfo2UsageAdapter.java


示例12: getUsageType

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
public UsageType getUsageType(PsiElement element, @NotNull UsageTarget[] targets) {
  if (element instanceof PyElement) {
    if (PsiTreeUtil.getParentOfType(element, PyImportStatementBase.class) != null) {
      return IN_IMPORT;
    }
    if (element instanceof PyQualifiedExpression) {
      final PyExpression qualifier = ((PyQualifiedExpression)element).getQualifier();
      if (qualifier != null) {
        final TypeEvalContext context = TypeEvalContext.userInitiated(element.getProject(), element.getContainingFile());
        final PyType type = context.getType(qualifier);
        if (type == null || type instanceof PyStructuralType) {
          return UNTYPED;
        }
      }
    }
    if (element instanceof PyReferenceExpression) {
      final PyCallExpression call = PsiTreeUtil.getParentOfType(element, PyCallExpression.class);
      if (call != null && call.isCalleeText(PyNames.ISINSTANCE)) {
        final PyExpression[] args = call.getArguments();
        if (args.length == 2) {
          PyExpression typeExpression = args[1];
          if (element == typeExpression) {
            return USAGE_IN_ISINSTANCE;
          }
          typeExpression = PyPsiUtils.flattenParens(typeExpression);
          if (typeExpression instanceof PySequenceExpression && element.getParent() == typeExpression) {
            return USAGE_IN_ISINSTANCE;
          }
        }
      }
      final PyClass pyClass = PsiTreeUtil.getParentOfType(element, PyClass.class);
      if (pyClass != null && PsiTreeUtil.isAncestor(pyClass.getSuperClassExpressionList(), element, true)) {
        return USAGE_IN_SUPERCLASS;
      }
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:PyUsageTypeProvider.java


示例13: getUsageType

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
@Override
@Nullable
public UsageType getUsageType(PsiElement element) {
  final PsiFile psiFile = element.getContainingFile();
  if (psiFile != null && XMLLanguage.INSTANCE.equals(psiFile.getLanguage()) &&
      DomManager.getDomManager(element.getProject()).getFileElement((XmlFile)psiFile, DomElement.class) != null) {
    return DOM_USAGE_TYPE;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:DomUsageTypeProvider.java


示例14: getUsageType

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
@Nullable
public UsageType getUsageType(PsiElement element) {
  final PsiFile psiFile = element.getContainingFile();
  if (psiFile.getFileType() == StdFileTypes.GUI_DESIGNER_FORM) {
    return FORM_USAGE_TYPE;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:FormUsageTypeProvider.java


示例15: getUsageType

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
@Override
@Nullable
public UsageType getUsageType(PsiElement element, @NotNull UsageTarget[] targets) {
  if (!(element instanceof BuildElement)) {
    return null;
  }
  if (PsiTreeUtil.getParentOfType(element, LoadStatement.class) != null) {
    return IN_LOAD;
  }
  if (PsiTreeUtil.getParentOfType(element, GlobExpression.class, false) != null) {
    return IN_GLOB;
  }
  return GENERIC;
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:15,代码来源:BuildUsageTypeProvider.java


示例16: getUsageType

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
@Nullable
@Override
public UsageType getUsageType(PsiElement element) {
    if(element instanceof JSGraphQLNamedPropertyPsiElement) {
        return UsageType.READ;
    }
    return null;
}
 
开发者ID:jimkyndemeyer,项目名称:js-graphql-intellij-plugin,代码行数:9,代码来源:JSGraphQLUsageTypeProvider.java


示例17: getUsageType

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
@Nullable
public UsageType getUsageType(PsiElement element) {
  final PsiFile psiFile = element.getContainingFile();
  if (psiFile != null && XMLLanguage.INSTANCE.equals(psiFile.getLanguage()) &&
      DomManager.getDomManager(element.getProject()).getFileElement((XmlFile)psiFile, DomElement.class) != null) {
    return DOM_USAGE_TYPE;
  }
  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:DomUsageTypeProvider.java


示例18: getUsageType

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
@Nullable
@Override
public UsageType getUsageType(PsiElement element) {
    if (element == null) return null;

    if (element.getParent() instanceof XQueryLiteral) {
        return UsageType.LITERAL_USAGE;
    }
    if (element instanceof XQueryVarName
            && PsiTreeUtil.getParentOfType(element, XQueryVarRef.class, false) != null) {
        return UsageType.READ;
    }
    return null;
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:15,代码来源:XQueryUsageTypeProvider.java


示例19: getUsageType

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
@Override
@Nullable
public UsageType getUsageType(PsiElement element)
{
	final PsiFile psiFile = element.getContainingFile();
	if(psiFile.getFileType() == GuiFormFileType.INSTANCE)
	{
		return FORM_USAGE_TYPE;
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-ui-designer,代码行数:12,代码来源:FormUsageTypeProvider.java


示例20: processIntersectingRange

import com.intellij.usages.impl.rules.UsageType; //导入依赖的package包/类
private void processIntersectingRange(@Nonnull UsageInfo2UsageAdapter usageInfo2UsageAdapter,
                                      @Nonnull final CharSequence chars,
                                      int hiStart,
                                      final int hiEnd,
                                      @Nonnull final TextAttributesKey[] tokenHighlights,
                                      final boolean selectUsageWithBold,
                                      @Nonnull final List<TextChunk> result) {
  final TextAttributes originalAttrs = convertAttributes(tokenHighlights);
  if (selectUsageWithBold) {
    originalAttrs.setFontType(Font.PLAIN);
  }

  final int[] lastOffset = {hiStart};
  usageInfo2UsageAdapter.processRangeMarkers(new Processor<Segment>() {
    @Override
    public boolean process(Segment segment) {
      int usageStart = segment.getStartOffset();
      int usageEnd = segment.getEndOffset();
      if (rangeIntersect(lastOffset[0], hiEnd, usageStart, usageEnd)) {
        addChunk(chars, lastOffset[0], Math.max(lastOffset[0], usageStart), originalAttrs, false, null, result);

        UsageType usageType = isHighlightedAsString(tokenHighlights) ? UsageType.LITERAL_USAGE : isHighlightedAsComment(tokenHighlights) ? UsageType.COMMENT_USAGE : null;
        addChunk(chars, Math.max(lastOffset[0], usageStart), Math.min(hiEnd, usageEnd), originalAttrs, selectUsageWithBold, usageType, result);
        lastOffset[0] = usageEnd;
        if (usageEnd > hiEnd) {
          return false;
        }
      }
      return true;
    }
  });
  if (lastOffset[0] < hiEnd) {
    addChunk(chars, lastOffset[0], hiEnd, originalAttrs, false, null, result);
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:36,代码来源:ChunkExtractor.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MultiPart类代码示例发布时间:2022-05-21
下一篇:
Java Args类代码示例发布时间:2022-05-21
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap