Creating "default" ProjectResources?

I’m trying to create some default ProjectResources whenever a new project is created.
Right now I’m adding a ProjectListener to the Gateway project manager, listening to projectAdded, and adding my resources as ChangeOperations.CreateResourceOperations using ProjectManager#push().

Things are kinda working… after creating a new project I can see my ProjectListener fire, but the resources don’t get picked up right away (they’re not visible in the designer). Only after a couple minutes I see this in the Gateway Logs:

Setting LastModification to "external" on [myProjectName]/[myResourceName] [myResourceType]

After this message shows in the logs, I can pull changes into the designer and see my created resources.

What do I need to do to get the resources loaded immediately after creating a project from the designer?

This seems like it might be an XY problem. What are the ‘default’ resources you’re creating - are they expected to be present (and not able to be deleted) or actual ‘templates’ of some kind?

1 Like

Yeah, you’re right :laughing:

These resources are meant to be used as a starting point and can be deleted/edited by the user.
Thinking it through, providing a template project for users to import alongside my module is probably a better route to take.

I think this starting by incorrectly remembering that default vision/perspective windows/views were created for each new project (they’re only created when you select a project template).

One thing along these lines that we added recently is the concept of ‘Welcome’ tabs for most workspaces in the designer. There’s some useful helpers you can extend:
https://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.10/com/inductiveautomation/ignition/designer/workspacewelcome/package-summary.html

Ooh I like that idea, thanks for the reference!