This function is used to create mrof when a project is opened for the firt time with the recent files feature
This routine acts as a logic to migrate existing viewlist to mrof structure
@private
518270
function _createMROFList() {

        var paneList = MainViewManager.getPaneIdList(),
            mrofList = [],
            fileList,
            index;

        var pane, file, mrofEntry, paneCount, fileCount;
        // Iterate over the pane ID list
        for (paneCount = 0; paneCount < paneList.length; paneCount++) {
            pane = paneList[paneCount];
            fileList = MainViewManager.getWorkingSet(pane);
            // Iterate over the file list for this pane
            for (fileCount = 0; fileCount < fileList.length; fileCount++) {
                file = fileList[fileCount];
                mrofEntry = _makeMROFListEntry(file.fullPath, pane, null);
                // Add it in the MRU list order
                index = MainViewManager.findInGlobalMRUList(pane, file);
                mrofList[index] = mrofEntry;
            }
        }

        return mrofList;
    }
27147
function () {
            var result = new $.Deferred();
            var path = this.path;
            var createIfMissing = this.createIfMissing;
            var recreateIfInvalid = this.recreateIfInvalid;
            var self = this;

            if (path) {
                var prefFile = FileSystem.getFileForPath(path);
                prefFile.read({}, function (err, text) {
                    if (err) {
                        if (createIfMissing) {
                            // Unreadable file is also unwritable -- delete so get recreated
                            if (recreateIfInvalid && (err === FileSystemError.NOT_READABLE || err === FileSystemError.UNSUPPORTED_ENCODING)) {
                                appshell.fs.moveToTrash(path, function (err) {
                                    if (err) {
                                        console.log("Cannot move unreadable preferences file " + path + " to trash!!");
                                    } else {
                                        console.log("Brackets has recreated the unreadable preferences file " + path + ". You may refer to the deleted file in trash in case you need it!!");
                                    }
                                }.bind(this));
                            }
                            result.resolve({});
                        } else {
                            result.reject(new Error("Unable to load preferences at " + path + " " + err));
                        }
                        return;
                    }

                    self._lineEndings = FileUtils.sniffLineEndings(text);

                    // If the file is empty, turn it into an empty object
                    if (/^\s*$/.test(text)) {
                        result.resolve({});
                    } else {
                        try {
                            result.resolve(JSON.parse(text));
                        } catch (e) {
                            if (recreateIfInvalid) {
                                // JSON parsing error -- recreate the preferences file
                                appshell.fs.moveToTrash(path, function (err) {
                                    if (err) {
                                        console.log("Cannot move unparseable preferences file " + path + " to trash!!");
                                    } else {
                                        console.log("Brackets has recreated the Invalid JSON preferences file " + path + ". You may refer to the deleted file in trash in case you need it!!");
                                    }
                                }.bind(this));
                                result.resolve({});
                            } else {
                                result.reject(new ParsingError("Invalid JSON settings at " + path + "(" + e.toString() + ")"));
                            }
                        }
                    }
                });
            } else {
                result.resolve({});
            }

            return result.promise();
        }
658254
function buildIndexObjects (initialRefs, currentRefs) {
  const ret = []
  const refValueNames = Object.keys(initialRefs)

  refValueNames.forEach(refValueName => {
    const initialRefValue = initialRefs[refValueName]
    const currentRefValue = currentRefs[refValueName]

    if (!initialRefValue || !currentRefValue) {
      return
    }

    const name = initialRefValue.name
    const initialValue = initialRefValue.value
    const indexType = initialRefValue.indexType || currentRefs.indexType
    let currentValue = currentRefs[refValueName].value

    if (_.isNull(currentValue) || _.isUndefined(currentValue)) {
      currentValue = null
    }

    if (Array.isArray(currentValue)) {
      currentValue = currentValue.sort()
    }

    if (Array.isArray(initialValue) || Array.isArray(currentValue)) {
      const toRemove = _.difference(initialValue || [], currentValue || []) || []
      const union = _.union(initialValue || [], currentValue || []) || []
      const toAdd = _.difference(union, toRemove) || []

      toRemove.forEach(v => {
        ret.push({
          name,
          indexType,
          value: v,
          action: INDEX_ACTIONS.REMOVE
        })
      })

      toAdd.forEach(v => {
        ret.push({
          name,
          indexType,
          value: v,
          action: INDEX_ACTIONS.UPSERT
        })
      })
    } else if (_.isEqual(initialValue, currentValue)) {
      ret.push({
        name,
        value: currentValue,
        indexType,
        action: INDEX_ACTIONS.UPSERT
      })
    } else {
      if (initialValue !== null) {
        ret.push({
          name,
          value: initialValue,
          indexType,
          action: INDEX_ACTIONS.REMOVE
        })
      }

      if (currentValue !== null) {
        ret.push({
          name,
          value: currentValue,
          indexType,
          action: INDEX_ACTIONS.UPSERT
        })
      }
    }
  })

  return ret
}
635238
def add_subview(view_or_constant, opts={})
      subviews_added = []

      selected.each do |selected_view|
        created = false
        appended = false
        built = false

        if view_or_constant.is_a?(UIView)
          new_view = view_or_constant
        else
          created = true
          new_view = create_view(view_or_constant, opts)
        end

        rmq_data = new_view.rmq_data

        unless rmq_data.built
          rmq_data.built = true # build only once
          built = true
        end

        rmq_data.view_controller = self.weak_view_controller

        subviews_added << new_view

        unless opts[:do_not_add]
          if at_index = opts[:at_index]
            selected_view.insertSubview(new_view, atIndex: at_index)
          elsif below_view = opts[:below_view]
            selected_view.insertSubview(new_view, belowSubview: below_view)
          else
            selected_view.addSubview(new_view)
          end

          appended = true
        end

        if created
          new_view.rmq_created
        end
        new_view.rmq_build if built
        new_view.rmq_appended if appended

        if self.stylesheet
          apply_style_to_view(new_view, opts[:style]) if opts[:style]
        end
      end

      view = RMQ.create_with_array_and_selectors(subviews_added, selectors, @context, self)
      opts[:block].call view if opts[:block]
      opts[:raw_block].call view.get if opts[:raw_block]
      view
    end
