本文整理汇总了Java中consulo.dotnet.psi.DotNetVariable.getName方法的典型用法代码示例。如果您正苦于以下问题:Java DotNetVariable.getName方法的具体用法?Java DotNetVariable.getName怎么用?Java DotNetVariable.getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类consulo.dotnet.psi.DotNetVariable
的用法示例。
在下文中一共展示了DotNetVariable.getName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateResult
import consulo.dotnet.psi.DotNetVariable; //导入方法依赖的package包/类
@Nullable
@Override
@RequiredDispatchThread
public Result calculateResult(@NotNull Expression[] params, ExpressionContext context)
{
final Project project = context.getProject();
final int offset = context.getStartOffset();
PsiFile file = PsiDocumentManager.getInstance(project).getPsiFile(context.getEditor().getDocument());
PsiElement place = file.findElementAt(offset);
List<DotNetVariable> dotNetVariables = CSharpLiveTemplateMacroUtil.resolveAllVariables(place);
DotNetVariable variable = CSharpLineMarkerUtil.getNameIdentifierAs(place, DotNetVariable.class);
ChooseLetterLoop:
for(char letter = 'i'; letter <= 'z'; letter++)
{
for(DotNetVariable dotNetVariable : dotNetVariables)
{
// skip self
if(dotNetVariable == variable)
{
continue;
}
String name = dotNetVariable.getName();
if(name != null && name.length() == 1 && name.charAt(0) == letter)
{
continue ChooseLetterLoop;
}
}
return new TextResult(String.valueOf(letter));
}
return null;
}
示例2: addIfNotNull
import consulo.dotnet.psi.DotNetVariable; //导入方法依赖的package包/类
@RequiredReadAction
private void addIfNotNull(DotNetVariable variable)
{
String name = variable.getName();
if(name != null)
{
myVariables.putValue(name, variable);
DotNetExpression initializer = variable.getInitializer();
if(initializer != null)
{
initializer.accept(this);
}
}
}
示例3: checkImpl
import consulo.dotnet.psi.DotNetVariable; //导入方法依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public HighlightInfoFactory checkImpl(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull DotNetVariable element)
{
String name = element.getName();
if(name == null)
{
return null;
}
CSharpSimpleLikeMethodAsElement method = PsiTreeUtil.getTopmostParentOfType(element, CSharpSimpleLikeMethodAsElement.class);
if(method == null)
{
return null;
}
AnalyzeContext context = CachedValuesManager.getCachedValue(method, () -> CachedValueProvider.Result.create(new AnalyzeContext(method), PsiModificationTracker.MODIFICATION_COUNT));
Collection<DotNetVariable> variables = context.myVariables.get(name);
if(variables.size() <= 1)
{
return null;
}
DotNetVariable prevVariable = null;
for(DotNetVariable variable : variables)
{
if(variable == element)
{
break;
}
prevVariable = variable;
}
if(prevVariable != null)
{
//return newBuilder(getNameIdentifier(element), name, name, getScope(prevVariable, element));
}
return null;
}