BinaryFilesManager.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /* eslint-disable
  2. max-len,
  3. no-unused-vars,
  4. */
  5. // TODO: This file was created by bulk-decaffeinate.
  6. // Fix any style issues and re-enable lint.
  7. /*
  8. * decaffeinate suggestions:
  9. * DS102: Remove unnecessary code created because of implicit returns
  10. * Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
  11. */
  12. import './controllers/BinaryFileController'
  13. let BinaryFilesManager
  14. export default BinaryFilesManager = class BinaryFilesManager {
  15. constructor(ide, $scope) {
  16. this.ide = ide
  17. this.$scope = $scope
  18. this.$scope.$on('entity:selected', (event, entity) => {
  19. if (this.$scope.ui.view !== 'track-changes' && entity.type === 'file') {
  20. return this.openFile(entity)
  21. }
  22. })
  23. }
  24. openFile(file) {
  25. this.ide.fileTreeManager.selectEntity(file)
  26. this.$scope.ui.view = 'file'
  27. this.$scope.openFile = null
  28. this.$scope.$apply()
  29. return window.setTimeout(
  30. () => {
  31. this.$scope.openFile = file
  32. this.$scope.$apply()
  33. this.$scope.$broadcast('file-view:file-opened')
  34. },
  35. 0,
  36. this
  37. )
  38. }
  39. }