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

« back to all changes in this revision

Viewing changes to src/core/MonoDevelop.Ide/MonoDevelop.Ide.NavigateToDialog/NavigateToCommand.cs

  • Committer: Bazaar Package Importer
  • Author(s): Jo Shields
  • Date: 2011-06-27 17:03:13 UTC
  • mto: (1.8.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 54.
  • Revision ID: james.westby@ubuntu.com-20110627170313-6cvz3s19x6e9hqe9
ImportĀ upstreamĀ versionĀ 2.5.92+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
25
// THE SOFTWARE.
26
26
using System;
 
27
using System.Collections.Generic;
27
28
using Gtk;
28
29
using MonoDevelop.Components.Commands;
29
30
using MonoDevelop.Core;
41
42
                        var dialog = new NavigateToDialog (NavigateToType.Types, false) {
42
43
                                Title = GettextCatalog.GetString ("Go to Type"),
43
44
                        };
 
45
                        IEnumerable<NavigateToDialog.OpenLocation> locations = null;
44
46
                        try {
45
47
                                if (MessageService.RunCustomDialog (dialog, MessageService.RootWindow) == (int)ResponseType.Ok) {
46
48
                                        dialog.Sensitive = false;
47
 
                                        foreach (var loc in dialog.Locations)
48
 
                                                IdeApp.Workbench.OpenDocument (loc.Filename, loc.Line, loc.Column, true);
 
49
                                        locations = dialog.Locations;
49
50
                                }
50
51
                        } finally {
51
52
                                dialog.Destroy ();
52
53
                        }
 
54
                        if (locations != null) {
 
55
                                foreach (var loc in locations)
 
56
                                        IdeApp.Workbench.OpenDocument (loc.Filename, loc.Line, loc.Column);
 
57
                        }
53
58
                }
54
59
                
55
60
                protected override void Update (CommandInfo info)
65
70
                        var dialog = new NavigateToDialog (NavigateToType.Files, false) {
66
71
                                Title = GettextCatalog.GetString ("Go to File"),
67
72
                        };
 
73
                        IEnumerable<NavigateToDialog.OpenLocation> locations = null;
68
74
                        try {
69
75
                                if (MessageService.RunCustomDialog (dialog, MessageService.RootWindow) == (int)ResponseType.Ok) {
70
76
                                        dialog.Sensitive = false;
71
 
                                        foreach (var loc in dialog.Locations)
72
 
                                                IdeApp.Workbench.OpenDocument (loc.Filename, loc.Line, loc.Column, true);
 
77
                                        locations = dialog.Locations;
73
78
                                }
74
79
                        } finally {
75
80
                                dialog.Destroy ();
76
81
                        }
 
82
                        if (locations != null) {
 
83
                                foreach (var loc in locations)
 
84
                                        IdeApp.Workbench.OpenDocument (loc.Filename, loc.Line, loc.Column);
 
85
                        }
77
86
                }
78
87
                
79
88
                protected override void Update (CommandInfo info)
87
96
                protected override void Run ()
88
97
                {
89
98
                        var dialog = new NavigateToDialog (NavigateToType.All, true);
 
99
                        IEnumerable<NavigateToDialog.OpenLocation> locations = null;
90
100
                        try {
91
101
                                if (MessageService.RunCustomDialog (dialog, MessageService.RootWindow) == (int)ResponseType.Ok) {
92
102
                                        dialog.Sensitive = false;
93
 
                                        foreach (var loc in dialog.Locations)
94
 
                                                IdeApp.Workbench.OpenDocument (loc.Filename, loc.Line, loc.Column, true);
 
103
                                        locations = dialog.Locations;
95
104
                                }
96
105
                        } finally {
97
106
                                dialog.Destroy ();
98
107
                        }
 
108
                        if (locations != null) {
 
109
                                foreach (var loc in locations)
 
110
                                        IdeApp.Workbench.OpenDocument (loc.Filename, loc.Line, loc.Column);
 
111
                        }
99
112
                }
100
113
                
101
114
                protected override void Update (CommandInfo info)