當前位置: 首頁>>代碼示例>>Java>>正文


Java DotNetModifierListOwner.hasModifier方法代碼示例

本文整理匯總了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);
		}
	}
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:23,代碼來源:CSharpOverrideOrImplementCompletionContributor.java

示例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;
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:22,代碼來源:CS0708.java

示例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);
	}
}
 
開發者ID:consulo,項目名稱:consulo-ikvm,代碼行數:31,代碼來源:StubBuilder.java

示例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;
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:13,代碼來源:AddXModifierFix.java

示例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);
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:12,代碼來源:AddInternalModifierFix.java

示例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;
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:16,代碼來源:CS0026.java

示例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;
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:29,代碼來源:CS0501.java

示例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;
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:16,代碼來源:CS1511.java

示例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);
	}
}
 
開發者ID:consulo,項目名稱:consulo-dotnet,代碼行數:30,代碼來源:MsilIconDescriptorUpdater.java

示例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;
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:64,代碼來源:CSharpContextUtil.java

示例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;
}
 
開發者ID:consulo,項目名稱:consulo-csharp,代碼行數:58,代碼來源:CS0534.java


注:本文中的consulo.dotnet.psi.DotNetModifierListOwner.hasModifier方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。