MonoDevelop Addins: hello world, tyring to find all references and files in project
[CSharpForFun/.git] / MonoDevelop / addins / MonoDevelop.HelloWorld / MonoDevelop.HelloWorld / ShowFilesDialog.cs
1 /**
2 * Copyright 2015 Gustavo Martin Morcuende
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 using System;
17 using System.Linq;
18 using MonoDevelop.Projects;
19 using System.Text;
20
21 namespace MonoDevelop.HelloWorld
22 {
23         public partial class ShowFilesDialog : Gtk.Dialog
24         {
25                 readonly Project project;
26
27                 public ShowFilesDialog (Project project)
28                 {
29                         this.project = project;
30                         this.Build ();
31                 }
32
33                 protected void OnButtonShowFilesClickEvent (object sender, EventArgs e)
34                 {
35                         var fileNames = new StringBuilder ();
36                         fileNames.Append ("Project name: " + project.Name);
37                         fileNames.Append (Environment.NewLine);
38                         // IT DOESN'T FIND ALL REFERENCES IN PROJECT!!! WHAT CAN I DO??? :(
39                         project.GetItemFiles (true).ForEach (file =>
40                         {
41                                 fileNames.Append (file.FullPath);
42                                 fileNames.Append (Environment.NewLine);
43                         });
44
45                         this.ShowFilesTextView.Buffer.Text = fileNames.ToString ();
46                 }
47         }
48 }
49