IntelliJ open's two frames of IDEA whne project is created programmatically

Hi,

I am creating Java project programmatically using API's from openapi.jar and idea.jar.
The steps that we followed are:
1:ProjectManagerImpl.getInstanceEx().newProject(newProjectFilePath,true,false);
2:Added project jdk and set it compliance level to 1.4
3:Save the project.
4:Create a JavaModuleBuilder
5:Create a model using ModifiableModuleModel model = ModuleManager.getInstance(project).getModifiableModel();
6:Set te module file path, module name. set sourcepaths, set classes path, set content entry path, set module jdk.
7:Create module using modulebuilder.createModule(model); and do a model.commit().
8:StartupManager.getInstance(project).registerPostStartupActivity(new Runnable() {

public void run()
{
SwingUtilities.invokeLater(new Runnable() {

public void run()
{
ToolWindow toolwindow = ToolWindowManager.getInstance(project).getToolWindow(ToolWindowId.PROJECT_VIEW);
if(toolwindow != null)
toolwindow.activate(null);
if(modulebuilder == null)
ModulesConfigurator.showDialog(project, null, null, true);
}
});
}

});

9:Finally we open the project instance using ProjectManagerEx.getInstanceEx().openProject(project);

The project gets opened in a new frame but an additional frame of the same project also gets opened. This behavior is random.

Can someone provide me with more information why two instances of IDEA are created when I use openProject() API?

~Priya

Please sign in to leave a comment.