本文整理汇总了Java中consulo.dotnet.psi.DotNetVariable类的典型用法代码示例。如果您正苦于以下问题:Java DotNetVariable类的具体用法?Java DotNetVariable怎么用?Java DotNetVariable使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DotNetVariable类属于consulo.dotnet.psi包,在下文中一共展示了DotNetVariable类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: visitReferenceExpression
import consulo.dotnet.psi.DotNetVariable; //导入依赖的package包/类
@Override
public void visitReferenceExpression(CSharpReferenceExpression expression)
{
PsiElement resolvedElement = expression.resolve();
if(resolvedElement instanceof DotNetVariable)
{
if(((DotNetVariable) resolvedElement).isConstant() || ((DotNetVariable) resolvedElement).hasModifier(CSharpModifier.READONLY))
{
DotNetExpression initializer = ((DotNetVariable) resolvedElement).getInitializer();
if(initializer == null)
{
return;
}
myValue = new ConstantExpressionEvaluator(initializer).getValue();
}
}
}
示例2: resolveTargetElement
import consulo.dotnet.psi.DotNetVariable; //导入依赖的package包/类
@Nullable
@RequiredReadAction
private static DotNetTypeDeclaration resolveTargetElement(@NotNull PsiElement element, @NotNull PsiElement scope)
{
if(element instanceof CSharpTypeDeclaration)
{
return (DotNetTypeDeclaration) element;
}
else if(element instanceof DotNetVariable)
{
DotNetTypeRef typeRef = ((DotNetVariable) element).toTypeRef(true);
PsiElement resolvedElement = typeRef.resolve().getElement();
if(resolvedElement == null)
{
return null;
}
return resolveTargetElement(resolvedElement, scope);
}
return null;
}
示例3: processDeclarations
import consulo.dotnet.psi.DotNetVariable; //导入依赖的package包/类
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent,
@NotNull PsiElement place)
{
if(lastParent == null || !PsiTreeUtil.isAncestor(this, lastParent, false))
{
return true;
}
DotNetVariable variable = getVariable();
if(variable != null)
{
if(!processor.execute(variable, state))
{
return false;
}
}
return true;
}
示例4: toTypeRefImpl
import consulo.dotnet.psi.DotNetVariable; //导入依赖的package包/类
@NotNull
@Override
@RequiredReadAction
public DotNetTypeRef toTypeRefImpl(boolean resolveFromParent)
{
PsiElement resolvedElement = resolveToCallable();
if(resolvedElement instanceof DotNetVariable)
{
DotNetTypeRef dotNetTypeRef = ((DotNetVariable) resolvedElement).toTypeRef(false);
DotNetTypeResolveResult typeResolveResult = dotNetTypeRef.resolve();
if(typeResolveResult instanceof CSharpLambdaResolveResult)
{
return ((CSharpLambdaResolveResult) typeResolveResult).getReturnTypeRef();
}
return DotNetTypeRef.ERROR_TYPE;
}
if(resolvedElement instanceof CSharpSimpleLikeMethodAsElement)
{
return ((CSharpSimpleLikeMethodAsElement) resolvedElement).getReturnTypeRef();
}
return CSharpReferenceExpressionImplUtil.toTypeRef(resolvedElement);
}
示例5: processDeclarations
import consulo.dotnet.psi.DotNetVariable; //导入依赖的package包/类
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent, @NotNull PsiElement
place)
{
if(lastParent == null || !PsiTreeUtil.isAncestor(this, lastParent, false))
{
return true;
}
for(DotNetVariable dotNetVariable : getVariables())
{
if(!processor.execute(dotNetVariable, state))
{
return false;
}
}
return true;
}
示例6: processDeclarations
import consulo.dotnet.psi.DotNetVariable; //导入依赖的package包/类
@Override
public boolean processDeclarations(@NotNull PsiScopeProcessor processor, @NotNull ResolveState state, PsiElement lastParent,
@NotNull PsiElement place)
{
if(lastParent == null || !PsiTreeUtil.isAncestor(this, lastParent, false))
{
return true;
}
for(DotNetVariable dotNetVariable : getVariables())
{
if(!processor.execute(dotNetVariable, state))
{
return false;
}
}
return true;
}
示例7: getAdditionalModifiers
import consulo.dotnet.psi.DotNetVariable; //导入依赖的package包/类
@RequiredReadAction
private static CSharpModifier[] getAdditionalModifiers(int index, DotNetLikeMethodDeclaration parent, DotNetVariable variable)
{
if(index == 0)
{
PsiElement msilElement = parent.getOriginalElement();
// we can use mirror due ExtensionAttribute is in ban list
if(DotNetAttributeUtil.hasAttribute(msilElement, DotNetTypes.System.Runtime.CompilerServices.ExtensionAttribute))
{
return new CSharpModifier[]{CSharpModifier.THIS};
}
}
DotNetModifierList modifierList = variable.getModifierList();
if(modifierList != null && modifierList.hasModifier(MsilTokens.BRACKET_OUT_KEYWORD))
{
DotNetType type = variable.getType();
if(type instanceof MsilTypeByRefImpl)
{
return new CSharpModifier[]{CSharpModifier.OUT};
}
}
return CSharpModifier.EMPTY_ARRAY;
}
示例8: invoke
import consulo.dotnet.psi.DotNetVariable; //导入依赖的package包/类
@Override
@RequiredWriteAction
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException
{
DotNetVariable element = myPointer.getElement();
if(element == null)
{
return;
}
PsiDocumentManager.getInstance(project).commitAllDocuments();
DotNetExpression initializer = element.getInitializer();
if(initializer == null)
{
return;
}
initializer.delete();
ASTNode node = element.getNode();
ASTNode childByType = node.findChildByType(CSharpTokenSets.EQ);
if(childByType != null)
{
node.removeChild(childByType);
}
}
示例9: invoke
import consulo.dotnet.psi.DotNetVariable; //导入依赖的package包/类
@Override
@RequiredDispatchThread
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException
{
PsiDocumentManager.getInstance(project).commitAllDocuments();
DotNetVariable element = myVariablePointer.getElement();
if(element == null)
{
return;
}
DotNetType typeOfVariable = element.getType();
if(typeOfVariable == null)
{
return;
}
String typeText = CSharpTypeRefPresentationUtil.buildShortText(myToTypeRef, element);
DotNetType type = CSharpFileFactory.createMaybeStubType(project, typeText, typeOfVariable);
typeOfVariable.replace(type);
}
示例10: buildCallArguments
import consulo.dotnet.psi.DotNetVariable; //导入依赖的package包/类
@RequiredReadAction
private static List<NCallArgument> buildCallArguments(@NotNull CSharpCallArgument[] callArguments, @NotNull PsiElement callable, @NotNull PsiElement scope)
{
if(callable instanceof DotNetVariable)
{
DotNetTypeRef ref = ((DotNetVariable) callable).toTypeRef(true);
DotNetTypeResolveResult resolve = ref.resolve();
if(resolve instanceof CSharpLambdaResolveResult)
{
return MethodResolver.buildCallArguments(callArguments, ((CSharpLambdaResolveResult) resolve).getParameterInfos(), scope);
}
}
else if(callable instanceof DotNetParameterListOwner)
{
return MethodResolver.buildCallArguments(callArguments, (DotNetParameterListOwner) callable, scope);
}
return Collections.emptyList();
}
示例11: getParametersForLookup
import consulo.dotnet.psi.DotNetVariable; //导入依赖的package包/类
@Nullable
@Override
@RequiredReadAction
public ItemToShow[] getParametersForLookup(LookupElement item, ParameterInfoContext context)
{
Object object = item.getObject();
if(object instanceof DotNetLikeMethodDeclaration)
{
return new ItemToShow[]{new ItemToShow((CSharpSimpleLikeMethod) object, context.getFile())};
}
if(object instanceof DotNetVariable)
{
DotNetVariable variable = (DotNetVariable) object;
DotNetTypeRef dotNetTypeRef = variable.toTypeRef(tracksParameterIndex());
DotNetTypeResolveResult typeResolveResult = dotNetTypeRef.resolve();
if(typeResolveResult instanceof CSharpLambdaResolveResult)
{
return new ItemToShow[]{new ItemToShow((CSharpSimpleLikeMethod) typeResolveResult, variable)};
}
}
return ItemToShow.EMPTY_ARRAY;
}
示例12: visitNamedFieldOrPropertySet
import consulo.dotnet.psi.DotNetVariable; //导入依赖的package包/类
@Override
@RequiredReadAction
public void visitNamedFieldOrPropertySet(CSharpNamedFieldOrPropertySet parent)
{
CSharpReferenceExpression nameReferenceExpression = parent.getNameElement();
DotNetExpression valueExpression = parent.getValueExpression();
if(nameReferenceExpression == myCurrentElement)
{
if(valueExpression != null)
{
myExpectedTypeInfos.add(new ExpectedTypeInfo(valueExpression.toTypeRef(false), null));
}
}
else if(valueExpression == myCurrentElement)
{
PsiElement resolvedElement = nameReferenceExpression.resolve();
if(resolvedElement instanceof DotNetVariable)
{
myExpectedTypeInfos.add(new ExpectedTypeInfo(((DotNetVariable) resolvedElement).toTypeRef(true), resolvedElement));
}
}
}
示例13: getParameterName
import consulo.dotnet.psi.DotNetVariable; //导入依赖的package包/类
@RequiredReadAction
private static String getParameterName(DotNetVariable variable)
{
if(variable instanceof DotNetParameter)
{
return variable.getName();
}
String name = variable.getName();
assert name != null;
char ch = name.charAt(0);
if(Character.isUpperCase(ch))
{
return StringUtil.decapitalize(name);
}
else if(ch == '_')
{
return name.substring(1, name.length());
}
return name;
}
示例14: calculateResult
import consulo.dotnet.psi.DotNetVariable; //导入依赖的package包/类
@Override
public Result calculateResult(@NotNull Expression[] params, ExpressionContext context)
{
final PsiElement[] vars = getVariables(params, context);
if(vars == null || vars.length == 0)
{
return null;
}
return new PsiElementResult(vars[0])
{
@Override
public String toString()
{
PsiElement element = getElement();
if(element instanceof DotNetVariable)
{
return ((DotNetVariable) element).getName();
}
return super.toString();
}
};
}
示例15: getVariables
import consulo.dotnet.psi.DotNetVariable; //导入依赖的package包/类
@Nullable
@Override
protected PsiElement[] getVariables(Expression[] params, ExpressionContext context)
{
final PsiElement psiElementAtStartOffset = context.getPsiElementAtStartOffset();
if(psiElementAtStartOffset == null)
{
return PsiElement.EMPTY_ARRAY;
}
List<DotNetVariable> variables = CSharpLiveTemplateMacroUtil.resolveAllVariables(context.getPsiElementAtStartOffset());
List<DotNetVariable> list = new SmartList<DotNetVariable>();
for(DotNetVariable variable : variables)
{
DotNetTypeRef typeRefOfVariable = variable.toTypeRef(true);
if(CSharpTypeDeclarationImplUtil.isInheritOrSelf(typeRefOfVariable, psiElementAtStartOffset, ourAcceptableTypes))
{
list.add(variable);
}
}
return list.toArray(new PsiElement[list.size()]);
}