Creating PARENT-5-PROJECT_LOC links programmatically [message #1829991] |
Wed, 15 July 2020 06:29  |
Eclipse User |
|
|
|
Hi,
According to documentation, IFolder.createLink(URI location, requires the the location URI to be either absolute or starting with a PathVariable.
Inspecting a .project file in where I manually imporated a number of links reveals that PARENT-n-PROJECT_LOC is a valid variable referring to the directory that is n levels higher then the project location.
Is it possible to create links like this using IFolder.createLink? Is there a better way to create (programmatically) links to folders/files that are expressed relative to the project location?
Regards,
Wilbert.
|
|
|
|
Re: Creating PARENT-5-PROJECT_LOC links programmatically [message #1830042 is a reply to message #1829992] |
Thu, 16 July 2020 02:51   |
Eclipse User |
|
|
|
There is a org.eclipse.core.internal.resources.PathVariableUtil.buildParentPathVariable(String, int, boolean) method that generates the 'PARENT-count-' string.
Snippets from the call hierarchy:
org.eclipse.core.internal.resources.PathVariableUtil.convertToRelative(IPathVariableManager, URI, IResource, boolean, String)
org.eclipse.core.internal.resources.ProjectPathVariableManager.convertToRelative(URI, boolean, String)
org.eclipse.ui.wizards.datatransfer.ImportOperation.createRelativePath(IPath, IResource)
org.eclipse.ui.wizards.datatransfer.ImportOperation.importFolder(Object, int, IProgressMonitor) [line 730]
You probably want to use ProjectPathVariableManager.convertToRelative. ImportOperation.createRelativePath and ImportOperation.importFolder should give you enough context on how to use it.
|
|
|
|
Powered by
FUDForum. Page generated in 0.04820 seconds