Skip to content

Commit 614a03a

Browse files
committed
chore: fix lint errors after rebase onto main
1 parent 8fb9141 commit 614a03a

4 files changed

Lines changed: 47 additions & 47 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
//
2+
// MainContentCoordinator+Registry.swift
3+
// TablePro
4+
//
5+
6+
import AppKit
7+
import Foundation
8+
9+
extension MainContentCoordinator {
10+
static func allActiveCoordinators() -> [MainContentCoordinator] {
11+
Array(activeCoordinators.values)
12+
}
13+
14+
static func coordinator(for windowId: UUID) -> MainContentCoordinator? {
15+
activeCoordinators.values.first { $0.windowId == windowId }
16+
}
17+
18+
static func coordinator(forWindow window: NSWindow) -> MainContentCoordinator? {
19+
activeCoordinators.values.first { $0.contentWindow === window }
20+
}
21+
22+
static func hasAnyUnsavedChanges() -> Bool {
23+
activeCoordinators.values.contains { coordinator in
24+
coordinator.changeManager.hasChanges
25+
|| coordinator.tabManager.tabs.contains { $0.pendingChanges.hasChanges }
26+
}
27+
}
28+
29+
static func allTabs(for connectionId: UUID) -> [QueryTab] {
30+
activeCoordinators.values
31+
.filter { $0.connectionId == connectionId }
32+
.flatMap { $0.tabManager.tabs }
33+
}
34+
35+
static func coordinator(
36+
forConnection connectionId: UUID,
37+
tabMatching predicate: (QueryTab) -> Bool
38+
) -> MainContentCoordinator? {
39+
activeCoordinators.values.first { coordinator in
40+
coordinator.connectionId == connectionId
41+
&& coordinator.tabManager.tabs.contains(where: predicate)
42+
}
43+
}
44+
}

TablePro/Views/Main/MainContentCoordinator.swift

Lines changed: 1 addition & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ final class MainContentCoordinator {
243243

244244
/// Registry of active coordinators for aggregated quit-time persistence.
245245
/// Keyed by ObjectIdentifier of each coordinator instance.
246-
private static var activeCoordinators: [ObjectIdentifier: MainContentCoordinator] = [:]
246+
static var activeCoordinators: [ObjectIdentifier: MainContentCoordinator] = [:]
247247

248248
/// Register this coordinator so quit-time persistence can aggregate tabs.
249249
private func registerForPersistence() {
@@ -255,50 +255,6 @@ final class MainContentCoordinator {
255255
Self.activeCoordinators.removeValue(forKey: ObjectIdentifier(self))
256256
}
257257

258-
/// Find a coordinator by its window identifier.
259-
static func coordinator(for windowId: UUID) -> MainContentCoordinator? {
260-
activeCoordinators.values.first { $0.windowId == windowId }
261-
}
262-
263-
/// Find the coordinator whose `contentWindow` matches the given NSWindow.
264-
/// Used by `TabWindowController` to dispatch NSWindowDelegate callbacks
265-
/// to the correct coordinator without needing a shared registry key.
266-
static func coordinator(forWindow window: NSWindow) -> MainContentCoordinator? {
267-
activeCoordinators.values.first { $0.contentWindow === window }
268-
}
269-
270-
/// Check whether any active coordinator has unsaved edits.
271-
static func hasAnyUnsavedChanges() -> Bool {
272-
activeCoordinators.values.contains { coordinator in
273-
coordinator.changeManager.hasChanges
274-
|| coordinator.tabManager.tabs.contains { $0.pendingChanges.hasChanges }
275-
}
276-
}
277-
278-
/// Collect all tabs from all active coordinators for a given connectionId.
279-
static func allTabs(for connectionId: UUID) -> [QueryTab] {
280-
activeCoordinators.values
281-
.filter { $0.connectionId == connectionId }
282-
.flatMap { $0.tabManager.tabs }
283-
}
284-
285-
/// All currently active coordinators across windows.
286-
static func allActiveCoordinators() -> [MainContentCoordinator] {
287-
Array(activeCoordinators.values)
288-
}
289-
290-
/// Find the first coordinator for `connectionId` that owns a tab matching `predicate`.
291-
/// Used to dedup cross-window tabs (Server Dashboard singleton, ER Diagram reuse).
292-
static func coordinator(
293-
forConnection connectionId: UUID,
294-
tabMatching predicate: (QueryTab) -> Bool
295-
) -> MainContentCoordinator? {
296-
activeCoordinators.values.first { coordinator in
297-
coordinator.connectionId == connectionId
298-
&& coordinator.tabManager.tabs.contains(where: predicate)
299-
}
300-
}
301-
302258
/// Collect non-preview tabs for persistence.
303259
private static func aggregatedTabs(for connectionId: UUID) -> [QueryTab] {
304260
let coordinators = activeCoordinators.values

TablePro/Views/Results/Cells/DataGridBaseCellView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class DataGridBaseCellView: NSTableCellView {
6565
return view
6666
}()
6767

68-
required override init(frame frameRect: NSRect) {
68+
override required init(frame frameRect: NSRect) {
6969
cellTextField = Self.makeTextField()
7070
super.init(frame: frameRect)
7171
commonInit()

TablePro/Views/Results/DataGridCellFactory.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ final class DataGridCellFactory {
1313
private static let sampleRowCount = 30
1414
private static let maxMeasureChars = 50
1515

16-
private static let headerFont: NSFont = NSFont.systemFont(ofSize: 13, weight: .semibold)
16+
private static let headerFont = NSFont.systemFont(ofSize: 13, weight: .semibold)
1717

1818
func calculateColumnWidth(for columnName: String) -> CGFloat {
1919
let attributes: [NSAttributedString.Key: Any] = [.font: Self.headerFont]

0 commit comments

Comments
 (0)