aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel Luong2013-06-17 12:53:54 (EDT)
committerskaegi2013-06-17 14:47:29 (EDT)
commiteea83f6e23bca2e1b6810e04906fddf3cf2bf45c (patch)
tree1775f9ae67ffa12a9e435e53531e3dab96a2dd80
parentd1a8fc0347d6eb4c88ea22cc4eae7f8ae8667ab1 (diff)
downloadorg.eclipse.orion.client-eea83f6e23bca2e1b6810e04906fddf3cf2bf45c.zip
org.eclipse.orion.client-eea83f6e23bca2e1b6810e04906fddf3cf2bf45c.tar.gz
org.eclipse.orion.client-eea83f6e23bca2e1b6810e04906fddf3cf2bf45c.tar.bz2
Bug 410616 - Navigator page consistency with Editor navigator - if in an empty folder display the "Use the [+] to create new files and folders. Click a file to start coding." message
-rw-r--r--bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js44
-rw-r--r--bundles/org.eclipse.orion.client.ui/web/orion/navigate/nls/root/messages.js3
2 files changed, 36 insertions, 11 deletions
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js b/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js
index 65ecddc..8b380eb 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/explorers/explorer-table.js
@@ -73,7 +73,7 @@ define(['i18n!orion/navigate/nls/messages', 'require', 'orion/Deferred', 'orion/
return children;
};
- FileModel.prototype.getChildren = function(parentItem, /* function(items) */ onComplete){
+ FileModel.prototype.getChildren = function(parentItem, /* function(items) */ onComplete) {
var self = this;
// the parent already has the children fetched
if (parentItem.children) {
@@ -91,6 +91,15 @@ define(['i18n!orion/navigate/nls/messages', 'require', 'orion/Deferred', 'orion/
onComplete([]);
}
};
+
+ FileModel.prototype.hasChildren = function() {
+ var result = false;
+ if (this.root.Children) {
+ result = this.root.Children.length > 0;
+ }
+ return result;
+ };
+
FileModel.prototype.constructor = FileModel;
@@ -564,16 +573,31 @@ define(['i18n!orion/navigate/nls/messages', 'require', 'orion/Deferred', 'orion/
}
}
}
-
- self.createTree(self.parentId, self.model, {
- navHandlerFactory: self.navHandlerFactory,
- setFocus: (typeof self.setFocus === "undefined" ? true : self.setFocus),
- selectionPolicy: self.renderer.selectionPolicy,
- onCollapse: function(model){
- if(self.getNavHandler()){
- self.getNavHandler().onCollapse(model);
+
+ if (self.model.hasChildren()) {
+ self.createTree(self.parentId, self.model, {
+ navHandlerFactory: self.navHandlerFactory,
+ setFocus: (typeof self.setFocus === "undefined" ? true : self.setFocus),
+ selectionPolicy: self.renderer.selectionPolicy,
+ onCollapse: function(model) {
+ if(self.getNavHandler()){
+ self.getNavHandler().onCollapse(model);
+ }
}
- }});
+ });
+ } else {
+ lib.empty(parent);
+ var noFile = document.createElement("div"); //$NON-NLS-0$
+ noFile.classList.add("noFile"); //$NON-NLS-0$
+ noFile.textContent = messages["NoFile"];
+ var plusIcon = document.createElement("span"); //$NON-NLS-0$
+ plusIcon.classList.add("core-sprite-addcontent"); //$NON-NLS-0$
+ plusIcon.classList.add("icon-inline"); //$NON-NLS-0$
+ plusIcon.classList.add("imageSprite"); //$NON-NLS-0$
+ lib.processDOMNodes(noFile, [plusIcon]);
+ parent.appendChild(noFile);
+ }
+
if (typeof postLoad === "function") { //$NON-NLS-0$
try {
postLoad();
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/navigate/nls/root/messages.js b/bundles/org.eclipse.orion.client.ui/web/orion/navigate/nls/root/messages.js
index 3fd4633..f96cb9c 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/navigate/nls/root/messages.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/navigate/nls/root/messages.js
@@ -109,5 +109,6 @@ define({
"Extracted from:" : "Extracted from:",
"Did not drop ${0}. Folder drop is not supported in this browser.": "Did not drop ${0}. Folder drop is not supported in this browser.",
"You cannot copy files directly into the workspace. Create a folder first.": "You cannot copy files directly into the workspace. Create a folder first.",
- "Unzip ${0}?": "Unzip ${0}?"
+ "Unzip ${0}?": "Unzip ${0}?",
+ "NoFile": "Use the ${0} to create new files and folders. Click a file to start coding." //$NON-NLS-1$ //$NON-NLS-0$
});