Changeset 9576


Ignore:
Timestamp:
12/09/09 15:59:58 (2 years ago)
Author:
garu
Message:

Fixing template functions for Catalyst Plugin (SeWi?++)

Location:
trunk/Padre-Plugin-Catalyst/lib/Padre
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Padre-Plugin-Catalyst/lib/Padre/Plugin/Catalyst.pm

    r9574 r9576  
    583583sub editor_changed { 
    584584    my $self = shift; 
    585  
    586     return; # TODO: remove this line as soon as the following are working. 
    587  
    588     my $document = undef; # TODO: Fill with the current document 
    589      
     585    my $document = $self->main->current->document || return; 
     586 
    590587    $document->{menu} = [] if (!defined($document->{menu})) or (ref($document->{menu}) ne 'ARRAY'); 
    591     $document ->{menu} = [grep (!/^menu\.catalyst$/,@{$document->{menu}}) ]; 
    592     if (my $document_is_from_catalyst_project) { 
    593         push @{$document->{menu}},'menu.catalyst'; 
     588    $document->{menu} = [grep (!/^menu\.Catalyst$/,@{$document->{menu}}) ]; 
     589 
     590    require Padre::Plugin::Catalyst::Util; 
     591    if (Padre::Plugin::Catalyst::Util::in_catalyst_project($document->filename)) { 
     592        push @{$document->{menu}}, 'menu.Catalyst'; 
    594593    } 
    595594} 
  • trunk/Padre-Plugin-Catalyst/lib/Padre/Wx/Menu/Catalyst.pm

    r9574 r9576  
    88use Padre::Wx       (); 
    99use Padre::Wx::Menu (); 
     10use Params::Util '_INSTANCE'; 
     11use Padre::Current '_CURRENT'; 
    1012 
    1113our $VERSION = '0.51'; 
     
    5759    # Disable document-specific entries if we are in a Perl project 
    5860    # but not in a Perl document. 
    59     $self->{beginner_check}->Enable($perl); 
     61# FIXME: the two commands below crash unless they are defined. Should they 
     62# ALWAYS be defined or should we leave them like so? (garu) 
     63    $self->{beginner_check}->Enable($perl) if defined $self->{beginner_check}; 
    6064 
    6165    # Apply config-driven state 
    62     $self->{autocomplete_brackets}->Check( $config->autocomplete_brackets ); 
     66    $self->{autocomplete_brackets}->Check( $config->autocomplete_brackets ) 
     67        if defined $self->{autocomplete_brackets}; 
    6368 
    6469    return; 
Note: See TracChangeset for help on using the changeset viewer.