| 1 | package Padre::Plugin::HG::ProjectClone; | ||
| 2 | |||
| 3 | |||
| 4 | |||
| 5 | |||
| 6 | |||
| 7 | |||
| 8 | =pod | ||
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | package Padre::Plugin::HG::ProjectClone | ||
| 13 | Displays the prompts for making a project clone. | ||
| 14 | |||
| 15 | =head1 SYNOPSIS | ||
| 16 | |||
| 17 | my $object = Padre::Plugin::HG::ProjectClone->new(); | ||
| 18 | |||
| 19 | thats it will display the prompts and call the clone method. | ||
| 20 | |||
| 21 | =head1 DESCRIPTION | ||
| 22 | |||
| 23 | |||
| 24 | |||
| 25 | =head1 METHODS | ||
| 26 | |||
| 27 | =cut | ||
| 28 | |||
| 29 | use 5.006; | ||
| 30 | use strict; | ||
| 31 | use warnings; | ||
| 32 | |||
| 33 | our $VERSION = '0.01'; | ||
| 34 | |||
| 35 | use Wx qw[:everything]; | ||
| 36 | use base 'Wx::Panel'; | ||
| 37 | |||
| 38 | =pod | ||
| 39 | |||
| 40 | =head2 new | ||
| 41 | |||
| 42 | create a new ProjectClone object. | ||
| 43 | |||
| 44 | |||
| 45 | =cut | ||
| 46 | |||
| 47 | sub new | ||
| 48 | { | ||
| 49 | my ($class, $hg) = @_; | ||
| 50 | my $self = $class->SUPER::new( Padre::Current->main); | ||
| 51 | $self->{hg} = $hg; | ||
| 52 | return $self; | ||
| 53 | } | ||
| 54 | |||
| 55 | |||
| 56 | |||
| 57 | sub enter_repository | ||
| 58 | { | ||
| 59 | my ($self) = @_; | ||
| 60 | my $main = Padre->ide->wx->main; | ||
| 61 | my $message = $main->prompt("Clone Project", "Enter the Project URL to clone", 'http://'); | ||
| 62 | $self->{project_url} = $message ; | ||
| 63 | return $message; | ||
| 64 | } | ||
| 65 | |||
| 66 | sub choose_destination | ||
| 67 | { | ||
| 68 | my ($self) = @_; | ||
| 69 | my $dialog = Wx::DirDialog->new($self, 'Choose a Destination Directory'); | ||
| 70 | my $choice = $dialog->ShowModal(); | ||
| 71 | if ($choice == Wx::wxID_CANCEL) | ||
| 72 | { | ||
| 73 | $self->{destination_dir} = undef(); | ||
| 74 | return; | ||
| 75 | } | ||
| 76 | else | ||
| 77 | { | ||
| 78 | $self->{destination_dir} = $dialog->GetPath(); | ||
| 79 | return $self->{destination_dir}; | ||
| 80 | } | ||
| 81 | } | ||
| 82 | |||
| 83 | sub project_url | ||
| 84 | { | ||
| 85 | my($self) =@_; | ||
| 86 | return $self->{project_url}; | ||
| 87 | } | ||
| 88 | |||
| 89 | sub destination_dir | ||
| 90 | { | ||
| 91 | my($self) =@_; | ||
| 92 | return $self->{destination_dir}; | ||
| 93 | } | ||
| 94 | |||
| 95 | |||
| 96 | 1; | ||
| 97 | |||
| 98 | =pod | ||
| 99 | |||
| 100 | =head1 SUPPORT | ||
| 101 | |||
| 102 | No support is available | ||
| 103 | |||
| 104 | =head1 AUTHOR | ||
| 105 | |||
| 106 | Copyright 2009 Michael Mueller | ||
| 107 | |||
| 108 | =cut |