setActiveInstance method
Called to set the instance given by instanceId as the active instance in the pane
given by paneId.
- Adds the instanceId to the pane's data (if not already present)
- Updates the globally active instance
- Updates the active instance for the pane given by
paneId - Notifies listeners
Implementation
void setActiveInstance({
required String instanceId,
required String paneId,
}) {
if (!api.workspace.workspaceConfigs.panesData[paneId]!.instances
.contains(instanceId)) {
api.workspace
.addInstancesToPane(instanceIds: [instanceId], paneId: paneId);
}
api.workspace.workspaceConfigs
..activeInstance = instanceId
..panesData[paneId]!.activeInstance = instanceId;
AffogatoEvents.windowPaneRequestReloadEventsController
.add(WindowPaneRequestReloadEvent(paneId));
AffogatoEvents.windowInstanceDidSetActiveEventsController
.add(WindowInstanceDidSetActiveEvent(instanceId: instanceId));
}