summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Moffatt <emoffatt@ca.ibm.com>2015-07-02 15:15:13 -0400
committerEric Moffatt <emoffatt@ca.ibm.com>2015-07-02 15:15:13 -0400
commit575ea352ac8b9092ade4b635056c398651997824 (patch)
treeb5cc39285c7f0b713a90cd98f90e0a0d7524cb60
parent5e15da82fea960c2765d27500426bafcb198b304 (diff)
downloadorg.eclipse.orion.client-origin/emoffatt/ProjectSearch.zip
org.eclipse.orion.client-origin/emoffatt/ProjectSearch.tar.gz
org.eclipse.orion.client-origin/emoffatt/ProjectSearch.tar.bz2
Capture the project name from the metadata and hide the checkbox if the search is always globalorigin/emoffatt/ProjectSearch
-rw-r--r--bundles/org.eclipse.orion.client.ui/web/orion/searchClient.js4
-rw-r--r--bundles/org.eclipse.orion.client.ui/web/orion/webui/dialogs/OpenResourceDialog.js27
2 files changed, 22 insertions, 9 deletions
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/searchClient.js b/bundles/org.eclipse.orion.client.ui/web/orion/searchClient.js
index e50ba0f..3990f9d 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/searchClient.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/searchClient.js
@@ -293,6 +293,7 @@ function(messages, require, lib, i18nUtil, mSearchUtils, mSearchCrawler, navigat
if(!locationName){
locationName = "";
}
+ this._searchLocationName = locationName;
if(searchInputDom && searchInputDom.placeholder){
searchInputDom.value = "";
var placeHolder = i18nUtil.formatMessage(messages["Search ${0}"], locationName);
@@ -323,6 +324,9 @@ function(messages, require, lib, i18nUtil, mSearchUtils, mSearchCrawler, navigat
return this._fileService.fileServiceRootURL();
}
},
+ getSearchLocationName: function(){
+ return this._searchLocationName;
+ },
getSearchRootLocation: function(){
if(this._searchRootLocation){
return this._searchRootLocation;
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/webui/dialogs/OpenResourceDialog.js b/bundles/org.eclipse.orion.client.ui/web/orion/webui/dialogs/OpenResourceDialog.js
index 6ac8478..cb5766f 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/webui/dialogs/OpenResourceDialog.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/webui/dialogs/OpenResourceDialog.js
@@ -33,7 +33,7 @@ define(['i18n!orion/widgets/nls/messages', 'orion/crawler/searchCrawler', 'orion
'<div role="search">' + //$NON-NLS-0$
'<div><label id="fileNameMessage" for="fileName">${Type the name of a file to open (? = any character, * = any string):}</label></div>' + //$NON-NLS-0$
'<div><input id="fileName" type="text" class="openResourceDialogInput" style="min-width: 25em; width:90%;"/></div>' + //$NON-NLS-0$
- '<div><input id="searchScope" type="checkbox" style="width: auto" class="openResourceDialogInput">${Search all Projects}</div>' + //$NON-NLS-0$
+ '<div><input id="searchScope" type="checkbox" style="width: auto" class="openResourceDialogInput"/><label for="searchScope">${Search all Projects}</label></input></div>' + //$NON-NLS-0$
'<div id="progress" style="padding: 2px 0 0; width: 100%;"><img src="'+ require.toUrl("../../../images/progress_running.gif") + '" class="progressPane_running_dialog" id="crawlingProgress"></img></div>' + //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
'<div id="results" style="max-height:250px; height:auto; overflow-y:auto;" aria-live="off"></div>' + //$NON-NLS-0$
'<div id="statusbar"></div>' + //$NON-NLS-0$
@@ -198,17 +198,16 @@ define(['i18n!orion/widgets/nls/messages', 'orion/crawler/searchCrawler', 'orion
var scope = messages["AnyProject"];
if (!isGlobalSearch) {
- var sl = this._searcher.getSearchLocation();
- if (sl) {
- var parts = sl.split('/');
- scope = "'" + parts[parts.length-2] + "'"; //$NON-NLS-2$ //$NON-NLS-1$
- }
+ scope = "\'" + this._searcher.getSearchLocationName() + "\'"; //$NON-NLS-1$ //$NON-NLS-2$
}
var newTitle = util.formatMessage(this.title, scope);
- if (newTitle.length > 0) {
- var titleDiv = lib.$("span", this.$frame); //$NON-NLS-1$
- titleDiv.textContent = newTitle;
+ var titleDiv = lib.$("span", this.$frame); //$NON-NLS-1$
+ titleDiv.textContent = newTitle;
+
+ // Hide the checkbox if this search must be global
+ if (this.forcedGlobalSearch()) {
+ this.$searchScope.parentNode.style.display = "none"; //$NON-NLS-1$
}
};
@@ -225,7 +224,17 @@ define(['i18n!orion/widgets/nls/messages', 'orion/crawler/searchCrawler', 'orion
};
/** @private */
+ OpenResourceDialog.prototype.forcedGlobalSearch = function() {
+ var loc = this._searcher.getSearchLocation();
+ var rootLoc = this._searcher.getSearchRootLocation();
+ return loc === rootLoc;
+ };
+
+ /** @private */
OpenResourceDialog.prototype.getSearchPref = function() {
+ if (this.forcedGlobalSearch())
+ return true;
+
var globalSearch = localStorage.getItem("/searchScope") === 'true'; //$NON-NLS-0$
return globalSearch;
};