本文整理匯總了Java中consulo.dotnet.psi.DotNetModifierListOwner.hasModifier方法的典型用法代碼示例。如果您正苦於以下問題:Java DotNetModifierListOwner.hasModifier方法的具體用法?Java DotNetModifierListOwner.hasModifier怎麽用?Java DotNetModifierListOwner.hasModifier使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類consulo.dotnet.psi.DotNetModifierListOwner
的用法示例。
在下文中一共展示了DotNetModifierListOwner.hasModifier方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: 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);
}
}
}
示例2: 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;
}
示例3: 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);
}
}
示例4: hasModifiers
import consulo.dotnet.psi.DotNetModifierListOwner; //導入方法依賴的package包/類
@RequiredReadAction
protected boolean hasModifiers(DotNetModifierListOwner owner)
{
for(CSharpModifier modifier : myModifiers)
{
if(!owner.hasModifier(modifier))
{
return false;
}
}
return true;
}
示例5: hasModifiers
import consulo.dotnet.psi.DotNetModifierListOwner; //導入方法依賴的package包/類
@RequiredReadAction
@Override
protected boolean hasModifiers(DotNetModifierListOwner owner)
{
if(owner.hasModifier(CSharpModifier.PROTECTED) && owner.hasModifier(DotNetModifier.INTERNAL))
{
//if we have protected internal - it not our, return true
return false;
}
return super.hasModifiers(owner);
}
示例6: checkImpl
import consulo.dotnet.psi.DotNetModifierListOwner; //導入方法依賴的package包/類
@RequiredReadAction
@Nullable
@Override
public HighlightInfoFactory checkImpl(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull CSharpReferenceExpression element)
{
if(element.kind() == CSharpReferenceExpression.ResolveToKind.THIS)
{
DotNetModifierListOwner modifierListOwner = (DotNetModifierListOwner) PsiTreeUtil.getContextOfType(element, DotNetQualifiedElement.class);
if(modifierListOwner == null || modifierListOwner.hasModifier(DotNetModifier.STATIC))
{
return newBuilder(element, "this");
}
}
return null;
}
示例7: isAllowEmptyCodeBlock
import consulo.dotnet.psi.DotNetModifierListOwner; //導入方法依賴的package包/類
@RequiredReadAction
private boolean isAllowEmptyCodeBlock(DotNetCodeBlockOwner declaration)
{
DotNetModifierListOwner owner = (DotNetModifierListOwner) declaration;
if(owner.hasModifier(DotNetModifier.ABSTRACT) || owner.hasModifier(CSharpModifier.PARTIAL) || owner.hasModifier(CSharpModifier.EXTERN))
{
return true;
}
if(owner instanceof DotNetXXXAccessor)
{
PsiElement parent = owner.getParent();
if(parent instanceof CSharpPropertyDeclaration)
{
return CSharpPropertyUtil.isAutoProperty(parent);
}
}
if(declaration instanceof CSharpMethodDeclaration)
{
if(((CSharpMethodDeclaration) declaration).isDelegate())
{
return true;
}
}
return false;
}
示例8: checkImpl
import consulo.dotnet.psi.DotNetModifierListOwner; //導入方法依賴的package包/類
@RequiredReadAction
@Nullable
@Override
public HighlightInfoFactory checkImpl(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull CSharpReferenceExpression element)
{
if(element.kind() == CSharpReferenceExpression.ResolveToKind.BASE)
{
DotNetModifierListOwner modifierListOwner = (DotNetModifierListOwner) PsiTreeUtil.getParentOfType(element, DotNetQualifiedElement.class);
if(modifierListOwner == null || modifierListOwner.hasModifier(DotNetModifier.STATIC))
{
return newBuilder(element, "base");
}
}
return null;
}
示例9: processModifierListOwner
import consulo.dotnet.psi.DotNetModifierListOwner; //導入方法依賴的package包/類
@RequiredReadAction
private static void processModifierListOwner(PsiElement element, IconDescriptor iconDescriptor, int flags)
{
DotNetModifierListOwner owner = (DotNetModifierListOwner) element;
if(BitUtil.isSet(flags, Iconable.ICON_FLAG_VISIBILITY))
{
if(owner.hasModifier(MsilTokens.PRIVATE_KEYWORD))
{
iconDescriptor.setRightIcon(AllIcons.Nodes.C_private);
}
else if(owner.hasModifier(MsilTokens.PUBLIC_KEYWORD))
{
iconDescriptor.setRightIcon(AllIcons.Nodes.C_public);
}
else if(owner.hasModifier(MsilTokens.PROTECTED_KEYWORD))
{
iconDescriptor.setRightIcon(AllIcons.Nodes.C_protected);
}
else
{
iconDescriptor.setRightIcon(AllIcons.Nodes.C_plocal);
}
}
if(owner.hasModifier(MsilTokens.SEALED_KEYWORD))
{
iconDescriptor.addLayerIcon(AllIcons.Nodes.FinalMark);
}
}
示例10: getParentContextTypeForReference
import consulo.dotnet.psi.DotNetModifierListOwner; //導入方法依賴的package包/類
@NotNull
@RequiredReadAction
public static ContextType getParentContextTypeForReference(@NotNull CSharpReferenceExpression referenceExpression)
{
PsiElement qualifier = referenceExpression.getQualifier();
if(qualifier == null)
{
// object initializer can only initialize instance variables
PsiElement parent = referenceExpression.getParent();
if(parent instanceof CSharpFieldOrPropertySet && ((CSharpFieldOrPropertySet) parent).getNameElement() == referenceExpression)
{
return ContextType.INSTANCE;
}
PsiElement resolvedElement = referenceExpression.resolve();
if(resolvedElement instanceof CSharpTypeDeclaration ||
resolvedElement instanceof DotNetNamespaceAsElement ||
resolvedElement instanceof CSharpLocalVariable ||
resolvedElement instanceof CSharpLinqVariable ||
resolvedElement instanceof DotNetParameter ||
resolvedElement instanceof CSharpLambdaParameter ||
resolvedElement instanceof CSharpConstructorDeclaration)
{
return ContextType.ANY;
}
DotNetModifierListOwner qualifiedElement = (DotNetModifierListOwner) PsiTreeUtil.getParentOfType(referenceExpression, DotNetQualifiedElement.class);
if(qualifiedElement == null)
{
return ContextType.ANY;
}
if(qualifiedElement.hasModifier(DotNetModifier.STATIC) || CSharpPsiUtilImpl.isTypeLikeElement(qualifiedElement))
{
return ContextType.STATIC;
}
// if member is static we can use it inside instance elements
if(resolvedElement instanceof DotNetModifierListOwner && ((DotNetModifierListOwner) resolvedElement).hasModifier(DotNetModifier.STATIC))
{
return ContextType.ANY;
}
return ContextType.INSTANCE_WITH_STATIC;
}
else if(qualifier instanceof CSharpReferenceExpression)
{
CSharpReferenceExpression.ResolveToKind kind = ((CSharpReferenceExpression) qualifier).kind();
// this.<caret> and base.<caret> accept only instance elements
if(kind == CSharpReferenceExpression.ResolveToKind.BASE || kind == CSharpReferenceExpression.ResolveToKind.THIS)
{
return ContextType.INSTANCE;
}
PsiElement qualifiedResolvedElement = ((CSharpReferenceExpression) qualifier).resolve();
// Console.<caret>
if(isLikeType(qualifiedResolvedElement))
{
return ContextType.STATIC;
}
return ContextType.INSTANCE;
}
return ContextType.ANY;
}
示例11: checkImpl
import consulo.dotnet.psi.DotNetModifierListOwner; //導入方法依賴的package包/類
@RequiredReadAction
@Nullable
@Override
public HighlightInfoFactory checkImpl(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull CSharpTypeDeclaration element)
{
if(element.isInterface())
{
return null;
}
PsiElement nameIdentifier = element.getNameIdentifier();
if(nameIdentifier == null)
{
return null;
}
Collection<DotNetModifierListOwner> abstractElements = OverrideUtil.collectMembersWithModifier(element, DotNetGenericExtractor.EMPTY, CSharpModifier.ABSTRACT);
if(!abstractElements.isEmpty())
{
List<DotNetModifierListOwner> targets = new SmartList<>();
boolean isAbstract = CSharpCompositeTypeDeclaration.selectCompositeOrSelfType(element).hasModifier(CSharpModifier.ABSTRACT);
for(DotNetModifierListOwner abstractElement : abstractElements)
{
if(abstractElement.hasModifier(CSharpModifier.INTERFACE_ABSTRACT))
{
targets.add(abstractElement);
}
else if(!isAbstract)
{
targets.add(abstractElement);
}
}
if(targets.isEmpty())
{
return null;
}
DotNetModifierListOwner firstItem = targets.get(0);
CompilerCheckBuilder compilerCheckBuilder;
if(firstItem.hasModifier(CSharpModifier.INTERFACE_ABSTRACT))
{
compilerCheckBuilder = newBuilderImpl(CS0535.class, nameIdentifier, formatElement(element), formatElement(firstItem));
}
else
{
compilerCheckBuilder = newBuilder(nameIdentifier, formatElement(element), formatElement(firstItem));
}
compilerCheckBuilder.addQuickFix(new ImplementMembersQuickFix());
return compilerCheckBuilder;
}
return null;
}