summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorelijahe2013-11-15 17:31:20 (EST)
committer Silenio Quarti2013-11-21 10:16:44 (EST)
commit2a61751516638029666bbaa2cc350fe955a2589a (patch)
treeb15519d8069464d9098e08293fd302081467fa07
parent89922b7082abfcccd01e8954ea6a632f246f352d (diff)
downloadorg.eclipse.orion.client-2a61751516638029666bbaa2cc350fe955a2589a.zip
org.eclipse.orion.client-2a61751516638029666bbaa2cc350fe955a2589a.tar.gz
org.eclipse.orion.client-2a61751516638029666bbaa2cc350fe955a2589a.tar.bz2
Bug 394861 - outliner should provide filtering
--Signed-off-by: Elijah El-Haddad <elijahe@ca.ibm.com>
-rw-r--r--bundles/org.eclipse.orion.client.ui/web/css/sections.css13
-rw-r--r--bundles/org.eclipse.orion.client.ui/web/orion/nls/root/messages.js3
-rw-r--r--bundles/org.eclipse.orion.client.ui/web/orion/outliner.js43
3 files changed, 57 insertions, 2 deletions
diff --git a/bundles/org.eclipse.orion.client.ui/web/css/sections.css b/bundles/org.eclipse.orion.client.ui/web/css/sections.css
index 0ffe9b8..2cf2c09 100644
--- a/bundles/org.eclipse.orion.client.ui/web/css/sections.css
+++ b/bundles/org.eclipse.orion.client.ui/web/css/sections.css
@@ -81,3 +81,16 @@ sectionAnchor {
font-weight: bold;
font-size: 1.2em;
}
+
+.outlineFilter {
+ border: 1px solid black;
+ border-radius: 4px;
+ box-shadow: 0 2px 1px #888888;
+ float: left;
+ text-align: left;
+ width: 99%;
+}
+
+.hiddenRow {
+ display: none;
+}
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/nls/root/messages.js b/bundles/org.eclipse.orion.client.ui/web/orion/nls/root/messages.js
index a2d0910..59780bf 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/nls/root/messages.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/nls/root/messages.js
@@ -85,5 +85,6 @@ define({
"Open the raw file or folder in the browser": "Open the raw file or folder in the browser",
"OutlineProgress": "Getting outline for ${0} from ${1}",
"UnknownError": "An unknown error occurred.",
- "UnknownWarning": "An unknown warning occurred."
+ "UnknownWarning": "An unknown warning occurred.",
+ "Filter": "Filter"
});
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/outliner.js b/bundles/org.eclipse.orion.client.ui/web/orion/outliner.js
index 742783a..d1f2f13 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/outliner.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/outliner.js
@@ -85,7 +85,26 @@ define([
return link;
};
-
+ OutlineRenderer.prototype.getCellHeaderElement = function(col_no){
+ var th = null;
+ var input;
+
+ if (0 === col_no) {
+ th = document.createElement("th"); //$NON-NLS-0$
+ input = document.createElement("input"); //$NON-NLS-0$
+ input.className = "outlineFilter"; //$NON-NLS-0$
+ input.placeholder = messages["Filter"]; //$NON-NLS-0$
+ input.type="text"; //$NON-NLS-0$
+ input.addEventListener("input", function (e) { //$NON-NLS-0$
+ this.explorer.filterChanged(input.value);
+ }.bind(this));
+ th.appendChild(input);
+ }
+
+ return th;
+ };
+
+
function OutlineExplorer(serviceRegistry, selection, title) {
/* we intentionally do not do this:
this.selection = selection;
@@ -98,6 +117,24 @@ define([
OutlineExplorer.prototype = new mExplorer.Explorer();
OutlineExplorer.prototype.constructor = OutlineExplorer;
+
+ OutlineExplorer.prototype.filterChanged = function (filter) {
+ var navDict = this.getNavDict();
+ var itemMap = this.model.getIdItemMap();
+
+ for (var id in itemMap) {
+ if (itemMap.hasOwnProperty(id)) {
+ if (-1 === id.indexOf(filter)) {
+ //hide
+ navDict.getValue(id).rowDomNode.classList.add("hiddenRow"); //$NON-NLS-0$
+ } else {
+ //id matches filter, show row
+ navDict.getValue(id).rowDomNode.classList.remove("hiddenRow"); //$NON-NLS-0$
+ }
+ }
+ }
+ };
+
function OutlineModel(items, rootId) {
this.items = items;
this.root = {children: items};
@@ -135,6 +172,10 @@ define([
return id;
};
+
+ OutlineModel.prototype.getIdItemMap = function(){
+ return this.idItemMap;
+ };
OutlineModel.prototype.getChildren = function(parentItem, /* function(items) */ onComplete){
if (parentItem.children) {