本文整理汇总了Java中consulo.msil.lang.psi.MsilClassEntry类的典型用法代码示例。如果您正苦于以下问题:Java MsilClassEntry类的具体用法?Java MsilClassEntry怎么用?Java MsilClassEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MsilClassEntry类属于consulo.msil.lang.psi包,在下文中一共展示了MsilClassEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAdditionalModifiers
import consulo.msil.lang.psi.MsilClassEntry; //导入依赖的package包/类
@NotNull
public static CSharpModifier[] getAdditionalModifiers(PsiElement parent, List<Pair<DotNetXXXAccessor, MsilMethodEntry>> pairs)
{
PsiElement maybeTypeParent = parent.getParent();
if(maybeTypeParent instanceof MsilClassEntry && ((MsilClassEntry) maybeTypeParent).hasModifier(MsilTokens.INTERFACE_KEYWORD))
{
return CSharpModifier.EMPTY_ARRAY;
}
boolean staticMod = false;
List<CSharpAccessModifier> modifiers = new SmartList<CSharpAccessModifier>();
for(Pair<DotNetXXXAccessor, MsilMethodEntry> pair : pairs)
{
CSharpAccessModifier accessModifier = getAccessModifier(pair.getSecond());
modifiers.add(accessModifier);
if(pair.getSecond().hasModifier(MsilTokens.STATIC_KEYWORD))
{
staticMod = true;
}
}
ContainerUtil.sort(modifiers);
CSharpAccessModifier access = modifiers.isEmpty() ? CSharpAccessModifier.PUBLIC : modifiers.get(0);
return staticMod ? ArrayUtil.append(access.getModifiers(), CSharpModifier.STATIC) : access.getModifiers();
}
示例2: MsilMethodAsCSharpMethodDeclaration
import consulo.msil.lang.psi.MsilClassEntry; //导入依赖的package包/类
@RequiredReadAction
public MsilMethodAsCSharpMethodDeclaration(PsiElement parent, @Nullable MsilClassEntry declaration, @NotNull GenericParameterContext genericParameterContext, @NotNull MsilMethodEntry methodEntry)
{
super(parent, CSharpModifier.EMPTY_ARRAY, methodEntry);
myDelegate = declaration;
setGenericParameterList(declaration != null ? declaration : methodEntry, genericParameterContext);
myTypeForImplementValue = NullableLazyValue.of(() ->
{
String nameFromBytecode = myOriginal.getNameFromBytecode();
String typeBeforeDot = StringUtil.getPackageName(nameFromBytecode);
SomeType someType = SomeTypeParser.parseType(typeBeforeDot, nameFromBytecode);
if(someType != null)
{
return new DummyType(getProject(), MsilMethodAsCSharpMethodDeclaration.this, someType);
}
return null;
});
}
示例3: hasModifierInParentIfType
import consulo.msil.lang.psi.MsilClassEntry; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@RequiredReadAction
private static <T extends DotNetModifierListOwner> boolean hasModifierInParentIfType(DotNetModifierList msilModifierList, DotNetModifier modifier)
{
PsiElement parent = msilModifierList.getParent();
if(parent == null)
{
return false;
}
PsiElement parent1 = parent.getParent();
if(!(parent1 instanceof MsilClassEntry))
{
return false;
}
T modifierListOwner = (T) parent1;
return modifierListOwner.hasModifier(modifier);
}
示例4: wrapToDelegateMethod
import consulo.msil.lang.psi.MsilClassEntry; //导入依赖的package包/类
@Nullable
@RequiredReadAction
private static CSharpMethodDeclaration wrapToDelegateMethod(@NotNull MsilClassEntry typeDeclaration, @Nullable PsiElement parent, @NotNull GenericParameterContext context)
{
if(DotNetInheritUtil.isInheritor(typeDeclaration, DotNetTypes.System.MulticastDelegate, false))
{
MsilMethodEntry msilMethodEntry = (MsilMethodEntry) ContainerUtil.find((typeDeclaration).getMembers(), element -> element instanceof MsilMethodEntry && Comparing.equal(element.getName(),
"Invoke"));
assert msilMethodEntry != null : typeDeclaration.getPresentableQName();
return new MsilMethodAsCSharpMethodDeclaration(parent, typeDeclaration, context, msilMethodEntry);
}
else
{
return null;
}
}
示例5: getVmQName
import consulo.msil.lang.psi.MsilClassEntry; //导入依赖的package包/类
@Override
@RequiredReadAction
public String getVmQName()
{
MsilClassEntryStub stub = getGreenStub();
if(stub != null)
{
return stub.getVmQName();
}
if(hasModifier(MsilTokens.NESTED_KEYWORD))
{
PsiElement parent = getParent();
if(parent instanceof MsilClassEntry) //dont throw exception if tree is broken
{
return ((MsilClassEntry) parent).getVmQName() + "/" + getNameFromBytecode();
}
}
return getNameFromBytecode();
}
示例6: resolveResult
import consulo.msil.lang.psi.MsilClassEntry; //导入依赖的package包/类
@RequiredReadAction
@NotNull
@Override
protected DotNetTypeResolveResult resolveResult()
{
Project project = myElement.getProject();
if(DumbService.isDumb(project))
{
return DotNetTypeResolveResult.EMPTY;
}
DotNetTypeDeclaration[] types = DotNetPsiSearcher.getInstance(project).findTypes(myRef, myElement.getResolveScope());
for(DotNetTypeDeclaration type : types)
{
if(type instanceof MsilClassEntry)
{
return new MsilTypeResolveResult(type, DotNetTypeRef.EMPTY_ARRAY);
}
}
return DotNetTypeResolveResult.EMPTY;
}
示例7: MsilClassAsCSharpTypeDefinition
import consulo.msil.lang.psi.MsilClassEntry; //导入依赖的package包/类
@RequiredReadAction
public MsilClassAsCSharpTypeDefinition(@Nullable PsiElement parent, MsilClassEntry classEntry, @NotNull GenericParameterContext genericParameterContext)
{
super(parent, classEntry);
myGenericParameterContext = genericParameterContext;
myModifierList = new MsilModifierListToCSharpModifierList(this, classEntry.getModifierList());
DotNetGenericParameterList genericParameterList = classEntry.getGenericParameterList();
myGenericParameterList = MsilGenericParameterListAsCSharpGenericParameterList.build(this, genericParameterList, genericParameterContext);
myExtendTypeRefsValue = NotNullLazyValue.createValue(() ->
{
String vmQName = getVmQName();
// hack
if(DotNetTypes.System.Object.equals(vmQName))
{
return DotNetTypeRef.EMPTY_ARRAY;
}
DotNetTypeRef[] extendTypeRefs = myOriginal.getExtendTypeRefs();
if(extendTypeRefs.length == 0)
{
return DotNetTypeRef.EMPTY_ARRAY;
}
DotNetTypeRef[] typeRefs = new DotNetTypeRef[extendTypeRefs.length];
for(int i = 0; i < typeRefs.length; i++)
{
typeRefs[i] = MsilToCSharpUtil.extractToCSharp(extendTypeRefs[i], myOriginal);
}
return typeRefs;
});
myTypeRefForEnumConstantsValue = NotNullLazyValue.createValue(() -> MsilToCSharpUtil.extractToCSharp(myOriginal.getTypeRefForEnumConstants(), myOriginal));
}
示例8: transform
import consulo.msil.lang.psi.MsilClassEntry; //导入依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public PsiElement transform(@NotNull PsiElement element)
{
if(element instanceof MsilClassEntry)
{
if(((MsilClassEntry) element).isNested())
{
MsilClassEntry rootClassEntry = findRootClassEntry((MsilClassEntry) element);
PsiElement wrappedElement = MsilToCSharpUtil.wrap(rootClassEntry, null);
// we wrap it
if(wrappedElement != rootClassEntry)
{
PsiElement elementByOriginal = findElementByOriginal(wrappedElement, element);
if(elementByOriginal != null)
{
return elementByOriginal;
}
else
{
LOGGER.warn("We cant find by original element class: " + rootClassEntry.getVmQName() + "/" + ((MsilClassEntry) element).getVmQName());
}
}
}
else
{
return MsilToCSharpUtil.wrap(element, null);
}
}
return null;
}
示例9: findElementByOriginal
import consulo.msil.lang.psi.MsilClassEntry; //导入依赖的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;
}
示例10: createStub
import consulo.msil.lang.psi.MsilClassEntry; //导入依赖的package包/类
@RequiredReadAction
@Override
public MsilClassEntryStub createStub(@NotNull MsilClassEntry msilClassEntry, StubElement stubElement)
{
String namespace = msilClassEntry.getPresentableParentQName();
String name = msilClassEntry.getName();
String vmQName = msilClassEntry.getVmQName();
return new MsilClassEntryStub(stubElement, this, namespace, name, vmQName);
}
示例11: isNested
import consulo.msil.lang.psi.MsilClassEntry; //导入依赖的package包/类
@RequiredReadAction
@Override
public boolean isNested()
{
PsiElement parentByStub = getParentByStub();
return parentByStub instanceof MsilClassEntry;
}
示例12: compute
import consulo.msil.lang.psi.MsilClassEntry; //导入依赖的package包/类
@Nullable
@Override
public Result<MsilMethodEntry> compute()
{
DotNetType targetType = getStubOrPsiChildByIndex(MsilStubTokenSets.TYPE_STUBS, DotNetType.ARRAY_FACTORY, 1);
if(targetType == null)
{
return null;
}
String name = getMethodName();
if(name == null)
{
return null;
}
PsiElement element = targetType.toTypeRef().resolve().getElement();
if(!(element instanceof MsilClassEntry))
{
return null;
}
DotNetTypeRef[] parameterTypeRefs = getParameterTypeRefs();
MsilMethodEntry method = null;
for(DotNetNamedElement namedElement : ((MsilClassEntry) element).getMembers())
{
if(namedElement instanceof MsilMethodEntry && Comparing.equal(((MsilMethodEntry) namedElement).getNameFromBytecode(), name) && Comparing.equal(((MsilMethodEntry) namedElement)
.getParameterTypeRefs(), parameterTypeRefs))
{
method = (MsilMethodEntry) namedElement;
break;
}
}
if(method == null)
{
return null;
}
return Result.create(method, PsiModificationTracker.OUT_OF_CODE_BLOCK_MODIFICATION_COUNT);
}
示例13: processElementsWithName
import consulo.msil.lang.psi.MsilClassEntry; //导入依赖的package包/类
@Override
public void processElementsWithName(@NotNull String name, @NotNull final Processor<NavigationItem> processor, @NotNull FindSymbolParameters parameters)
{
StubIndex.getInstance().processElements(MsilIndexKeys.TYPE_BY_NAME_INDEX, name, parameters.getProject(), parameters.getSearchScope(), parameters.getIdFilter(), MsilClassEntry.class,
msilClassEntry ->
{
ProgressManager.checkCanceled();
return processor.process(new NavigatableWithRepresentation(msilClassEntry));
});
}
示例14: getDelegate
import consulo.msil.lang.psi.MsilClassEntry; //导入依赖的package包/类
@Nullable
public MsilClassEntry getDelegate()
{
return myDelegate;
}
示例15: collectTypes
import consulo.msil.lang.psi.MsilClassEntry; //导入依赖的package包/类
@Override
public void collectTypes(@NotNull String name, @NotNull GlobalSearchScope scope, @Nullable IdFilter filter, @NotNull Processor<DotNetTypeDeclaration> processor)
{
StubIndex.getInstance().processElements(MsilIndexKeys.TYPE_BY_NAME_INDEX, name, myProject, scope, MsilClassEntry.class, processor);
}