Esempio n. 1
0
            public TableDataSourceFindUsagesContext(
                StreamingFindUsagesPresenter presenter,
                IFindAllReferencesWindow findReferencesWindow,
                bool alwaysIncludeDeclarations)
            {
                presenter.AssertIsForeground();

                Presenter = presenter;
                _alwaysIncludeDeclarations = alwaysIncludeDeclarations;
                _findReferencesWindow      = findReferencesWindow;
                _tableControl = (IWpfTableControl2)findReferencesWindow.TableControl;
                _tableControl.GroupingsChanged += OnTableControlGroupingsChanged;

                // If the window is closed, cancel any work we're doing.
                _findReferencesWindow.Closed += OnFindReferencesWindowClosed;

                DetermineCurrentGroupingByDefinitionState();

                // Remove any existing sources in the window.
                foreach (var source in findReferencesWindow.Manager.Sources.ToArray())
                {
                    findReferencesWindow.Manager.RemoveSource(source);
                }

                // And add ourselves as the source of results for the window.
                findReferencesWindow.Manager.AddSource(this);

                // After adding us as the source, the manager should immediately call into us to
                // tell us what the data sink is.
                Debug.Assert(_tableDataSink != null);
            }
Esempio n. 2
0
            protected AbstractTableDataSourceFindUsagesContext(
                StreamingFindUsagesPresenter presenter,
                IFindAllReferencesWindow findReferencesWindow)
            {
                presenter.AssertIsForeground();

                Presenter                      = presenter;
                _findReferencesWindow          = findReferencesWindow;
                TableControl                   = (IWpfTableControl2)findReferencesWindow.TableControl;
                TableControl.GroupingsChanged += OnTableControlGroupingsChanged;

                // If the window is closed, cancel any work we're doing.
                _findReferencesWindow.Closed += OnFindReferencesWindowClosed;

                DetermineCurrentGroupingByDefinitionState();

                Debug.Assert(_findReferencesWindow.Manager.Sources.Count == 0);

                // And add ourselves as the source of results for the window.
                _findReferencesWindow.Manager.AddSource(this);

                // After adding us as the source, the manager should immediately call into us to
                // tell us what the data sink is.
                Debug.Assert(_tableDataSink != null);
            }
Esempio n. 3
0
            protected AbstractTableDataSourceFindUsagesContext(
                StreamingFindUsagesPresenter presenter,
                IFindAllReferencesWindow findReferencesWindow,
                ImmutableArray <ITableColumnDefinition> customColumns,
                bool includeContainingTypeAndMemberColumns,
                bool includeKindColumn)
            {
                presenter.AssertIsForeground();

                Presenter                      = presenter;
                _findReferencesWindow          = findReferencesWindow;
                TableControl                   = (IWpfTableControl2)findReferencesWindow.TableControl;
                TableControl.GroupingsChanged += OnTableControlGroupingsChanged;

                // If the window is closed, cancel any work we're doing.
                _findReferencesWindow.Closed += OnFindReferencesWindowClosed;

                DetermineCurrentGroupingByDefinitionState();

                Debug.Assert(_findReferencesWindow.Manager.Sources.Count == 0);

                // Add ourselves as the source of results for the window.
                // Additionally, add applicable custom columns to display custom reference information
                _findReferencesWindow.Manager.AddSource(
                    this,
                    SelectCustomColumnsToInclude(customColumns, includeContainingTypeAndMemberColumns, includeKindColumn));

                // After adding us as the source, the manager should immediately call into us to
                // tell us what the data sink is.
                Debug.Assert(_tableDataSink != null);
            }
        protected override void SetTableControl(IWpfTableControl2 tableControl)
        {
            if (TableControl != null)
            {
                TableControl.Manager.RemoveSource(_dataSource);
                TableControl.FiltersChanged   -= OnFiltersChanged;
                TableControl.GroupingsChanged -= OnGroupingsChanged;
            }

            base.SetTableControl(tableControl);

            if (TableControl != null)
            {
                TableControl.FiltersChanged   += OnFiltersChanged;
                TableControl.GroupingsChanged += OnGroupingsChanged;

                TableControl.Manager.AddSource(_dataSource);
            }
        }
        protected virtual void SetTableControl(IWpfTableControl2 tableControl)
        {
            if (TableControl != null)
            {
                TableControl.FiltersChanged   -= OnFiltersChanged;
                TableControl.GroupingsChanged -= OnGroupingsChanged;
                _contentWrapper.Child          = null;
                TableControl.Dispose();
            }

            TableControl = tableControl;

            if (tableControl != null)
            {
                _contentWrapper.Child          = TableControl.Control;
                TableControl.FiltersChanged   += OnFiltersChanged;
                TableControl.GroupingsChanged += OnGroupingsChanged;
            }
        }
