本文整理汇总了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;
}
示例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;
});
}
示例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();
}
示例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;
});
}
示例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;
}
示例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);
}
}
}
}
示例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);
}
示例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;
}
示例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());
}
示例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);
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}