Skip to content

Commit

Permalink
Fixes #648 (#651)
Browse files Browse the repository at this point in the history
Signed-off-by: shiv12095 <[email protected]>
  • Loading branch information
shiv12095 authored and aedelmann committed Jun 27, 2017
1 parent cb78491 commit 2e7b539
Showing 1 changed file with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -397,15 +397,19 @@ define(["../init/AppController"], function(controllers) {

$scope.$on("closeProject", function(event, save) {
var promises = [];
$scope.editors.forEach(function(editor){
if(!save){
editor.setValue(editor.lastSavedValue);
}
promises.push(editor.xtextServices.saveResource());
$q.all(promises).then(function(results){
$scope.closeProject();
if($scope.editors.length == 0){
$scope.closeProject();
}else{
$scope.editors.forEach(function(editor){
if(!save){
editor.setValue(editor.lastSavedValue);
}
promises.push(editor.xtextServices.saveResource());
$q.all(promises).then(function(results){
$scope.closeProject();
});
});
});
}
});

$window.onbeforeunload = function() {
Expand Down

0 comments on commit 2e7b539

Please sign in to comment.