当前位置: 首页>>代码示例>>Java>>正文


Java DotNetXXXAccessor类代码示例

本文整理汇总了Java中consulo.dotnet.psi.DotNetXXXAccessor的典型用法代码示例。如果您正苦于以下问题:Java DotNetXXXAccessor类的具体用法?Java DotNetXXXAccessor怎么用?Java DotNetXXXAccessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DotNetXXXAccessor类属于consulo.dotnet.psi包,在下文中一共展示了DotNetXXXAccessor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isAutoProperty

import consulo.dotnet.psi.DotNetXXXAccessor; //导入依赖的package包/类
@RequiredReadAction
public static boolean isAutoProperty(@NotNull PsiElement element)
{
	if(element instanceof CSharpPropertyDeclaration)
	{
		CSharpPropertyDeclaration propertyDeclaration = (CSharpPropertyDeclaration) element;
		DotNetXXXAccessor[] accessors = propertyDeclaration.getAccessors();
		if(accessors.length == 2 && accessors[0].getCodeBlock() == null && accessors[1].getCodeBlock() == null)
		{
			return true;
		}

		// C# 6.0 specific readonly auto property
		if(accessors.length == 1 && accessors[0].getAccessorKind() == DotNetXXXAccessor.Kind.GET && accessors[0].getCodeBlock() == null)
		{
			return CSharpModuleUtil.findLanguageVersion(element).isAtLeast(CSharpLanguageVersion._6_0);
		}
	}
	return false;
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:21,代码来源:CSharpPropertyUtil.java

示例2: MsilPropertyAsCSharpPropertyDeclaration

import consulo.dotnet.psi.DotNetXXXAccessor; //导入依赖的package包/类
@RequiredReadAction
public MsilPropertyAsCSharpPropertyDeclaration(PsiElement parent, MsilPropertyEntry variable, List<Pair<DotNetXXXAccessor, MsilMethodEntry>> pairs)
{
	super(parent, getAdditionalModifiers(variable, pairs), variable);
	myAccessors = buildAccessors(this, pairs);

	myTypeForImplementValue = NullableLazyValue.of(() ->
	{
		String nameFromBytecode = getVariable().getNameFromBytecode();
		String typeBeforeDot = StringUtil.getPackageName(nameFromBytecode);
		SomeType someType = SomeTypeParser.parseType(typeBeforeDot, nameFromBytecode);
		if(someType != null)
		{
			return new DummyType(getProject(), MsilPropertyAsCSharpPropertyDeclaration.this, someType);
		}
		return null;
	});
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:19,代码来源:MsilPropertyAsCSharpPropertyDeclaration.java

示例3: getAdditionalModifiers

import consulo.dotnet.psi.DotNetXXXAccessor; //导入依赖的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();
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:27,代码来源:MsilPropertyAsCSharpPropertyDeclaration.java

示例4: MsilEventAsCSharpEventDeclaration

import consulo.dotnet.psi.DotNetXXXAccessor; //导入依赖的package包/类
@RequiredReadAction
public MsilEventAsCSharpEventDeclaration(PsiElement parent, MsilEventEntry variable, List<Pair<DotNetXXXAccessor, MsilMethodEntry>> pairs)
{
	super(parent, MsilPropertyAsCSharpPropertyDeclaration.getAdditionalModifiers(variable, pairs), variable);
	myAccessors = MsilPropertyAsCSharpPropertyDeclaration.buildAccessors(this, pairs);

	myTypeForImplementValue = NullableLazyValue.of(() ->
	{
		String nameFromBytecode = getVariable().getNameFromBytecode();
		String typeBeforeDot = StringUtil.getPackageName(nameFromBytecode);
		SomeType someType = SomeTypeParser.parseType(typeBeforeDot, nameFromBytecode);
		if(someType != null)
		{
			return new DummyType(getProject(), MsilEventAsCSharpEventDeclaration.this, someType);
		}
		return null;
	});
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:19,代码来源:MsilEventAsCSharpEventDeclaration.java

示例5: isAutoAccessorOwner

import consulo.dotnet.psi.DotNetXXXAccessor; //导入依赖的package包/类
public static boolean isAutoAccessorOwner(@NotNull PsiElement element)
{
	if(element instanceof CSharpXXXAccessorOwner)
	{
		DotNetXXXAccessor[] accessors = ((CSharpXXXAccessorOwner) element).getAccessors();
		for(DotNetXXXAccessor accessor : accessors)
		{
			PsiElement codeBlock = accessor.getCodeBlock();
			if(codeBlock != null)
			{
				return false;
			}
		}
		return true;
	}
	return false;
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:18,代码来源:CSharpFormattingUtil.java

示例6: generateReturn

import consulo.dotnet.psi.DotNetXXXAccessor; //导入依赖的package包/类
@RequiredReadAction
public static void generateReturn(@NotNull StringBuilder builder, @NotNull PsiElement item)
{
	if(item instanceof CSharpMethodDeclaration)
	{
		generateReturnForTypeRef(builder, ((CSharpMethodDeclaration) item).getReturnTypeRef(), item);
	}
	else if(item instanceof DotNetXXXAccessor)
	{
		DotNetXXXAccessor.Kind accessorKind = ((DotNetXXXAccessor) item).getAccessorKind();
		if(accessorKind == DotNetXXXAccessor.Kind.GET)
		{
			PsiElement parent = item.getParent();
			if(parent instanceof CSharpPropertyDeclaration)
			{
				generateReturnForTypeRef(builder, ((CSharpPropertyDeclaration) parent).toTypeRef(false), item);
			}
			else if(parent instanceof CSharpIndexMethodDeclaration)
			{
				generateReturnForTypeRef(builder, ((CSharpIndexMethodDeclaration) parent).getReturnTypeRef(), item);
			}
		}
	}
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:25,代码来源:GenerateImplementMemberHandler.java

示例7: createStub

import consulo.dotnet.psi.DotNetXXXAccessor; //导入依赖的package包/类
@RequiredReadAction
@Override
public CSharpXXXAccessorStub createStub(@NotNull DotNetXXXAccessor accessor, StubElement stubElement)
{
	int otherModifiers = CSharpXXXAccessorStub.getOtherModifiers(accessor);
	return new CSharpXXXAccessorStub(stubElement, otherModifiers);
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:8,代码来源:CSharpXXXAccessorStubElementType.java

示例8: getOtherModifiers

import consulo.dotnet.psi.DotNetXXXAccessor; //导入依赖的package包/类
public static int getOtherModifiers(DotNetXXXAccessor accessor)
{
	DotNetXXXAccessor.Kind accessorKind = accessor.getAccessorKind();
	if(accessorKind == null)
	{
		return -1;
	}
	int i = ArrayUtil.indexOf(DotNetXXXAccessor.Kind.VALUES, accessor.getAccessorKind());
	assert i != -1;
	return i;
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:12,代码来源:CSharpXXXAccessorStub.java

示例9: MsilXXXAccessorAsCSharpXXXAccessor

import consulo.dotnet.psi.DotNetXXXAccessor; //导入依赖的package包/类
public MsilXXXAccessorAsCSharpXXXAccessor(@NotNull PsiElement parent,
		@NotNull DotNetXXXAccessor original,
		@NotNull MsilMethodEntry resolvedMethod)
{
	super(parent, original);
	myParent = parent;
	myModifierList = new MsilModifierListToCSharpModifierList(this, resolvedMethod.getModifierList());
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:9,代码来源:MsilXXXAccessorAsCSharpXXXAccessor.java

示例10: buildAccessors

import consulo.dotnet.psi.DotNetXXXAccessor; //导入依赖的package包/类
public static DotNetXXXAccessor[] buildAccessors(@NotNull PsiElement parent, @NotNull List<Pair<DotNetXXXAccessor, MsilMethodEntry>> pairs)
{
	List<DotNetXXXAccessor> accessors = new ArrayList<DotNetXXXAccessor>(2);

	for(Pair<DotNetXXXAccessor, MsilMethodEntry> pair : pairs)
	{
		accessors.add(new MsilXXXAccessorAsCSharpXXXAccessor(parent, pair.getFirst(), pair.getSecond()));
	}
	return ContainerUtil.toArray(accessors, DotNetXXXAccessor.ARRAY_FACTORY);
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:11,代码来源:MsilPropertyAsCSharpPropertyDeclaration.java

示例11: isCanShowAccessorKeyword

import consulo.dotnet.psi.DotNetXXXAccessor; //导入依赖的package包/类
private static boolean isCanShowAccessorKeyword(IElementType elementType, CSharpXXXAccessorOwner accessorOwner)
{
	DotNetXXXAccessor[] accessors = accessorOwner.getAccessors();
	for(DotNetXXXAccessor accessor : accessors)
	{
		DotNetXXXAccessor.Kind accessorKind = accessor.getAccessorKind();
		if(accessorKind == null)
		{
			continue;
		}
		IElementType expectedElementType;
		switch(accessorKind)
		{
			case GET:
				expectedElementType = CSharpSoftTokens.GET_KEYWORD;
				break;
			case SET:
				expectedElementType = CSharpSoftTokens.SET_KEYWORD;
				break;
			case ADD:
				expectedElementType = CSharpSoftTokens.ADD_KEYWORD;
				break;
			case REMOVE:
				expectedElementType = CSharpSoftTokens.REMOVE_KEYWORD;
				break;
			default:
				continue;
		}
		if(expectedElementType == elementType)
		{
			return false;
		}
	}
	return true;
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:36,代码来源:CSharpAccessorCompletionContributor.java

示例12: getText

import consulo.dotnet.psi.DotNetXXXAccessor; //导入依赖的package包/类
@Override
@RequiredDispatchThread
public String getText()
{
	StringBuilder builder = new StringBuilder();
	CSharpAccessModifier modifier = CSharpAccessModifier.findModifier(myDeclaration);
	boolean canGenerateCodeBlock = myCanGenerateBlock;
	if(modifier != CSharpAccessModifier.NONE && canGenerateCodeBlock)
	{
		builder.append(modifier.getPresentableText()).append(" ");
	}

	builder.append(getPresentationText());
	builder.append(" {\n");
	for(DotNetXXXAccessor accessor : myDeclaration.getAccessors())
	{
		DotNetXXXAccessor.Kind accessorKind = accessor.getAccessorKind();
		if(accessorKind == null)
		{
			continue;
		}
		builder.append(accessorKind.name().toLowerCase(Locale.US));
		if(myCanGenerateBlock)
		{
			builder.append(" {\n");
			myReturnAppender.consume(accessor, builder);
			builder.append("}");
		}
		else
		{
			builder.append(";");
		}
	}
	builder.append("}");
	return builder.toString();
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:37,代码来源:XXXAccessorOwnerChooseMember.java

示例13: isWritable

import consulo.dotnet.psi.DotNetXXXAccessor; //导入依赖的package包/类
@RequiredReadAction
private static boolean isWritable(DotNetVariable targetSetElement)
{
	if(targetSetElement.isConstant())
	{
		return false;
	}

	if(targetSetElement.hasModifier(CSharpModifier.READONLY))
	{
		return false;
	}

	if(targetSetElement instanceof CSharpPropertyDeclaration)
	{
		DotNetXXXAccessor[] accessors = ((CSharpPropertyDeclaration) targetSetElement).getAccessors();
		for(DotNetXXXAccessor accessor : accessors)
		{
			if(accessor.getAccessorKind() == DotNetXXXAccessor.Kind.SET)
			{
				return true;
			}
		}

		return false;
	}
	return true;
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:29,代码来源:CS1612.java

示例14: checkImpl

import consulo.dotnet.psi.DotNetXXXAccessor; //导入依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public HighlightInfoFactory checkImpl(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull DotNetCodeBlockOwner element)
{
	PsiElement superParent = null;

	if(element instanceof DotNetXXXAccessor)
	{
		superParent = element.getParent().getParent();
	}
	else
	{
		superParent = element.getParent();
	}

	if(element.getCodeBlock() != null && superParent instanceof DotNetTypeDeclaration && ((DotNetTypeDeclaration) superParent).isInterface())
	{
		PsiElement nameIdentifier = ((PsiNameIdentifierOwner) element).getNameIdentifier();
		if(nameIdentifier == null)
		{
			return null;
		}
		return newBuilder(nameIdentifier, formatElement(element)).addQuickFix(new CS0500.RemoveCodeBlockFix(element));
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:28,代码来源:CS0531.java

示例15: checkImpl

import consulo.dotnet.psi.DotNetXXXAccessor; //导入依赖的package包/类
@RequiredReadAction
@Nullable
@Override
public CompilerCheckBuilder checkImpl(@NotNull CSharpLanguageVersion languageVersion, @NotNull CSharpHighlightContext highlightContext, @NotNull DotNetCodeBlockOwner element)
{
	if(element instanceof CSharpIndexMethodDeclaration)
	{
		return null;
	}

	PsiElement highlight = ((PsiNameIdentifierOwner) element).getNameIdentifier();

	if(highlight == null)
	{
		highlight = element;
	}

	PsiElement codeBlock = element.getCodeBlock();
	if(codeBlock == null && !isAllowEmptyCodeBlock(element))
	{
		CompilerCheckBuilder result = newBuilder(highlight, formatElement(element));
		if(element instanceof CSharpConstructorDeclaration)
		{
			result.addQuickFix(new CreateEmptyCodeBlockFix(element));
		}
		else if(element instanceof CSharpMethodDeclaration && !(((CSharpMethodDeclaration) element).isDelegate()))
		{
			result.addQuickFix(new CreateEmptyCodeBlockFix(element));
			result.addQuickFix(new AddModifierFix(CSharpModifier.ABSTRACT, (DotNetModifierListOwner) element));
			result.addQuickFix(new AddModifierFix(CSharpModifier.EXTERN, (DotNetModifierListOwner) element));
			result.addQuickFix(new AddModifierFix(CSharpModifier.PARTIAL, (DotNetModifierListOwner) element));
		}
		else if(element instanceof DotNetXXXAccessor)
		{
			result.addQuickFix(new CreateEmptyCodeBlockFix(element));
		}
		return result;
	}
	return null;
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:41,代码来源:CS0501.java


注:本文中的consulo.dotnet.psi.DotNetXXXAccessor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。