void UpdateMembers()
        {
            _listStore = new Gtk.ListStore(typeof(string), typeof(string), typeof(string));
            var entities   = MemberExtensionsHelper.Instance.GetEntities();            //TODO filter
            var filterText = _searchView.Text;

            if (string.IsNullOrEmpty(filterText))
            {
                _filteredEntities = entities;
            }
            else
            {
                var filteredEntities = entities.Where(e => MemberMatchingHelper.GetMatchWithSearchText(filterText, e.Name)).ToList();
                _filteredEntities = new Collection <IUnresolvedEntity> (filteredEntities);
            }

            foreach (var entity in _filteredEntities)
            {
                string parameters = GetParameters(entity);

                var name = entity.Name;
                if (name == ".ctor")
                {
                    name = "* " + entity.DeclaringTypeDefinition.Name;
                }

                string returnType = GetFormattedReturnType(entity);

                var iconName = entity.GetStockIcon();

                _listStore.AppendValues(iconName, name + parameters + returnType);
            }
            _treeView.Model = _listStore;

            if (SelectedEntity != null)
            {
                var newIndex = _filteredEntities.IndexOf(s => s.FullName.Equals(SelectedEntity.FullName));
                SelectRowIndex(newIndex == -1 ? 0 : newIndex);
            }
            else
            {
                SelectRowIndex(0);
            }
            UpdateSrollPosition();
        }
Exemple #2
0
        void UpdateDocuments()
        {
            _listStore = new Gtk.ListStore(typeof(string));
            var documents  = FileHistoryHelper.Instance.GetRecentDocuments();             //TODO filter
            var filterText = _searchView.Text;

            if (string.IsNullOrEmpty(filterText))
            {
                _filteredDocuments = new Collection <FileOpenInformation> (documents);
            }
            else
            {
                var filteredDocuments = documents.Where(e => {
                    return(MemberMatchingHelper.GetMatchWithSearchText(filterText, e.FileName.FileName));
                }).ToList();
                _filteredDocuments = new Collection <FileOpenInformation> (filteredDocuments);
            }
            foreach (var document in _filteredDocuments)
            {
                //TODO improve this
                var name = document.FileName.FileName;
                _listStore.AppendValues(name);
            }

            _treeView.Model = _listStore;

            if (_filteredDocuments.Count > 0)
            {
                if (_selectedDocument != null)
                {
                    var newIndex = _filteredDocuments.IndexOf(_selectedDocument);
                    SelectRowIndex(newIndex == -1 ? 0 : newIndex);
                }
                else
                {
                    SelectRowIndex(0);
                }
            }
            UpdateSrollPosition();
        }