Permalink
Browse files

Merge remote-tracking branch 'origin/master' into tvoliter/quick-func…

…tion-find

* origin/master: (30 commits)
  Removed a few unnecessary requires
  Rename JSLint to JSLintUtils
  Whitespace cleanup
  Major reorganization of Brackets source files into subfolders
  Update README.md
  use display:block to select whole line
  Add TODO
  estimate initial width
  fix project tree horz scrollbars so they're only shown when necessary
  Temporary fix for global key bindings
  Revert "Always set focus to primary button in dialogs"
  added a comment explaining reason for font size difference
  change the way we do platform-specific font selection due to complications with dummy-text
  respond to comments
  nevermind, removing ubuntu mono again
  account for line endings
  Update CodeMirror SHA
  css color keywords should not be in quotes
  updates after latest refactorings
  update unit tests for initial refactoring
  ...

Conflicts:
	src/project/FileIndexManager.js
	src/search/QuickFileOpen.js
	src/thirdparty/CodeMirror2
  • Loading branch information...
2 parents 43f2443 + f442d02 commit dd806bff914cb2216cd946386e13b4d9472b3dec @tvoliter tvoliter committed Mar 23, 2012
Showing with 1,577 additions and 504 deletions.
  1. +5 −0 README.md
  2. +30 −27 src/brackets.js
  3. 0 src/{ → command}/CommandManager.js
  4. 0 src/{ → command}/Commands.js
  5. +21 −2 src/{ → command}/KeyBindingManager.js
  6. 0 src/{ → command}/KeyMap.js
  7. +2 −2 src/{ → command}/Menus.js
  8. +7 −7 src/{ → debug}/DebugCommandHandlers.js
  9. +33 −17 src/{FileCommandHandlers.js → document/DocumentCommandHandlers.js}
  10. +92 −94 src/{ → document}/DocumentManager.js
  11. +4 −4 src/{ → editor}/CodeHintManager.js
  12. +1 −1 src/{ → editor}/Editor.js
  13. +19 −14 src/{ → editor}/EditorManager.js
  14. 0 src/{ → editor}/EditorUtils.js
  15. +10 −10 src/{ → editor}/InlineEditorProviders.js
  16. +20 −2 src/{ → file}/FileUtils.js
  17. +1 −1 src/{ → file}/NativeFileSystem.js
  18. +1 −1 src/index.html
  19. +4 −5 src/{ → language}/CSSUtils.js
  20. 0 src/{CodeHintUtils.js → language/HTMLUtils.js}
  21. +2 −2 src/{JSLint.js → language/JSLintUtils.js}
  22. 0 src/{ → preferences}/PreferencesManager.js
  23. +6 −6 src/{ → project}/FileIndexManager.js
  24. +460 −0 src/project/FileIndexManager.js.orig
  25. +118 −73 src/{ → project}/FileSyncManager.js
  26. +6 −6 src/{ → project}/FileViewController.js
  27. +17 −18 src/{ → project}/ProjectManager.js
  28. +76 −59 src/{ → project}/WorkingSetView.js
  29. +6 −6 src/{ → search}/FindInFiles.js
  30. +7 −7 src/{ → search}/QuickFileOpen.js
  31. +428 −0 src/search/QuickFileOpen.js.orig
  32. +1 −1 src/{ → styles}/brackets.less
  33. +8 −1 src/styles/brackets_codemirror_override.less
  34. +1 −5 src/styles/brackets_fonts.less
  35. +29 −1 src/styles/brackets_theme_default.less
  36. +1 −1 src/styles/jsTreeTheme.less
  37. +1 −1 src/thirdparty/CodeMirror2
  38. 0 src/{ → utils}/Async.js
  39. 0 src/{ → utils}/PerfUtils.js
  40. +1 −1 src/{ → utils}/ShellAPI.js
  41. 0 src/{ → utils}/ViewUtils.js
  42. +4 −0 src/{ → widgets}/Dialogs.js
  43. +1 −1 test/SpecRunner.js
  44. +5 −5 test/spec/CSSUtils-test-files/offsets.css
  45. +4 −4 test/spec/CSSUtils-test.js
  46. +37 −37 test/spec/CodeHintUtils-test.js
  47. 0 test/spec/{FileCommandHandlers-test-files → DocumentCommandHandlers-test-files}/test.js
  48. +4 −4 test/spec/{FileCommandHandlers-test.js → DocumentCommandHandlers-test.js}
  49. +2 −2 test/spec/Editor-test.js
  50. +12 −0 test/spec/EditorManager-test-files/test.html
  51. +66 −56 test/spec/EditorManager-test.js
  52. +1 −1 test/spec/InlineEditorProviders-test.js
  53. +1 −1 test/spec/KeyMap-test.js
  54. +1 −1 test/spec/NativeFileSystem-test.js
  55. +1 −1 test/spec/PreferencesManager-test.js
  56. +9 −9 test/spec/SpecRunnerUtils.js
  57. +11 −7 test/spec/WorkingSetView-test.js
