【发布时间】:2014-01-12 09:27:15
【问题描述】:
.project 的示例包含
<linkedResources>
<link>
<name>node_lib</name>
<type>2</type>
<location>E:/Nodejs/node-v0.10.22/node-v0.10.22/lib</location>
</link>
</linkedResources>
如何以编程方式添加链接资源?
org.eclipse.core.resources.IProjectDescription没有相关方法
所以这个Q提到getLinks()为IProject(JavaDoc没有)
Eclipse Add marker for linked resources
相关:
Programmatically remove linked files from the project in eclipse
更新: 在这两个答案的帮助下解决了,因为它们带来了对 Eclipse 术语(什么是什么)的理解
代码
IFolder link = project.getFolder("Link");
IPath location = new Path("TEMP/folder");
if (workspace.validateLinkLocation(location).isOK()) {
link.createLink(location, IResource.NONE, null);
} else {
//invalid location, throw an exception or warn user
}
【问题讨论】:
标签: java eclipse eclipse-plugin nodeclipse eclipse-project-file