void BuildComponents(string defaultServer) { mSearchField = new SearchField(); mSearchField.downOrUpArrowKeyPressed += SearchField_OnDownOrUpArrowKeyPressed; RepositoriesListHeaderState headerState = RepositoriesListHeaderState.Default; TreeHeaderSettings.Load(headerState, UnityConstants.REPOSITORIES_TABLE_SETTINGS_NAME, (int)RepositoriesListColumn.Name); mRepositoriesListView = new RepositoriesListView( headerState, RepositoriesListHeaderState.GetColumnNames(), OkButtonAction); mRepositoriesListView.Reload(); mFillRepositoriesTable = new FillRepositoriesTable( new LocalRepositoriesProvider()); mState = new State() { Server = defaultServer, ProgressData = new ProgressControlsForDialogs.Data() }; KnownServersListOperations.GetCombinedServers( true, new List <string>(), mProgressControls, this, CmConnection.Get().GetProfileManager()); }
static void DoToolbarArea( SearchField searchField, RepositoriesListView listView, bool isEnabled, Action refreshAction, GenericMenu.MenuFunction2 selectServerAction, ref State state) { GUILayout.BeginHorizontal(); GUILayout.Label("Server:"); GUI.enabled = isEnabled; state.Server = DoDropDownTextField( state.Server, state.AvailableServers, selectServerAction, refreshAction); if (GUILayout.Button("Refresh", EditorStyles.miniButton)) { refreshAction(); } GUILayout.FlexibleSpace(); DrawSearchField.For( searchField, listView, SEARCH_FIELD_WIDTH); GUI.enabled = true; GUILayout.EndHorizontal(); }
static void RegenerateRows( RepositoriesListView listView, IList repositories, TreeViewItem rootItem, List <TreeViewItem> rows) { ClearRows(rootItem, rows); if (repositories.Count == 0) { return; } for (int i = 0; i < repositories.Count; i++) { RepositoryListViewItem repositoryListViewItem = new RepositoryListViewItem(i + 1, (RepositoryInfo)repositories[i]); rootItem.AddChild(repositoryListViewItem); rows.Add(repositoryListViewItem); } listView.SetSelection(new List <int> { 1 }); }
static void DoListArea( RepositoriesListView listView, bool isEnabled) { GUI.enabled = isEnabled; Rect treeRect = GUILayoutUtility.GetRect(0, 100000, 0, 100000); listView.OnGUI(treeRect); GUI.enabled = true; }