當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。