Skip to content

Commit f05b446

Browse files
tduguidtduguid
authored andcommitted
Updated menu button labels to callback procedure
1 parent de62cf3 commit f05b446

File tree

3 files changed

+94
-43
lines changed

3 files changed

+94
-43
lines changed

CS/Ribbon.xml

Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -238,55 +238,55 @@ Or use the following tag to remove all other ribbons when this loads
238238
<button
239239
id="btnScriptTypeTSqlCreateTable"
240240
getImage="GetButtonImage"
241-
label="T-SQL Create Table"
241+
getLabel="GetLabelText"
242242
onAction="OnAction"
243243
getVisible="GetVisible"
244-
screentip="T-SQL Create Table"
244+
getScreentip="GetLabelText"
245245
supertip="This changes the query string to a T-SQL CREATE TABLE script."
246246
/>
247247
<button
248248
id="btnScriptTypeTSqlInsertValues"
249249
getImage="GetButtonImage"
250-
label="T-SQL Insert Values"
250+
getLabel="GetLabelText"
251251
onAction="OnAction"
252252
getVisible="GetVisible"
253-
screentip="T-SQL Insert Values"
253+
getScreentip="GetLabelText"
254254
supertip="This changes the query string to a T-SQL INSERT VALUES script."
255255
/>
256256
<button
257257
id="btnScriptTypeTSqlMergeValues"
258258
getImage="GetButtonImage"
259-
label="T-SQL Merge Values"
259+
getLabel="GetLabelText"
260260
onAction="OnAction"
261261
getVisible="GetVisible"
262-
screentip="T-SQL Merge Values"
262+
getScreentip="GetLabelText"
263263
supertip="This changes the query string to a T-SQL MERGE VALUES script."
264264
/>
265265
<button
266266
id="btnScriptTypeTSqlSelectValues"
267267
getImage="GetButtonImage"
268-
label="T-SQL Select Values"
268+
getLabel="GetLabelText"
269269
onAction="OnAction"
270270
getVisible="GetVisible"
271-
screentip="T-SQL Select Values"
271+
getScreentip="GetLabelText"
272272
supertip="This changes the query string to a T-SQL SELECT VALUES script."
273273
/>
274274
<button
275275
id="btnScriptTypeTSqlSelectUnion"
276276
getImage="GetButtonImage"
277-
label="T-SQL Select Union"
277+
getLabel="GetLabelText"
278278
onAction="OnAction"
279279
getVisible="GetVisible"
280-
screentip="T-SQL Select Union"
280+
getScreentip="GetLabelText"
281281
supertip="This changes the query string to a T-SQL SELECT UNION script."
282282
/>
283283
<button
284284
id="btnScriptTypeTSqlUpdateValues"
285285
getImage="GetButtonImage"
286-
label="T-SQL Update Values"
286+
getLabel="GetLabelText"
287287
onAction="OnAction"
288288
getVisible="GetVisible"
289-
screentip="T-SQL Update Values"
289+
getScreentip="GetLabelText"
290290
supertip="This changes the query string to a T-SQL UPDATE VALUES script."
291291
/>
292292
<menuSeparator
@@ -295,55 +295,55 @@ Or use the following tag to remove all other ribbons when this loads
295295
<button
296296
id="btnScriptTypePlSqlCreateTable"
297297
getImage="GetButtonImage"
298-
label="PL/SQL Create Table"
298+
getLabel="GetLabelText"
299299
onAction="OnAction"
300300
getVisible="GetVisible"
301-
screentip="PL/SQL Create Table"
301+
getScreentip="GetLabelText"
302302
supertip="This changes the query string to a PL/SQL CREATE TABLE script."
303303
/>
304304
<button
305305
id="btnScriptTypePlSqlInsertValues"
306306
getImage="GetButtonImage"
307-
label="PL/SQL Insert Values"
307+
getLabel="GetLabelText"
308308
onAction="OnAction"
309309
getVisible="GetVisible"
310-
screentip="PL/SQL Insert Values"
310+
getScreentip="GetLabelText"
311311
supertip="This changes the query string to a PL/SQL INSERT VALUES script."
312312
/>
313313
<button
314314
id="btnScriptTypePlSqlMergeValues"
315315
getImage="GetButtonImage"
316-
label="PL/SQL Merge Values"
316+
getLabel="GetLabelText"
317317
onAction="OnAction"
318318
getVisible="GetVisible"
319-
screentip="PL/SQL Merge Values"
319+
getScreentip="GetLabelText"
320320
supertip="This changes the query string to a PL/SQL MERGE VALUES script."
321321
/>
322322
<button
323323
id="btnScriptTypePlSqlSelectValues"
324324
getImage="GetButtonImage"
325-
label="PL/SQL Select Values"
325+
getLabel="GetLabelText"
326326
onAction="OnAction"
327327
getVisible="GetVisible"
328-
screentip="PL/SQL Select Values"
328+
getScreentip="GetLabelText"
329329
supertip="This changes the query string to a PL/SQL SELECT VALUES script."
330330
/>
331331
<button
332332
id="btnScriptTypePlSqlSelectUnion"
333333
getImage="GetButtonImage"
334-
label="PL/SQL Select Union"
334+
getLabel="GetLabelText"
335335
onAction="OnAction"
336336
getVisible="GetVisible"
337-
screentip="PL/SQL Select Union"
337+
getScreentip="GetLabelText"
338338
supertip="This changes the query string to a PL/SQL SELECT UNION script."
339339
/>
340340
<button
341341
id="btnScriptTypePlSqlUpdateValues"
342342
getImage="GetButtonImage"
343-
label="PL/SQL Update Values"
343+
getLabel="GetLabelText"
344344
onAction="OnAction"
345345
getVisible="GetVisible"
346-
screentip="PL/SQL Update Values"
346+
getScreentip="GetLabelText"
347347
supertip="This changes the query string to a PL/SQL UPDATE VALUES script."
348348
/>
349349
<menuSeparator
@@ -352,54 +352,54 @@ Or use the following tag to remove all other ribbons when this loads
352352
<button
353353
id="btnScriptTypeDqlAppend"
354354
getImage="GetButtonImage"
355-
label="DQL Append"
355+
getLabel="GetLabelText"
356356
onAction="OnAction"
357357
getVisible="GetVisible"
358-
screentip="DQL Append"
358+
getScreentip="GetLabelText"
359359
supertip="This changes the query string to a DQL APPEND script (This is used for repeating values)."
360360
/>
361361
<button
362362
id="btnScriptTypeDqlAppendLocked"
363363
getImage="GetButtonImage"
364-
label="DQL Append/Locked"
364+
getLabel="GetLabelText"
365365
onAction="OnAction"
366366
getVisible="GetVisible"
367-
screentip="DQL Append/Locked"
367+
getScreentip="GetLabelText"
368368
supertip="This changes the query string to a DQL APPEND script (This is used for repeating values) and also unlocks and locks the metadata."
369369
/>
370370
<button
371371
id="btnScriptTypeDqlCreate"
372372
getImage="GetButtonImage"
373-
label="DQL Create"
373+
getLabel="GetLabelText"
374374
onAction="OnAction"
375375
getVisible="GetVisible"
376-
screentip="DQL Create"
376+
getScreentip="GetLabelText"
377377
supertip="This changes the query string to a DQL CREATE script."
378378
/>
379379
<button
380380
id="btnScriptTypeDqlTruncateAppend"
381381
getImage="GetButtonImage"
382-
label="DQL Truncate/Append"
382+
getLabel="GetLabelText"
383383
onAction="OnAction"
384384
getVisible="GetVisible"
385-
screentip="DQL Truncate/Append"
385+
getScreentip="GetLabelText"
386386
supertip="This changes the query string to a DQL TRUNCATE/APPEND script (This is used for removing all repeating values and then updating to one value)." />
387387
<button
388388
id="btnScriptTypeDqlUpdate"
389389
getImage="GetButtonImage"
390-
label="DQL Update"
390+
getLabel="GetLabelText"
391391
onAction="OnAction"
392392
getVisible="GetVisible"
393-
screentip="DQL Update"
393+
getScreentip="GetLabelText"
394394
supertip="This changes the query string to a DQL UPDATE script."
395395
/>
396396
<button
397397
id="btnScriptTypeDqlUpdateLocked"
398398
getImage="GetButtonImage"
399-
label="DQL Update/Locked"
399+
getLabel="GetLabelText"
400400
onAction="OnAction"
401401
getVisible="GetVisible"
402-
screentip="DQL Update/Locked"
402+
getScreentip="GetLabelText"
403403
supertip="This changes the query string to a DQL UPDATE script and also unlocks and locks the metadata."
404404
/>
405405
<menuSeparator
@@ -408,10 +408,10 @@ Or use the following tag to remove all other ribbons when this loads
408408
<button
409409
id="btnScriptTypeGithubTable"
410410
getImage="GetButtonImage"
411-
label="Markdown Table"
411+
getLabel="GetLabelText"
412412
onAction="OnAction"
413413
getVisible="GetVisible"
414-
screentip="Markdown Table"
414+
getScreentip="GetLabelText"
415415
supertip="This changes the query string to a Markdown table script (This is used for READ ME files in GitHub)."
416416
/>
417417
<menuSeparator
@@ -420,19 +420,19 @@ Or use the following tag to remove all other ribbons when this loads
420420
<button
421421
id="btnScriptTypeHtmlTable"
422422
getImage="GetButtonImage"
423-
label="HTML Table"
423+
getLabel="GetLabelText"
424424
onAction="OnAction"
425425
getVisible="GetVisible"
426-
screentip="HTML Table"
426+
getScreentip="GetLabelText"
427427
supertip="This changes the query string to a HMTL Table script."
428428
/>
429429
<button
430430
id="btnScriptTypeXmlValues"
431431
getImage="GetButtonImage"
432-
label="XML Values"
432+
getLabel="GetLabelText"
433433
onAction="OnAction"
434434
getVisible="GetVisible"
435-
screentip="XML Values"
435+
getScreentip="GetLabelText"
436436
supertip="This changes the query string to a XML script."
437437
/>
438438
</menu>

