1

I want to develop an Eclipse plug-in with my own project structure. So in detail, where can I define the folders which should be created when creating my own project after installing the plugin?

oberlies
  • 11,503
  • 4
  • 63
  • 110
Sercane
  • 21
  • 2

1 Answers1

4

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.

Sandman
  • 9,610
  • 8
  • 36
  • 41