An example of .project
contains
<linkedResources>
<link>
<name>node_lib</name>
<type>2</type>
<location>E:/Nodejs/node-v0.10.22/node-v0.10.22/lib</location>
</link>
</linkedResources>
How to add linked resources programmatically?
org.eclipse.core.resources.IProjectDescription
does not have related methods
So this Q mentions getLinks()
for IProject
(JavaDoc has no)
Eclipse Add marker for linked resources
Related to:
Programmatically remove linked files from the project in eclipse
UPDATED: Solved with help of both answers, as they brought understanding of Eclipse terminology (what is what)
Code
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
}
One of your linked questions actually refers to example code using the createLink
method of IFolder
.