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


Java MsilFile类代码示例

本文整理汇总了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;
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:17,代码来源:MsilFileNode.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:17,代码来源:MsilFileRepresentationManagerImpl.java

示例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);
		}
	};
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:18,代码来源:MsilFileStubElementType.java

示例4: getRepresentFileName

import consulo.msil.lang.psi.MsilFile; //导入依赖的package包/类
@Nullable
@Override
@RequiredReadAction
public String getRepresentFileName(@NotNull MsilFile msilFile)
{
	return msilFile.getContainingFile().getVirtualFile().getNameWithoutExtension();
}
 
开发者ID:consulo,项目名称:consulo-ikvm,代码行数:8,代码来源:JavaRepresentationProvider.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-ikvm,代码行数:39,代码来源:JavaRepresentationProvider.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:34,代码来源:MsilFileRepresentationProjectViewProvider.java

示例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);
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:11,代码来源:MsilFileRepresentationManager.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:12,代码来源:MsilFileRepresentationManager.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:51,代码来源:DotNetModuleAsAssemblyModule.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:7,代码来源:CSharpMsilFileRepresentationProvider.java

示例11: MsilFileNode

import consulo.msil.lang.psi.MsilFile; //导入依赖的package包/类
public MsilFileNode(Project project, MsilFile value, ViewSettings viewSettings)
{
	super(project, value, viewSettings);
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:5,代码来源:MsilFileNode.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:6,代码来源:MsilRepresentFileNode.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:44,代码来源:MsilFileRepresentationManagerImpl.java

示例14: MsilFileStub

import consulo.msil.lang.psi.MsilFile; //导入依赖的package包/类
public MsilFileStub(MsilFile file)
{
	super(file);
}
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:5,代码来源:MsilFileStub.java

示例15: getRepresentFileName

import consulo.msil.lang.psi.MsilFile; //导入依赖的package包/类
@Nullable
String getRepresentFileName(@NotNull MsilFile msilFile);
 
开发者ID:consulo,项目名称:consulo-dotnet,代码行数:3,代码来源:MsilFileRepresentationProvider.java


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