Creating an Eclipse plug-in with its own folder structure
I want to develop an Eclipse plug-in with my own project structure. So in detail, where c开发者_JS百科an I define the folders which should be created when creating my own project after installing the plugin?
Here's an example of how one would create a bare bones project with two folders:
IProgressMonitor progressMonitor = new NullProgressMonitor();
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IProject project = root.getProject("MyProject");
try {
project.create(progressMonitor);
project.open(progressMonitor);
IFolder firstFolder = project.getFolder("firstfolder");
firstFolder.create(true, true, progressMonitor);
IFolder secondFolder = project.getFolder("secondfolder");
secondFolder.create(true, true, progressMonitor);
} catch (CoreException e) {
e.printStackTrace();
}
You can modify this code to suit your needs and execute it from your "New Project" wizard.
Mind you, the code I posted is just an example, I strongly suggest you look at Workspace and Resource API to learn more about this topic, find out how you can add your own project nature and so on.
精彩评论