Skip to content
This repository was archived by the owner on Sep 6, 2021. It is now read-only.

Commit 82bb3f7

Browse files
committed
Merge pull request #8913 from adobe/jeff/splitview-landing-final
Implement Splitview (with non-final UI)
2 parents fe3f150 + 0919006 commit 82bb3f7

File tree

120 files changed

+9035
-3133
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

120 files changed

+9035
-3133
lines changed

src/LiveDevelopment/Agents/GotoAgent.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ define(function GotoAgent(require, exports, module) {
4040

4141
var DocumentManager = require("document/DocumentManager");
4242
var EditorManager = require("editor/EditorManager");
43+
var MainViewManager = require("view/MainViewManager");
4344

4445
/** Return the URL without the query string
4546
* @param {string} URL
@@ -172,7 +173,7 @@ define(function GotoAgent(require, exports, module) {
172173
path = decodeURI(path);
173174
var promise = DocumentManager.getDocumentForPath(path);
174175
promise.done(function onDone(doc) {
175-
DocumentManager.setCurrentDocument(doc);
176+
MainViewManager._edit(MainViewManager.ACTIVE_PANE, doc);
176177
if (location) {
177178
openLocation(location, noFlash);
178179
}

src/LiveDevelopment/Documents/HTMLDocument.js

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ define(function HTMLDocumentModule(require, exports, module) {
155155
self._onChange(event, editor, change);
156156
});
157157

158+
$(this.editor).on("beforeDestroy.HTMLDocument", function (event, editor) {
159+
self._onDestroy(event, editor);
160+
});
161+
158162
// Experimental code
159163
if (LiveDevelopment.config.experimental) {
160164
$(HighlightAgent).on("highlight.HTMLDocument", function (event, node) {
@@ -266,6 +270,18 @@ define(function HTMLDocumentModule(require, exports, module) {
266270
});
267271
};
268272

273+
/**
274+
* Triggered when the editor is being destroyed
275+
* @param {$.Event} event Event
276+
* @param {!Editor} editor The editor being destroyed
277+
*/
278+
HTMLDocument.prototype._onDestroy = function (event, editor) {
279+
if (this.editor === editor) {
280+
this.detachFromEditor();
281+
}
282+
};
283+
284+
269285
/**
270286
* Triggered on change by the editor
271287
* @param {$.Event} event Event
@@ -396,4 +412,4 @@ define(function HTMLDocumentModule(require, exports, module) {
396412

397413
// Export the class
398414
module.exports = HTMLDocument;
399-
});
415+
});

src/LiveDevelopment/LiveDevelopment.js

Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -68,38 +68,39 @@ define(function LiveDevelopment(require, exports, module) {
6868
var _ = require("thirdparty/lodash");
6969

7070
// Status Codes
71-
var STATUS_ERROR = exports.STATUS_ERROR = -1;
72-
var STATUS_INACTIVE = exports.STATUS_INACTIVE = 0;
73-
var STATUS_CONNECTING = exports.STATUS_CONNECTING = 1;
74-
var STATUS_LOADING_AGENTS = exports.STATUS_LOADING_AGENTS = 2;
75-
var STATUS_ACTIVE = exports.STATUS_ACTIVE = 3;
76-
var STATUS_OUT_OF_SYNC = exports.STATUS_OUT_OF_SYNC = 4;
77-
var STATUS_SYNC_ERROR = exports.STATUS_SYNC_ERROR = 5;
78-
79-
var Async = require("utils/Async"),
80-
Dialogs = require("widgets/Dialogs"),
81-
DefaultDialogs = require("widgets/DefaultDialogs"),
82-
DocumentManager = require("document/DocumentManager"),
83-
EditorManager = require("editor/EditorManager"),
84-
FileServer = require("LiveDevelopment/Servers/FileServer").FileServer,
85-
FileSystemError = require("filesystem/FileSystemError"),
86-
FileUtils = require("file/FileUtils"),
87-
LiveDevServerManager = require("LiveDevelopment/LiveDevServerManager"),
88-
NativeApp = require("utils/NativeApp"),
89-
PreferencesDialogs = require("preferences/PreferencesDialogs"),
90-
ProjectManager = require("project/ProjectManager"),
91-
Strings = require("strings"),
92-
StringUtils = require("utils/StringUtils"),
93-
UserServer = require("LiveDevelopment/Servers/UserServer").UserServer;
71+
var STATUS_ERROR = exports.STATUS_ERROR = -1;
72+
var STATUS_INACTIVE = exports.STATUS_INACTIVE = 0;
73+
var STATUS_CONNECTING = exports.STATUS_CONNECTING = 1;
74+
var STATUS_LOADING_AGENTS = exports.STATUS_LOADING_AGENTS = 2;
75+
var STATUS_ACTIVE = exports.STATUS_ACTIVE = 3;
76+
var STATUS_OUT_OF_SYNC = exports.STATUS_OUT_OF_SYNC = 4;
77+
var STATUS_SYNC_ERROR = exports.STATUS_SYNC_ERROR = 5;
78+
79+
var Async = require("utils/Async"),
80+
Dialogs = require("widgets/Dialogs"),
81+
DefaultDialogs = require("widgets/DefaultDialogs"),
82+
DocumentManager = require("document/DocumentManager"),
83+
EditorManager = require("editor/EditorManager"),
84+
FileServer = require("LiveDevelopment/Servers/FileServer").FileServer,
85+
FileSystemError = require("filesystem/FileSystemError"),
86+
FileUtils = require("file/FileUtils"),
87+
LiveDevServerManager = require("LiveDevelopment/LiveDevServerManager"),
88+
MainViewManager = require("view/MainViewManager"),
89+
NativeApp = require("utils/NativeApp"),
90+
PreferencesDialogs = require("preferences/PreferencesDialogs"),
91+
ProjectManager = require("project/ProjectManager"),
92+
Strings = require("strings"),
93+
StringUtils = require("utils/StringUtils"),
94+
UserServer = require("LiveDevelopment/Servers/UserServer").UserServer;
9495

9596
// Inspector
96-
var Inspector = require("LiveDevelopment/Inspector/Inspector");
97+
var Inspector = require("LiveDevelopment/Inspector/Inspector");
9798

9899
// Documents
99-
var CSSDocument = require("LiveDevelopment/Documents/CSSDocument"),
100+
var CSSDocument = require("LiveDevelopment/Documents/CSSDocument"),
100101
CSSPreprocessorDocument = require("LiveDevelopment/Documents/CSSPreprocessorDocument"),
101-
HTMLDocument = require("LiveDevelopment/Documents/HTMLDocument"),
102-
JSDocument = require("LiveDevelopment/Documents/JSDocument");
102+
HTMLDocument = require("LiveDevelopment/Documents/HTMLDocument"),
103+
JSDocument = require("LiveDevelopment/Documents/JSDocument");
103104

104105
// Document errors
105106
var SYNC_ERROR_CLASS = "live-preview-sync-error";
@@ -185,7 +186,7 @@ define(function LiveDevelopment(require, exports, module) {
185186
* @type {BaseServer}
186187
*/
187188
var _server;
188-
189+
189190
function _isPromisePending(promise) {
190191
return promise && promise.state() === "pending";
191192
}
@@ -1321,18 +1322,18 @@ define(function LiveDevelopment(require, exports, module) {
13211322
}
13221323
}
13231324

1324-
// TODO: need to run _onDocumentChange() after load if doc != currentDocument here? Maybe not, since activeEditorChange
1325+
// TODO: need to run _onFileChanged() after load if doc != currentDocument here? Maybe not, since activeEditorChange
13251326
// doesn't trigger it, while inline editors can still cause edits in doc other than currentDoc...
13261327
_getInitialDocFromCurrent().done(function (doc) {
13271328
var prepareServerPromise = (doc && _prepareServer(doc)) || new $.Deferred().reject(),
13281329
otherDocumentsInWorkingFiles;
13291330

13301331
if (doc && !doc._masterEditor) {
1331-
otherDocumentsInWorkingFiles = DocumentManager.getWorkingSet().length;
1332-
DocumentManager.addToWorkingSet(doc.file);
1332+
otherDocumentsInWorkingFiles = MainViewManager.getWorkingSet(MainViewManager.ALL_PANES).length;
1333+
MainViewManager.addToWorkingSet(MainViewManager.ACTIVE_PANE, doc.file);
13331334

13341335
if (!otherDocumentsInWorkingFiles) {
1335-
DocumentManager.setCurrentDocument(doc);
1336+
MainViewManager._edit(MainViewManager.ACTIVE_PANE, doc);
13361337
}
13371338
}
13381339

@@ -1374,9 +1375,9 @@ define(function LiveDevelopment(require, exports, module) {
13741375

13751376
/**
13761377
* @private
1377-
* DocumentManager currentDocumentChange event handler.
1378+
* MainViewManager.currentFileChange event handler.
13781379
*/
1379-
function _onDocumentChange() {
1380+
function _onFileChanged() {
13801381
var doc = _getCurrentDocument();
13811382

13821383
if (!doc || !Inspector.connected()) {
@@ -1475,10 +1476,13 @@ define(function LiveDevelopment(require, exports, module) {
14751476
// We may get interim added/removed events when pushing incremental updates
14761477
$(CSSAgent).on("styleSheetAdded.livedev", _styleSheetAdded);
14771478

1478-
$(DocumentManager).on("currentDocumentChange", _onDocumentChange)
1479+
$(MainViewManager)
1480+
.on("currentFileChange", _onFileChanged);
1481+
$(DocumentManager)
14791482
.on("documentSaved", _onDocumentSaved)
14801483
.on("dirtyFlagChange", _onDirtyFlagChange);
1481-
$(ProjectManager).on("beforeProjectClose beforeAppClose", close);
1484+
$(ProjectManager)
1485+
.on("beforeProjectClose beforeAppClose", close);
14821486

14831487
// Register user defined server provider
14841488
LiveDevServerManager.registerServer({ create: _createUserServer }, 99);

src/brackets.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ define(function (require, exports, module) {
6969
EditorManager = require("editor/EditorManager"),
7070
CSSInlineEditor = require("editor/CSSInlineEditor"),
7171
JSUtils = require("language/JSUtils"),
72-
WorkingSetView = require("project/WorkingSetView"),
73-
WorkingSetSort = require("project/WorkingSetSort"),
72+
WorkingSetView = require("project/WorkingSetView"),
73+
WorkingSetSort = require("project/WorkingSetSort"),
7474
DocumentCommandHandlers = require("document/DocumentCommandHandlers"),
7575
FileViewController = require("project/FileViewController"),
7676
FileSyncManager = require("project/FileSyncManager"),
@@ -105,6 +105,7 @@ define(function (require, exports, module) {
105105
DeprecationWarning = require("utils/DeprecationWarning"),
106106
ViewCommandHandlers = require("view/ViewCommandHandlers"),
107107
ThemeManager = require("view/ThemeManager"),
108+
MainViewManager = require("view/MainViewManager"),
108109
_ = require("thirdparty/lodash");
109110

110111
// DEPRECATED: In future we want to remove the global CodeMirror, but for now we
@@ -118,7 +119,7 @@ define(function (require, exports, module) {
118119
return CodeMirror;
119120
}
120121
});
121-
122+
122123
// Load modules that self-register and just need to get included in the main project
123124
require("command/DefaultMenus");
124125
require("document/ChangedDocumentTracker");
@@ -139,6 +140,9 @@ define(function (require, exports, module) {
139140
require("file/NativeFileSystem");
140141
require("file/NativeFileError");
141142

143+
// Compatibility shim for PanelManager to WorkspaceManager migration
144+
require("view/PanelManager");
145+
142146
PerfUtils.addMeasurement("brackets module dependencies resolved");
143147

144148
// Local variables
@@ -188,6 +192,8 @@ define(function (require, exports, module) {
188192
LanguageManager : LanguageManager,
189193
LiveDevelopment : require("LiveDevelopment/LiveDevelopment"),
190194
LiveDevServerManager : require("LiveDevelopment/LiveDevServerManager"),
195+
MainViewManager : MainViewManager,
196+
MainViewFactory : require("view/MainViewFactory"),
191197
Menus : Menus,
192198
MultiRangeInlineEditor : require("editor/MultiRangeInlineEditor").MultiRangeInlineEditor,
193199
NativeApp : NativeApp,
@@ -198,7 +204,6 @@ define(function (require, exports, module) {
198204
ScrollTrackMarkers : require("search/ScrollTrackMarkers"),
199205
UpdateNotification : require("utils/UpdateNotification"),
200206
WorkingSetView : WorkingSetView,
201-
202207
doneLoading : false
203208
};
204209

@@ -213,8 +218,6 @@ define(function (require, exports, module) {
213218
function _onReady() {
214219
PerfUtils.addMeasurement("window.document Ready");
215220

216-
EditorManager.setEditorHolder($("#editor-holder"));
217-
218221
// Let the user know Brackets doesn't run in a web browser yet
219222
if (brackets.inBrowser) {
220223
Dialogs.showModalDialog(
@@ -248,6 +251,9 @@ define(function (require, exports, module) {
248251

249252
// Load the initial project after extensions have loaded
250253
extensionLoaderPromise.always(function () {
254+
// Signal that extensions are loaded
255+
AppInit._dispatchReady(AppInit.EXTENSIONS_LOADED);
256+
251257
// Finish UI initialization
252258
ViewCommandHandlers.restoreFontSize();
253259
var initialProjectPath = ProjectManager.getInitialProjectPath();
@@ -265,7 +271,7 @@ define(function (require, exports, module) {
265271
if (ProjectManager.isWelcomeProjectPath(initialProjectPath)) {
266272
FileSystem.resolve(initialProjectPath + "index.html", function (err, file) {
267273
if (!err) {
268-
var promise = CommandManager.execute(Commands.FILE_ADD_TO_WORKING_SET, { fullPath: file.fullPath });
274+
var promise = CommandManager.execute(Commands.CMD_ADD_TO_WORKINGSET_AND_OPEN, { fullPath: file.fullPath });
269275
promise.then(deferred.resolve, deferred.reject);
270276
} else {
271277
deferred.reject();
@@ -409,7 +415,7 @@ define(function (require, exports, module) {
409415
$target.is("input:not([type])") || // input with no type attribute defaults to text
410416
$target.is("textarea") ||
411417
$target.is("select");
412-
418+
413419
if (!isFormElement) {
414420
e.preventDefault();
415421
}

0 commit comments

Comments
 (0)