Example #1
0
        internal ResourceListState ConfigureColumns(ResourceListState state, IResourceList resList,
                                                    IResource ownerResource)
        {
            RestoreSettings();
            _displayColumnManager = Core.DisplayColumnManager as DisplayColumnManager;
            _resourceList         = resList;
            _allTypes             = _resourceList.GetAllTypes();
            _allNoFileTypes       = _displayColumnManager.CollapseFileTypes(_allTypes);
            _availableColumns     = _displayColumnManager.GetAvailableColumns(_resourceList);
            _state = state;
            FillPropertyList();

            SetViewRadioButtons(_state, ownerResource);

            if (ShowDialog(Core.MainWindow) == DialogResult.OK)
            {
                if (_state.KeyTypes != null && radThisView.Checked)
                {
                    _state = new ResourceListState(new ColumnDescriptor[] {}, _state.SortSettings, state.GroupItems);
                    _state.SetOwner(ownerResource, Core.TabManager.CurrentTabId);
                }
                else if (_state.OwnerResource != null && radAllViews.Checked)
                {
                    _state.Delete();
                    _state = _displayColumnManager.StateFromList(_resourceList,
                                                                 _displayColumnManager.GetDefaultColumns(_resourceList), true);
                }
                SaveColumnsToState(_state);
            }
            return(_state);
        }
Example #2
0
        internal static ResourceListState FromResource(IResource res)
        {
            DisplayColumnProps props = (Core.DisplayColumnManager as DisplayColumnManager).Props;

            IResourceList columnDescriptorResources = res.GetLinksOfType("ColumnDescriptor", props.ColumnDescriptor);

            columnDescriptorResources.Sort(new int[] { props.ColumnOrder }, true);
            ColumnDescriptor[] columns = new ColumnDescriptor [columnDescriptorResources.Count];
            for (int i = 0; i < columnDescriptorResources.Count; i++)
            {
                columns [i] = LoadColumnDescriptor(columnDescriptorResources [i]);
            }

            SortSettings sortSettings = LoadSortSettings(res, props);

            ResourceListState result = new ResourceListState(columns, sortSettings,
                                                             res.HasProp(props.GroupItems));

            result._columnSchemeResource = res;

            if (res.HasProp(props.ColumnKeyTypes))
            {
                result.KeyTypes = res.GetPropText(props.ColumnKeyTypes).Split(';');
            }
            if (res.HasProp(props.ColumnSchemeOwner))
            {
                result.SetOwner(res.GetLinkProp(props.ColumnSchemeOwner),
                                res.GetStringProp(props.ColumnSchemeTab));
            }

            return(result);
        }