1
package Padre::Action::Plugins;
3
# Fully encapsulated Run menu
9
use Padre::Constant ();
13
use Padre::Current qw{_CURRENT};
15
our $VERSION = '0.50';
21
#####################################################################
22
# Padre::Action::Plugins Methods
28
# Create the empty object as normal, it won't be used usually
29
my $self = bless {}, $class;
31
# Add additional properties
32
$self->{main} = $main;
34
# Link to the Plugin Manager
36
name => 'plugins.plugin_manager',
37
label => Wx::gettext('Plugin Manager'),
38
comment => Wx::gettext('Show the Padre plugin manager to enable or disable plugins'),
40
require Padre::Wx::Dialog::PluginManager;
41
Padre::Wx::Dialog::PluginManager->new(
43
Padre->ide->plugin_manager,
48
# TODO: should be replaced by a link to http://cpan.uwinnipeg.ca/chapter/World_Wide_Web_HTML_HTTP_CGI/Padre
49
# better yet, by a window that also allows the installation of all the plugins that can take into account
50
# the type of installation we have (ppm, stand alone, rpm, deb, CPAN, etc.)
52
name => 'plugins.plugin_list',
53
label => Wx::gettext('Plugin List (CPAN)'),
55
Padre::Wx::launch_browser('http://cpan.uwinnipeg.ca/search?query=Padre%3A%3APlugin%3A%3A&mode=dist');
60
name => 'plugins.edit_my_plugin',
61
label => Wx::gettext('Edit My Plugin'),
62
comment => Wx::gettext('My-Plugin is a plugin where developers could extend their Padre installation'),
64
my $file = File::Spec->catfile(
65
Padre::Constant::CONFIG_DIR,
66
qw{ plugins Padre Plugin My.pm }
68
return $self->error( Wx::gettext("Could not find the Padre::Plugin::My plugin") ) unless -e $file;
70
# Use the plural so we get the "close single unused document"
71
# behaviour, and so we get a free freezing and refresh calls.
72
$_[0]->setup_editors($file);
77
name => 'plugins.reload_my_plugin',
78
label => Wx::gettext('Reload My Plugin'),
79
comment => Wx::gettext('This function reloads the My-Plugin without restarting Padre'),
81
Padre->ide->plugin_manager->reload_plugin('Padre::Plugin::My');
86
name => 'plugins.reset_my_plugin',
87
label => Wx::gettext('Reset My Plugin'),
88
comment => Wx::gettext('Reset the My-Plugin to the default'),
90
my $ret = Wx::MessageBox(
91
Wx::gettext("Reset My Plugin"),
92
Wx::gettext("Reset My Plugin"),
93
Wx::wxOK | Wx::wxCANCEL | Wx::wxCENTRE,
96
if ( $ret == Wx::wxOK ) {
97
my $manager = Padre->ide->plugin_manager;
98
$manager->unload_plugin('Padre::Plugin::My');
99
$manager->reset_my_plugin(1);
100
$manager->load_plugin('Padre::Plugin::My');
106
name => 'plugins.reload_all_plugins',
107
label => Wx::gettext('Reload All Plugins'),
108
comment => Wx::gettext('Reload all plugins from disk'),
110
Padre->ide->plugin_manager->reload_plugins;
115
name => 'plugins.reload_current_plugin',
116
label => Wx::gettext('(Re)load Current Plugin'),
117
comment => Wx::gettext('Reloads (or initially loads) the current plugin'),
119
Padre->ide->plugin_manager->reload_current_plugin;
123
# Padre::Action->new(
125
# name => 'plugins.test_a_plugin',
126
# label => Wx::gettext('Test A Plugin From Local Dir'),
127
# menu_event => sub {
128
# Padre->ide->plugin_manager->test_a_plugin;
134
name => 'plugins.install_cpan',
135
label => Wx::gettext("Install CPAN Module"),
136
comment => Wx::gettext('Install a Perl module from CPAN'),
139
require Padre::Wx::CPAN;
140
my $cpan = Padre::CPAN->new;
141
my $gui = Padre::Wx::CPAN->new( $cpan, $_[0] );
147
name => 'plugins.install_local',
148
label => Wx::gettext("Install Local Distribution"),
150
$self->install_file( $_[0] );
155
name => 'plugins.install_remote',
156
label => Wx::gettext("Install Remote Distribution"),
158
$self->install_url( $_[0] );
163
name => 'plugins.cpan_config',
164
label => Wx::gettext("Open CPAN Config File"),
166
$self->cpan_config( $_[0] );
175
# Copyright 2008-2009 The Padre development team as listed in Padre.pm.
177
# This program is free software; you can redistribute it and/or
178
# modify it under the same terms as Perl 5 itself.