CS/Scripts/Ribbon.cs

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,11 @@ public static class AppVariables
4949
/// </summary>
5050
public static string FirstColumnName { get; set; }
5151

52+
/// <summary>
53+
/// The first visible column name in the table
54+
/// </summary>
55+
public static string ControlLabel { get; set; }
56+
5257
}
5358

5459
#region | Task Panes |
@@ -289,6 +294,48 @@ public string GetLabelText(Office.IRibbonControl control)
289294
case "txtReleaseDate":
290295
DateTime dteCreateDate = Properties.Settings.Default.App_ReleaseDate;
291296
return dteCreateDate.ToString("dd-MMM-yyyy hh:mm tt");
297+
case "btnScriptTypeDqlAppend":
298+
return "DQL Append";
299+
case "btnScriptTypeDqlAppendLocked":
300+
return "DQL Append/Locked";
301+
case "btnScriptTypeDqlCreate":
302+
return "DQL Create";
303+
case "btnScriptTypeDqlTruncateAppend":
304+
return "DQL Truncate/Append";
305+
case "btnScriptTypeDqlUpdate":
306+
return "DQL Update";
307+
case "btnScriptTypeDqlUpdateLocked":
308+
return "DQL Update/Locked";
309+
case "btnScriptTypeGithubTable":
310+
return "Markdown Table";
311+
case "btnScriptTypeHtmlTable":
312+
return "HTML Table";
313+
case "btnScriptTypePlSqlCreateTable":
314+
return "PL/SQL Create Table";
315+
case "btnScriptTypePlSqlInsertValues":
316+
return "PL/SQL Insert Values";
317+
case "btnScriptTypePlSqlMergeValues":
318+
return "PL/SQL Merge Values";
319+
case "btnScriptTypePlSqlSelectValues":
320+
return "PL/SQL Select Values";
321+
case "btnScriptTypePlSqlSelectUnion":
322+
return "PL/SQL Select Union";
323+
case "btnScriptTypePlSqlUpdateValues":
324+
return "PL/SQL Update Values";
325+
case "btnScriptTypeTSqlCreateTable":
326+
return "T-SQL Create Table";
327+
case "btnScriptTypeTSqlInsertValues":
328+
return "T-SQL Insert Values";
329+
case "btnScriptTypeTSqlMergeValues":
330+
return "T-SQL Merge Values";
331+
case "btnScriptTypeTSqlSelectValues":
332+
return "T-SQL Select Values";
333+
case "btnScriptTypeTSqlSelectUnion":
334+
return "T-SQL Select Union";
335+
case "btnScriptTypeTSqlUpdateValues":
336+
return "T-SQL Update Values";
337+
case "btnScriptTypeXmlValues":
338+
return "XML Values";
292339
default:
293340
return string.Empty;
294341
}
@@ -444,6 +491,7 @@ public void OnAction(Office.IRibbonControl control)
444491
{
445492
try
446493
{
494+
Ribbon.AppVariables.ControlLabel = GetLabelText(control);
447495
switch (control.Id)
448496
{
449497
case "btnStart":
@@ -1461,7 +1509,7 @@ public static void OpenScriptPane()
14611509
myScript.Dispose();
14621510
}
14631511
myScript = new TaskPane.Script();
1464-
myTaskPaneScript = Globals.ThisAddIn.CustomTaskPanes.Add(myScript, "Script for " + Scripts.AssemblyInfo.Title);
1512+
myTaskPaneScript = Globals.ThisAddIn.CustomTaskPanes.Add(myScript, Ribbon.AppVariables.ControlLabel);
14651513
myTaskPaneScript.DockPosition = Office.MsoCTPDockPosition.msoCTPDockPositionRight;
14661514
myTaskPaneScript.DockPositionRestrict = Office.MsoCTPDockPositionRestrict.msoCTPDockPositionRestrictNoChange;
14671515
myTaskPaneScript.Width = 675;

CS/TaskPane/Script.Designer.cs

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)