Hi all,
I am developing various plugins.
I need to via the plugin/api add referenced/dependent projects. I can get them,
but there seems no way to add/remove them.
Please help!
Thanks
George
Hi all,
I am developing various plugins.
I need to via the plugin/api add referenced/dependent projects. I can get them,
but there seems no way to add/remove them.
Please help!
Thanks
George
Better late than never!
What you need to is get your current active project. From this you can then call the addLinkedProject()
method which requires you to pass through two parameters, a file
and a frame
.
The file
being your path to your workspace location (which will contain your projects). The frame
being some sort of dialog. In the example below I just pass through an empty frame (this is the default based upon the API docs).
Take the following code snippet:
public static void linkProject(){
IProject currProj = ApplicationManager.instance().getProjectManager().getProject();
ViewManager viewManager = ApplicationManager.instance().getViewManager();
File file = buildWorkSpacePath("Test");
currProj.addLinkedProject(file, viewManager.getRootFrame());
}
private static File buildWorkSpacePath(String projectName){
File dir = ApplicationManager.instance().getWorkspaceLocation().getAbsoluteFile();
String path = dir.getPath() + "/teamwork_client/projects/" + projectName + "/" + projectName + ".vpp";
File file = new File(path);
return file;
}
Hope this helps!