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


Java DotNetVariable.getName方法代码示例

本文整理汇总了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;
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:37,代码来源:SuggestIndexVariableNameMacro.java

示例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);
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:16,代码来源:CS0136.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:43,代码来源:CS0136.java


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