783770
function () {

				this._oSrcFileContent = {};

				this._oViewModel = new JSONModel({
					autoPreview: true,
					selectedFileName: SRC_FILE_NAMES.XML, // initially select the xml file
					selectedFileType: SRC_FILE_TYPES[SRC_FILE_NAMES.XML],
					selectedFileContent: ""
				});

				this.getView().setModel(this._oViewModel, "viewModel");

				// fetch the initial content of the sample files
				new JSONModel(sap.ui.require.toUrl('sap/ui/documentation/sdk/model') + '/LiveEditorData.json').attachRequestCompleted(function (oEvent) {
					var oData = oEvent.getSource().getData(),
						sCoreUrl = new URI(sap.ui.require.toUrl("sap-ui-core.js"), document.baseURI).href();
					if (oData[SRC_FILE_NAMES.HTML]) {
						oData[SRC_FILE_NAMES.HTML] = oData[SRC_FILE_NAMES.HTML].replace(/&sol;/g, "/").replace("resources/sap-ui-core.js", sCoreUrl);
					}
					this._oSrcFileContent = oData;
					this.showFileInEditor(SRC_FILE_NAMES.XML); // initially show the xml file

				}.bind(this));

				this.getView().byId("resultBox").addEventDelegate({ onAfterRendering: this.requestExecuteCurrentSrc.bind(this) });

				// flags for minor performance optimization:
				// indicators to temporarily suppress the processing of the editor content
				// (while switching the currently displayed file in the editor)
				this._bSuppressRemoveOnce = false;
				this._bSuppressInsertOnce = false;

				// additional performance optimization:
				// throttle the output of src changes
				this._oThrottledTask = null;
			}
96332
function(target) {
		
		var self = this;
		var viewList = this.list();
		
		$.each(viewList, function(i, view) {
			view.main().appendTo(target);
			self.cmp().target(target);
		});
		
		return this;
	}
516097
function createRef(file){

		// Create a new fileRef
		var pointer = new fileRef({
			name : file.name,
			type : file.type,
			file : file
		}, current_network, current_bucket, true);

		ref.push( pointer );

		if(current_folder==="local"){
			readFile(file, function(dataURL){

				// Update list
				pointer.update({
					thumbnail : dataURL,
					picture : dataURL
				});
			});
		}
		else{
			// Upload the files to the current directory
			hello.api(current_folder, "post", {file: file}, function(r){
				// Once the files have been successfully upload lets update the pointer
				pointer.update({
					id : r.id,
					thumbnail : r.source,
					picture : r.source
				});
			});
		}
	}
173180
function _handleRemoveFromPaneView(e, removedFiles) {
        var handleFileRemoved = function (file) {
            var doc = DocumentManager.getOpenDocumentForPath(file.fullPath);

            if (doc) {
                MainViewManager._destroyEditorIfNotNeeded(doc);
            }
        };

        // when files are removed from a pane then
        //    we should destroy any unnecssary views
        if ($.isArray(removedFiles)) {
            removedFiles.forEach(function (removedFile) {
                handleFileRemoved(removedFile);
            });
        } else {
            handleFileRemoved(removedFiles);
        }
    }
