Better view refresh after refreshing linked file

This commit is contained in:
Shane Kilkelly
2018-05-24 11:31:50 +01:00
parent 578d667efa
commit 656d40ac39
3 changed files with 14 additions and 25 deletions

View File

@@ -19,17 +19,3 @@ define [
, 0
, this
)
openFileById: (id) ->
file = @ide.fileTreeManager.selectEntityById(id)
@$scope.ui.view = "file"
@$scope.openFile = null
@$scope.$apply()
window.setTimeout(
() =>
@$scope.openFile = file
@$scope.$apply()
@$scope.$digest()
, 0
, this
)

View File

@@ -47,6 +47,18 @@ define [
else
return url
_tryOpenFile = (new_file_id) ->
iterations = 0
do tryOpen = () ->
if iterations > 10
return
iterations += 1
newFile = ide.fileTreeManager.findEntityById(new_file_id)
if newFile?
ide.binaryFilesManager.openFile(newFile)
else
setTimeout(tryOpen, 500)
$scope.refreshFile = (file) ->
$scope.refreshing = true
$scope.refreshError = null
@@ -56,8 +68,8 @@ define [
{ new_file_id } = data
$timeout(
() ->
ide.binaryFilesManager.openFileById(new_file_id)
, 1000
_tryOpenFile(new_file_id)
, 0
)
$scope.refreshError = null
.catch (response) ->

View File

@@ -87,15 +87,6 @@ define [
entity.selected = false
entity.selected = true
selectEntityById: (entity_id) ->
@selected_entity_id = entity_id # For reselecting after a reconnect
selected_entity = null
@ide.fileTreeManager.forEachEntity (entity) ->
if entity.id == entity_id
selected_entity = entity
entity.selected = true
return selected_entity
toggleMultiSelectEntity: (entity) ->
entity.multiSelected = !entity.multiSelected
@$scope.multiSelectedCount = @multiSelectedCount()