Programmatically generate an Eclipse project

前端 未结 3 1947
半阙折子戏
半阙折子戏 2020-12-08 22:04

I use eclipse to work on an application which was originally created independently of eclipse. As such, the application\'s directory structure is decidedly not eclipse-frie

3条回答
  •  心在旅途
    2020-12-08 22:22

    You should be able to accomplish this by writing a small Eclipse plugin. You could even extend it out to being a "headless" RCP app, and pass in the command line arguments you need.

    The barebones code to create a project is:

    IProgressMonitor progressMonitor = new NullProgressMonitor();
    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
    IProject project = root.getProject("DesiredProjectName");
    project.create(progressMonitor);
    project.open(progressMonitor);
    

    Just take a look at the eclipse code for the Import Project wizard to give you a better idea of where to go with it.

提交回复
热议问题