As you probably know we can load the currently open project using this code :
And also we can show the opening project dialog using this:
But is there any way to open all project inside the work space at a time ? I want to load all model elements from all projects .I know i can show opening project dialog for each project separately but this is very annoying to open all projects (about 12 projects) one after another every time i run the plugin.
I want a way to load all projects (all model elements) at a time.
Thanks in advance
Not really, keep in mind that you can have only one project open at the same time. The best you can do to get access to extra projects is to reference them (a feature provided by the Standard Edition and up).
But as far as I know this method is not fully supported by the API as of yet. The interface com.vp.plugin.RelationshipRetriever provides an option to get a list of all the currently referenced projects through the getAllRelationships() method, but it doesn’t allow us to create new references.
The first question I’m gong to ask is, what is the purpose? What are you going to process or what do you intend to do with the model elements when opening the project?
I have a theory that technically you could achieve to meet your goal. You could create 12 separate workspaces and then have VP to boot up a new instance of itself by creating a new script. Obviously if you booted up 12 instances of VP you’re machine would probably die as VP consumes a lot of memory. We allocate around 8GB memory just for VP on our own individual machines and even then it can be temperamental and a little slow at times.
We have a script(s) which opens up a VP project one at a time, does some processing and then stores information into a MySQL table(s). The only problem with this is that it does take a couple of minutes just to open and then close a project at a time when running a script.
After two years i need this feature again !!
@GregS thanks for your reply. Your solution works but its not a good solution cause i already have about 30 different projects ! Also your solution is a static manner and we should change it every time we add or remove a project.
But guys it could be great if we had a static method like :
openProject(Project name) or openProject(Project id) or …
which take the project name or id as an argument and then automatically opened that project without asking user to open it.By using this method we can provide a list of names of all projects and run that method inside a loop. So the users dont need to open projects one after another.
Dear moderators would you please share this idea with the development team?
@Mamad I got round this problem by having a plugin menu which takes the project name and the “type” of project and stores that information in a MySQL table. We then have a node script that takes all those projects and iterates over them. Depending on the “type” of project, it’ll do different things like refresh diagrams, process elements etc. To do this, we use this link to run VP without having the UI open.