summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorKris De Volder2012-01-31 17:08:03 (EST)
committer John Arthorne2012-02-02 16:32:55 (EST)
commit0641e29dc82de224aa15e20dcaa5cc3d96549021 (patch)
tree88a92b04d475dc7551ab057d38c0763160e9fcf3
parent07335a519d7aa649fed734d62455083df6cf493d (diff)
downloadorg.eclipse.orion.client-0641e29dc82de224aa15e20dcaa5cc3d96549021.zip
org.eclipse.orion.client-0641e29dc82de224aa15e20dcaa5cc3d96549021.tar.gz
org.eclipse.orion.client-0641e29dc82de224aa15e20dcaa5cc3d96549021.tar.bz2
Some code cleanups.
-rw-r--r--bundles/org.eclipse.orion.client.core/web/edit/setup.js2
-rw-r--r--bundles/org.eclipse.orion.client.core/web/js-tests/searchRendering/testcase.js10
-rw-r--r--bundles/org.eclipse.orion.client.core/web/orion/searchClient.js14
-rw-r--r--bundles/org.eclipse.orion.client.core/web/orion/searchRenderer.js3
-rw-r--r--bundles/org.eclipse.orion.client.core/web/orion/widgets/OpenResourceDialog.js2
5 files changed, 11 insertions, 20 deletions
diff --git a/bundles/org.eclipse.orion.client.core/web/edit/setup.js b/bundles/org.eclipse.orion.client.core/web/edit/setup.js
index 63f52f0..7b881a2 100644
--- a/bundles/org.eclipse.orion.client.core/web/edit/setup.js
+++ b/bundles/org.eclipse.orion.client.core/web/edit/setup.js
@@ -334,7 +334,7 @@ exports.setUpEditor = function(serviceRegistry, preferences, isReadOnly){
dojo.place(document.createTextNode("\"" + searchPattern + "\"..."), b, "only");
searchFloat.style.display = "block";
var query = searcher.createSearchQuery(searchPattern, null, "Name");
- var renderer = mSearchRenderer.makeRenderFunction(searchFloat, false, null, false);
+ var renderer = mSearchRenderer.makeRenderFunction(searchFloat, false, null);
searcher.search(query, inputManager.getInput(), renderer);
}, 0);
return true;
diff --git a/bundles/org.eclipse.orion.client.core/web/js-tests/searchRendering/testcase.js b/bundles/org.eclipse.orion.client.core/web/js-tests/searchRendering/testcase.js
index cb8bb22..408f57f 100644
--- a/bundles/org.eclipse.orion.client.core/web/js-tests/searchRendering/testcase.js
+++ b/bundles/org.eclipse.orion.client.core/web/js-tests/searchRendering/testcase.js
@@ -16,19 +16,19 @@ define(["orion/assert", "orion/serviceregistry", "orion/searchRenderer"],
tests.testEmptyRendererWithQueryName = function() {
var renderer = mSearchRenderer.makeRenderFunction(dojo.query("#results")[0], false, function(results) {
assert.equal(results.innerHTML, "<div>No matches found for <b>No results</b></div>");
- }, true);
+ });
renderer([], "No results");
};
tests.testEmptyRendererNoName = function() {
var renderer = mSearchRenderer.makeRenderFunction(dojo.query("#results")[0], false, function(results) {
assert.equal(results.innerHTML, "");
- }, true);
+ });
renderer([]);
};
tests.testExternalResource = function() {
var renderer = mSearchRenderer.makeRenderFunction(dojo.query("#results")[0], false, function(results) {
assert.equal(results.innerHTML, "<table><tbody><tr><td><a href=\"http://eclipse.org\">link</a></td></tr></tbody></table>");
- }, true);
+ });
renderer([{
name: 'link',
path: 'http://eclipse.org',
@@ -38,7 +38,7 @@ define(["orion/assert", "orion/serviceregistry", "orion/searchRenderer"],
tests.testDirectory = function() {
var renderer = mSearchRenderer.makeRenderFunction(dojo.query("#results")[0], false, function(results) {
assert.equal(results.innerHTML, "<table><tbody><tr><td><a href=\"../../navigate/table.html#foo/blap\">link</a></td></tr></tbody></table>");
- }, true);
+ });
renderer([{
name: 'link',
path: 'foo/blap',
@@ -48,7 +48,7 @@ define(["orion/assert", "orion/serviceregistry", "orion/searchRenderer"],
tests.testFile = function() {
var renderer = mSearchRenderer.makeRenderFunction(dojo.query("#results")[0], false, function(results) {
assert.equal(results.innerHTML, "<table><tbody><tr><td><a href=\"../../edit/edit.html#foo/blap.js\">link</a></td></tr></tbody></table>");
- }, true);
+ });
renderer([{
name: 'link',
path: 'foo/blap.js',
diff --git a/bundles/org.eclipse.orion.client.core/web/orion/searchClient.js b/bundles/org.eclipse.orion.client.core/web/orion/searchClient.js
index d32db87..b7d47c2 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/searchClient.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/searchClient.js
@@ -15,15 +15,6 @@
define(['require', 'dojo', 'dijit', 'orion/auth', 'orion/util', 'orion/searchRenderer', 'orion/searchUtils', 'dijit/form/Button', 'dijit/layout/BorderContainer', 'dijit/layout/ContentPane' ], function(require, dojo, dijit, mAuth, mUtil, mSearchRenderer, mSearchUtils){
-// function legacySearch(resultsNode, query, excludeFile, generateHeadingAndSaveLink, onResultReady, hideSummaries) {
-// var renderer = mSearchRenderer.makeRenderFunction(resultsNode, generateHeadingAndSaveLink, onResultReady, hideSummaries);
-// this.searchAndRender(query, excludeFile, renderer);
-// }
-//
-// function legacySearchError() {
-// throw "This method was removed: use 'searchAndRender' instead.";
-// }
-
/**
* Creates a new search client.
* @param {Object} options The options object
@@ -49,8 +40,9 @@ define(['require', 'dojo', 'dijit', 'orion/auth', 'orion/util', 'orion/searchRen
try {
this._fileService.search(qObj.location, query).then(function(jsonData) {
/**
- * transforms the jsonData so that the result is understandable by the
- * renderer
+ * transforms the jsonData so that the result conforms to the same
+ * format as the favourites list. This way renderer implementation can
+ * be reused for both.
* jsonData.response.docs{ Name, Location, Directory, LineNumber }
*/
var transform = function(jsonData) {
diff --git a/bundles/org.eclipse.orion.client.core/web/orion/searchRenderer.js b/bundles/org.eclipse.orion.client.core/web/orion/searchRenderer.js
index 7e5e521..c03036b 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/searchRenderer.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/searchRenderer.js
@@ -27,10 +27,9 @@ define( ['require', 'dojo', 'dijit', 'orion/auth', 'orion/util', 'orion/searc
* @param {DOMNode} resultsNode Node under which results will be added.
* @param {String} [heading] the heading text (HTML), or null if none required
* @param {Function(DOMNode)} [onResultReady] If any results were found, this is called on the resultsNode.
- * @param {Boolean} [hideSummaries] Don't show the summary of what matched beside each result.
* @returns a render function.
*/
- function makeRenderFunction(resultsNode, heading, onResultReady, hideSummaries) {
+ function makeRenderFunction(resultsNode, heading, onResultReady) {
/**
* Displays links to resources under the given DOM node.
diff --git a/bundles/org.eclipse.orion.client.core/web/orion/widgets/OpenResourceDialog.js b/bundles/org.eclipse.orion.client.core/web/orion/widgets/OpenResourceDialog.js
index e2868af..8c0a220 100644
--- a/bundles/org.eclipse.orion.client.core/web/orion/widgets/OpenResourceDialog.js
+++ b/bundles/org.eclipse.orion.client.core/web/orion/widgets/OpenResourceDialog.js
@@ -161,11 +161,11 @@ var OpenResourceDialog = dojo.declare("orion.widgets.OpenResourceDialog", [dijit
*/
showFavorites: function() {
var that = this;
- var renderFunction = mSearchRenderer.makeRenderFunction(that.favresults, false, dojo.hitch(that, that.decorateResult), true);
return function(favs) {
if (favs.navigator) {
favs = favs.navigator;
}
+ var renderFunction = mSearchRenderer.makeRenderFunction(that.favresults, false, dojo.hitch(that, that.decorateResult));
renderFunction(favs);
if (favs && favs.length > 0) {
dojo.place("<hr/>", that.favresults, "last");