Esempio n. 6
0
            protected AbstractTableDataSourceFindUsagesContext(
                StreamingFindUsagesPresenter presenter,
                IFindAllReferencesWindow findReferencesWindow,
                ImmutableArray <AbstractCustomColumnDefinition> customColumns,
                bool includeContainingTypeAndMemberColumns,
                bool includeKindColumn)
            {
                presenter.AssertIsForeground();

                Presenter                      = presenter;
                _findReferencesWindow          = findReferencesWindow;
                TableControl                   = (IWpfTableControl2)findReferencesWindow.TableControl;
                TableControl.GroupingsChanged += OnTableControlGroupingsChanged;

                // If the window is closed, cancel any work we're doing.
                _findReferencesWindow.Closed += OnFindReferencesWindowClosed;

                DetermineCurrentGroupingByDefinitionState();

                Debug.Assert(_findReferencesWindow.Manager.Sources.Count == 0);

                // Add ourselves as the source of results for the window.
                // Additionally, add applicable custom columns to display custom reference information
                _findReferencesWindow.Manager.AddSource(
                    this,
                    SelectCustomColumnsToInclude(customColumns, includeContainingTypeAndMemberColumns, includeKindColumn).ToReadOnlyCollection());

                // After adding us as the source, the manager should immediately call into us to
                // tell us what the data sink is.
                Debug.Assert(_tableDataSink != null);

                // Initialize custom column states at start of the FAR query.
                _customColumnTitleToStatesMap = GetInitialCustomColumnStates(findReferencesWindow.TableControl.ColumnStates, customColumns);

                // Now update the custom columns' state/visibility in the FAR window.
                // Note that the visibility of the custom column(s) can change only at two possible places:
                //  1. FAR query start, i.e. below invocation to SetColumnStates and/or
                //  2. First reference result which has a non-default custom column value
                //     (UpdateCustomColumnVisibility method below).
                // Also note that the TableControl.SetColumnStates is not dependent on order of the input column states.
                TableControl.SetColumnStates(_customColumnTitleToStatesMap.Values);
            }
Esempio n. 7
0
            public TableDataSourceFindUsagesContext(
                StreamingFindUsagesPresenter presenter,
                IFindAllReferencesWindow findReferencesWindow,
                string referenceName,
                ImmutableArray <AbstractFindUsagesCustomColumnDefinition> customColumns)
            {
                Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();

                ReferenceName         = referenceName;
                Presenter             = presenter;
                _findReferencesWindow = findReferencesWindow;
                TableControl          = (IWpfTableControl2)findReferencesWindow.TableControl;

                // If the window is closed, cancel any work we're doing.
                _findReferencesWindow.Closed += OnFindReferencesWindowClosed;

                Debug.Assert(_findReferencesWindow.Manager.Sources.Count == 0);

                // And add ourselves as the source of results for the window.
                // Additionally, add custom columns to display custom reference information.
                _findReferencesWindow.Manager.AddSource(this, customColumns.Select(c => c.Name).ToArray());

                // After adding us as the source, the manager should immediately call into us to
                // tell us what the data sink is.
                Debug.Assert(_tableDataSink != null);

                // Initialize custom column states at start of the FAR query.
                _customColumnTitleToStatesMap = GetInitialCustomColumnStates(findReferencesWindow.TableControl.ColumnStates, customColumns);

                // Now update the custom columns' state/visibility in the FAR window.
                // Note that the visibility of the custom column(s) can change only at two possible places:
                //  1. FAR query start, i.e. below invocation to SetColumnStates and/or
                //  2. First reference result which has a non-default custom column value
                //     (UpdateCustomColumnVisibility method below).
                // Also note that the TableControl.SetColumnStates is not dependent on order of the input column states.
                TableControl.SetColumnStates(_customColumnTitleToStatesMap.Values);
            }
            public TableDataSourceFindUsagesContext(
                 StreamingFindUsagesPresenter presenter,
                 IFindAllReferencesWindow findReferencesWindow,
                 bool alwaysIncludeDeclarations)
            {
                presenter.AssertIsForeground();

                Presenter = presenter;
                _alwaysIncludeDeclarations = alwaysIncludeDeclarations;
                _findReferencesWindow = findReferencesWindow;
                _tableControl = (IWpfTableControl2)findReferencesWindow.TableControl;
                _tableControl.GroupingsChanged += OnTableControlGroupingsChanged;

                // If the window is closed, cancel any work we're doing.
                _findReferencesWindow.Closed += OnFindReferencesWindowClosed;

                DetermineCurrentGroupingByDefinitionState();

                // Remove any existing sources in the window.  
                foreach (var source in findReferencesWindow.Manager.Sources.ToArray())
                {
                    findReferencesWindow.Manager.RemoveSource(source);
                }

                // And add ourselves as the source of results for the window.
                findReferencesWindow.Manager.AddSource(this);

                // After adding us as the source, the manager should immediately call into us to
                // tell us what the data sink is.
                Debug.Assert(_tableDataSink != null);
            }