本文整理匯總了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;
}