本文整理汇总了Java中consulo.msil.lang.psi.MsilFile类的典型用法代码示例。如果您正苦于以下问题:Java MsilFile类的具体用法?Java MsilFile怎么用?Java MsilFile使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MsilFile类属于consulo.msil.lang.psi包,在下文中一共展示了MsilFile类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getChildrenImpl
import consulo.msil.lang.psi.MsilFile; //导入依赖的package包/类
@Override
public Collection<AbstractTreeNode> getChildrenImpl()
{
List<Pair<String, ? extends FileType>> representFiles = MsilFileRepresentationManager.getInstance(getProject()).getRepresentFileInfos((MsilFile) getValue());
if(representFiles.isEmpty())
{
return Collections.emptyList();
}
List<AbstractTreeNode> list = new ArrayList<AbstractTreeNode>(representFiles.size());
for(Pair<String, ? extends FileType> data : representFiles)
{
list.add(new MsilRepresentFileNode(getProject(), (MsilFile) getValue(), data));
}
return list;
}
示例2: getRepresentFileInfos
import consulo.msil.lang.psi.MsilFile; //导入依赖的package包/类
@NotNull
@Override
public List<Pair<String, ? extends FileType>> getRepresentFileInfos(@NotNull MsilFile msilFile, @NotNull VirtualFile virtualFile)
{
MsilFileRepresentationProvider[] extensions = MsilFileRepresentationProvider.EP_NAME.getExtensions();
List<Pair<String, ? extends FileType>> list = new ArrayList<Pair<String, ? extends FileType>>(extensions.length);
for(MsilFileRepresentationProvider extension : extensions)
{
String fileName = extension.getRepresentFileName(msilFile);
if(fileName != null)
{
list.add(new Pair<String, FileType>(fileName, extension.getFileType()));
}
}
return list;
}
示例3: getBuilder
import consulo.msil.lang.psi.MsilFile; //导入依赖的package包/类
@Override
public StubBuilder getBuilder()
{
return new DefaultStubBuilder()
{
@NotNull
@Override
protected StubElement createStubForFile(@NotNull PsiFile file)
{
if(file instanceof MsilFile)
{
return new MsilFileStub((MsilFile) file);
}
return super.createStubForFile(file);
}
};
}
示例4: getRepresentFileName
import consulo.msil.lang.psi.MsilFile; //导入依赖的package包/类
@Nullable
@Override
@RequiredReadAction
public String getRepresentFileName(@NotNull MsilFile msilFile)
{
return msilFile.getContainingFile().getVirtualFile().getNameWithoutExtension();
}
示例5: transform
import consulo.msil.lang.psi.MsilFile; //导入依赖的package包/类
@NotNull
@Override
@RequiredReadAction
public PsiFile transform(String fileName, @NotNull MsilFile msilFile)
{
DotNetNamedElement[] members = msilFile.getMembers();
StringBuilder builder = new StringBuilder();
for(DotNetNamedElement member : members)
{
JavaClassStubBuilder build = StubBuilder.build((DotNetTypeDeclaration) member);
if(build == null)
{
continue;
}
build.buildToText(builder, null);
builder.append("\n");
}
VirtualFile virtualFile = new MsilFileRepresentationVirtualFile(fileName, JavaFileType.INSTANCE, builder);
SingleRootFileViewProvider viewProvider = new SingleRootFileViewProvider(PsiManager.getInstance(msilFile.getProject()), virtualFile, true);
final PsiJavaFileImpl file = new PsiJavaFileImpl(viewProvider);
viewProvider.forceCachedPsi(file);
((PsiManagerEx) PsiManager.getInstance(msilFile.getProject())).getFileManager().setViewProvider(virtualFile, viewProvider);
new WriteCommandAction.Simple<Object>(file.getProject(), file)
{
@Override
protected void run() throws Throwable
{
CodeStyleManager.getInstance(getProject()).reformat(file);
}
}.execute();
return file;
}
示例6: modify
import consulo.msil.lang.psi.MsilFile; //导入依赖的package包/类
@Override
public Collection<AbstractTreeNode> modify(AbstractTreeNode parent, Collection<AbstractTreeNode> children, ViewSettings settings)
{
List<AbstractTreeNode> newList = new ArrayList<AbstractTreeNode>(children.size());
for(AbstractTreeNode n : children)
{
if(n instanceof MsilFileNode)
{
newList.add(n);
continue;
}
Object value = n.getValue();
if(value instanceof MsilFile)
{
List<Pair<String, ? extends FileType>> representFiles = MsilFileRepresentationManager.getInstance(myProject).getRepresentFileInfos((MsilFile) value);
if(representFiles.isEmpty())
{
newList.add(n);
}
else
{
newList.add(new MsilFileNode(myProject, (MsilFile) value, settings));
}
}
else
{
newList.add(n);
}
}
return newList;
}
示例7: getRepresentFileInfos
import consulo.msil.lang.psi.MsilFile; //导入依赖的package包/类
@NotNull
public List<Pair<String, ? extends FileType>> getRepresentFileInfos(@NotNull MsilFile msilFile)
{
VirtualFile virtualFile = msilFile.getVirtualFile();
if(virtualFile == null)
{
return Collections.emptyList();
}
return getRepresentFileInfos(msilFile, virtualFile);
}
示例8: getRepresentationFile
import consulo.msil.lang.psi.MsilFile; //导入依赖的package包/类
@Nullable
@RequiredReadAction
public PsiFile getRepresentationFile(@NotNull FileType fileType, @NotNull VirtualFile virtualFile)
{
if(virtualFile.getFileType() != MsilFileType.INSTANCE)
{
return null;
}
PsiFile file = PsiManager.getInstance(myProject).findFile(virtualFile);
return file instanceof MsilFile ? getRepresentationFile(fileType, (MsilFile) file) : null;
}
示例9: isAllowedAssembly
import consulo.msil.lang.psi.MsilFile; //导入依赖的package包/类
@RequiredReadAction
@Override
public boolean isAllowedAssembly(@NotNull String assemblyName)
{
VirtualFile archiveRootForLocalFile = ArchiveVfsUtil.getArchiveRootForLocalFile(myModuleFile);
if(archiveRootForLocalFile == null)
{
return false;
}
VirtualFile assemblyFile = archiveRootForLocalFile.findChild("AssemblyInfo.msil");
if(assemblyFile == null)
{
return false;
}
PsiFileImpl file = (PsiFileImpl) PsiManager.getInstance(myProject).findFile(assemblyFile);
if(!(file instanceof MsilFile))
{
return false;
}
for(PsiElement psiElement : ((MsilFile) file).getMembers())
{
if(psiElement instanceof MsilAssemblyEntry)
{
MsilAssemblyEntry assemblyEntry = (MsilAssemblyEntry) psiElement;
MsilCustomAttribute[] attributes = assemblyEntry.getAttributes();
for(MsilCustomAttribute attribute : attributes)
{
if(DotNetTypeRefUtil.isVmQNameEqual(attribute.toTypeRef(), attribute, DotNetTypes2.System.Runtime.CompilerServices.InternalsVisibleToAttribute))
{
MsilCustomAttributeArgumentList argumentList = MsilCustomAttributeStubber.build(attribute);
List<MsiCustomAttributeValue> constructorArguments = argumentList.getConstructorArguments();
if(constructorArguments.size() != 1)
{
continue;
}
MsiCustomAttributeValue msiCustomAttributeValue = constructorArguments.get(0);
if(msiCustomAttributeValue.getTypeSignature() == TypeSignature.STRING && Comparing.equal(msiCustomAttributeValue.getValue(), assemblyName))
{
return true;
}
}
}
}
}
return false;
}
示例10: getRepresentFileName
import consulo.msil.lang.psi.MsilFile; //导入依赖的package包/类
@Nullable
@Override
public String getRepresentFileName(@NotNull MsilFile msilFile)
{
return FileUtil.getNameWithoutExtension(msilFile.getName()) + CSharpFileType.DOT_EXTENSION;
}
示例11: MsilFileNode
import consulo.msil.lang.psi.MsilFile; //导入依赖的package包/类
public MsilFileNode(Project project, MsilFile value, ViewSettings viewSettings)
{
super(project, value, viewSettings);
}
示例12: MsilRepresentFileNode
import consulo.msil.lang.psi.MsilFile; //导入依赖的package包/类
public MsilRepresentFileNode(Project project, MsilFile psiFile, Pair<String, ? extends FileType> value)
{
super(project, value);
myPsiFile = psiFile;
}
示例13: getRepresentationFile
import consulo.msil.lang.psi.MsilFile; //导入依赖的package包/类
@Override
@RequiredReadAction
public PsiFile getRepresentationFile(@NotNull FileType fileType, @NotNull MsilFile msilFile)
{
VirtualFile virtualFile = msilFile.getVirtualFile();
if(virtualFile == null)
{
return null;
}
Collection<PsiFile> values = myFiles.getModifiable(virtualFile);
for(PsiFile value : values)
{
if(value.getFileType() == fileType)
{
return value;
}
}
String fileName = null;
MsilFileRepresentationProvider provider = null;
for(MsilFileRepresentationProvider extension : MsilFileRepresentationProvider.EP_NAME.getExtensions())
{
String temp = extension.getRepresentFileName(msilFile);
if(temp != null)
{
fileName = temp;
provider = extension;
break;
}
}
if(fileName == null)
{
return null;
}
PsiFile transform = provider.transform(fileName, msilFile);
values.add(transform);
return transform;
}
示例14: MsilFileStub
import consulo.msil.lang.psi.MsilFile; //导入依赖的package包/类
public MsilFileStub(MsilFile file)
{
super(file);
}
示例15: getRepresentFileName
import consulo.msil.lang.psi.MsilFile; //导入依赖的package包/类
@Nullable
String getRepresentFileName(@NotNull MsilFile msilFile);