()
| 1573 | |
| 1574 | /// <inheritdoc /> |
| 1575 | public override void OnInit() |
| 1576 | { |
| 1577 | // Content database events |
| 1578 | Editor.ContentDatabase.WorkspaceModified += () => _isWorkspaceDirty = true; |
| 1579 | Editor.ContentDatabase.ItemAdded += OnContentDatabaseItemAdded; |
| 1580 | Editor.ContentDatabase.ItemRemoved += OnContentDatabaseItemRemoved; |
| 1581 | Editor.ContentDatabase.WorkspaceRebuilding += () => { _workspaceRebuildLocation = SelectedNode?.Path; }; |
| 1582 | Editor.ContentDatabase.WorkspaceRebuilt += () => |
| 1583 | { |
| 1584 | var selected = Editor.ContentDatabase.Find(_workspaceRebuildLocation); |
| 1585 | if (selected is ContentFolder selectedFolder) |
| 1586 | { |
| 1587 | _navigationUnlocked = false; |
| 1588 | RefreshView(selectedFolder.Node); |
| 1589 | _tree.Select(selectedFolder.Node); |
| 1590 | UpdateItemsSearch(); |
| 1591 | _navigationUnlocked = true; |
| 1592 | UpdateUI(); |
| 1593 | } |
| 1594 | else if (_root != null) |
| 1595 | ShowRoot(); |
| 1596 | }; |
| 1597 | |
| 1598 | LoadExpandedFolders(); |
| 1599 | Refresh(); |
| 1600 | |
| 1601 | // Load last viewed folder |
| 1602 | if (Editor.ProjectCache.TryGetCustomData(ProjectDataLastViewedFolder, out string lastViewedFolder)) |
| 1603 | { |
| 1604 | if (Editor.ContentDatabase.Find(lastViewedFolder) is ContentFolder folder) |
| 1605 | _tree.Select(folder.Node); |
| 1606 | } |
| 1607 | |
| 1608 | ScriptsBuilder.ScriptsReloadBegin += OnScriptsReloadBegin; |
| 1609 | ScriptsBuilder.ScriptsReloadEnd += OnScriptsReloadEnd; |
| 1610 | } |
| 1611 | |
| 1612 | private void OnScriptsReloadBegin() |
| 1613 | { |
nothing calls this directly
no test coverage detected