开发者

Creating an Eclipse plug-in with its own folder structure

开发者 https://www.devze.com 2023-03-04 02:21 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号