Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Bug 424247 - Remove the downward arrow from the context menu
--Signed-off-by: Elijah El-Haddad <elijahe@ca.ibm.com>
  • Loading branch information
elijahe committed Dec 17, 2013
1 parent ce0ccd1 commit 1f92eac
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 103 deletions.
12 changes: 0 additions & 12 deletions bundles/org.eclipse.orion.client.ui/web/css/theme.css
Expand Up @@ -433,18 +433,6 @@ a.currentLocation:hover {
border: 1px solid #ccc !important;
}

button.browserContextButton { /* specifying <button> element to increase specificity and override .dropdownMenuItem's padding */
border: none;
width: 100%;
text-align: center;
padding: 0;
background: none;
}

span.browserContextButton {
line-height: 0; /* remove the extra padding from the open arrow icon */
}

.checkedMenuItem {
margin: 4px 6px 2px 0;
vertical-align: bottom;
Expand Down

This file was deleted.

89 changes: 3 additions & 86 deletions bundles/org.eclipse.orion.client.ui/web/orion/webui/contextmenu.js
Expand Up @@ -16,9 +16,8 @@ define([
'orion/objects',
'orion/webui/tooltip',
'i18n!orion/nls/messages',
'text!orion/webui/dropdownseparator.html',
'text!orion/webui/browsercontextmenubutton.html'
], function(lib, mDropdown, objects, Tooltip, messages, DropdownSeparatorFragment, BrowserContextMenuFragment) {
'text!orion/webui/dropdownseparator.html'
], function(lib, mDropdown, objects, Tooltip, messages, DropdownSeparatorFragment) {

var Dropdown = mDropdown.Dropdown;

Expand Down Expand Up @@ -59,8 +58,6 @@ define([

//clicking on the trigger node should close the context menu
this._triggerNode.addEventListener("click", this._boundContextMenuCloser, false);//$NON-NLS-0$

this.addEventListener("postpopulate", this._addBrowserContextMenuArrow.bind(this)); //$NON-NLS-0$
},

_positionContextMenu: function(event) {
Expand Down Expand Up @@ -103,67 +100,7 @@ define([
} else {
this.close();
}
},

_addBrowserContextMenuArrow: function(eventWrapper) {
var self = this;

if (this._separatorElement) {
this._dropdownNode.appendChild(this._separatorElement);
} else {
var separatorRange = document.createRange();
separatorRange.selectNode(this._dropdownNode);
var separatorFragment = separatorRange.createContextualFragment(DropdownSeparatorFragment);
this._dropdownNode.appendChild(separatorFragment);
this._separatorElement = this._dropdownNode.lastChild;
}

if (this._browserContextNode) {
this._dropdownNode.appendChild(this._browserContextNode);
} else {
var browserContextRange = document.createRange();
browserContextRange.selectNode(this._dropdownNode);
var browserContextMenuFragment = browserContextRange.createContextualFragment(BrowserContextMenuFragment);
this._dropdownNode.appendChild(browserContextMenuFragment);

this._browserContextNode = this._dropdownNode.lastChild;

var browserContextButtonNode = this._browserContextNode.firstElementChild;

this._browserContextTooltip = new Tooltip.Tooltip({
node: browserContextButtonNode,
text: messages["To view the browser's context menu, trigger the context menu again."], //$NON-NLS-0$
position: ["below", "right", "left", "above"], //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$
trigger: "none" //$NON-NLS-0$
});

// add handler to show tooltip
browserContextButtonNode.addEventListener("click", function(e){ //$NON-NLS-0$
self._browserContextTooltip.show();
}, false);

browserContextButtonNode.addEventListener("keyup", function(e){ //$NON-NLS-0$
if (e.which || e.keyCode) {
if ((e.which === lib.KEY.ENTER) || (e.keyCode === lib.KEY.ENTER)) {
self._browserContextTooltip.show();
return false;
}
}
});

// add handler to close submenu
browserContextButtonNode.addEventListener("mouseover", function(e){ //$NON-NLS-0$
self._closeSelectedSubmenu();
}, false);

}
},

_hideBrowserContextTooltip: function() {
if (this._browserContextTooltip) {
this._browserContextTooltip.hide(0);
}
}
},
});

ContextMenu.prototype.constructor = ContextMenu;
Expand All @@ -179,32 +116,12 @@ define([
return actionTaken;
};

// overrides Dropdown.protoype.submenuOpen
ContextMenu.prototype.submenuOpen = function(submenu) {
Dropdown.prototype.submenuOpen.call(this, submenu); //call function in super class
this._hideBrowserContextTooltip();
};

// overrides Dropdown.protoype.submenuOpen
ContextMenu.prototype.close = function(restoreFocus) {
Dropdown.prototype.close.call(this, restoreFocus); //call function in super class
this._hideBrowserContextTooltip();
};

// overrides Dropdown.protoype.destroy
ContextMenu.prototype.destroy = function() {
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);
this._browserContextNode = null;
}
if (this._browserContextTooltip) {
this._browserContextTooltip.destroy();
this._browserContextTooltip = null;
}
Dropdown.prototype.destroy.call(this); //call function in super class
};

Expand Down

0 comments on commit 1f92eac

Please sign in to comment.