~halega/+junk/sharpdevelop

« back to all changes in this revision

Viewing changes to src/AddIns/VersionControl/SubversionAddIn/Src/Gui/HistoryViewDisplayBinding/HistoryViewDisplayBinding.cs

  • Committer: sk
  • Date: 2011-09-10 05:17:57 UTC
  • Revision ID: halega@halega.com-20110910051757-qfouz1llya9m6boy
4.1.0.7915 Release Candidate 1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
 
2
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
 
3
 
 
4
using System;
 
5
using System.IO;
 
6
using ICSharpCode.Core;
 
7
using ICSharpCode.SharpDevelop;
 
8
 
 
9
namespace ICSharpCode.Svn
 
10
{
 
11
        public class HistoryViewDisplayBinding : ISecondaryDisplayBinding
 
12
        {
 
13
                /// <summary>
 
14
                /// When you return true for this property, the CreateSecondaryViewContent method
 
15
                /// is called again after the LoadSolutionProjects thread has finished.
 
16
                /// </summary>
 
17
                public bool ReattachWhenParserServiceIsReady {
 
18
                        get {
 
19
                                return false;
 
20
                        }
 
21
                }
 
22
                
 
23
                public ICSharpCode.SharpDevelop.Gui.IViewContent[] CreateSecondaryViewContent(ICSharpCode.SharpDevelop.Gui.IViewContent viewContent)
 
24
                {
 
25
                        return new ICSharpCode.SharpDevelop.Gui.IViewContent[] { new HistoryView(viewContent) };
 
26
                }
 
27
                
 
28
                public bool CanAttachTo(ICSharpCode.SharpDevelop.Gui.IViewContent content)
 
29
                {
 
30
                        if (!AddInOptions.UseHistoryDisplayBinding) {
 
31
                                return false;
 
32
                        }
 
33
                        OpenedFile file = content.PrimaryFile;
 
34
                        if (file == null || file.IsUntitled || !File.Exists(file.FileName)) {
 
35
                                return false;
 
36
                        }
 
37
                        
 
38
                        return SvnClientWrapper.IsInSourceControl(file.FileName);
 
39
                }
 
40
        }
 
41
}