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


Java JavaStatisticsManager.incVariableNameUseCount方法代码示例

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


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

示例1: getSuggestedNames

import com.intellij.psi.statistics.JavaStatisticsManager; //导入方法依赖的package包/类
@Override
public SuggestedNameInfo getSuggestedNames(final PsiElement element, @Nullable PsiElement nameSuggestionContext, Set<String> result) {
  if (nameSuggestionContext == null) nameSuggestionContext = element;
  if (element instanceof GrVariable && nameSuggestionContext instanceof GroovyPsiElement) {
    final PsiType type = ((GrVariable)element).getTypeGroovy();
    if (type != null) {
      final String[] names = GroovyNameSuggestionUtil
        .suggestVariableNameByType(type, new DefaultGroovyVariableNameValidator((GroovyPsiElement)nameSuggestionContext));
      result.addAll(Arrays.asList(names));
      return new SuggestedNameInfo(names) {
        @Override
        public void nameChosen(String name) {
          JavaStatisticsManager
            .incVariableNameUseCount(name, JavaCodeStyleManager.getInstance(element.getProject()).getVariableKind((GrVariable)element),
                                     ((GrVariable)element).getName(), type);
        }
      };
    }
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GroovyNameSuggestionProvider.java

示例2: suggestVariableName

import com.intellij.psi.statistics.JavaStatisticsManager; //导入方法依赖的package包/类
@NotNull
@Override
public SuggestedNameInfo suggestVariableName(@NotNull final VariableKind kind,
                                             @Nullable final String propertyName,
                                             @Nullable final PsiExpression expr,
                                             @Nullable PsiType type,
                                             final boolean correctKeywords) {
  LinkedHashSet<String> names = new LinkedHashSet<String>();

  if (expr != null && type == null) {
    type = expr.getType();
  }

  if (propertyName != null) {
    String[] namesByName = getSuggestionsByName(propertyName, kind, false, correctKeywords);
    sortVariableNameSuggestions(namesByName, kind, propertyName, null);
    ContainerUtil.addAll(names, namesByName);
  }

  final NamesByExprInfo namesByExpr;
  if (expr != null) {
    namesByExpr = suggestVariableNameByExpression(expr, kind, correctKeywords);
    if (namesByExpr.propertyName != null) {
      sortVariableNameSuggestions(namesByExpr.names, kind, namesByExpr.propertyName, null);
    }
    ContainerUtil.addAll(names, namesByExpr.names);
  }
  else {
    namesByExpr = null;
  }

  if (type != null) {
    String[] namesByType = suggestVariableNameByType(type, kind, correctKeywords);
    sortVariableNameSuggestions(namesByType, kind, null, type);
    ContainerUtil.addAll(names, namesByType);
  }

  final String _propertyName;
  if (propertyName != null) {
    _propertyName = propertyName;
  }
  else {
    _propertyName = namesByExpr != null ? namesByExpr.propertyName : null;
  }

  addNamesFromStatistics(names, kind, _propertyName, type);

  String[] namesArray = ArrayUtil.toStringArray(names);
  sortVariableNameSuggestions(namesArray, kind, _propertyName, type);

  final PsiType _type = type;
  return new SuggestedNameInfo(namesArray) {
    @Override
    public void nameChosen(String name) {
      if (_propertyName != null || _type != null && _type.isValid()) {
        JavaStatisticsManager.incVariableNameUseCount(name, kind, _propertyName, _type);
      }
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:61,代码来源:JavaCodeStyleManagerImpl.java

示例3: suggestVariableName

import com.intellij.psi.statistics.JavaStatisticsManager; //导入方法依赖的package包/类
@Override
public SuggestedNameInfo suggestVariableName(@NotNull final VariableKind kind,
                                             @Nullable final String propertyName,
                                             @Nullable final PsiExpression expr,
                                             @Nullable PsiType type,
                                             final boolean correctKeywords) {
  LinkedHashSet<String> names = new LinkedHashSet<String>();

  if (expr != null && type == null) {
    type = expr.getType();
  }

  if (propertyName != null) {
    String[] namesByName = getSuggestionsByName(propertyName, kind, false, correctKeywords);
    sortVariableNameSuggestions(namesByName, kind, propertyName, null);
    ContainerUtil.addAll(names, namesByName);
  }

  final NamesByExprInfo namesByExpr;
  if (expr != null) {
    namesByExpr = suggestVariableNameByExpression(expr, kind, correctKeywords);
    if (namesByExpr.propertyName != null) {
      sortVariableNameSuggestions(namesByExpr.names, kind, namesByExpr.propertyName, null);
    }
    ContainerUtil.addAll(names, namesByExpr.names);
  }
  else {
    namesByExpr = null;
  }

  if (type != null) {
    String[] namesByType = suggestVariableNameByType(type, kind, correctKeywords);
    sortVariableNameSuggestions(namesByType, kind, null, type);
    ContainerUtil.addAll(names, namesByType);
  }

  final String _propertyName;
  if (propertyName != null) {
    _propertyName = propertyName;
  }
  else {
    _propertyName = namesByExpr != null ? namesByExpr.propertyName : null;
  }

  addNamesFromStatistics(names, kind, _propertyName, type);

  String[] namesArray = ArrayUtil.toStringArray(names);
  sortVariableNameSuggestions(namesArray, kind, _propertyName, type);

  final PsiType _type = type;
  return new SuggestedNameInfo(namesArray) {
    @Override
    public void nameChosen(String name) {
      if (_propertyName != null || _type != null && _type.isValid()) {
        JavaStatisticsManager.incVariableNameUseCount(name, kind, _propertyName, _type);
      }
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:60,代码来源:JavaCodeStyleManagerImpl.java

示例4: suggestVariableName

import com.intellij.psi.statistics.JavaStatisticsManager; //导入方法依赖的package包/类
@NotNull
@Override
public SuggestedNameInfo suggestVariableName(@NotNull final VariableKind kind,
		@Nullable final String propertyName,
		@Nullable final PsiExpression expr,
		@Nullable PsiType type,
		final boolean correctKeywords)
{
	LinkedHashSet<String> names = new LinkedHashSet<String>();

	if(expr != null && type == null)
	{
		type = expr.getType();
	}

	if(propertyName != null)
	{
		String[] namesByName = getSuggestionsByName(propertyName, kind, false, correctKeywords);
		sortVariableNameSuggestions(namesByName, kind, propertyName, null);
		ContainerUtil.addAll(names, namesByName);
	}

	final NamesByExprInfo namesByExpr;
	if(expr != null)
	{
		namesByExpr = suggestVariableNameByExpression(expr, kind, correctKeywords);
		if(namesByExpr.propertyName != null)
		{
			sortVariableNameSuggestions(namesByExpr.names, kind, namesByExpr.propertyName, null);
		}
		ContainerUtil.addAll(names, namesByExpr.names);
	}
	else
	{
		namesByExpr = null;
	}

	if(type != null)
	{
		String[] namesByType = suggestVariableNameByType(type, kind, correctKeywords);
		sortVariableNameSuggestions(namesByType, kind, null, type);
		ContainerUtil.addAll(names, namesByType);
	}

	final String _propertyName;
	if(propertyName != null)
	{
		_propertyName = propertyName;
	}
	else
	{
		_propertyName = namesByExpr != null ? namesByExpr.propertyName : null;
	}

	addNamesFromStatistics(names, kind, _propertyName, type);

	String[] namesArray = ArrayUtil.toStringArray(names);
	sortVariableNameSuggestions(namesArray, kind, _propertyName, type);

	final PsiType _type = type;
	return new SuggestedNameInfo(namesArray)
	{
		@Override
		public void nameChosen(String name)
		{
			if(_propertyName != null || _type != null && _type.isValid())
			{
				JavaStatisticsManager.incVariableNameUseCount(name, kind, _propertyName, _type);
			}
		}
	};
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:73,代码来源:JavaCodeStyleManagerImpl.java


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