Trying to edit resources through the SDK as described in Working with Project Resources - Ignition SDK Programmer's Guide - Ignition Documentation (inductiveautomation.com), but I can't seem to find ResourceLockManager. Is there a Maven dependency I need for this to be visible?
Ah, that documentation is not applicable to 8.0+.
I don't know if we have anything about the new project system... let me look around.
Ah, looks like all we have is this example: https://github.com/inductiveautomation/ignition-sdk-examples/tree/master/project-resource
Thanks! I'll look into that
This is sorta what I need, but I'm not looking to make my own workspace, but to edit the already existing script resources, is this possible to use without creating a whole workspace for it?
Do you want to edit them programmatically or present a UI to the user to edit them?
programmatically
as well, im hoping to be able to programmatically change any of the resources on the gateway, not just the current project if that helps
Ok, you don't need any Designer scope stuff then.
Look at the javadoc for ProjectManager
and ProjectManagerBase
interfaces. You can get a Project
, find resources in that project, and eventually push change operations back into the ProjectManager
.
This works, thanks. However, the changes don't show up until pressing the "Merge gateway to open project" button. Do you know of a way to programmatically 'press' this or force the update to resources in the open project?
There's no supported way to do so; it's a potentially destructive operation for the user (if they have local changes) so it requires user action.
If you accept the risk/don't think it's a big deal, it's a public method on the IgnitionDesigner
(non-public) class: https://github.com/IgnitionModuleDevelopmentCommunity/ignition-extensions/blob/main/designer/src/main/kotlin/org/imdc/extensions/designer/DesignerProjectExtensions.kt#L36C11-L36C11
I think this will still pop a diff resolution dialog if there are conflicts.
That's my understanding too, but still something to be aware of.