@@ -154,6 +154,14 @@ define(function (require, exports, module) {
154154 function getMenu ( id ) {
155155 return menuMap [ id ] ;
156156 }
157+
158+ /**
159+ * Retrieves the map of all Menu objects.
160+ * @return {Object.<string, Menu> }
161+ */
162+ function getAllMenus ( ) {
163+ return menuMap ;
164+ }
157165
158166 /**
159167 * Retrieves the ContextMenu object for the corresponding id.
@@ -869,7 +877,27 @@ define(function (require, exports, module) {
869877 * Extensions should use the following format: "author.myextension.mymenuname".
870878 */
871879 function removeMenu ( id ) {
872- console . log ( "NOT IMPLEMENTED" ) ;
880+ if ( ! id ) {
881+ console . error ( "removeMenu(): missing required parameter: id" ) ;
882+ return ;
883+ }
884+
885+ if ( ! menuMap [ id ] ) {
886+ console . error ( "removeMenu(): menu id not found: %s" , id ) ;
887+ return ;
888+ }
889+
890+ if ( _isHTMLMenu ( id ) ) {
891+ console . log ( "**TO BE IMPLEMENTED**" ) ;
892+ } else {
893+ brackets . app . removeMenu ( id , function ( err ) {
894+ if ( err ) {
895+ console . error ( "removeMenu() -- id not found: " + id + " (error: " + err + ")" ) ;
896+ }
897+ } ) ;
898+ }
899+
900+ delete menuMap [ id ] ;
873901 }
874902
875903 /**
@@ -1029,6 +1057,7 @@ define(function (require, exports, module) {
10291057 exports . LAST_IN_SECTION = LAST_IN_SECTION ;
10301058 exports . DIVIDER = DIVIDER ;
10311059 exports . getMenu = getMenu ;
1060+ exports . getAllMenus = getAllMenus ;
10321061 exports . getMenuItem = getMenuItem ;
10331062 exports . getContextMenu = getContextMenu ;
10341063 exports . addMenu = addMenu ;
0 commit comments