6 using Microsoft
.TeamFoundation
.Client
;
7 using Microsoft
.TeamFoundation
.VersionControl
.Common
;
8 using Microsoft
.TeamFoundation
.VersionControl
.Client
;
10 namespace Gtk
.TeamFoundation
12 public class RepositoryView
: Gtk
.TreeView
14 TreeStore store
= new TreeStore(typeof(string), typeof(string));
15 ScrolledWindow scroller
= new ScrolledWindow();
16 CredentialCache credentialCache
= new CredentialCache();
17 IVersionControlServerFactory vcsFactory
;
19 public RepositoryView(IVersionControlServerFactory vcsFactory
)
21 this.vcsFactory
= vcsFactory
;
23 AppendColumn("name", new CellRendererText (), "text", 0);
25 WorkspaceInfo
[] infos
= Workstation
.Current
.GetAllLocalWorkspaceInfo();
26 foreach (WorkspaceInfo info
in infos
)
28 Gtk
.TreeIter serverIter
= store
.AppendValues(info
.ServerUri
.ToString(), VersionControlPath
.RootFolder
);
29 store
.AppendValues(serverIter
, "");
33 HeadersVisible
= false;
36 RowExpanded
+= MyRowExpandedHandler
;
39 private void MyRowExpandedHandler (object o
, RowExpandedArgs args
)
41 string path
= store
.GetValue(args
.Iter
, 1).ToString();
43 string url
= String
.Empty
;
45 if (store
.IterParent(out iterParent
, args
.Iter
))
46 url
= (string) store
.GetValue (iterParent
, 0);
48 url
= store
.GetValue(args
.Iter
, 0).ToString();
50 VersionControlServer versionControlServer
= vcsFactory
.GetVersionControlServer(url
);
53 ItemSpec itemSpec
= new ItemSpec (path
, RecursionType
.OneLevel
);
54 ItemSet itemSet
= versionControlServer
.GetItems (itemSpec
, VersionSpec
.Latest
,
55 DeletedState
.NonDeleted
, ItemType
.Any
, false);
56 if (itemSet
.Items
.Length
== 0)
57 SetRowValue(args
.Iter
, indx
, " - item list not available - ", "");
59 foreach (Microsoft
.TeamFoundation
.VersionControl
.Client
.Item item
in itemSet
.Items
)
61 if (item
.ServerItem
== VersionControlPath
.RootFolder
) continue;
63 string shortPath
= item
.ServerItem
.Substring(item
.ServerItem
.LastIndexOf('/') + 1);
64 if (item
.ItemType
== ItemType
.Folder
)
67 Gtk
.TreeIter child
= SetRowValue(args
.Iter
, indx
, shortPath
, item
.ServerItem
);
69 if (item
.ItemType
== ItemType
.Folder
)
70 store
.AppendValues(child
, "", "");
76 private Gtk
.TreeIter
SetRowValue(Gtk
.TreeIter parent
, int childIndx
,
77 string cell1
, string cell2
)
80 if (store
.IterNthChild(out child
, parent
, childIndx
))
82 store
.SetValue(child
, 0, cell1
);
83 store
.SetValue(child
, 1, cell2
);
86 child
= store
.AppendValues (parent
, cell1
, cell2
);