1164631
function refreshDynamicEmbeddedViews(lViewData) {
    for (var current = getLViewChild(lViewData); current !== null; current = current[NEXT]) {
        // Note: current can be an LViewData or an LContainer instance, but here we are only interested
        // in LContainer. We can tell it's an LContainer because its length is less than the LViewData
        // header.
        if (current.length < HEADER_OFFSET && current[ACTIVE_INDEX] === null) {
            var container_1 = current;
            for (var i = 0; i < container_1[VIEWS].length; i++) {
                var lViewNode = container_1[VIEWS][i];
                // The directives and pipes are not needed here as an existing view is only being refreshed.
                var dynamicViewData = lViewNode.data;
                ngDevMode && assertDefined(dynamicViewData[TVIEW], 'TView must be allocated');
                renderEmbeddedTemplate(lViewNode, dynamicViewData[TVIEW], dynamicViewData[CONTEXT], 2 /* Update */);
            }
        }
    }
}
1054509
function _onFocus(event) {
            var $scope = $(event.target).parent();
            $("#mrof-container #mrof-list > li.highlight").removeClass("highlight");
            $(event.target).parent().addClass("highlight");
            $mrofContainer.find("#recent-file-path").text($scope.data("path"));
            $mrofContainer.find("#recent-file-path").attr('title', ($scope.data("path")));
            $currentContext = $scope;
        }
230777
function createViewmodel(name,component,params,pre,post)
      {
        /* creates blank observable data set */
        var obsv = _mixed({},name);

        /* Attach Pre properties, or pre designed attachments for every Data set */
        for(var x=0,keys=Object.keys(pre),len=keys.length;x<len;x++)
        {
          if(_ignoreList.indexOf(keys[x]) !== -1)
          {
            Object.defineProperty(obsv,keys[x],setDescriptor(pre[keys[x]],(keys[x] !== 'filters')));
          }
          else
          {
            if(pre.pointers)
            {
              if(pre.pointers[keys[x]] === undefined) obsv.set(keys[x],pre[keys[x]]);
            }
            else
            {
              obsv.set(keys[x],pre[keys[x]]);
            }
          }
        }
        
        if(pre.pointers)
        {
          if(!obsv.pointers) Object.defineProperty(obsv,'pointers',setDescriptor({},false,true));
          for(var x=0,keys=Object.keys(pre.pointers),len=keys.length;x<len;x++)
          {
            obsv.pointers[keys[x]] = pre.pointers[keys[x]];
            obsv.addPointer(obsv.pointers[keys[x]].point,obsv.pointers[keys[x]].key,keys[x]);
          }
        }
        
        /* if there are any prototypes on this component they are added to the Data sets prototype */
        for(var x=0,keys=Object.keys(component.prototype),len=keys.length;x<len;x++)
        {
          Object.defineProperty(obsv,[keys[x]],setDescriptor(component.prototype[keys[x]],true));
        }
        
        /* we then apply the component constructor to the data set in order to add the 'this' properties from it and pass in the params */
        component.apply(obsv,params);
        
        /* Post attachments, overwritables, for data or pointers */
        for(var x=0,keys=Object.keys(post),len=keys.length;x<len;x++)
        {
          if(_ignoreList.indexOf(keys[x]) !== -1)
          {
            Object.defineProperty(obsv,keys[x],setDescriptor(post[keys[x]],(keys[x] !== 'filters')));
          }
          else
          {
            if(post.pointers)
            {
              if(post.pointers[keys[x]] === undefined) obsv.set(keys[x],post[keys[x]]);
            }
            else
            {
              obsv.set(keys[x],post[keys[x]]);
            }
          }
        }
        
        /* post pointers */
        if(post.pointers)
        {
          if(!obsv.pointers) Object.defineProperty(obsv,'pointers',setDescriptor({},false,true));
          for(var x=0,keys=Object.keys(post.pointers),len=keys.length;x<len;x++)
          {
            obsv.pointers[keys[x]] = post.pointers[keys[x]];
            obsv.addPointer(obsv.pointers[keys[x]].point,obsv.pointers[keys[x]].key,keys[x]);
          }
        }
        
        /* map filters as binded to vm */
        for(var x=0,keys=Object.keys(obsv.filters),len=keys.length;x<len;x++)
        {
          obsv.filters[keys[x]] = obsv.filters[keys[x]].bind(obsv);
        }

        /* Apply session storage if set, this allows for storing this vm in session storage, only those values that are enumerable */
        if(obsv.sessionStorage)
        {
            var storage = sessionStorage.getItem((obsv.id || name));
            
            /* load storage into the data set if it is set */
            if(storage)
            {
                storage = JSON.parse(storage);
                for(var x=0,keys=Object.keys(storage),len=keys.length;x<len;x++)
                {
                    obsv.set(keys[x],storage[keys[x]]);
                }
            }
          
            /* set the storage object with the defaults */
            else
            {
                sessionStorage.setItem((obsv.id || name),obsv.stringify());
            }
          
            /* if any data updates then the storage will be updated along with it */
            obsv.addChildDataUpdateListener('*',function(){
                sessionStorage.setItem((obsv.id || name),obsv.stringify());
            });
        }

        /* Apply local storage if set, similiar to session Storage except this persists even after browser is closed */
        if(obsv.localStorage)
        {
            var storage = localStorage.getItem((obsv.id || name));
          
            /* load storage into the data set if it is set */
            if(storage)
            {
                storage = JSON.parse(storage);
                for(var x=0,keys=Object.keys(storage),len=keys.length;x<len;x++)
                {
                    obsv.set(keys[x],storage[keys[x]]);
                }
            }
          
            /* set the storage object with the defaults */
            else
            {
                localStorage.setItem((obsv.id || name),obsv.stringify());
            }
          
            /* if any data updates then the storage will be updated along with it */
            obsv.addChildDataUpdateListener('*',function(){
                localStorage.setItem((obsv.id || name),obsv.stringify());
            });
        }
        
        if(obsv.store)
        {
            /* adds a pointer in model to this viewmodel, look into using id as an id from component: <test id="storeid"></test> */
            _model.set((obsv.id || name),obsv);
        }

        return obsv;
      }
