Skip to content

Commit 9fadd8a

Browse files
committed
copy method and propertie names to clipboard with right-click.
1 parent d084623 commit 9fadd8a

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

Source/+classInheritance/browse.m

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
% ugly "License checkout failed." error message.
3434
%
3535
try % matlab >= 2011a: `[TF, errmsg] = license('checkout',feature)`
36-
[b, errormessage] = license('checkout', 'bioinformatics_toolbox'); %#ok<NASGU>
36+
[b, errormessage] = license('checkout', 'bioinformatics_toolbox'); %#ok<ASGLU>
3737
catch me %#ok<NASGU> % matlab <= 2010b: `result = license('checkout',feature)`
3838
b = license('checkout', 'bioinformatics_toolbox');
3939
end
@@ -74,7 +74,7 @@
7474
displayinfo(obj, 1, obj.liststr{1});
7575
end
7676

77-
function display(obj) %#ok<MANU>
77+
function display(obj) %#ok<DISPLAY,MANU>
7878
display('Class Inheritance Analyzer/Browser')
7979
end
8080

@@ -90,7 +90,7 @@ function KeyPressFcn_browse(obj, src, evnt) %#ok<INUSL>
9090
switch evnt.Key
9191

9292
case 'm'
93-
[name, value] = get_selected_class_name(obj);
93+
[name, value] = get_selected_class_name(obj); %#ok<ASGLU>
9494
ak.create_metauml(obj.metadata{value});
9595
otherwise
9696

@@ -288,7 +288,7 @@ function LOCALmethCb(obj, src, evt) %#ok<INUSD>
288288

289289
end
290290

291-
function LOOCALpropLb(obj, src, evt)
291+
function LOOCALpropLb(obj, src, evt) %#ok<INUSD>
292292

293293
% find out what item user clicked on
294294
selected_entry = get(src, 'Value');
@@ -433,7 +433,7 @@ function LOCALsearchCb(obj, src, evt)
433433

434434
%% PRIVATE methods
435435
methods (Access = private)
436-
function displayinfo(obj,value,name)
436+
function displayinfo(obj,value,name) %#ok<DISPLAY>
437437
% takes a class name, and puts the methods and properties in respective
438438
% lists in the info figure.
439439

@@ -653,10 +653,12 @@ function setup_gui(obj)
653653
% context menus for listboxes
654654
cmenu = uicontextmenu;
655655
uimenu(cmenu, 'Label', 'Print property description to console', 'Callback', {@obj.LOCALpropCb});
656-
set(obj.guiHan.propH, 'UIContextMenu', cmenu);
656+
uimenu(cmenu, 'Label', 'Copy property name to clipboard', 'Callback', {@obj.copy_selection_to_clipboard});
657+
set(obj.guiHan.propH, 'UIContextMenu', cmenu);
657658

658659
cmenu = uicontextmenu;
659660
uimenu(cmenu, 'Label', 'Open method in editor', 'Callback', {@obj.LOCALmethCb});
661+
uimenu(cmenu, 'Label', 'Copy method name to clipboard', 'Callback', {@obj.copy_selection_to_clipboard});
660662
set(obj.guiHan.methH, 'UIContextMenu', cmenu);
661663

662664
% assign Callbacks and other functions
@@ -673,6 +675,19 @@ function setup_gui(obj)
673675
setup_gui_biograph_viewer(obj);
674676
end
675677

678+
679+
function copy_selection_to_clipboard(obj, src, evt) %#ok<INUSD>
680+
switch get(src, 'Label')
681+
case 'Copy property name to clipboard'
682+
selection = get_selected_property_name(obj);
683+
case 'Copy method name to clipboard'
684+
selection = get_selected_method_name(obj);
685+
otherwise
686+
error('undefined');
687+
end
688+
clipboard('copy', selection);
689+
end
690+
676691
end
677692

678693
%% STATIC methods, for this class only

0 commit comments

Comments
 (0)