From 47b8d0dc0262e47e1a4aa544ffd71fd7b27769ad Mon Sep 17 00:00:00 2001 From: Corey Johnson Date: Wed, 21 Sep 2011 14:26:44 -0700 Subject: [PATCH] making plugins unique to windows and 'classy'. This checkin breaks everything BTW. --- src/app.coffee | 5 +++-- src/startup.coffee | 2 +- src/window.coffee | 14 +++++++------- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/app.coffee b/src/app.coffee index 86ebc6d53..2ac9c3816 100644 --- a/src/app.coffee +++ b/src/app.coffee @@ -9,12 +9,13 @@ class App @activeWindow: null - @setup: -> + @start: -> @setActiveWindow new Window controller : WindowController path : localStorage.lastOpenedPath - @activeWindow.loadPlugins() + _.map File.list("~/.atomicity/"), (path) -> + require path @setActiveWindow: (window) -> @activeWindow = window diff --git a/src/startup.coffee b/src/startup.coffee index e4ff9cf86..a02e9d189 100644 --- a/src/startup.coffee +++ b/src/startup.coffee @@ -1,3 +1,3 @@ # yay! App = require 'app' -App.setup() +App.start() diff --git a/src/window.coffee b/src/window.coffee index 1c57e5445..8af12e2a3 100644 --- a/src/window.coffee +++ b/src/window.coffee @@ -30,6 +30,8 @@ class Window bindKey @, shortcut, method @nswindow = @controller?.window + @loadPlugins() + @document.ace._emit "loaded" loadPlugins: -> Editor = require 'editor' @@ -37,14 +39,12 @@ class Window @open @path if @path? + @plugins = [] App = require 'app' - _.map File.list(App.root + "/plugins"), (plugin) -> - require plugin - - _.map File.list("~/.atomicity/"), (path) -> - require path - - @document.ace._emit "loaded" + for pluginPath in File.list(App.root + "/plugins") + if File.isDirectory pluginPath + plugin = require pluginPath + @plugins.push new plugin(@) addPane: ({position, html}) -> verticalDiv = $('#app-vertical')