I'm developing an IDE plugin with Eclipse at work and need to create a custom import function that adds an existing project into the Project Explorer tree WITHOUT copying the files into the workspace. Ideally the user will be able to import an existing project into the Project Explorer Tree by providing the program with a project directory via a custom import wizard. I'm able to access the Project Explorer tree with the jface AbstractTreeViewer but I'm having difficulties adding to it with the 'add()' function. Specifically I'm not sure what information I need to provide into the 'parentElementOrTreePath' and 'childElement' fields.
The code I'm currently working with is thus:
final IWorkbenchPart activePart = getActivePart();
if (activePart != null && activePart instanceof IPackagesViewPart) {
AbstractTreeViewer tree = ((IPackagesViewPart) activePart).getTreeViewer();
tree.add(parentElementOrTreePath, childElement);
}