فهرست منبع

Add warning message for toolbar loading without buttons.

bentleyjoakes 5 سال پیش
والد
کامیت
23ec124a78
1فایلهای تغییر یافته به همراه10 افزوده شده و 0 حذف شده
  1. 10 0
      client/gui_utils.js

+ 10 - 0
client/gui_utils.js

@@ -612,11 +612,16 @@ GUIUtils = function(){
 		tb_div.attr("class", className() + ' toolbar unselectable');
 		tb_div.attr("title", tb);
 
+		// record whether this toolbar has buttons
+		let has_buttons = false;
+
 		sortedButtons().forEach(
 			function (b) {
 				if (type == __METAMODEL_TOOLBAR && b.match(/(.*)Link$/))
 					return;
 
+				has_buttons = true;
+
 				var spc1 = $('<span>'),
 					spc2 = $('<span>');
 //				spc1.className = spc2.className = 'toolbar_space';
@@ -640,6 +645,11 @@ GUIUtils = function(){
 				tb_div.append(spc2);
 			});
 
+		// print an informative message if no buttons were loaded
+		if (! has_buttons){
+			console.log("Warning: Toolbar '" + tb + "' was loaded, but there are no buttons. This may be due to the toolbar only containing associations or abstract classes.");
+		}
+
 		if (tb_div.children().length == 0)
 			tb_div.append(GUIUtils.getTextSpan(tb, 'toolbar_alt'));