Revert "VFS Fix collab code reverting for unsaved files"

pull/313/head
Tim Robinson 2016-06-06 10:29:35 -04:00
rodzic ff6fffcd90
commit 88e5dfa70f
2 zmienionych plików z 22 dodań i 22 usunięć

Wyświetl plik

@ -71,7 +71,7 @@
"c9.ide.language.javascript.infer": "#b9c2e4bdb8",
"c9.ide.language.jsonalyzer": "#72954f8da1",
"c9.ide.language.codeintel": "#4e0a272229",
"c9.ide.collab": "#4885f8e5a3",
"c9.ide.collab": "#24e28024d7",
"c9.ide.local": "#9169fec157",
"c9.ide.find": "#a2dfc3e306",
"c9.ide.find.infiles": "#488db22ee1",

Wyświetl plik

@ -1,7 +1,7 @@
define(function(require, exports, module) {
main.consumes = [
"Plugin", "fs", "settings", "preferences", "watcher", "tabManager",
"save", "dialog.question", "dialog.filechange", "threewaymerge", "collab"
"save", "dialog.question", "dialog.filechange", "threewaymerge"
];
main.provides = ["watcher.gui"];
return main;
@ -17,7 +17,6 @@ define(function(require, exports, module) {
var question = imports["dialog.question"];
var filechange = imports["dialog.filechange"];
var threeWayMerge = imports.threewaymerge.merge;
var collab = imports.collab;
var collabEnabled = options.collab;
@ -120,33 +119,33 @@ define(function(require, exports, module) {
// Hook watcher events
// A change event sent from the watcher plugin
// Update a file
watcher.on("change", function(e) {
var tab = tabManager.findTab(e.path);
if (tab) {
if (collabEnabled && tab.editorType == "ace") {
/* If the lastChange (added by collab) was greater than 1 second ago set up a watch
To ensure that collab makes this change, if not report an error. The lastChange
check is to avoid a race condition if collab updates before this function runs */
if (!tab.meta.$lastCollabChange || tab.meta.$lastCollabChange < (Date.now() - 1000)) {
if (tab.meta.$collabChangeRegistered) {
clearTimeout(tab.meta.$collabChangeRegistered);
}
}
return false;
}
// If collab picks this up and handles the change it will return false
if (emit("docChange", {tab: tab}) === false)
return;
addChangedTab(tab, e.type === "change");
}
});
collab.on("change", function (e) {
var tab = tabManager.findTab(e.path);
if (tab) {
addChangedTab(tab, e.type === "change");
}
});
// Directory watcher is not needed if the normal watcher works
// watcher.on("directory", function(e) {
// var base = e.path;
// var files = e.files;
//
// // Rename all tabs
// tabManager.getTabs().forEach(function(tab) {
// if (tab.path && tab.path.indexOf(base) == 0) {
// // If the file is gone, lets notify the user
// if (files.indexOf(tab.path) == -1) {
// resolveFileDelete(tab);
// }
// }
// });
// });
watcher.on("delete", function(e) {
var tab = tabManager.findTab(e.path);
@ -294,6 +293,7 @@ define(function(require, exports, module) {
function automerge(tab, data) {
if (!settings.getBool("user/general/@automerge"))
return false;
return merge(tab, data);
}