aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorelijahe2013-12-09 16:47:17 (EST)
committerSilenio Quarti2013-12-12 13:31:30 (EST)
commit05d634f286605e96480d3618a2159e14a2c58965 (patch)
tree2d9830ebb9ee6e6126558f1ac6a365e17e715225
parent0b2ad360d33a4c117fc1c5956b7b6395794ec12a (diff)
downloadorg.eclipse.orion.client-05d634f286605e96480d3618a2159e14a2c58965.zip
org.eclipse.orion.client-05d634f286605e96480d3618a2159e14a2c58965.tar.gz
org.eclipse.orion.client-05d634f286605e96480d3618a2159e14a2c58965.tar.bz2
Bug 421482 - UX: No context menu!
- Enabled context menu in common-nav - Removed _triggerNode click event listener in destroy() - Added NON-NLS comments --Signed-off-by: Elijah El-Haddad <elijahe@ca.ibm.com>
-rw-r--r--bundles/org.eclipse.orion.client.ui/web/orion/webui/contextmenu.js30
-rw-r--r--bundles/org.eclipse.orion.client.ui/web/orion/widgets/nav/common-nav.js5
2 files changed, 14 insertions, 21 deletions
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/webui/contextmenu.js b/bundles/org.eclipse.orion.client.ui/web/orion/webui/contextmenu.js
index e047d3f..adc4cc6 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/webui/contextmenu.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/webui/contextmenu.js
@@ -54,19 +54,13 @@ define([
//add context menu event handlers
this._boundcontextmenuEventHandler = this._contextmenuEventHandler.bind(this);
this._boundContextMenuCloser = this._contextMenuCloser.bind(this);
- this._triggerNode.addEventListener("contextmenu", this._boundcontextmenuEventHandler, true);
- window.addEventListener("contextmenu", this._boundContextMenuCloser, false);
+ this._triggerNode.addEventListener("contextmenu", this._boundcontextmenuEventHandler, true); //$NON-NLS-0$
+ window.addEventListener("contextmenu", this._boundContextMenuCloser, false); //$NON-NLS-0$
//clicking on the trigger node should close the context menu
- this._triggerNode.addEventListener("click", function(event) { //$NON-NLS-0$
- if (self.isVisible()) {
- if (self.close()) {
- lib.stop(event);
- }
- }
- }, false);
+ this._triggerNode.addEventListener("click", this._boundContextMenuCloser, false);//$NON-NLS-0$
- this.addEventListener("postpopulate", this._addBrowserContextMenuArrow.bind(this));
+ this.addEventListener("postpopulate", this._addBrowserContextMenuArrow.bind(this)); //$NON-NLS-0$
},
_positionContextMenu: function(event) {
@@ -94,7 +88,8 @@ define([
//ensure menu fits on page vertically
var overflowY = (bounds.top + bounds.height) - (bodyBounds.top + bodyBounds.height);
if (0 < overflowY) {
- this._dropdownNode.style.top = (bounds.top - overflowY) + "px"; //TODO improve bottom padding estimate
+ //TODO improve bottom padding estimate
+ this._dropdownNode.style.top = (bounds.top - overflowY) + "px"; //$NON-NLS-0$
}
},
@@ -143,12 +138,12 @@ define([
});
// add handler to show tooltip
- this._browserContextNode.addEventListener("click", function(e){
+ this._browserContextNode.addEventListener("click", function(e){ //$NON-NLS-0$
browserContextSpan.commandTooltip.show();
}, false);
// add handler to close submenu
- this._browserContextNode.addEventListener("mouseover", function(e){
+ this._browserContextNode.addEventListener("mouseover", function(e){ //$NON-NLS-0$
self._closeSelectedSubmenu();
}, false);
@@ -156,8 +151,8 @@ define([
var hideTooltip = function(e){
browserContextSpan.commandTooltip.hide(0);
};
- this.addEventListener("dropdownclosed", hideTooltip, true);
- this.addEventListener("submenuopen", hideTooltip, true);
+ this.addEventListener("dropdownclosed", hideTooltip, true); //$NON-NLS-0$
+ this.addEventListener("submenuopen", hideTooltip, true); //$NON-NLS-0$
this._browserContextTooltip = browserContextSpan.commandTooltip;
}
@@ -179,8 +174,9 @@ define([
// overrides Dropdown.protoype.destroy
ContextMenu.prototype.destroy = function() {
- this._triggerNode.removeEventListener("contextmenu", this._boundcontextmenuEventHandler, true);
- window.removeEventListener("contextmenu", this._boundContextMenuCloser, false);
+ this._triggerNode.removeEventListener("contextmenu", this._boundcontextmenuEventHandler, true); //$NON-NLS-0$
+ this._triggerNode.removeEventListener("click", this._boundContextMenuCloser, false); //$NON-NLS-0$
+ window.removeEventListener("contextmenu", this._boundContextMenuCloser, false); //$NON-NLS-0$
this._dropdownNode.dropdown = null;
if (this._browserContextNode) {
this._dropdownNode.removeChild(this._browserContextNode);
diff --git a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/nav/common-nav.js b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/nav/common-nav.js
index 5856634..40f79e9 100644
--- a/bundles/org.eclipse.orion.client.ui/web/orion/widgets/nav/common-nav.js
+++ b/bundles/org.eclipse.orion.client.ui/web/orion/widgets/nav/common-nav.js
@@ -34,7 +34,6 @@ define([
var NavigatorRenderer = mNavigatorRenderer.NavigatorRenderer;
var uriTemplate = new URITemplate("#{,resource,params*}"); //$NON-NLS-0$
- var enableContextMenu = false;
/**
* @class orion.sidebar.CommonNavExplorer
@@ -83,9 +82,7 @@ define([
this.commandsRegistered = this.registerCommands();
this._parentNode = lib.node(this.parentId);
- if (enableContextMenu) {
- this._createContextMenu();
- }
+ this._createContextMenu();
}
CommonNavExplorer.prototype = Object.create(FileExplorer.prototype);
objects.mixin(CommonNavExplorer.prototype, /** @lends orion.sidebar.CommonNavExplorer.prototype */ {