View
@@ -1,3 +1,8 @@
+**Note:** This README file is specific to the HTML/CSS/JS source code for Brackets.
+For more general notes on how to use the current build of Brackets, see the
+README.md file in the parent folder (or, if you're on github, the
+[brackets-app repo](http://github.com/adobe/brackets-app)).
+
Overview
========
View
@@ -26,29 +26,29 @@ define(function (require, exports, module) {
// Load dependent modules
- var ProjectManager = require("ProjectManager"),
- DocumentManager = require("DocumentManager"),
- EditorManager = require("EditorManager"),
- InlineEditorProviders = require("InlineEditorProviders"),
- WorkingSetView = require("WorkingSetView"),
- FileCommandHandlers = require("FileCommandHandlers"),
- FileViewController = require("FileViewController"),
- FileSyncManager = require("FileSyncManager"),
- KeyBindingManager = require("KeyBindingManager"),
- KeyMap = require("KeyMap"),
- Commands = require("Commands"),
- CommandManager = require("CommandManager"),
- CodeHintManager = require("CodeHintManager"),
- PerfUtils = require("PerfUtils"),
- FileIndexManager = require("FileIndexManager"),
- QuickFileOpen = require("QuickFileOpen"),
- Menus = require("Menus");
+ var ProjectManager = require("project/ProjectManager"),
+ DocumentManager = require("document/DocumentManager"),
+ EditorManager = require("editor/EditorManager"),
+ InlineEditorProviders = require("editor/InlineEditorProviders"),
+ WorkingSetView = require("project/WorkingSetView"),
+ DocumentCommandHandlers = require("document/DocumentCommandHandlers"),
+ FileViewController = require("project/FileViewController"),
+ FileSyncManager = require("project/FileSyncManager"),
+ KeyBindingManager = require("command/KeyBindingManager"),
+ KeyMap = require("command/KeyMap"),
+ Commands = require("command/Commands"),
+ CommandManager = require("command/CommandManager"),
+ CodeHintManager = require("editor/CodeHintManager"),
+ PerfUtils = require("utils/PerfUtils"),
+ FileIndexManager = require("project/FileIndexManager"),
+ QuickFileOpen = require("search/QuickFileOpen"),
+ Menus = require("command/Menus");
//Load modules the self-register and just need to get included in the main project
- require("JSLint");
- require("CodeHintManager");
- require("DebugCommandHandlers");
- require("FindInFiles");
+ require("language/JSLintUtils");
+ require("editor/CodeHintManager");
+ require("debug/DebugCommandHandlers");
+ require("search/FindInFiles");
// Define core brackets namespace if it isn't already defined
//
@@ -70,17 +70,17 @@ define(function (require, exports, module) {
// in the modules since they would run in context of the unit test window,
// and would not have access to the app html/css.
brackets.test = {
- PreferencesManager : require("PreferencesManager"),
+ PreferencesManager : require("preferences/PreferencesManager"),
ProjectManager : ProjectManager,
- FileCommandHandlers : FileCommandHandlers,
+ DocumentCommandHandlers : DocumentCommandHandlers,
FileViewController : FileViewController,
DocumentManager : DocumentManager,
EditorManager : EditorManager,
Commands : Commands,
WorkingSetView : WorkingSetView,
- CommandManager : require("CommandManager"),
+ CommandManager : require("command/CommandManager"),
FileIndexManager : FileIndexManager,
- CSSUtils : require("CSSUtils")
+ CSSUtils : require("language/CSSUtils")
};
// Uncomment the following line to force all low level file i/o routines to complete
@@ -90,7 +90,7 @@ define(function (require, exports, module) {
// Load native shell when brackets is run in a native shell rather than the browser
// TODO: (issue #266) load conditionally
- brackets.shellAPI = require("ShellAPI");
+ brackets.shellAPI = require("utils/ShellAPI");
brackets.inBrowser = !brackets.hasOwnProperty("fs");
@@ -141,7 +141,7 @@ define(function (require, exports, module) {
function initCommandHandlers() {
- FileCommandHandlers.init($("#main-toolbar .title"));
+ DocumentCommandHandlers.init($("#main-toolbar .title"));
}
function initKeyBindings() {
@@ -186,6 +186,9 @@ define(function (require, exports, module) {
});
}
+ // Add the platform (mac or win) to the body tag so we can have platform-specific CSS rules
+ $("body").addClass("platform-" + brackets.platform);
+
EditorManager.setEditorHolder($('#editorHolder'));
InlineEditorProviders.init();
File renamed without changes.
File renamed without changes.
@@ -11,12 +11,17 @@
define(function (require, exports, module) {
'use strict';
- var CommandManager = require("CommandManager");
+ var CommandManager = require("command/CommandManager");
/**
* The currently installed keymap.
*/
var _keymap = null;
+
+ /**
+ * Allow clients to toggle key binding
+ */
+ var _enabled = true;
/**
* Install the specified keymap as the current keymap, overwriting the existing keymap.
@@ -34,15 +39,29 @@ define(function (require, exports, module) {
* @return {boolean} true if the key was processed, false otherwise
*/
function handleKey(key) {
- if (_keymap && _keymap.map[key]) {
+ if (_enabled && _keymap && _keymap.map[key]) {
CommandManager.execute(_keymap.map[key]);
return true;
}
return false;
}
+
+
+ // TODO (issue #414): Replace this temporary fix with a more robust solution to handle focus and modality
+ /**
+ * Enable or disable key bindings. Clients such as dialogs may wish to disable
+ * global key bindings temporarily.
+ *
+ * @param {string} A key-description string.
+ * @return {boolean} true if the key was processed, false otherwise
+ */
+ function setEnabled(value) {
+ _enabled = value;
+ }
// Define public API
exports.installKeymap = installKeymap;
exports.handleKey = handleKey;
+ exports.setEnabled = setEnabled;
});
File renamed without changes.
@@ -9,8 +9,8 @@ define(function (require, exports, module) {
'use strict';
// Load dependent modules
- var Commands = require("Commands"),
- CommandManager = require("CommandManager");
+ var Commands = require("command/Commands"),
+ CommandManager = require("command/CommandManager");
function init() {
// Implements the File menu items
@@ -8,15 +8,15 @@
define(function (require, exports, module) {
'use strict';
- var Commands = require("Commands"),
- CommandManager = require("CommandManager"),
- JSLint = require("JSLint"),
- PerfUtils = require("PerfUtils");
+ var Commands = require("command/Commands"),
+ CommandManager = require("command/CommandManager"),
+ JSLintUtils = require("language/JSLintUtils"),
+ PerfUtils = require("utils/PerfUtils");
function _handleEnableJSLint() {
- JSLint.setEnabled(!JSLint.getEnabled());
- JSLint.run();
- $("#jslint-enabled-checkbox").css("display", JSLint.getEnabled() ? "" : "none");
+ JSLintUtils.setEnabled(!JSLintUtils.getEnabled());
+ JSLintUtils.run();
+ $("#jslint-enabled-checkbox").css("display", JSLintUtils.getEnabled() ? "" : "none");
}
// Implements the 'Run Tests' menu to bring up the Jasmine unit test window
@@ -11,21 +11,21 @@ define(function (require, exports, module) {
require("thirdparty/path-utils/path-utils.min");
// Load dependent modules
- var CommandManager = require("CommandManager"),
- Commands = require("Commands"),
- NativeFileSystem = require("NativeFileSystem").NativeFileSystem,
- ProjectManager = require("ProjectManager"),
- DocumentManager = require("DocumentManager"),
- EditorManager = require("EditorManager"),
- FileUtils = require("FileUtils"),
- Async = require("Async"),
- Dialogs = require("Dialogs"),
+ var CommandManager = require("command/CommandManager"),
+ Commands = require("command/Commands"),
+ NativeFileSystem = require("file/NativeFileSystem").NativeFileSystem,
+ ProjectManager = require("project/ProjectManager"),
+ DocumentManager = require("document/DocumentManager"),
+ EditorManager = require("editor/EditorManager"),
+ FileUtils = require("file/FileUtils"),
+ Async = require("utils/Async"),
+ Dialogs = require("widgets/Dialogs"),
Strings = require("strings"),
- PreferencesManager = require("PreferencesManager"),
- PerfUtils = require("PerfUtils");
+ PreferencesManager = require("preferences/PreferencesManager"),
+ PerfUtils = require("utils/PerfUtils");
/**
- * Handlers for commands related to file handling (opening, saving, etc.)
+ * Handlers for commands related to document handling (opening, saving, etc.)
*/
/** @type {jQueryObject} Container for label shown above editor */
@@ -165,7 +165,7 @@ define(function (require, exports, module) {
function handleFileAddToWorkingSet(commandData) {
handleFileOpen(commandData).done(function (doc) {
- DocumentManager.addToWorkingSet(doc);
+ DocumentManager.addToWorkingSet(doc.file);
});
}
@@ -327,7 +327,19 @@ define(function (require, exports, module) {
function saveAll() {
// Do in serial because doSave shows error UI for each file, and we don't want to stack
// multiple dialogs on top of each other
- return Async.doSequentially(DocumentManager.getWorkingSet(), doSave, false);
+ return Async.doSequentially(
+ DocumentManager.getWorkingSet(),
+ function (file) {
+ var doc = DocumentManager.getOpenDocumentForPath(file.fullPath);
+ if (doc) {
+ return doSave(doc);
+ } else {
+ // working set entry that was never actually opened - ignore
+ return (new $.Deferred()).resolve();
+ }
+ },
+ false
+ );
}
@@ -350,7 +362,7 @@ define(function (require, exports, module) {
function doClose(doc) {
if (!commandData || !commandData.promptOnly) {
// This selects a different document if the working set has any other options
- DocumentManager.closeDocument(doc);
+ DocumentManager.closeFullEditor(doc.file);
EditorManager.focusEditor();
}
@@ -417,8 +429,12 @@ define(function (require, exports, module) {
function handleFileCloseAll(commandData) {
var result = new $.Deferred();
- var unsavedDocs = DocumentManager.getWorkingSet().filter(function (doc) {
- return doc.isDirty;
+ var unsavedDocs = [];
+ DocumentManager.getWorkingSet().forEach(function (file) {
+ var doc = DocumentManager.getOpenDocumentForPath(file.fullPath);
+ if (doc && doc.isDirty) {
+ unsavedDocs.push(doc);
+ }
});
if (unsavedDocs.length === 0) {
Oops, something went wrong.

0 comments on commit dd806bf

Please sign in to comment.