Skip to content

Commit

Permalink
Show deprecated commands in command Autocomplete as well
Browse files Browse the repository at this point in the history
  • Loading branch information
samitbadle committed Mar 9, 2015
1 parent 837efa6 commit e160a45
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 76 deletions.
156 changes: 80 additions & 76 deletions ide/main/src/components/SeleniumIDEGenericAutoCompleteSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,42 +3,42 @@ function SeleniumIDEGenericAutoCompleteSearch() {
}

SeleniumIDEGenericAutoCompleteSearch.prototype = {
startSearch: function(searchString, searchParam, prevResult, listener) {
var result = new AutoCompleteResult(searchString, this.candidates[searchParam] || []);
listener.onSearchResult(this, result);
},

stopSearch: function() {
},

setCandidates: function(key, values) {
this.setCandidatesWithComments(key, values, null);
},

setCandidatesWithComments: function(key, values, comments) {
var count = values.Count();
var candidates = this.candidates[key] = new Array(count);
for (var i = 0; i < count; i++) {
candidates[i] = [values.GetElementAt(i).QueryInterface(Components.interfaces.nsISupportsString).data,
comments ? comments.GetElementAt(i).QueryInterface(Components.interfaces.nsISupportsString).data : null];
}
},

clearCandidates: function(key) {
if (this.candidates[key]) {
delete this.candidates[key];
}
},
startSearch: function(searchString, searchParam, prevResult, listener) {
var result = new AutoCompleteResult(searchString, this.candidates[searchParam] || []);
listener.onSearchResult(this, result);
},

stopSearch: function() {
},

setCandidates: function(key, values) {
this.setCandidatesWithComments(key, values, null);
},

setCandidatesWithComments: function(key, values, comments) {
var count = values.Count();
var candidates = this.candidates[key] = new Array(count);
for (var i = 0; i < count; i++) {
candidates[i] = [values.GetElementAt(i).QueryInterface(Components.interfaces.nsISupportsString).data,
comments ? comments.GetElementAt(i).QueryInterface(Components.interfaces.nsISupportsString).data : null];
}
},

clearCandidates: function(key) {
if (this.candidates[key]) {
delete this.candidates[key];
}
},

QueryInterface: function(uuid) {
if (uuid.equals(Components.interfaces.nsISeleniumIDEGenericAutoCompleteSearch) ||
uuid.equals(Components.interfaces.nsIAutoCompleteSearch) ||
uuid.equals(Components.interfaces.nsISupports)) {
return this;
}
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
return null;
QueryInterface: function(uuid) {
if (uuid.equals(Components.interfaces.nsISeleniumIDEGenericAutoCompleteSearch) ||
uuid.equals(Components.interfaces.nsIAutoCompleteSearch) ||
uuid.equals(Components.interfaces.nsISupports)) {
return this;
}
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
return null;
}
};

function AutoCompleteResult(search, candidates) {
Expand Down Expand Up @@ -70,49 +70,53 @@ function AutoCompleteResult(search, candidates) {
}

AutoCompleteResult.prototype = {
get defaultIndex() {
return 0;
},
get errorDescription() {
return '';
},
get matchCount() {
return this.result.length;
},
get searchResult() {
return Components.interfaces.nsIAutoCompleteResult.RESULT_SUCCESS;
},
get searchString() {
return this.search;
},
getCommentAt: function(index) {
return this.result[index][1] || '';
},
getStyleAt: function(index) {
return '';
},
getValueAt: function(index) {
return this.result[index][0];
},
getImageAt: function (index) {
return '';
},
getLabelAt: function getLabelAt(index) {
return this.getValueAt(index);
},
getFinalCompleteValueAt: function(index) {
return this.getValueAt(index);
},
removeValueAt: function(rowIndex, removeFromDb) {
},
QueryInterface: function (uuid) {
if (uuid.equals(Components.interfaces.nsIAutoCompleteResult) ||
uuid.equals(Components.interfaces.nsISupports)) {
return this;
}
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
return null;
get searchString() {
return this.search;
},
get searchResult() {
return Components.interfaces.nsIAutoCompleteResult.RESULT_SUCCESS;
},
get defaultIndex() {
return 0;
},
get errorDescription() {
return '';
},
get matchCount() {
return this.result.length;
},
get typeAheadResult() {
return false;
},
getValueAt: function(index) {
return this.result[index][0];
},
getLabelAt: function(index) {
return this.getValueAt(index);
},
getCommentAt: function(index) {
return this.result[index][1] || '';
},
getStyleAt: function(index) {
// TODO improve this proof of concept with an optimised version for multiple deprecated commands
return this.result[index][0] === "verifyTextPresent" ? 'deprecated' : '';
},
getImageAt: function (index) {
return '';
},
getFinalCompleteValueAt: function(index) {
return this.getValueAt(index);
},
removeValueAt: function(rowIndex, removeFromDb) {
},
QueryInterface: function (uuid) {
if (uuid.equals(Components.interfaces.nsIAutoCompleteResult) ||
uuid.equals(Components.interfaces.nsISupports)) {
return this;
}
Components.returnCode = Components.results.NS_ERROR_NO_INTERFACE;
return null;
}
};

//const COMPONENT_ID = Components.ID("{4791AF5F-AFBA-45A1-8204-47A135DF9591}");
Expand Down
6 changes: 6 additions & 0 deletions ide/main/src/skin/classic/selenium-ide.css
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,12 @@ treechildren::-moz-tree-cell-text(currentTestCase)
font-weight: bold;
}

/*
* Autocomplete show deprecated
*/
treechildren.autocomplete-treebody::-moz-tree-cell-text(deprecated) {
color: red;
}

/*
* Log Console
Expand Down

0 comments on commit e160a45

Please sign in to comment.