本文整理汇总了Java中consulo.dotnet.psi.DotNetMemberOwner类的典型用法代码示例。如果您正苦于以下问题:Java DotNetMemberOwner类的具体用法?Java DotNetMemberOwner怎么用?Java DotNetMemberOwner使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DotNetMemberOwner类属于consulo.dotnet.psi包,在下文中一共展示了DotNetMemberOwner类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createGenerateContext
import consulo.dotnet.psi.DotNetMemberOwner; //导入依赖的package包/类
@Override
@Nullable
public CreateUnresolvedElementFixContext createGenerateContext()
{
CSharpReferenceExpression element = myPointer.getElement();
if(element == null)
{
return null;
}
if(element.kind() == CSharpReferenceExpression.ResolveToKind.CONSTRUCTOR)
{
final DotNetQualifiedElement qualifiedElement = PsiTreeUtil.getParentOfType(element, DotNetQualifiedElement.class);
if(qualifiedElement == null)
{
return null;
}
PsiElement parent = qualifiedElement.getParent();
if(parent instanceof DotNetMemberOwner && parent.isWritable())
{
return new CreateUnresolvedElementFixContext(element, (DotNetMemberOwner) parent);
}
}
return null;
}
示例2: findElementByOriginal
import consulo.dotnet.psi.DotNetMemberOwner; //导入依赖的package包/类
@Nullable
public static PsiElement findElementByOriginal(@NotNull PsiElement wrappedElement, @NotNull PsiElement originalTarget)
{
PsiElement originalElement = wrappedElement.getOriginalElement();
if(originalElement.isEquivalentTo(originalTarget))
{
return wrappedElement;
}
if(wrappedElement instanceof MsilMethodAsCSharpMethodDeclaration)
{
MsilClassEntry delegate = ((MsilMethodAsCSharpMethodDeclaration) wrappedElement).getDelegate();
if(delegate != null && delegate.isEquivalentTo(originalTarget))
{
return wrappedElement;
}
}
if(wrappedElement instanceof DotNetMemberOwner)
{
DotNetNamedElement[] members = ((DotNetMemberOwner) wrappedElement).getMembers();
for(DotNetNamedElement member : members)
{
PsiElement elementByOriginal = findElementByOriginal(member, originalTarget);
if(elementByOriginal != null)
{
return elementByOriginal;
}
}
}
return null;
}
示例3: check
import consulo.dotnet.psi.DotNetMemberOwner; //导入依赖的package包/类
@RequiredReadAction
@NotNull
@Override
public List<CompilerCheckBuilder> check(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull DotNetMemberOwner element)
{
if(element instanceof CSharpFile || element instanceof CSharpNamespaceDeclaration)
{
return CS0102.doCheck(this, element);
}
return Collections.emptyList();
}
示例4: findMethodByName
import consulo.dotnet.psi.DotNetMemberOwner; //导入依赖的package包/类
@Nullable
@RequiredReadAction
public static DotNetMethodDeclaration findMethodByName(@NotNull final String name,
@NotNull PsiElement owner,
@Nullable String parentQName,
@NotNull DotNetGenericExtractor extractor,
final int parameterSize)
{
//TODO [VISTALL] some hack until we dont make override more powerfull
if(parentQName != null)
{
if(owner instanceof DotNetMemberOwner)
{
for(DotNetNamedElement dotNetNamedElement : ((DotNetMemberOwner) owner).getMembers())
{
if(dotNetNamedElement instanceof CSharpMethodDeclaration && ((CSharpMethodDeclaration) dotNetNamedElement).getParameters().length == 0 &&
name.equals(dotNetNamedElement.getName()))
{
DotNetTypeRef typeRefForImplement = ((CSharpMethodDeclaration) dotNetNamedElement).getTypeRefForImplement();
if(DotNetTypeRefUtil.isVmQNameEqual(typeRefForImplement, owner, parentQName))
{
return (DotNetMethodDeclaration) GenericUnwrapTool.extract(dotNetNamedElement, extractor);
}
}
}
}
}
AsPsiElementProcessor psiElementProcessor = new AsPsiElementProcessor();
MemberResolveScopeProcessor memberResolveScopeProcessor = new MemberResolveScopeProcessor(owner, psiElementProcessor, new ExecuteTarget[]{ExecuteTarget.ELEMENT_GROUP},
OverrideProcessor.ALWAYS_TRUE);
ResolveState state = ResolveState.initial();
state = state.put(CSharpResolveUtil.EXTRACTOR, extractor);
state = state.put(CSharpResolveUtil.SELECTOR, new MemberByNameSelector(name));
CSharpResolveUtil.walkChildren(memberResolveScopeProcessor, owner, false, true, state);
for(PsiElement psiElement : psiElementProcessor.getElements())
{
if(psiElement instanceof CSharpElementGroup)
{
for(PsiElement element : ((CSharpElementGroup<?>) psiElement).getElements())
{
//TODO [VISTALL] parameter handling
if(element instanceof DotNetMethodDeclaration &&
((DotNetMethodDeclaration) element).getParameters().length == parameterSize &&
isMyElement(element, parentQName))
{
return (DotNetMethodDeclaration) element;
}
}
}
}
return null;
}
示例5: createGenerateContext
import consulo.dotnet.psi.DotNetMemberOwner; //导入依赖的package包/类
@Override
protected CreateUnresolvedElementFixContext createGenerateContext()
{
CSharpReferenceExpression element = myPointer.getElement();
if(element == null)
{
return null;
}
if(element.kind() == CSharpReferenceExpression.ResolveToKind.ANY_MEMBER)
{
PsiElement qualifier = element.getQualifier();
if(qualifier == null)
{
final DotNetQualifiedElement qualifiedElement = PsiTreeUtil.getParentOfType(element, DotNetQualifiedElement.class);
if(qualifiedElement == null)
{
return null;
}
PsiElement parent = qualifiedElement.getParent();
if(parent instanceof DotNetMemberOwner && parent.isWritable())
{
return new CreateUnresolvedElementFixContext(element, (DotNetMemberOwner) parent);
}
}
else
{
if(qualifier instanceof DotNetExpression)
{
DotNetTypeRef typeRef = ((DotNetExpression) qualifier).toTypeRef(true);
DotNetTypeResolveResult typeResolveResult = typeRef.resolve();
PsiElement typeResolveResultElement = typeResolveResult.getElement();
if(typeResolveResultElement instanceof DotNetMemberOwner && typeResolveResultElement.isWritable())
{
return new CreateUnresolvedElementFixContext(element, (DotNetMemberOwner) typeResolveResultElement);
}
}
}
}
return null;
}
示例6: createGenerateContext
import consulo.dotnet.psi.DotNetMemberOwner; //导入依赖的package包/类
@Override
@Nullable
@RequiredReadAction
protected CreateUnresolvedElementFixContext createGenerateContext()
{
CSharpReferenceExpression element = myPointer.getElement();
if(element == null)
{
return null;
}
if(element.kind() == CSharpReferenceExpression.ResolveToKind.METHOD)
{
PsiElement qualifier = element.getQualifier();
if(qualifier == null)
{
final DotNetQualifiedElement qualifiedElement = PsiTreeUtil.getParentOfType(element, DotNetQualifiedElement.class);
if(qualifiedElement == null)
{
return null;
}
PsiElement parent = qualifiedElement.getParent();
if(parent instanceof DotNetMemberOwner && parent.isWritable())
{
return new CreateUnresolvedElementFixContext(element, (DotNetMemberOwner) parent);
}
}
else
{
DotNetTypeRef typeRef = ((DotNetExpression) qualifier).toTypeRef(true);
DotNetTypeResolveResult typeResolveResult = typeRef.resolve();
PsiElement typeResolveResultElement = typeResolveResult.getElement();
if(typeResolveResultElement instanceof DotNetMemberOwner && typeResolveResultElement.isWritable())
{
return new CreateUnresolvedElementFixContext(element, (DotNetMemberOwner) typeResolveResultElement);
}
}
}
return null;
}
示例7: CreateUnresolvedElementFixContext
import consulo.dotnet.psi.DotNetMemberOwner; //导入依赖的package包/类
public CreateUnresolvedElementFixContext(CSharpReferenceExpression expression, DotNetMemberOwner targetForGenerate)
{
myExpression = expression;
myTargetForGenerate = targetForGenerate;
}
示例8: getTargetForGenerate
import consulo.dotnet.psi.DotNetMemberOwner; //导入依赖的package包/类
public DotNetMemberOwner getTargetForGenerate()
{
return myTargetForGenerate;
}
示例9: getLineMarkerInfo
import consulo.dotnet.psi.DotNetMemberOwner; //导入依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public LineMarkerInfo getLineMarkerInfo(@NotNull PsiElement element)
{
if(myDaemonCodeAnalyzerSettings.SHOW_METHOD_SEPARATORS && (element instanceof DotNetQualifiedElement))
{
if(element.getNode().getTreeParent() == null)
{
return null;
}
final PsiElement parent = element.getParent();
if(!(parent instanceof DotNetMemberOwner))
{
return null;
}
if(ArrayUtil.getFirstElement(((DotNetMemberOwner) parent).getMembers()) == element)
{
return null;
}
LineMarkerInfo info = new LineMarkerInfo<PsiElement>(element, element.getTextRange(), null, Pass.UPDATE_ALL, FunctionUtil.<Object, String>nullConstant(), null,
GutterIconRenderer.Alignment.RIGHT);
EditorColorsScheme scheme = myEditorColorsManager.getGlobalScheme();
info.separatorColor = scheme.getColor(CodeInsightColors.METHOD_SEPARATORS_COLOR);
info.separatorPlacement = SeparatorPlacement.TOP;
return info;
}
final Ref<LineMarkerInfo> ref = Ref.create();
Consumer<LineMarkerInfo> consumer = new Consumer<LineMarkerInfo>()
{
@Override
public void consume(LineMarkerInfo markerInfo)
{
ref.set(markerInfo);
}
};
//noinspection ForLoopReplaceableByForEach
for(int j = 0; j < ourSingleCollector.length; j++)
{
LineMarkerCollector ourCollector = ourSingleCollector[j];
ourCollector.collect(element, consumer);
}
return ref.get();
}
示例10: modify
import consulo.dotnet.psi.DotNetMemberOwner; //导入依赖的package包/类
@Override
@RequiredDispatchThread
public Collection<AbstractTreeNode> modify(AbstractTreeNode abstractTreeNode, Collection<AbstractTreeNode> oldNodes, ViewSettings settings)
{
List<AbstractTreeNode> nodes = new ArrayList<>(oldNodes.size());
for(AbstractTreeNode treeNode : oldNodes)
{
Object value = treeNode.getValue();
if(value instanceof PsiFile)
{
CSharpFile file = CSharpPsiUtilImpl.findCSharpFile((PsiFile) value);
if(file != null)
{
if(CSharpLocationUtil.isValidLocation(myProject, ((PsiFile) value).getVirtualFile()))
{
DotNetNamedElement singleElement = CSharpPsiUtilImpl.findSingleElementNoNameCheck(file);
if(singleElement instanceof CSharpDummyDeclarationImpl)
{
nodes.add(new CSharpElementTreeNode(file, settings, 0));
}
else if(singleElement != null)
{
nodes.add(new CSharpElementTreeNode(singleElement, settings, CSharpElementTreeNode.ALLOW_GRAY_FILE_NAME));
}
else
{
nodes.add(new CSharpElementTreeNode(file, settings, CSharpElementTreeNode.FORCE_EXPAND));
}
}
else
{
nodes.add(treeNode);
}
}
else
{
nodes.add(treeNode);
}
}
else
{
if(value instanceof DotNetMemberOwner)
{
nodes.add(new CSharpElementTreeNode((DotNetMemberOwner) value, settings, 0));
}
else
{
nodes.add(treeNode);
}
}
}
return nodes;
}
示例11: doCheck
import consulo.dotnet.psi.DotNetMemberOwner; //导入依赖的package包/类
@NotNull
@RequiredReadAction
public static List<CompilerCheckBuilder> doCheck(@NotNull CompilerCheck<? extends DotNetMemberOwner> compilerCheck, @NotNull DotNetMemberOwner t)
{
List<CompilerCheckBuilder> results = new SmartList<>();
final DotNetNamedElement[] members = t.getMembers();
List<DotNetNamedElement> duplicateMembers = new ArrayList<>();
for(DotNetNamedElement searchElement : members)
{
if(!(searchElement instanceof PsiNameIdentifierOwner))
{
continue;
}
String searchName = searchElement.getName();
if(searchName == null)
{
continue;
}
for(DotNetNamedElement mayDuplicate : members)
{
if(searchElement == mayDuplicate)
{
continue;
}
if(!(mayDuplicate instanceof PsiNameIdentifierOwner))
{
continue;
}
String targetName = mayDuplicate.getName();
if(searchName.equals(targetName))
{
// skip type declarations if partial
if(searchElement instanceof CSharpTypeDeclaration && mayDuplicate instanceof CSharpTypeDeclaration && CSharpElementCompareUtil.isEqualWithVirtualImpl(searchElement, mayDuplicate,
searchElement) && isPartial(searchElement) && isPartial(mayDuplicate))
{
continue;
}
if(searchElement instanceof CSharpTypeDeclaration && mayDuplicate instanceof CSharpTypeDeclaration && ((CSharpTypeDeclaration) searchElement).getGenericParametersCount() !=
((CSharpTypeDeclaration) mayDuplicate).getGenericParametersCount())
{
continue;
}
if(searchElement instanceof DotNetLikeMethodDeclaration && mayDuplicate instanceof DotNetLikeMethodDeclaration && !CSharpElementCompareUtil.isEqualWithVirtualImpl(searchElement,
mayDuplicate, searchElement))
{
continue;
}
if(searchElement instanceof CSharpPropertyDeclaration && mayDuplicate instanceof CSharpPropertyDeclaration && !CSharpElementCompareUtil.isEqualWithVirtualImpl(searchElement,
mayDuplicate, searchElement))
{
continue;
}
duplicateMembers.add(mayDuplicate);
}
}
}
String name = t instanceof PsiFile ? "<global namespace>" : ((DotNetQualifiedElement) t).getPresentableQName();
for(DotNetNamedElement duplicateMember : duplicateMembers)
{
PsiElement toHighlight = duplicateMember;
if(duplicateMember instanceof PsiNameIdentifierOwner)
{
PsiElement nameIdentifier = ((PsiNameIdentifierOwner) duplicateMember).getNameIdentifier();
toHighlight = ObjectUtil.notNull(nameIdentifier, duplicateMember);
}
results.add(compilerCheck.newBuilder(toHighlight, name, duplicateMember.getName()));
}
return results;
}