本文整理汇总了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;
}
示例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);
}
}
};
}
示例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);
}
}
};
}
示例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);
}
}
};
}