361155
function handleCurrentFileChange() {
        var newFile = MainViewManager.getCurrentlyViewedFile(MainViewManager.ACTIVE_PANE);

        if (newFile) {
            var newDocument = DocumentManager.getOpenDocumentForPath(newFile.fullPath);

            if (newDocument) {
                _currentTitlePath = _shortTitleForDocument(newDocument);
            } else {
                _currentTitlePath = ProjectManager.makeProjectRelativeIfPossible(newFile.fullPath);
            }
        } else {
            _currentTitlePath = null;
        }

        // Update title text & "dirty dot" display
        _updateTitle();
    }
739981
function() {
					// don't create more object URLs than needed
					if (blob_changed || !object_url) {
						object_url = get_URL().createObjectURL(blob);
					}
					if (target_view) {
						target_view.location.href = object_url;
					} else {
						var new_tab = view.open(object_url, "_blank");
						if (new_tab == undefined && typeof safari !== "undefined") {
							//Apple do not allow window.open, see http://bit.ly/1kZffRI
							view.location.href = object_url
						}
					}
					filesaver.readyState = filesaver.DONE;
					dispatch_all();
					revoke(object_url);
				}
835676
function View(bytes, elementType) {
    if (!(this instanceof View))
        return new View(bytes, elementType);
    this.bytes = bytes;
    this.elementType = elementType;
}
805470
function() {
				self.convertEventPropsToHandlers(dispatches);

				self.bind('RuntimeInit', function(e, runtime) {
					self.ruid = runtime.uid;
					self.shimid = runtime.shimid;

					self.bind("Ready", function() {
						self.trigger("Refresh");
					}, 999);

					self.bind("Change", function() {
						var files = runtime.exec.call(self, 'FileInput', 'getFiles');

						self.files = [];

						Basic.each(files, function(file) {
							// ignore empty files (IE10 for example hangs if you try to send them via XHR)
							if (file.size === 0) {
								return true; 
							}
							self.files.push(new File(self.ruid, file));
						});
					}, 999);

					// re-position and resize shim container
					self.bind('Refresh', function() {
						var pos, size, browseButton, shimContainer;
						
						browseButton = Dom.get(options.browse_button);
						shimContainer = Dom.get(runtime.shimid); // do not use runtime.getShimContainer(), since it will create container if it doesn't exist

						if (browseButton) {
							pos = Dom.getPos(browseButton, Dom.get(options.container));
							size = Dom.getSize(browseButton);

							if (shimContainer) {
								Basic.extend(shimContainer.style, {
									top     : pos.y + 'px',
									left    : pos.x + 'px',
									width   : size.w + 'px',
									height  : size.h + 'px'
								});
							}
						}
						shimContainer = browseButton = null;
					});
					
					runtime.exec.call(self, 'FileInput', 'init', options);
				});

				// runtime needs: options.required_features, options.runtime_order and options.container
				self.connectRuntime(Basic.extend({}, options, {
					required_caps: {
						select_file: true
					}
				}));
			}
1360619
public void fileReused(File f) {
        if (!recentFiles.contains(f)) {
            throw new IllegalStateException("Selected a recent project that doesn't exist?");
        } else {
            recentFiles.remove(f);
            recentFiles.add(f);
        }
    }
1224257
function _documentSelectionFocusChange() {
        var curFullPath = MainViewManager.getCurrentlyViewedPath(MainViewManager.ACTIVE_PANE);
        if (curFullPath && _hasFileSelectionFocus()) {
            actionCreator.setSelected(curFullPath, true);
        } else {
            actionCreator.setSelected(null);
        }
        _fileViewControllerChange();
    }