Changeset 11995


Ignore:
Timestamp:
07/24/10 22:34:54 (19 months ago)
Author:
adamk
Message:

Adding an initial simple method to trigger an action by name.
Demonstrated by the following:
Padre::Current->main->action('help.about');

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Padre/lib/Padre/Wx/Main.pm

    r11978 r11995  
    57915791Various methods that did not fit exactly in above categories... 
    57925792 
     5793=head2 C<action> 
     5794 
     5795  Padre::Current->main->action('help.about'); 
     5796 
     5797Single execution of a named action. 
     5798 
     5799=cut 
     5800 
     5801sub action { 
     5802    my $self = shift; 
     5803    my $name = shift; 
     5804 
     5805    # Does the action exist 
     5806    my $action = $self->ide->{actions}->{$name}; 
     5807    unless ( $action ) { 
     5808        die "No such action '$name'"; 
     5809    } 
     5810 
     5811    # Execute the action 
     5812    $action->menu_event->( $self ); 
     5813    return 1; 
     5814} 
     5815 
    57935816=head3 C<install_cpan> 
    57945817 
Note: See TracChangeset for help on using the changeset viewer.