Refactor ExtensionPoints to make them easier to create in the future.

This commit is contained in:
Maurice Parker
2020-04-14 16:47:05 -05:00
parent f5aac9516f
commit e206909237
16 changed files with 381 additions and 246 deletions

View File

@@ -24,15 +24,12 @@ final class ExtensionPointPreferencesViewController: NSViewController {
NotificationCenter.default.addObserver(self, selector: #selector(activeExtensionPointsDidChange(_:)), name: .ActiveExtensionPointsDidChange, object: nil)
showController(ExtensionPointAddViewController())
// Fix tableView frame  for some reason IB wants it 1pt wider than the clip view. This leads to unwanted horizontal scrolling.
var rTable = tableView.frame
rTable.size.width = tableView.superview!.frame.size.width
tableView.frame = rTable
activeExtensionPointIDs = Array(ExtensionPointManager.shared.activeExtensionPoints.keys)
tableView.reloadData()
showDefaultView()
}
@IBAction func enableExtensionPoints(_ sender: Any) {
@@ -104,6 +101,10 @@ extension ExtensionPointPreferencesViewController: NSTableViewDelegate {
private extension ExtensionPointPreferencesViewController {
@objc func activeExtensionPointsDidChange(_ note: Notification) {
showDefaultView()
}
func showDefaultView() {
activeExtensionPointIDs = Array(ExtensionPointManager.shared.activeExtensionPoints.keys).sorted(by: { $0.title < $1.title })
tableView.reloadData()
showController(ExtensionPointAddViewController())