Import project programmatically from new project dialog.


I'm encountered a simple problem. I need to do an import acton from my, custom "new project" dialog. At the last sstep, I have runed ProjectUtils.openOrImport, but it's opens 2 project windows with same project. How can I cancel one of them? May be somehow cancel my "new" dialog after import started... But I can't find, how.

Or may be you have another solution.

Why import? Because I used new project dialog for customize some files, and then run an utility, to make project files from them.


Hi Seagull,

I'm afraid I don't quite understand what do you want to achieve via calling ProjectUtil.openOrImport(). You can check how built-in IJ importers work (e.g. here).



No, no. I have write my own importer. And it's works perfect for me.

And I want to use it in new project dialog.

I have my own xml-based project file format. I have implemented importer, which makes idea project. In new project dialog (created via Project tempate factory), I do all work to setup my project. And now I need to convert it to idea project, using already written code. And I actually can do it, using openOrImport.

Al was good, but one thing. Idea open my project twice. First, because of new project wizard end. Second time, cause openOrImport. By the way, I have realized now, that it will likely ask "Open on this or another window". It's bad to... Can I skip it?


Is your plugin open-source? I'm asking because it's still not clear what is performed there.



No, It's not open-source.

Let's suppose I have an utility to create idea-project. Externally. And I want to run it, and then open project, I received. Thats all.

It's simpler? Cause I can't understand, what i need to explain detailed, may be you point me at unclear moments for you.

I'll be glad for any help.

P.S. Sorry, for misleading. yes, I don't need any import. Only to open, a valid idea project. But it's generated by external utility during "new project wizard". In the same folder, as the wizard's created project. So, I think, I can allow idea to create it's project stub, and then owerrite default files. In this case I need an method to invoke my utility (simple call some java code), right after project was created.
And I remember, that I have seen some function like this before... Will search now.


All right. I have managed it. But now it ask to reload project, due to external changes in project files. Anyway it's better, nearly works. But maybe I can change idea-generated files earlier? To load  actual files at project startup?


Why do you want to change directly IJ project config files? Why don't you want to modify Project object instead? That would allow to avoid that in-memory/file system inconsistency.



Please sign in to leave a comment.