~ubuntu-branches/ubuntu/oneiric/monodevelop/oneiric-updates

« back to all changes in this revision

Viewing changes to src/addins/VersionControl/MonoDevelop.VersionControl/MonoDevelop.VersionControl/Checkout.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2009-02-18 08:40:51 UTC
  • mfrom: (1.2.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090218084051-gh8m6ukvokbwj7cf
Tags: 1.9.2+dfsg-1ubuntu1
* Merge from Debian Experimental (LP: #330519), remaining Ubuntu changes:
  + debian/control:
    - Update for Gnome# 2.24
    - Add libmono-cairo1.0-cil to build-deps to fool pkg-config check

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
using System;
2
 
using System.IO;
3
 
using System.Collections;
4
 
using MonoDevelop.Components.Commands;
5
 
using MonoDevelop.Ide.Gui;
6
 
 
7
 
using MonoDevelop.VersionControl.Dialogs;
8
 
 
9
 
namespace MonoDevelop.VersionControl
10
 
{
11
 
        internal class CheckoutCommand : CommandHandler
12
 
        {
13
 
                protected override void Run()
14
 
                {
15
 
                        if (!VersionControlService.CheckVersionControlInstalled ())
16
 
                                return;
17
 
                        
18
 
                        SelectRepositoryDialog del = new SelectRepositoryDialog (SelectRepositoryMode.Checkout);
19
 
                        try {
20
 
                                if (del.Run () == (int) Gtk.ResponseType.Ok && del.Repository != null) {
21
 
                                        CheckoutWorker w = new CheckoutWorker (del.Repository, del.TargetPath);
22
 
                                        w.Start ();
23
 
                                }
24
 
                        } finally {
25
 
                                del.Destroy ();
26
 
                        }
27
 
                }
28
 
        }
29
 
        
30
 
        class CheckoutWorker : Task
31
 
        {
32
 
                Repository vc;
33
 
                string path;
34
 
                                        
35
 
                public CheckoutWorker (Repository vc, string path)
36
 
                {
37
 
                        this.vc = vc;
38
 
                        this.path = path;
39
 
                }
40
 
                
41
 
                protected override string GetDescription ()
42
 
                {
43
 
                        return "Checkout " + path + "...";
44
 
                }
45
 
                
46
 
                protected override void Run () 
47
 
                {
48
 
                        vc.Checkout (path, null, true, GetProgressMonitor ());
49
 
                        string projectFn = null;
50
 
                        
51
 
                        string[] list = System.IO.Directory.GetFiles(path);
52
 
                        foreach (string str in list ) {
53
 
                                if (str.EndsWith(".mds")) {
54
 
                                        projectFn = str;
55
 
                                        break;
56
 
                                }
57
 
                        }
58
 
                        if ( projectFn == null ) {
59
 
                                foreach ( string str in list ) {
60
 
                                        if (str.EndsWith(".mdp")) {
61
 
                                                projectFn = str;
62
 
                                                break;
63
 
                                        }
64
 
                                }       
65
 
                        }
66
 
                        if ( projectFn == null ) {
67
 
                                foreach (string str in list ) {
68
 
                                        if (MonoDevelop.Projects.Services.ProjectService.IsCombineEntryFile (str)) {
69
 
                                                projectFn = str;
70
 
                                                break;
71
 
                                        }
72
 
                                }       
73
 
                        }
74
 
                        
75
 
                        if (projectFn != null)
76
 
                                IdeApp.ProjectOperations.OpenCombine (projectFn);
77
 
                }
78
 
        }
79
 
}