Skip to content

Commit

Permalink
Merge pull request adobe#3783 from dschaffe/dschaffe/MaxIndexFileShow…
Browse files Browse the repository at this point in the history
…Once

Fix for adobe#3773: Only show 'Indexing Max Files Exceeded' dialog once per project
  • Loading branch information
peterflynn committed May 16, 2013
2 parents 6be669f + da974ba commit 2ddcf52
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
29 changes: 25 additions & 4 deletions src/project/FileIndexManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ define(function (require, exports, module) {
*/
var _indexListDirty = true;

/**
* Store whether the index manager has exceeded the limit so the warning dialog only
* appears once.
* @type {boolean}
*/
var _maxFileDialogDisplayed = false;

/** class FileIndex
*
* A FileIndex contains an array of fileInfos that meet the criteria specified by
Expand Down Expand Up @@ -218,7 +225,13 @@ define(function (require, exports, module) {
if (state.fileCount > 10000) {
if (!state.maxFilesHit) {
state.maxFilesHit = true;
_showMaxFilesDialog();
if (!_maxFileDialogDisplayed) {
_showMaxFilesDialog();
_maxFileDialogDisplayed = true;
} else {
console.warn("The maximum number of files have been indexed. Actions " +
"that lookup files in the index may function incorrectly.");
}
}
return;
}
Expand All @@ -231,7 +244,6 @@ define(function (require, exports, module) {
_scanDirectoryRecurse(entry);
}
});

_finishDirScan(dirEntry);
},
// error callback
Expand Down Expand Up @@ -397,11 +409,20 @@ define(function (require, exports, module) {
return PathUtils.filenameExtension(filename) === ".css";
}
);

$(ProjectManager).on("projectOpen projectFilesChange", function (event, projectRoot) {

/**
* When a new project is opened set the flag for index exceeding maximum
* warning back to false.
*/
$(ProjectManager).on("projectOpen", function (event, projectRoot) {
_maxFileDialogDisplayed = false;
markDirty();
});

$(ProjectManager).on("projectFilesChange", function (event, projectRoot) {
markDirty();
});

PerfUtils.createPerfMeasurement("FILE_INDEX_MANAGER_SYNC", "syncFileIndex");

exports.markDirty = markDirty;
Expand Down
2 changes: 1 addition & 1 deletion src/project/ProjectManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ define(function (require, exports, module) {
* @return boolean true if the file should be displayed
*/
function shouldShow(entry) {
if ([".git", ".gitignore", ".gitmodules", ".svn", ".DS_Store", "Thumbs.db"].indexOf(entry.name) > -1) {
if ([".git", ".gitignore", ".gitmodules", ".svn", ".DS_Store", "Thumbs.db", ".hg"].indexOf(entry.name) > -1) {
return false;
}
var extension = entry.name.split('.').pop();
Expand Down

0 comments on commit 2ddcf52

Please sign in to comment.