本文整理汇总了Java中consulo.dotnet.psi.DotNetModifierListOwner类的典型用法代码示例。如果您正苦于以下问题:Java DotNetModifierListOwner类的具体用法?Java DotNetModifierListOwner怎么用?Java DotNetModifierListOwner使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DotNetModifierListOwner类属于consulo.dotnet.psi包,在下文中一共展示了DotNetModifierListOwner类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getRequiredOverrideModifier
import consulo.dotnet.psi.DotNetModifierListOwner; //导入依赖的package包/类
@RequiredReadAction
public static CSharpModifier getRequiredOverrideModifier(@NotNull DotNetModifierListOwner modifierListOwner)
{
DotNetModifierList modifierList = modifierListOwner.getModifierList();
if(modifierList == null)
{
return null;
}
if(modifierList.hasModifier(CSharpModifier.INTERFACE_ABSTRACT))
{
return null;
}
if(modifierList.hasModifierInTree(CSharpModifier.ABSTRACT) || modifierList.hasModifierInTree(CSharpModifier.VIRTUAL) || modifierList.hasModifierInTree(CSharpModifier.OVERRIDE))
{
return CSharpModifier.OVERRIDE;
}
return CSharpModifier.NEW;
}
示例2: isAllowForOverride
import consulo.dotnet.psi.DotNetModifierListOwner; //导入依赖的package包/类
@RequiredReadAction
public static boolean isAllowForOverride(@NotNull PsiElement parent)
{
if(!(parent instanceof DotNetVirtualImplementOwner))
{
return false;
}
if(parent instanceof CSharpMethodDeclaration && ((CSharpMethodDeclaration) parent).isDelegate())
{
return false;
}
if(parent instanceof DotNetModifierListOwner && ((DotNetModifierListOwner) parent).hasModifier(CSharpModifier.STATIC))
{
return false;
}
return true;
}
示例3: collectMembersWithModifier
import consulo.dotnet.psi.DotNetModifierListOwner; //导入依赖的package包/类
@NotNull
@RequiredReadAction
public static Collection<DotNetModifierListOwner> collectMembersWithModifier(@NotNull PsiElement element, @NotNull DotNetGenericExtractor extractor, @NotNull CSharpModifier modifier)
{
List<DotNetModifierListOwner> psiElements = new SmartList<>();
for(PsiElement psiElement : getAllMembers(element, element.getResolveScope(), extractor, false, true))
{
ProgressManager.checkCanceled();
if(psiElement instanceof DotNetModifierListOwner && ((DotNetModifierListOwner) psiElement).hasModifier(modifier))
{
psiElements.add((DotNetModifierListOwner) psiElement);
}
}
return psiElements;
}
示例4: hasModifierInParentIfType
import consulo.dotnet.psi.DotNetModifierListOwner; //导入依赖的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);
}
示例5: findOwner
import consulo.dotnet.psi.DotNetModifierListOwner; //导入依赖的package包/类
@Nullable
@RequiredReadAction
public static DotNetModifierListOwner findOwner(@NotNull PsiElement element)
{
PsiElement parent = element.getParent();
if(element instanceof CSharpIdentifier && parent instanceof DotNetModifierListOwner)
{
return (DotNetModifierListOwner) parent;
}
if(parent instanceof CSharpIdentifier && parent.getParent() instanceof DotNetModifierListOwner)
{
return (DotNetModifierListOwner) parent.getParent();
}
PsiElement prevSibling = element.getPrevSibling();
if(prevSibling instanceof CSharpIdentifier && prevSibling.getParent() instanceof DotNetModifierListOwner)
{
return (DotNetModifierListOwner) prevSibling.getParent();
}
return null;
}
示例6: invoke
import consulo.dotnet.psi.DotNetModifierListOwner; //导入依赖的package包/类
@Override
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException
{
DotNetModifierListOwner owner = CSharpIntentionUtil.findOwner(element);
if(owner == null || !owner.isWritable())
{
return;
}
DotNetModifierList modifierList = owner.getModifierList();
if(modifierList == null)
{
return;
}
beforeAdd(modifierList);
for(CSharpModifier modifier : ArrayUtil.reverseArray(myModifiers))
{
modifierList.addModifier(modifier);
}
}
示例7: processCompletion
import consulo.dotnet.psi.DotNetModifierListOwner; //导入依赖的package包/类
@RequiredReadAction
@Override
public void processCompletion(@NotNull CompletionParameters parameters,
@NotNull ProcessingContext context,
@NotNull final Consumer<LookupElement> result,
@NotNull CSharpTypeDeclaration typeDeclaration)
{
Collection<DotNetModifierListOwner> overrideItems = getItemsImpl(typeDeclaration);
for(DotNetModifierListOwner overrideItem : overrideItems)
{
LookupElementBuilder builder = buildLookupItem(typeDeclaration, overrideItem, false);
result.consume(builder);
if(!typeDeclaration.isInterface() && overrideItem.hasModifier(CSharpModifier.INTERFACE_ABSTRACT))
{
builder = buildLookupItem(typeDeclaration, overrideItem, true);
result.consume(builder);
}
}
}
示例8: invoke
import consulo.dotnet.psi.DotNetModifierListOwner; //导入依赖的package包/类
@Override
public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull PsiFile file)
{
DotNetVirtualImplementOwner virtualImplementOwner = findVirtualImplementOwner(editor, file);
if(virtualImplementOwner == null)
{
return;
}
Collection<DotNetVirtualImplementOwner> collection = OverrideUtil.collectOverridingMembers(virtualImplementOwner);
for(DotNetVirtualImplementOwner owner : collection)
{
if(!(owner instanceof DotNetModifierListOwner && ((DotNetModifierListOwner) owner).hasModifier(DotNetModifier.ABSTRACT)))
{
((Navigatable)owner).navigate(true);
return;
}
}
DotNetVirtualImplementOwner firstItem = ContainerUtil.getFirstItem(collection);
if(firstItem instanceof Navigatable)
{
((Navigatable) firstItem).navigate(true);
}
}
示例9: checkImpl
import consulo.dotnet.psi.DotNetModifierListOwner; //导入依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public HighlightInfoFactory checkImpl(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull CSharpReferenceExpression element)
{
PsiElement resolve = element.resolve();
if(resolve instanceof DotNetModifierListOwner)
{
if(!CSharpVisibilityUtil.isVisible((DotNetModifierListOwner) resolve, element))
{
return newBuilder(element.getReferenceElement(), formatElement(resolve));
}
}
return null;
}
示例10: isAllowedUnsafeCode
import consulo.dotnet.psi.DotNetModifierListOwner; //导入依赖的package包/类
@NotNull
private static Pair<Boolean, DotNetModifierListOwner> isAllowedUnsafeCode(PsiElement element)
{
CSharpUnsafeStatementImpl unsafeStatement = PsiTreeUtil.getParentOfType(element, CSharpUnsafeStatementImpl.class);
if(unsafeStatement != null)
{
return Pair.create(Boolean.TRUE, null);
}
DotNetQualifiedElement qualifiedElement = PsiTreeUtil.getParentOfType(element, DotNetQualifiedElement.class);
if(!(qualifiedElement instanceof DotNetModifierListOwner))
{
// dont interest if we dont have parent - how it can be?
return Pair.create(Boolean.TRUE, null);
}
DotNetModifierListOwner modifierListOwner = (DotNetModifierListOwner) qualifiedElement;
return Pair.create(modifierListOwner.hasModifier(CSharpModifier.UNSAFE), modifierListOwner);
}
示例11: checkImpl
import consulo.dotnet.psi.DotNetModifierListOwner; //导入依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public CompilerCheckBuilder checkImpl(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull DotNetVariable element)
{
if(element instanceof DotNetParameter)
{
// see CS0721
return null;
}
DotNetType type = element.getType();
PsiElement resolve = DotNetTypeRefUtil.resolve(type);
if(resolve instanceof DotNetTypeDeclaration && ((DotNetTypeDeclaration) resolve).hasModifier(DotNetModifier.STATIC))
{
return newBuilder(type, formatElement(element)).addQuickFix(new RemoveModifierFix(DotNetModifier.STATIC, (DotNetModifierListOwner) resolve));
}
return null;
}
示例12: checkImpl
import consulo.dotnet.psi.DotNetModifierListOwner; //导入依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public HighlightInfoFactory checkImpl(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull DotNetElement element)
{
PsiElement targetElement = getElement(element);
if(targetElement == null)
{
return null;
}
CSharpSimpleModuleExtension extension = highlightContext.getCSharpModuleExtension();
if(extension != null && !extension.isAllowUnsafeCode())
{
CompilerCheckBuilder builder = newBuilder(targetElement).addQuickFix(new AllowUnsafeCodeFix());
if(targetElement.getParent() instanceof CSharpModifierList)
{
builder.addQuickFix(new RemoveModifierFix(CSharpModifier.UNSAFE, (DotNetModifierListOwner) element));
}
return builder;
}
return null;
}
示例13: getElement
import consulo.dotnet.psi.DotNetModifierListOwner; //导入依赖的package包/类
@Nullable
private static PsiElement getElement(DotNetElement element)
{
if(element instanceof CSharpUnsafeStatementImpl)
{
return ((CSharpUnsafeStatementImpl) element).getUnsafeElement();
}
else if(element instanceof DotNetModifierListOwner)
{
DotNetModifierList modifierList = ((DotNetModifierListOwner) element).getModifierList();
if(modifierList == null)
{
return null;
}
return modifierList.getModifierElement(CSharpModifier.UNSAFE);
}
return null;
}
示例14: checkImpl
import consulo.dotnet.psi.DotNetModifierListOwner; //导入依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public HighlightInfoFactory checkImpl(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull DotNetModifierListOwner element)
{
PsiElement parent = element.getParent();
if(parent instanceof DotNetTypeDeclaration && ((DotNetTypeDeclaration) parent).hasModifier(DotNetModifier.STATIC))
{
if(CSharpPsiUtilImpl.isTypeLikeElement(element))
{
return null;
}
if(!element.hasModifier(DotNetModifier.STATIC))
{
PsiElement nameIdentifier = ((PsiNameIdentifierOwner) element).getNameIdentifier();
return newBuilder(ObjectUtil.notNull(nameIdentifier, element), formatElement(element)).addQuickFix(new AddModifierFix
(DotNetModifier.STATIC, element));
}
}
return null;
}
示例15: copyModifiers
import consulo.dotnet.psi.DotNetModifierListOwner; //导入依赖的package包/类
@RequiredReadAction
private static void copyModifiers(DotNetModifierListOwner modifierListOwner, BaseStubBuilder baseStubBuilder)
{
if(modifierListOwner.hasModifier(DotNetModifier.STATIC))
{
baseStubBuilder.addModifier(PsiModifier.STATIC);
}
if(modifierListOwner.hasModifier(DotNetModifier.PUBLIC))
{
baseStubBuilder.addModifier(PsiModifier.PUBLIC);
}
else if(modifierListOwner.hasModifier(DotNetModifier.PRIVATE))
{
baseStubBuilder.addModifier(PsiModifier.PRIVATE);
}
else if(modifierListOwner.hasModifier(DotNetModifier.PROTECTED))
{
baseStubBuilder.addModifier(PsiModifier.PROTECTED);
}
else
{
//baseStubBuilder.addModifier(PsiModifier.PACKAGE_LOCAL);
}
if(modifierListOwner.hasModifier(DotNetModifier.ABSTRACT))
{
baseStubBuilder.addModifier(PsiModifier.ABSTRACT);
}
}