private void UpdateTreeModel() { var firstInit = MaintainerPersonalSettings.References.referencesTreeHeaderState == null || MaintainerPersonalSettings.References.referencesTreeHeaderState.columns == null || MaintainerPersonalSettings.References.referencesTreeHeaderState.columns.Length == 0; var headerState = ReferencesTreeView <ReferencesTreeElement> .CreateDefaultMultiColumnHeaderState(); if (MultiColumnHeaderState.CanOverwriteSerializedFields(MaintainerPersonalSettings.References.referencesTreeHeaderState, headerState)) { MultiColumnHeaderState.OverwriteSerializedFields(MaintainerPersonalSettings.References.referencesTreeHeaderState, headerState); } MaintainerPersonalSettings.References.referencesTreeHeaderState = headerState; var multiColumnHeader = new MaintainerMultiColumnHeader(headerState); if (firstInit) { MaintainerPersonalSettings.References.referencesTreeViewState = new TreeViewState(); } treeElements = LoadLastTreeElements(); treeModel = new TreeModel <ReferencesTreeElement>(treeElements); treeView = new ReferencesTreeView <ReferencesTreeElement>(MaintainerPersonalSettings.References.referencesTreeViewState, multiColumnHeader, treeModel); treeView.SetSearchString(MaintainerPersonalSettings.References.searchString); treeView.Reload(); searchField = new SearchField(); searchField.downOrUpArrowKeyPressed += treeView.SetFocusAndEnsureSelectedItem; if (firstInit) { multiColumnHeader.ResizeToFit(); } }
public void Draw() { using (new GUILayout.HorizontalScope()) { GUILayout.Space(5); using (new GUILayout.VerticalScope()) { EditorGUI.BeginChangeCheck(); var searchString = searchField.OnGUI(GUILayoutUtility.GetRect(0, 0, 20, 20, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false)), MaintainerPersonalSettings.References.searchString); if (EditorGUI.EndChangeCheck()) { MaintainerPersonalSettings.References.searchString = searchString; treeView.SetSearchString(searchString); treeView.Reload(); } treeView.OnGUI(GUILayoutUtility.GetRect(0, 0, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))); } GUILayout.Space(5); } }
public void Draw() { using (new GUILayout.HorizontalScope()) { GUILayout.Space(5); using (new GUILayout.VerticalScope()) { EditorGUI.BeginChangeCheck(); var searchString = searchField.OnGUI( GUILayoutUtility.GetRect(0, 0, 20, 20, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(false)), MaintainerPersonalSettings.References.searchString); if (EditorGUI.EndChangeCheck()) { MaintainerPersonalSettings.References.searchString = searchString; treeView.SetSearchString(searchString); treeView.Reload(); } GetSplitterState(); CSReflectionTools.BeginVerticalSplit(splitterState, new GUILayoutOption[0]); using (new GUILayout.VerticalScope()) { treeView.OnGUI(GUILayoutUtility.GetRect(0, 0, GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true))); GUILayout.Space(2f); } using (new GUILayout.VerticalScope()) { GUILayout.Space(2f); using (new GUILayout.VerticalScope(UIHelpers.panelWithoutBackground)) { GUILayout.Label("Exact references", UIHelpers.centeredLabel); GUILayout.Space(1f); } GUILayout.Space(-1f); var selected = treeView.GetSelection(); if (selected != null && selected.Count > 0) { var selectedRow = treeView.GetRow(selected[0]); exactReferencesPanel.Draw(selectedRow); } else { exactReferencesPanel.Draw(null); } } CSReflectionTools.EndVerticalSplit(); SaveSplitterState(); } GUILayout.Space(5); } }